Add new data into PHP JSON string

I was just searching for the solution to this and stumbled across this question (already one year old). The answers provided so far were not very helpful to me. So, hopefully this helps the next person. The answer I was looking for was $json = json_decode($data,true); which returns the result in an array structure, not … Read more

unstaged files gone after git reset –hard

It’s not clear if you lost files in your working directory, or files in the index. You say you lost your “unstaged files”, but then you mention you might have run “git add”. “unstaged files” are lost for good. Staged files can be recovered with git fsck –full –unreachable –no-reflog For each file added there … Read more

Git: add vs push vs commit

git add adds your modified files to the queue to be committed later. Files are not committed git commit commits the files that have been added and creates a new revision with a log… If you do not add any files, git will not commit anything. You can combine both actions with git commit -a … Read more

How to add hours to current time in python

from datetime import datetime, timedelta nine_hours_from_now = datetime.now() + timedelta(hours=9) #datetime.datetime(2012, 12, 3, 23, 24, 31, 774118) And then use string formatting to get the relevant pieces: >>> ‘{:%H:%M:%S}’.format(nine_hours_from_now) ’23:24:31′ If you’re only formatting the datetime then you can use: >>> format(nine_hours_from_now, ‘%H:%M:%S’) ’23:24:31′ Or, as @eumiro has pointed out in comments – strftime

Java ‘+’ operator between Arithmetic Add & String concatenation? [duplicate]

This is basic operator precedence, combined with String concatenation vs numerical addition. Quoting: If only one operand expression is of type String, then string conversion (ยง5.1.11) is performed on the other operand to produce a string at run time. The result of string concatenation is a reference to a String object that is the concatenation … Read more

How to Install Older iOS Simulators in XCode 4.2.1 (SDK5.0)

X-Code 4.2 will have iOS 5 simulator and library only. If you want lower version simulator and library with X-Code just goto X-Code->Prefrences-> Downloads Tab. In downloads tab you’ll have two tabs: 1) Components – Here you will have option to download iOS 4.3 simulator(~600 Mb), iOS 4.0-4.1(~670 MB) Device debugging support, iOS 3.0-3.2.2(686.3 MB) … Read more