Update.update_all_updated(updates) # Update updated updates
function urlREPLACER(dtTEXTVALUE){
dtTEXTVALUE.indexOf('http://') != -1 && (dtTEXTVALUE = dtTEXTVALUE.replace('http://','')) && dtTEXTVALUE.indexOf('.aspx') == -1 && (dtTEXTVALUE += '.aspx');
return dtTEXTVALUE;
}
@SuppressWarnings("unchecked")
private void addEndpointsTags(JsonArray tagsArray) throws IOException {
if (registeredHandlers == null || registeredHandlers.isEmpty()) {
return;
}
TreeSet<String> handlerNamesSorted = new TreeSet<>(registeredHandlers.keySet());
handlerNamesSorted.forEach(key -> {
StringBuilder sb = new StringBuilder();
sb.append("{\"name\":\"");
sb.append(key);
sb.append("\",\"request\":{\"name\":\"");
try {
ServiceMethodHandler handler = registeredHandlers.get(key);
Class<? extends Message> requestClass = (Class<? extends Message>)
findSubClassParameterType(handler, 0);
Class<? extends Message> responseClass = (Class<? extends Message>)
findSubClassParameterType(handler, 1);
sb.append(requestClass.getSimpleName());
sb.append("\",\"type\":\"");
sb.append(requestClass.getSimpleName());
sb.append("\",\"values\":[");
sb.append(getProtobufClassFieldDescriptions(requestClass, new HashSet<>()));
sb.append("]},\"response\":{\"name\":\"");
sb.append(responseClass.getSimpleName());
sb.append("\",\"type\":\"");
sb.append(responseClass.getSimpleName());
sb.append("\",\"values\":[");
sb.append(getProtobufClassFieldDescriptions(responseClass, new HashSet<>()));
sb.append("]},\"metadata\":{\"stream\":\"false\"}}");
} catch (Exception e) {
logger.error("Error inspecting handlers", e);
return;
}
String tag = sb.toString();
tagsArray.add(new JsonPrimitive("e-" + binaryEncode(tag)));
});
}
public static int[] sleepSort(int... args) {
final int[] sorted = new int[args.length];
final AtomicInteger index = new AtomicInteger(0);
List<Thread> threads = new ArrayList<Thread>(0);
for (int i = 0; i < args.length; i++) {
final int x = i;
Thread sorter = new Thread(() -> {
try {
Thread.sleep(args[x]);
} catch (InterruptedException ex) {
// shrug
}
sorted[index.getAndIncrement()] = args[x];
});
sorter.setDaemon(true);
sorter.start();
threads.add(sorter);
}
try {
for (Thread t : threads) { t.join(); }
} catch (InterruptedException e) {
e.printStackTrace();
}
return sorted;
}
Takes an unsorted array of integers, sorts by sleeping for the int value of each item in the array and then writing that into the resulting sorted array. Big-O analysis is... difficult.
try {
User.ClaimToken();
}
catch {
User.ClaimToken();
}
else if result !== true && result === false { return result !== true }
should I keep this in our project or nah
public void updateCurrency() {
LOGGER.info("Update currencies");
var ok = false;
try {
getExchangeRatesMechanism(getExchangeRatesProcessor());
ok = true;
} catch (Exception exception) {
LOGGER.error(exception.getMessage(), exception);
}
if (ok) {
LOGGER.info("The currencies were updated successfully!");
}
}
product = None
for key in dictionary.keys():
if product is None:
product = dictionary[key]
else:
product = itertools.product(product, dictionary[key])
product = "{0}".format(list(product))
product = re.sub(r"\), \(+", "], [", product)
product = re.sub(r"\(+", "[", product)
product = product.replace(")]", "]]").replace(")", "")
product = ast.literal_eval(product)
Ok, I have a weird array of objects as output of itertools and I need an array of strings... 1 - Convert the array to string 2 - Clean it up with regex and replace 3 - Convert the string to array 4 - Problem solved
var lightBox_ReplaceSelectsWithSpans = function()
{
var selects = document.getElementsByTagName('select');
for (var i = 0; i < selects.length; i++) {
var select = selects[i];
if (select.clientWidth == 0 || select.clientHeight == 0 ||
select.nextSibling == null || select.nextSibling.className == 'selectReplacement') {
continue;
}
var span = document.createElement('span');
// this would be "- 3", but for that appears to shift the block that contains the span
// one pixel down; instead we tolerate the span being 1px shorter than the select
span.style.height = (select.clientHeight - 4) + 'px';
span.style.width = (select.clientWidth - 6) + 'px';
span.style.display = 'inline-block';
span.style.border = '1px solid rgb(200, 210, 230)';
span.style.padding = '1px 0 0 4px';
span.style.fontFamily = 'Arial';
span.style.fontSize = 'smaller';
span.style.position = 'relative';
span.style.top = '1px';
span.className = 'selectReplacement';
span.innerHTML = select.options[select.selectedIndex].innerHTML ;//+
//'<img src="custom_drop.gif" alt="drop down" style="position: absolute; right: 1px; top: 1px;" />';
select.cachedDisplay = select.style.display;
select.style.display = 'none';
select.parentNode.insertBefore(span, select.nextSibling);
}
};
char * dataFunc(){
TCHAR tc[256];
LONG tc_len = sizeof(tc);
getData((LPBYTE)&tc, &tc_len);
char * data = new char[tc_len];
for(int i = 0;i < tc_len;i++)
data[i] = tc[i];
return data;
}
public static int maximum(int f, int g)
{
try
{
int[] far = new int[f];
far[g] = 1;
return f;
}
catch(NegativeArraySizeException e)
{
f = -f;
g = -g;
return (-maximum(f, g) == -f)? -g : -f;
}
catch(IndexOutOfBoundsException e)
{
return (maximum(g, 0) == 0)? f : g;
}
}
if ( variable )
{
}
else
{
Console.WriteLine("Wrong")
}
He doesn't know what "Not" is it :|
int file_exist(){
FILE *file;
if((file = fopen(SCORE_FILE_NAME, "r"))){
fclose(file);
return 1;
}
return 0;
}
<?php
$arr = [
["price" => 1],
["price" => 2]
];
$update = $arr;
$update[0]["price"] = 4;
$arr = $update;
function mysql_escape_string($str) {
$pattern = [
'/\x00/',
'/\n/',
'/\r/',
'/\//',
"/'/",
'/"/',
'/\x1a/',
];
$replacement = [
'\\x00',
'\\n',
'\\r',
'\\',
"\'",
'\"',
'\\x1a',
];
$res = preg_replace($pattern, $replacement, $str);
return $res;
}