for (InformacionPagareServiceDTO aux : res_pon.getListaRespuesta()) {
String pattern_dic = "{\"Estdo\":\"%s\", \"Fecha Firma\":\"%s\", \"Fecha Grabacion\": \"%s\", \"ID Pagare\": \"%s\",\"Nombre Otorgante\": \"%s\",\"Tipo documento Otorgante\": \"%s\",\"Documento Otorgante\": \"%s\",\"Numero Pagare Entidad\": \"%s\",\"Pdf Pagare Nom\": \"%s\",\"Pdf Pagare Cont\": \"%s\"}";
if (aux.getPdfPagare() == null) {
if(dic_txt.equals("")) {
dic_txt = String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare(), aux.getPdfPagare());
}else {
dic_txt += ","+String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare(), aux.getPdfPagare());
}
}else {
if(dic_txt.equals("")) {
dic_txt = String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare().getNombreArchivo(), aux.getPdfPagare().getContenido());
}else {
dic_txt += ","+String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare().getNombreArchivo(), aux.getPdfPagare().getContenido());
}
}
}
Holy Shit
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;
}
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.
public class NullableFloatToNullableDoubleConverter : ITypeConverter<float?, double?>
{
public double? Convert(float? source, double? destination, ResolutionContext context)
{
if (source == null)
{
return null;
}
var floatAsString = source.Value.ToString(CultureInfo.InvariantCulture);
return double.Parse(floatAsString);
}
}
try
{
len = readBufferSize(reader);
}
catch (IOException xcp)
{
throw xcp;
}
I swear I didn't omit a single symbol (except for tabs at the beginning)
double func_atof(char *p){
double integer = 0.0, div = 1.0 , fract = 0.0 , sign = 1.0;
if( *p == 45 ){sign = -1.0, *p++ ; }
while ( isdigit(*p) ) {
integer = ( *p++ ) + (10.0 * integer) - 48.0 ;
}
if(*p == 46 ){
(*p++ ) ;
while ( isdigit(*p) ) {
fract = ( *p++ ) + (10.0 * fract) - 48.0 ;
div *= 10;
}
}
return (integer + fract / div ) * sign ;
}
const configs = {
employeeObject: {
// tab 0
firstName: "",
middleName: "",
nickname: "",
lastName: "",
gender: "",
race: "",
title: "",
dob: "",
employeeIDNo: "",
// tab 1
userName: "",
permissionRole: 0,
employeeNo: "",
phoneExt: "",
startDate: "",
company: "",
division: "",
jobDescription: "",
businessUnit: "",
regionId: "",
participantStatus: "",
costCentre: "",
personType: "",
comments: "",
// tab 2
phone1: "",
phone2: "",
phone3: "",
address1: "",
address2: "",
address3: "",
address4: "",
postalCode: "",
email: "",
},
Why add another object with a title when you can just add a comment saying... well... nothing really...
/// <summary>
/// Builds the suffixs for the request sequence number
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
public static string GetSequenceNumber(int i)
{
string strCount = string.Empty;
string increase = string.Empty;
int count;
strCount = i.ToString();
count = strCount.Length;
//Add 0 infront of the index to make a 4 digit number
if (count < 5)
{
for (int j = 0; j < (4 - count); j++)
{
increase = increase + "0";
}
strCount = increase + strCount;
}
return strCount;
}
$orderDateTS = strtotime($data['ordertime']);
$nowTS = strtotime('now');
$diff = $nowTS - $orderDateTS;
$diff = $diff / 86400;
$dayDiff = floor($diff);
found in a shopware plugin
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
O | O | O
-----------
O | O | O
-----------
O | O | O
*/
package tictactoe;
import java.util.Scanner;
public class TicTacToe {
/**
* @param args the command line arguments
* @throws java.lang.InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
Scanner input = new Scanner(System.in);
String a1 = "1";
String a2 = "2";
String a3 = "3";
String a4 = "4";
String a5 = "5";
String a6 = "6";
String a7 = "7";
String a8 = "8";
String a9 = "9";
int inO;
int inX = 0;
boolean winner = false;
PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
System.out.printf("How to play - wait for your turn and when it comes write the number of the field that you want to draw in (from 1 to 9)\n");
System.out.printf("Player O's turn: ");
inO = input.nextInt();
while (true) {
switch (inO) {
case 1:
if (a1 == "1") {
a1 = "O";
}
break;
case 2:
if (a2 == "2") {
a2 = "O";
}
break;
case 3:
if (a3 == "3") {
a3 = "O";
}
break;
case 4:
if (a4 == "4") {
a4 = "O";
}
break;
case 5:
if (a5 == "5") {
a5 = "O";
}
break;
case 6:
if (a6 == "6") {
a6 = "O";
}
break;
case 7:
if (a7 == "7") {
a7 = "O";
}
break;
case 8:
if (a8 == "8") {
a8 = "O";
}
break;
case 9:
if (a9 == "9") {
a9 = "O";
}
break;
default:
System.out.printf("An error occured. Please accept it politely and restart the game.");
break;
}
System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
case "NONE":
if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
winner = true;
System.out.println("DRAW!");
Thread.sleep(3000);
break;
} else {
PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
System.out.printf("Player X's turn: ");
inX = input.nextInt();
break;
}
case "X":
winner = true;
System.out.println("X HAS WON!!!");
Thread.sleep(3000);
break;
case "O":
winner = true;
System.out.printf("O HAS WON!!!");
Thread.sleep(3000);
break;
default:
break;
}
if (winner) {
break;
}
switch (inX) {
case 1:
if (a1 == "1") {
a1 = "X";
}
break;
case 2:
if (a2 == "2") {
a2 = "X";
}
break;
case 3:
if (a3 == "3") {
a3 = "X";
}
break;
case 4:
if (a4 == "4") {
a4 = "X";
}
break;
case 5:
if (a5 == "5") {
a5 = "X";
}
break;
case 6:
if (a6 == "6") {
a6 = "X";
}
break;
case 7:
if (a7 == "7") {
a7 = "X";
}
break;
case 8:
if (a8 == "8") {
a8 = "X";
}
break;
case 9:
if (a9 == "9") {
a9 = "X";
}
break;
default:
System.out.printf("An error occured. Please accept it politely and restart the game.");
break;
}
System.out.printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
if (null != Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9))switch (Winners(a1,a2,a3,a4,a5,a6,a7,a8,a9)) {
case "NONE":
if (a1 != "1" && a2 != "2" && a3 != "3" && a4 != "4" && a5 != "5" && a6 != "6" && a7 != "7" && a8 != "8" && a9 != "9") {
winner = true;
System.out.println("DRAW!");
Thread.sleep(3000);
break;
} else {
PrintBoard(a1,a2,a3,a4,a5,a6,a7,a8,a9);
System.out.printf("Player O's turn: ");
inO = input.nextInt();
break;
}
case "X":
winner = true;
System.out.println("X HAS WON!!!");
Thread.sleep(3000);
break;
case "O":
winner = true;
System.out.println("O HAS WON!!!");
Thread.sleep(3000);
break;
default:
break;
}
if (winner) {
break;
}
}
}
public static void PrintBoard(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {
System.out.printf(" %s | %s | %s \n",f1,f2,f3);
System.out.printf(" ----------- \n");
System.out.printf(" %s | %s | %s \n",f4,f5,f6);
System.out.printf(" ----------- \n");
System.out.printf(" %s | %s | %s \n",f7,f8,f9);
System.out.printf(" \n");
}
public static String Winners(String f1, String f2, String f3, String f4, String f5, String f6, String f7, String f8, String f9) {
if (f1 == f2 && f2 == f3 && f3 == "O") {
return "O";
} else if (f4 == f5 && f5 == f6 && f6 == "O") {
return "O";
} else if (f7 == f8 && f8 == f9 && f9 == "O") {
return "O";
} else if (f1 == f4 && f4 == f7 && f7 == "O") {
return "O";
} else if (f2 == f5 && f5 == f8 && f8 == "O") {
return "O";
} else if (f3 == f6 && f6 == f9 && f9 == "O") {
return "O";
} else if (f1 == f5 && f5 == f9 && f9 == "O") {
return "O";
} else if (f3 == f5 && f5 == f7 && f7 == "O") {
return "O";
} else if (f1 == f2 && f2 == f3 && f3 == "X") {
return "X";
} else if (f4 == f5 && f5 == f6 && f6 == "X") {
return "X";
} else if (f7 == f8 && f8 == f9 && f9 == "X") {
return "X";
} else if (f1 == f4 && f4 == f7 && f7 == "X") {
return "X";
} else if (f2 == f5 && f5 == f8 && f8 == "X") {
return "X";
} else if (f3 == f6 && f6 == f9 && f9 == "X") {
return "X";
} else if (f1 == f5 && f5 == f9 && f9 == "X") {
return "X";
} else if (f3 == f5 && f5 == f7 && f7 == "X") {
return "X";
} else {
return "NONE";
}
}
}
There are sooo many problems with this...
StartCoroutine(Patrol());
public IEnumerator Patrol() {
while(true) {
dt.Walk();
yield return new WaitForSeconds(reactionTime);
}
}
cd /some/directory
rm -rf *
I regularly see these two lines in Bash scripts I don't understand but some programmers think you need a CD command before any command, and they also don't know that paths can be part of parameters (which explains why they use many CD commands)
// Save the files for 100 timea in case failed
try {
for (let i; i <= 100; i++) {
File.save();
}
} catch (e) {
// Save the files for 100 timea since it already failed
for (let i; i <= 100; i++) {
File.save();
}
}
val weekEnd = DateTime.now.withDayOfWeek(5).plusDays(2)
$url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22https%3A%2F%2Fwww.google.com%2Ffinance%3Fq%3D' . $stock_identifier . '%26fstype%3Dii%26ei%3DCFrdWImFNdiGe_atlegC%22%20and%20compat%3D%22html5%22%20and%20xpath%3D' . "'%2F%2Ftable%5Bcontains(%40class%2C%22gf-table%20rgt%22)%5D'" . '&format=json&diagnostics=true&callback=';
$json = json_decode($this->getJsonFromYql($url), true);
$json = $json["query"]["results"]["table"];
//If the value is red, that means there is an additional span class which needs to be checked through.
$response["revanueValue"] = empty($json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"];
$response["costofRevanue"] = $json["1"]["tbody"]["tr"]["3"]["td"]["1"]["content"];
$response["operatingIncome"] = empty($json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"];
$response["netIncome"] = empty($json["1"]["tbody"]["tr"]["24"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["24"]["td"]["1"]["span"]["content"] : $json["0"]["tbody"]["tr"]["24"]["td"]["1"]["content"];
$response["dividendsPerShare"] = $json["1"]["tbody"]["tr"]["35"]["td"]["1"]["content"];
$response["dilutedNormalizedEps"] = empty($json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"];
$response["minorityInterest"] = $json["1"]["tbody"]["tr"]["18"]["td"]["1"]["content"];
Website --> Json --> PHP Parsing Beautiful.