Posts

bash - How can I subtract timestamp results from `date` in one line of shell? -

i can generate 2 timestamps so: date +"%s" -d "$(curl -s --head http://google.com | grep ^date: | sed 's/date: //g')" // result: 1417800327 date +"%s" // result: 1417800325 how can subtract them 1 line? echo "$((1417800327-1417800325))" // result: 2 but want closer to: echo "$(( (date +"%s" -d "$(curl -s --head http://google.com | grep ^date: | sed 's/date: //g')") - (date +"%s")))" try doing : lang=c echo $(( $(date +%s) - $(date -d "$(curl -s --head http://google.com 2>&1 | awk -f'date: ' '/^date:/{print $2}')" +%s) )) or splitted multi-lines readability : lang=c echo $(( $(date +%s) - $( date -d "$(curl -s --head http://google.com | awk -f'date: ' '/^date:/{print $2}' )" +%s) ))

c++ - Newbie here: Different results on PC and MAC. Why? -

this question has answer here: parameter evaluation order before function calling in c [duplicate] 7 answers i trying learn basics of c/c++ right now. going through course on lynda.com my questions deals sequence of code chapter 4 "macro caveats course c/c++ essential training". have followed setup procedures xcode , eclipse setup correctly on mac , eclipse on pc. when run code on mac , pc different results. trying understand why happening , can same result on both. here code: // working.c bill weinman <http://bw.org/> #include <stdio.h> #define max(a, b) ( (a) > (b) ? (a) : (b) ) int increment() { static int = 42; += 5; printf("increment returns %d\n", i); return i; } int main( int argc, char ** argv ) { int x = 50; printf("max of %d , %d %d\n", x, increment(), max(x, increment())); pr...

html - Using <br/> versus <p></p> versus CSS for form fields, what is the current accepted best practice for desktop, mobile, and accessibility? -

question: should avoid using <br/> break lines in favor of wrapping content in <p></p> ? when ok use <br/> (if ever)? they both work fine in call typical desktop browsers, 1 or other work better accessibility features , mobile devices? what current recommended best practice? (it seems moving target.) for example, when doing stuff this: using <br/> separate label input <label for="txtusername">username</label><br/> <input type="text" id="txtusername" autocomplete="off" maxlength="50" spellcheck="false"/> using <p></p> separate label input <p><label for="txtusername">username</label></p> <p><input type="text" id="txtusername" autocomplete="off" maxlength="50" spellcheck="false"/></p> i've searched around bit , the...

python - Changing text of label does not work -

i have problem following python script. later, catch data barcode scanner , display text label. whenever text should changed label (highlighted line), program crashes. absolute beginner python , can not explain that. comment out line, program works. from tkinter import * import pyhook class application(frame): def __init__(self): frame.__init__(self) self.master.title("sc4nn0r") self.variable = "start variable" self.master.geometry("363x200") self.master.resizable(0,0) self.master.rowconfigure( 0, weight = 1) self.master.columnconfigure( 0, weight = 1 ) self.grid( sticky = w+e+n+s ) self.label4string = stringvar() self.label4 = label(self, textvariable=self.label4string) self.label4.grid( row = 2, column = 1, columnspan = 2, sticky = w+e+n+s) self.label4string.set("variable1") self.string = '' hook = pyhook.hookma...

jquery - Pushing variable to an existing function with javascript -

so, lets have function this (function($){ $.fn.test = function(opts){ var _object = $(this), _opts = $.extend({}, $.fn.test.defaults, opts), _callback = _opts.objects[1].callback /* code here */ _callback() /* calling callback */ } $.fn.test.defaults = { /* not important */ } }) that's how initialise function $('.element').test({ option: 0, /* not important */ variable: 1, /* not important */ objects: [ { "object" : ".element2", "callback" : false }, { "object" : ".element3", /* object № 2 */ "callback" : function(){ /* >>> {this part} <<< */ console.log (this) } }, ] so on {this part} returns data of object №2, callback function run on _object element $.fn.test output data of $('.element') . c...

iOS CMake and XCode 6 "no such product type for 'iphoneos'" -

when generate library project , try compile get: target specifies product type 'com.apple.product-type.tool', there's no such product type 'iphoneos' platform from understand product type available on mac os , not ios, correct? how possible fix it? cannot find clue.

asp.net - Session Ends Automatically -

about application: build application in .net have installed on 5 sub domains. example client1.mydomain.com, client2.mydomain.com . uploaded application on shared server. issues: found, sometime user session end without reason. try figure out. support team told me can use maximum of 150 mb in pool. application using 70-80 mb, though 5 sub domains using 70*5 = 350 mb, , that's why poll getting reset/recycling & session ends automatically. shifted app on vps. configuration 2gb ram, 40gb space, windows 2008 r2, iis 7.5. issues still same. i found lots of suggestion, looks me experimental my thoughts , query: guess need set maximum pool size. if correct, can set pool size through "memory based maximums", question is, if uncheck maximum pool size default. , maximized pool size value can set ? can suggest me check , how can resolve issues ? thanks please refer article. http://technet.microsoft.com/en-us/library/cc745955.aspx there idletimeou...