…is unimaginable.
INTERESTING
How you determine your age?
I was born in 1987 and this is 2011, so I am 24 years old right now.
How most computer systems determine your age?
Time passed since 1st January 1970 till now (2011)
minus
Time passed since 1st January 1970 till when you were born (1987)
equals
(well, again) 24
The date 1st January 1970 is the Epoch date for the computer, signifying the start of time for it. That’s why timestamps in most programming languages are the seconds/milliseconds elapsed since the epoch.
Another of my free time exercises, Unjumble does just that – it unscrambles a jumbled/scrambled word into all possible English dictionary words that can be formed out of that jumbled word. The interface is extremely simple. You have a textbox to input your jumbled word, and as you type, all unjumbled word suggestions start appearing as list items in the combobox below. To copy an unjumbled word to clipboard, just click on it. Simple, isn’t it?
Like QuickCopy, Unjumble was coded in C#, and makes use of SQLite as the portable database to store a huge list of English dictionary words. What’s the most interesting thing about this little app is the algorithm behind it.
There is a pre-prepared database of almost all (58000+) English words [wordlist.txt], stored along with their hashes (words formed by the original words’ individual alphabets in sorted order). The input jumbled word’s hash is then calculated in a similar way, and is compared with the hashes stored in the database. All matches are then displayed in the list box.
I bet, using Unjumble, you’ll never lose your newspaper’s jumbled words game again.
Download: Source Code (1.5 MB) – Installer (1.7 MB)
A very simple password management tool that I developed in my free time. It aims to simplify the task of copy-pasting frequently used text, like usernames and passwords. A Windows-only tool, it’s code purely in C#, and makes use of the wonderfully portable SQLite to store entries in the backend. The interface includes 2 components (basically 3; one is hidden) — system tray icon and “add content” dialog. All content added through the dialog gets added as a menu item in the system tray icon’s context menu (the one you see on right-clicking the icon). To copy a content from the menu to the clipboard, all you need to do is just click on its entry in the menu and it’s done!
Some features:
- Store content – frequently used text, like usernames.
- Store passwords – these are masked by content tags, which are then shown in the context menu (in red color).
- Hotkeys – the top 3 entries in the context menu can be quickly copied to the clipboard using the key combinations of CTRL+F1, CTRL+F2 and CTRL+F3.
For a password, its respective content tag acts as a mask to hide it under its name. Say you’re adding your Gmail password @ILuvKatz!! in the dialog, and set its content tag as Gmail Password, the password’s entry will appear in the menu in red color with the name Gmail Password. When you click on Gmail Password, your actual password will be copied to the clipboard.
There is no easy provision of modifying existing content entries. But I’ve provided a QueryEditor (invoked by pressing CTRL+Q in the “Add Content” dialog), where you can change the content entries by issuing your regular SQL queries. For example:
UPDATE content SET content='@IHateKatz!!' WHERE content_tag='Gmail Password'
Download: Source Code (1.1 MB) – Installer (1.2 MB)
ASP.NET controls essentially translate to a bunch of HTML and JavaScript code when being rendered in the browser, because HTML and JS is all what a browser can understand. So does that mean you can access an ASP.NET control with ease through JavaScript? Yes and no. Really depends on the version of .NET installed on the server (hosting your ASP.NET website).
HTML controls/elements/tags are generally referred to by their IDs. In plain JS, we would do something like:
var name = document.getElementById('txtName').value;
In jQuery, that would translate to:
var name = $('#txtName').val();
That’s assuming that your page has a text box with the ID ‘txtName’. One would expect that ASP.NET controls can also be referred to by their IDs in JavaScript. But that’s not always true. Prior to .NET 3, a compiler-generated prefix used to get added to a control’s ID (while rendering it in browser), to form what’s called the control’s ClientID. An example of such a ClientID can be “ctl00$mainpage$txtName”. In short, if you have an ASP.NET 3.0 textbox control having an ID ‘txtName’, you can access it in JavaScript like:
var name = document.getElementById('txtName').value;
But obviously, that won’t work in case of ASP.NET 2.0, because the actually ID you want to refer to is “ctl00$mainpage$txtName”.
That is where the ASP.NET short tag notation comes into play. Regardless of whatever version of .NET is installed on your server, you can access an ASP.NET control in JS in the following way:
var name = document.getElementById('<%= txtName.ClientId %>').value;
Of course, you can directly do something like:
var name = <%= txtName.Text %>;
Well, all depends on your needs. This tip is just meant to get you started with the interoperability between ASP.NET and JavaScript. And remember, the ASP.NET short tag notation works the same way in case of HTML too.
Further Reading
You can even have ASP.NET methods return data to your JavaScript code. That can be done with a little-bit of AJAX and by declaring your ASP.NET methods as webmethods. This beautiful tutorial discusses how to do just that (in plain JS and in jQuery)