if (responseCode / 100 == 2) {//success
return handleSuccess();
} else if (responseCode == 401) {
return handleNotAuthorized();
} else {
// something else
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
void run_func(char *map[], char *fnt , char *km , float *x , float *y , int line , int row , int lift );
char *long_met[3][8] = {{"mile","0.621371" , "yard","1093.61" , "fut","3280.84" , "duim","39370.1" } ,
{ "mile" ,"1.60934" , "yard","0.0009144" , "fut","0.0003048" , "duim","0.0000254"},
{"kilometer","1" , "meter","1000" , "stmeter","100000" , "mmeter","1000000" } };
char *amount[3][4] = { { "gallon" , "0.264172" , "quarta" , "1.05669" } ,
{"gallon" , " 3.78541" , "quarta" , "0.946353" },
{"litr" , "1" , "mililitr" , "1000" }};
char *mass[3][8] = { {"eng.tonna","0.984207" , "amer.tonna","1.10231" , "stone","157.473" , "funt","2204.62" } ,
{ "eng.tonna" , "1.01605" , "amer.tonna", "0.907185" , "stone","0.00635029" , "funt","0.000453592"},
{"tonna","1" , "kilogram" , "1000" , "miligram","100000" , "microgram","1000000" }};
char **cp;
char *buf_data;
char *fnt_sys;
char *mtr_sys;
char *word[100];
while(1){
int bg = 0,convert_ch = 3,y = 0, d = 0, numb = 0;
float mn =0 , xm = 0 ;
printf("%s", "enter data for converter: ");
fgets( (char *) word, 99 ,stdin);
buf_data = strtok((char *) word, " ");
if( ! strcmp(buf_data, "funt.sys" ) ){
convert_ch = 0;
}
else if( ! strcmp(buf_data, "metric.sys" ) ){
convert_ch = 1;
}
for( bg = 0 ; buf_data != NULL; buf_data = strtok(NULL, " ") , bg++ ) {
switch(bg){
case 1:
if( !strcmp("long_met" , buf_data ) ){
y = sizeof(*long_met) / sizeof(long_met[0][0]);
d = sizeof(long_met) / sizeof(long_met[0][0]);
cp = &long_met[convert_ch][0] ;
}
else if(!strcmp("amount" , buf_data ) ){
y = sizeof(*amount) / sizeof(amount [0][0]);
d = sizeof(amount) / sizeof(amount[0][0]);
cp = &amount[convert_ch][0] ;
}
else if(!strcmp("mass" , buf_data ) ){
y = sizeof(*mass ) / sizeof(mass[0][0]);
d = sizeof(mass ) / sizeof(mass[0][0]);
cp = &mass[convert_ch][0] ;
}
break;
case 2:
fnt_sys = buf_data;
break;
case 3:
mtr_sys = buf_data;
break;
case 4:
numb = atoi(buf_data);
break;
}
}
if( !y || !d || !cp || convert_ch == 3 || !numb ){
puts("error");
}
else{
run_func( cp, fnt_sys , mtr_sys , &mn , &xm , y , d , convert_ch );
if( !mn || !xm ){
puts("error");
} else{
printf("%f\n" , !convert_ch ? (mn / xm ) * numb : ( mn * xm ) * numb );
}
}
}
return 0;
}
void run_func(char *map[], char *fnt , char *km , float *x , float *y , int line , int row , int lift ){
int m ;
if( ( lift ) ){
row -= line;
}
for( m = 0 ; m <= line ; m++){
if(!strcmp(fnt,map[m])){
*x = atof(map[m + 1] ) ;
break;
}
}
for( m = (row - line) ; m <= row - 1 ; m++){
if( !strcmp( km , map[m] ) ){
*y = atof(map[m + 1 ] );
break;
}
}
}
public function getProfilePicture(Company $company, $id, $url = null) {
// @TODO: Figure out how to do this.
return null;
}
this.props.HeaderStore.setHeader(true, null, false, false, true, true,'dashboardNavigation');
<?
if (ini_get('register_globals') != 1){
if ((isset($_POST) == true) && (is_array($_POST) == true)) extract($_POST, EXTR_OVERWRITE);
if ((isset($_GET) == true) && (is_array($_GET) == true)) extract($_GET, EXTR_OVERWRITE);}
// powtierdzenie decyzji
function zapytaj(pytanie){
if(confirm(pytanie)) return true
else return false;
}
var list = new List<string>() { // Assume some items in the list };
for (var i = 0; i < list.Count; i++)
{
var item = list[i];
list.Remove(item);
i--;
}
Simple alternative to List.Clear()
def dow_to_dict_from_self(self):
# res = {'name': self.name, 'enabled': self.enabled }
res = {'sun': 0, 'mon': 0, 'tue': 0, 'wed': 0, 'thr': 0, 'fri': 0,
'sat': 0,
'enabled': 0, 'dow': 0, 'name': 'untitled'}
if (int(self.days_of_week) & 0x01) == 0x01: # sun
res['sun'] = 1
if (int(self.days_of_week) & 0x02) == 0x02: # mon
res['mon'] = 1
if (int(self.days_of_week) & 0x04) == 0x04: # tue
res['tue'] = 1
if (int(self.days_of_week) & 0x08) == 0x08: # wed
res['wed'] = 1
if (int(self.days_of_week) & 0x10) == 0x10: # thr
res['thr'] = 1
res['thu'] = 1 # '%a' returns thu for Thursday
if (int(self.days_of_week) & 0x20) == 0x20: # fri
res['fri'] = 1
if (int(self.days_of_week) & 0x40) == 0x40: # sat
res['sat'] = 1
if (int(
self.days_of_week) & 0x40) == 0x80: # enabled # new enable#
# flag -- duplicate in db
res['enabled'] = 1
res['enabled'] = self.enabled # remove this
res['dow'] = self.days_of_week
res['name'] = self.name
return res
kept the original comments - they're very helpful
{!! Form::select('ticket_category', \App\Models\Term::whereHas('taxonomy', function($query) {
$query->where('slug', 'ticket_category');
})->whereIn('id', ['15', '16', '17', '18'])
->pluck('name','id'), old('ticket_category'), [
'id' => 'ticket_category',
'class' => 'form-control',
'placeholder' => 'Seleccione una categorÃa']
)
!!}
to do it in an array if you can put it in the database so that you still burn the position
public static class time
{
public const int minutes_per_hour = 60;
public const int seconds_per_minute = 60;
public const int hours_per_day = 24;
public const int minutes_per_day = minutes_per_hour * hours_per_day;
public const int seconds_per_day = seconds_per_minute * minutes_per_day;
public const int days_per_year = 365;
}
strcpy(szBuffer, sBuffer);
so many questions given you by Hungarian notation
void MagicUnit::getSomeVoltage(std::uint64_t w_data, double &val)
{
std::uint64_t r_data = 0;
hwRead((int)Address::Voltage, 3, w_data, 2, &r_data);
val = r_data;
val /= 16; // shit right 4 bits
val *= 0.004;
val -= 8.192;
}
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
void randy(int array[] ){
int i = 0 , d = 0;
for(i = 1 ; i <= 23 ; i++){
array[i] = 1 + (rand() % 365 );
}
}
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int find (int arr[]){
int d = 0;
for(d = 1 ;d <=23 ; d++ ){
if(arr[d] == arr[d + 1]){
return 1;
}
}
return 0;
}
int main(void){
double count_birthday = 0;
int people[24];
srand(time(NULL));
int c = 0 ;
long double ip = 0;
while(ip++ <= 1000000 ){
randy(people);
qsort (people, 25, sizeof(int), compare);
if(find (people) == 1 ){
count_birthday++;
}
}
printf("%.2lf", count_birthday / 10000 );
return 0;
}
/// <summary>
/// Returns true if any component of of Vector3 v is negative
/// </summary>
public static bool Ext_IsNegative(this Vector3 v)
{
return v.x < 0f && v.y < 0f && v.z < 0f;
}
Either the description is wrong or the method in itself
public static returnTrue(boolean b){
if (b){
return true;
} else {
return true;
}
}
When you want your function always returns the correct value