Long ago, I needed to populate a table content and in the table there shall be textboxes created on the fly. I wanted default values in my array to be appearing in my textboxes by default. Here is the old javascript way within HTML. <html> <head> <script language=javascript> var myCars=new Array("Saab","Volvo","BMW"); [...]
baran
Years ago, when I was fiddling with PHP, I found out that I needed name attribute on html element even I have a form having id, action to url and post method. I have my html tags having ids. This was surprising as I was sure that it was enough. For input controls to be posted back to the server from a form, I needed to assign each [...]
baran
I haven’t done anything on PHP lately so, let’s warm up with a very simple and informative code snippet with PHP POST variable. First some theory, when a client makes a request to a server, the client can send request variables. If the request is made via the POST method, PHP will helpfully gather up the request variables and [...]
baran
Long time ago, I needed to do XPath on a certain XML data and it was a hassle. Below is a “malformed” XML content which local-name will work like a charm: <Envelope> <Body> <Aresponse> <Mys> <My> <primerId>3</primerid> <secondaryId>5</secondaryId> </My> <My> [...]
baran
Some time ago (a long time ago), I needed to fiddle with the DOM elements I had an example for my need and the output of the following example will be – the element [object] – a Jquery object wrapping the element. As you can see, The $() wraps the element in a JQuery object which allows you to access all of the Jquery [...]
baran
Long ago, I was trying to convert a java application from 1.7 to 1.6 and yes I was downgrading and the following code was failing: File aFile = anotherfile.toPath().getParent().resolve(newname).toFile() and the solution was simple: String newname = simpleDateFormat.format(date) + anotherFile.getName(); File aFile = new [...]
baran
I have an xml having an invalid xml character, like diamond looking question mark, � and I had editted the following code to include the code point for diamond question mark. Thanks for the original author of this code. And well, diamond question mark character has a code point of 0xFFFD import java.io.FileInputStream; import [...]
baran
Every now and I need to see the file sizes and well, you can do it easily in Windows or you can use Treesize, but I just found a cmd snippet I used year ago and share it here 🙂 This will list the files under C:\ drive and export the file information to desktop as a csv file. Nice? 😛 @echo off pushd c:\ for /f "tokens=*" %%F in ('dir /b [...]
baran
The following vbs code is not my implementation. However, it was failing due to permission settings on the given path and I wanted to resume the execution even there are error. The original code is as follows: '========================================================================== ' NAME: folderSize.vbs ' COMMENT: Scans folder sizes [...]
baran
Out of the blue, I needed to round a file size in VBS and I always forget how VBS works and spend 20-30 minutes to recall 🙂 Following code snippet fails to round: strWrite.WriteLine(oF.Name + "," + CStr(oF.Size/1048576) + "," + CStr(oF.Files.Count) + "," + CStr(oF.Subfolders.Count)) So, in this case using & instead of + is a better [...]
baran