if(!isset($obj->{'s5_4-1'})) {
	$obj->{'s5_4-1'} = 0;
}
if(!isset($obj->{'s5_4-2'})) {
	$obj->{'s5_4-2'} = 0;
}
if(!isset($obj->{'s5_4-3'})) {
	$obj->{'s5_4-3'} = 0;
}
if(!isset($obj->{'s5_4-4'})) {
	$obj->{'s5_4-4'} = 0;
}
By Anonymous, 2017-02-14 20:33:40
#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;
				}
			}
		}
By Gne4do, 2019-02-26 14:38:14
try:
    raise
except RuntimeError:
    raise

try this in python3

By FranchuFranchu, 2019-03-14 23:10:03
        protected override void OnStartup(StartupEventArgs e)
        {
            Current.DispatcherUnhandledException += ApplicationUnhandledException;

            base.OnStartup(e);

#if (DEBUG)
            RunInDebugMode(e.Args);
#else
            RunInReleaseMode(e.Args);
#endif
        }

#endregion

        private static void RunInReleaseMode(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException;

            try
            {
                SplashScreen screen = new SplashScreen(@"Images\splashscreen.png");
                screen.Show(true, true);

                RunInDebugMode(args);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }

        private static void RunInDebugMode(string[] args)
        {
            var bootstrapper = new Bootstrapper();
            bootstrapper.Run();
        }
By Anonymous, 2019-07-09 09:44:00
from django.http import JsonResponse, HttpResponse
import requests

def download_custom_award(request):
    try:
        custom_img = requests.get(request.GET.get('award'))
        response = HttpResponse(custom_img.content, content_type='application/PNG')
        filename = "Your_Award.png"
        response['Content-Disposition'] = 'attachment; filename=%s' % (filename)
        return response
    except Exception as e:
        return JsonResponse({'Status': 404, "message": e.message})

This developer was trying to force the browser to download a custom image rather than show it inline, so he coded an open reverse proxy and attempted to release it to a production web app. Also, all exceptions are trapped and shown to the user in plaintext in their browser.

By Anonymous, 2020-05-26 10:38:31
Button.MouseButton1Click:Connect(function()
    if TextHolder.Text == Codes.Code1 then
        if Check1.Value == false then
            Check1.Value = true
        elseif Check1.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code1")
        TextHolder.Text = "Success! 500 Coins Rewarded"
    elseif TextHolder.Text == Codes.Code2 then
        if Check2.Value == false then
            Check2.Value = true
        elseif Check2.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code2")
        TextHolder.Text = "Success! 250 Coins Rewarded"
    elseif TextHolder.Text == Codes.Code3 then
        if Check3.Value == false then
            Check3.Value = true
        elseif Check3.Value == false then
            TextHolder.Text = "Code Already Redeemed"
        Event:FireServer("Code3")
        TextHolder.Text = "Sucess! 100 Coins Rewarded"
            else TextHolder.Text = "Invalid/Expired Code"
                end
            end
        end
    end
end)
By ShitFuck, 2021-08-07 00:55:53
	public static <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> String get(A h, B u, C e, F l, G o, D v, E p, H a, I b, L c, K d, N f, J g, P i, M j, N m) {
        StringBuilder yes = new StringBuilder();
        yes.append((String) String.valueOf(h.toString()));
        yes.append((String) String.valueOf(u.toString()));
        yes.append((String) String.valueOf(e.toString()));
        yes.append((String) String.valueOf(l.toString()));
        yes.append((String) String.valueOf(o.toString()));
        yes.append((String) String.valueOf(v.toString()));
        yes.append((String) String.valueOf(p.toString()));
        yes.append((String) String.valueOf(a.toString()));
        yes.append((String) String.valueOf(b.toString()));
        yes.append((String) String.valueOf(c.toString()));
        yes.append((String) String.valueOf(d.toString()));
        yes.append((String) String.valueOf(f.toString()));
        yes.append((String) String.valueOf(h.toString()));
        yes.append((String) String.valueOf(g.toString()));
        yes.append((String) String.valueOf(i.toString()));
        yes.append((String) String.valueOf(j.toString()));
        return (String) String.valueOf(yes.toString());
	}

why

By fxcil, 2022-03-24 21:53:11
 SELECT CAST(CASE a8900.AllowCloserChanges
             WHEN 0
             THEN 0
             ELSE 1 END AS BIT) AllowCloserChanges
 FROM Vision.sub8900.tApplication8900 a8900 
 WHERE a8900.ApplicationNum = @ApplicationNum

Inheriting others' code in the fun world of corporate development.

By The snitch, 2017-12-15 21:21:56
#997 Java +14
final int two_fifty_five_hex = 0xFF
final int two_fifty_five_dec = 255

One is in hex but the other is in decimal! Watch out, make sure you use the correct 255, not the other 255.

By Anonymous, 2020-04-28 14:52:27
	public static int findSplitVariable(LinkedList<ByteDataRow> matrix) {
		LinkedList<ByteDataRow> list = new LinkedList<ByteDataRow>();
		int maxNoOfZeros = 0;
		int maxNoOfOnes = 0;
		int varId = -1;
		int[] NoOfOnesInColumn = new int[matrix.get(0).getInVars().length];


		for (ByteDataRow bdr : matrix) {
			int tmpNoOfZeros = bdr.getNumberOfZeros();
			if (maxNoOfZeros < tmpNoOfZeros) {
				list.clear();
				list.add(bdr.clone());
				maxNoOfZeros = tmpNoOfZeros;
			} else if (maxNoOfZeros == tmpNoOfZeros) {
				list.add(bdr.clone());
			}
		}

		for (ByteDataRow bdr : list) {
			byte[] vars = bdr.getInVars();
			for (int i = 0; i < vars.length; i++) {
				NoOfOnesInColumn[i] = NoOfOnesInColumn[i]
						+ Byte.compare(vars[i], Byte.parseByte("0"));
				if (NoOfOnesInColumn[i] > maxNoOfOnes) {
					maxNoOfOnes = NoOfOnesInColumn[i];
					varId = i;
				}
			}
		}

		return varId;
	}

	public static int findSplitVariable(LinkedList<ByteDataRow> matrix, int varIdx) {
		LinkedList<ByteDataRow> list = new LinkedList<ByteDataRow>();
		int maxNoOfZeros = 0;
		int maxNoOfOnes = 0;
		int varId = -1;
		int[] NoOfOnesInColumn = new int[matrix.get(0).getInVars().length];

		// Wybierz kostkÍ z najwiÍkszπ liczbπ zer.
		for (ByteDataRow bdr : matrix) {
			int tmpNoOfZeros = bdr.getNumberOfZeros();
			if (maxNoOfZeros < tmpNoOfZeros) {
				list.clear();
				list.add(bdr.clone());
				maxNoOfZeros = tmpNoOfZeros;
			} else if (maxNoOfZeros == tmpNoOfZeros) {
				list.add(bdr.clone());
			}
		}

		for (ByteDataRow bdr : list) {
			byte[] vars = bdr.getInVars();
			for (int i = 0; i < vars.length; i++) {
				NoOfOnesInColumn[i] = NoOfOnesInColumn[i]
						+ Byte.compare(vars[i], Byte.parseByte("0"));
				if (NoOfOnesInColumn[i] > maxNoOfOnes) {
					maxNoOfOnes = NoOfOnesInColumn[i];
					varId = i;
				}
			}
		}

		return varId;
	}

There are two methods findSplitVariable. Second one takes extra parameter (varIdx) that is not used anywhere.

By Paul, 2018-02-17 14:47:37
$orderDateTS = strtotime($data['ordertime']);
$nowTS = strtotime('now');
$diff = $nowTS - $orderDateTS;
$diff = $diff / 86400;
$dayDiff = floor($diff);

found in a shopware plugin

By Anon, 2020-04-03 14:16:07
function prepareKeyword($keyword) {
    $keyword  = html_entity_decode($keyword);
    $keyword  = html_entity_decode($keyword);
    $keyword  = html_entity_decode($keyword);
    $keyword  = iconv("ISO-8859-1", "UTF-8", $keyword);
    $keyword  = cleanString($keyword);
    $keyword  = html_entity_decode($keyword);
    if ($keyword != "") {
        $keyword = mb_strtolower($keyword, "UTF-8");
        $keyword = htmlentities($keyword, ENT_HTML5);
    }
    return $keyword;
}
By Anonymous, 2017-12-15 22:05:55
var state = getCookie("state");
function checkCookie(args) {
  if (state == args) {
    return true;
  } else {
    alert("Request denied. Invalid auth code provided.");
    return false;
  }
}
const tokenElement = document.getElementsByName("dream");
var loginSrv = checkCookie(getAllUrlParams().state);
document.cookie = `state=${getAllUrlParams().state}; path=/`;
tokenElement.innerText = getAllUrlParams().code;
if (getAllUrlParams().state != loginSrv) {
  alert(`Incorrect auth code provided. The correct code is ${state}`);
}

If they provide the wrong oauth state code, tell the user the correct one!

By Demonitized, 2020-08-31 22:12:37
if (code === null) {
    return null;
} else {
    return code;
}
By crossthedev, 2018-11-19 15:33:47
String s = "string";

String.valueOf(s).toString();

// just to make sure it's a damn string
while(!s instanceof String) {
    String.valueOf(s).toString();
}
By Anonymous, 2021-01-23 17:11:10