Feb 11 2014
JQuery Calendar and PHP: Handling Inserts
1) Getting Current Time in Javascript
The ISO 8601 date format can be utilized to convert the date on the browser side to a format that include timestamp information. Quoting from here:
Note that the “T” appears literally in the string, to indicate the beginning of the time element. Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator (“Z”). Used in ATOM RSS feeds.
function fnISO() { // Only works in Firefox using ECMAScript 5 var now = new Date().toISOString(); alert(now); }
Result: 2009-08-06T23:36:31.390Z





Feb 11 2014
Retrieve images of chemical structures using Excel VBA
The below is from an answer I posted on stackoverflow.
You can retrieve the chemical structure of an image using the following:
Sub Run() getImage ("iron") End Sub Public Function getImage(ByVal name As String) As String Dim imgURL As String Dim XMLhttp: Set XMLhttp = CreateObject("MSXML2.ServerXMLHTTP") XMLhttp.setTimeouts 1000, 1000, 1000, 1000 imgURL = "http://cactus.nci.nih.gov/chemical/structure/" + name + "/image" XMLhttp.Open "GET", imgURL, False XMLhttp.send If XMLhttp.Status = 200 Then 'It exists so get the image Sheets(1).Shapes.AddPicture imgURL, msoFalse, msoTrue, 100, 100, 250, 250 Else ' End If End FunctionThis can further simplified to simply only use
Instead of downloading the image the twice, and simply using an error handler to catch when image not found.
Reference:
By Menelaos Bakopoulos • Uncategorized 0