// 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();
}
}
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.
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!
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);
}
}
j =0
import random
import hashlib
#geetting inputs
c = input("data ")
n= int(input("N(the count of last numbers)= "))
v= input(str(n)+" last char ")
#list of alphas
l1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'u']
l2 = ["A", 'B', 'C', 'D', 'E', 'F','G' , 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', 'U']
alphas= 0
#calc the count of alppphas
x=""
for j in c:
if(j in l1 or j in l2):
alphas +=1
#positions
h = 2**alphas
hs = []
cc =0
j=0
xf =0
# the stat of main coode
for j in range(h):
#making a sring with 1 and 0
while True:
x=""
for i in range(len(c)):
x+=str(random.randint(0,1))
if(not(x in hs)):
hs.append(x)
break
Xx =""
cc =0
#convert that to lower and upper
for j1 in x:
if(j1=="0"):
Xx+=c[cc].lower()
else:
Xx+=c[cc].upper()
cc+=1
#hash
m = hashlib.sha256()
m.update(Xx.encode('utf-8'))
h = m.hexdigest()
#if
if(h[0-n:]==v):
print("text :"+Xx)
print("hash :"+h)
xf = True
break
if xf==True:
break
j =0
#if that not possible to have git push -Desirable-hash by changed lower to upper and upper to lower
if(xf==0):
while 1:
j+=1
d = c+str(j)
m = hashlib.sha256()
m.update(d.encode('utf-8'))
h = m.hexdigest()
if(h[0-n:]==v):
print("text :"+d)
print("hash :"+h)
break
x = input("press enter to exit")0
this program take a string from you and give you a Desirable-hash by changing lower to upper and changing lower to upper if that possible
public class CustomBoolean {
private Container<java.lang.Boolean> booleanContainer;
public CustomBoolean(Container<Boolean> booleanContainer) {
CustomBoolean custom_boolean = getThis();
custom_boolean.booleanContainer = booleanContainer;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container<Boolean> getBooleanContainer() {
return booleanContainer;
}
public static CustomBoolean create(Boolean value) {
return new CustomBoolean(Container.builder().setValue(true).build());
}
public static void main(String[] args) {
System.out.println(CustomBoolean.create(Boolean.TRUE).getBooleanContainer().getObject());
}
public static class Container<T extends Object> {
private T object = null;
private Container(T object) {
Container<T> _this = getThis();
_this.object = (T) (Object) object;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public static Builder builder() {
return new Builder();
}
public T getObject() {
return object;
}
public static class Builder<T extends Object> {
private T value;
public Builder<T> setValue(T value) {
Container<T> _this = getThis();
_this.object = (T) (Object) value;
return this;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container build() {
return new Container(value);
}
}
}
} // Dort#0001
trolled
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)
#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;
}
}
}
FOR x IN ( SELECT COUNT(*) cnt
FROM DUAL
WHERE EXISTS ( SELECT NULL FROM task
WHERE task.task_type_id = lib.task_type_check()
AND task.task_status_id = lib.task_status_open()
AND task.unit_id = in_unit_id
AND task.station_id = v_station_id
)
)
LOOP
IF( x.cnt = 1 ) THEN
v_task_exist := TRUE;
ELSE
v_task_exist := FALSE;
END IF;
END LOOP;
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;
}
if (!response ||
!response.data ||
!response.data.success ||
response.data.success == false ) {
//process stuff
}
Not talking about the '===' warning, here
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.
function resetfields_simple()
{
pole1=document.getElementById('dataOd');
pole1.value='';
pole2=document.getElementById('dataDo');
pole2.value='';
pole3=document.getElementById('trescKom');
pole3.value='';
pole4=document.getElementById('katId');
pole4.value='';
}
function resetfields()
{
pole1=document.getElementById('dataOd');
pole1.value='';
pole2=document.getElementById('dataDo');
pole2.value='';
pole3=document.getElementById('trescKom');
pole3.value='';
pole4=document.getElementById('dokId');
pole4.value='';
pole5=document.getElementById('katId');
pole5.value='';
pole6=document.getElementById('currId');
pole6.value='';
}
function resetfields_arch()
{
pole1=document.getElementById('dataOd');
pole1.value='';
pole2=document.getElementById('dataDo');
pole2.value='';
pole3=document.getElementById('trescKom');
pole3.value='';
pole4=document.getElementById('dokId');
pole4.value='';
pole5=document.getElementById('katId');
pole5.value='';
}
let already_in = True;
while (already_in) {
let random_index = Math.floor(arr.length * Math.random());
let already_in = False;
for (ex of exs) {
if (ex.id === arr[random_index].id) {
already_in = True;
}
}
}
Yes, this is JavaScript, and yes it didn't work. Found while reviewing some code
<Image source={ this.props.pickupOrDropoff == "pickup"
? i.pickup
? iconBlue
: iconWhite
: i.dropoff
? iconBlue
: iconWhite} style={{
height:this.props.pickupOrDropoff == "pickup"
? i.pickup
? 30
: i.sign === 'D' ? 30 : 35
: i.dropoff
? 30
: i.sign === 'D' ? 30 : 35,
marginRight:10 ,
width: this.props.pickupOrDropoff == "pickup"
? i.pickup
? 40
: 40
: i.dropoff
? 40
: 40
,resizeMode:'contain'}}/>
I love when the code is neat...