Posts

osx - Mac OS or Linux - Change year but leave Month Day Hours & Seconds untouched -

i need recurse directory tree , update year portion of timestamp files year. can't work out how touch. can't use touch -a since the target files have many different years relative adjustment out. i want update years 2013 regardless of need leave rest of time stamp untouched. possible? any appreciated. thanks, steve. #!/bin/sh #this ensure output of commands in english export lang=c #gets modification date file, can change other timestamp instead. moddate=$(stat $1 | fgrep modify | cut -d" " -f2) year=2013 #sets month , day old date month=$(echo $moddate | cut -d- -f2) day=$(echo $moddate | cut -d- -f3) newdate=$year-$month-$day #sets new date touch -d $newdate $1

ipc - Create shared memory for several processes by using only native C++ operations? -

how can allocate shared memory accessible multiple processes using native c++ operations? or should use os api in case of inter thread synchronization objects such mutex , semaphores are? (i mean can not use bool instead of mutex. os has specific types organizing synchronization.) there no notion of "shared memory", or "process", in "only native c++". platform-specific concepts. you can try boost's interprocess library useful abstractions.

vb.net - Delay in reading from specific database -

i have application written in vb.net reads data sql server 2008 r2. @ time of login, user select 1 of many database files (available in dropdown list) , keys in username , password login. while logging in, application reads table in selected database called 'strings' , while loop put values in 25-30 variables creating working environment of application. i have put in time tracking @ beginning , end of while loop , shows 1 of database, takes 26 seconds read values , takes 0 seconds (since not tracking @ mili-seconds level). ironically, 'strings' table in database takes 26 seconds has 125 rows , database takes 0 seconds has 159 rows. apparently, code same, , database structure true replica (both databases generated using same script). i have thought of possibilities not sure why there's such huge difference delays login time of user. can please put light on how can figure out? thanks without specific information rather difficult find going on. r...

python - invalid syntax error python3 -

can please explain error message me please file "game.py", line 3, in <module> import random file "/usr/lib/python3.2/random.py", line 40, in <module> types import methodtype _methodtype, builtinmethodtype _builtinmethodtype file "/home/twitches/documents/types.py", line 6 print x i used () print in line 6 print("hello") the traceback pretty clear. have file, same name, standard python module - types . rename/move file /home/twitches/documents/types.py

javascript - Design decisions in TodoMVC for Backbone Marionette example -

i wondering why in todomvc backbone marionette , marionette.layout used footer instead of simple itemview header ? also why use compositeview todolist.views.listview instead of collectionview ? i don't see need using layout in footer. think author thought maybe need add regions footer , used layout , in actual implementation? no need. about compositeview instead of collectionview . collectionview doesn't allow have template on it. imagine need show list of clients don't want simple <ul> show clients, want headers, information , <ul> compositeview can add template can contain header, information , of course <ul> . in concrete case, wants show checkbox list, since needs show markup apart <ul> needs compositeview able add template. tl;dr use collectionview if don't need markup , if so, use compositeview

ios6 - using saved GPS coordinates from CLLocation to plot on the iPhone map -

i have been using core data save user's location various times in table view. can location details (coordinates mainly) @ various times, plot coordinates available @ each time on mapview (no overlays, single point point location @ time). have coordinates (one latitude , 1 longitude value) available, know how plot them on mapview. just put question simply, how 1 can plot coordinates on mapview ? i browsed through , not able find exact solution solve problem ! appreciated. thanks time ! regards, raj. with of mkannotation, problem can solved. @craig , vishal kurup ! create annotation class subclass of nsobject. in annotation.h: @interface annotation : nsobject <mkannotation> @property (nonatomic, assign) cllocationcoordinate2d coordinate; @property (nonatomic, assign) nsstring *title; @property (nonatomic, assign) nsstring *subtitle; @end it should conform mkannotation , 3 properties ones required when conforming mkannotation class. declare , syn...

dom - Return edited XML string with Javascript -

i'm using the xml < script > library w3c dom parser available here . (this because i'm using js inside .net cli jint program instead of browser.) my problem is, edit xml using domimplementation.loadxml() function , edit 1 node value, want retrieve string xml including modified one: //instantiate w3c dom parser var parser = new domimplementation(); //load xml parser , domdocument var domdoc = parser.loadxml($xmldata); //get root node (in case, rootnode) var docroot = domdoc.getdocumentelement(); // change "name" element value docroot.getelementsbytagname("name").item(0).nodevalue="john"; // try retreive xml including changed 1 $xmldata=docroot.getxml(); sample xml: <name>carlos</name> all works except last line: docroot.getxml(); which returns original xml string , not modified one. any idea how can retreive xml string including modified? fixed replacing: docroot.getelementsbytagname(...