Wednesday, November 15, 2017
Hacking Your Monitor
It might be a good idea to resize your browser window whenever you are doing transactions on websites that require you to send sensitive information (providing credit card information, accessing bank accounts, etc.)
Saturday, January 09, 2016
More than 5 years in Hibernation
I neither have the time nor the inspiration to update this post in the near future. Just a quick update after a long, long time. I am now working here in Downtown DC for almost two years now. Still in the software development industry. Aside from the lots of different places and people of all shapes and size :-), not much has changed in my daily routine.
Just keeping in touch.
Saturday, September 04, 2010
I'm Still Here
Wednesday, March 19, 2008
Windows Vista versus XP
Wednesday, February 20, 2008
Top-10 Application-Design Mistakes
Here's the link: http://www.useit.com/alertbox/application-mistakes.html
Tuesday, February 12, 2008
sheijin@yahoo.com has shared: Load OSX 10.5 Leopard on the eeePC
sheijin@yahoo.com wanted to share this with you:
Load OSX 10.5 Leopard on the eeePC
| | Load OSX 10.5 Leopard on the eeePC http://uneasysilence.com/archive/2007/11/12654/ |
Powered by ShareThis
Tuesday, February 05, 2008
Need to print from a x64 machine? Can you wait 60 seconds?
Missing ASP.NET Tab on IIS Manager Solution
- Stop the IIS Admin service and any services that depend on it.
- Open C:\WINDOWS\system32\inetsrv\MetaBase.xml in notepad or your favorite XML Editor.
- Delete the line that reads Enable32BitAppOnWin64='TRUE'
- Start IIS via Windows | Start | Run | iisreset
PROBLEM DESCRIPTION
===================
On a Windows 2003 64bit machine with both .NET Framework 1.1 and 2.0 installed, you are tying to configure a website on IIS, but you are unable to find the tab to specify ASP.NET settings.SUMMARY of TROUBLESHOOTING
==========================
Researched turned out this being a bug that is closed as "won't fix".
Click here for the link to blog article on MSDN Blog.
Friday, February 01, 2008
10 Principles of Effective Web
Friday, January 18, 2008
"Blog This" embedded blog editor
Thursday, January 10, 2008
Cool Javascript Trick
To test:
Go to a search engine (e.g. Google). Then search for images. Or click here to launch Google Image Search. After the search engine has returned results, copy the text below and paste it on the address bar.
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3= 1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images; DIL=DI.length; function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos (R*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0)
Hit enter, and there you go. Enjoy.
Tuesday, December 04, 2007
Transparent Winform Control
If you want to check it out, click here. I welcome all comments specially when the rating that was given was low, because I want to know how else can I improve my solution.
Wednesday, November 14, 2007
window.location.search Property
window.location.search Property
One of the not so commonly-used properties ofwindow.location object in javascript is the window.location.searchproperty.For example, in a web address like
the window.location.search property will have all the characters after the "?" including it(?user=2&role=admin).
How can this information be useful? Well, for starter, we can access all the request parameters at client-side (using javascript) instead of processing it at server-side using codebehind. Since we have access to the request parameters,
we can do manipulations on its value or use the values contained in the request parameters to populate the value of the controls on the current page. For example, we have a web address like:
Here's the complete source of the sample:<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<script type="text/javascript">
window.onload = function()
{
if(window.location != null && window.location.search.length > 1 )
{
var urlParameters = window.location.search.substring(1);
var parameterPair = urlParameters.split('&');
var pos = parameterPair[0].indexOf('=');
var argName = parameterPair[0].substring(0, pos);
var argVal = parameterPair[0].substring(pos + 1);
if(argName == 'username' )
{
document.getElementById('user').innerText = argVal;
}
}
}
</script>
</head>
<body>
<table cellpadding="4" cellspacing="0">
<tr>
<td colspan="2">Enter login information</td>
</tr>
<tr>
<td align="right">username:</td>
<td><input type="text" size="25" id="user" name="user" /></td>
</tr>
<tr>
<td align="right">password:</td><td><input type="text" size="25" id="pass" name="pass" /></td>
</tr>
lt;tr>
<td align="right"></td>
<td><input type="button" value="login" /></td>
</tr>
</table>
</body>
</html>
Still you need to add input validation and error-handling in your code should you
need to adopt this sample code but the code itself is running on a "happy scenario",
if you know what I mean.
I thought You'd Like to Know
Page.RegisterStartupScript (System.Web.UI)
Emits a client-side script block in the page response.
This method is now obsolete. Use ClientScript.RegisterStartupScript instead.
Page.RegisterClientScriptBlock (System.Web.UI)
Emits client-side script blocks to the response.
This method is now obsolete. Use ClientScript.RegisterClientScriptBlock instead.
Tuesday, November 13, 2007
How to add External Tool on Visual Studio IDE
Note: This article is for absolute beginner.
There are some cool external tools that I found valuable in my web development tasks. One of them is a utility called javascript lint, a javascript checker/verifier. In this article, I would discuss how to add js lint as an external tool.
First, you need to download a copy of javascript lint.
- Then click on Tool->External Tools
- Click Add.
- Specify name for the Tool
- On the Command field, click browse to locate the javascript lint executable. The value of this field should be complete path to executable plus the executable name.
- On the Arguments field, you can just put -process $(ItemPath). The arguments here depends on the arguments that are supported by the external tool. In this case, javascript lint needs a -process parameter.
- On the Initial Directory, put $(ProjectDir)
- Put a check mark on Use Output Window checkbox.
- Click Apply.
Cool! Now you are set. You should be able to see a new Tool Menu item. Go ahead and give it a try.
String Concatenation versus StringBuilder Class
When concatenating large strings (for example, building an HTML table from a database),the length of time to complete can become quite long as the string gets larger. This article demonstrates the difference in string concatenation using String and StringBuilder classes.
String Concatenation using String Class.An ordinary code to create a string from a subset of two strings is usually implemented this way:
string c = "sample" + "code";
This approach usually does the job for most of the applications that we write. But when the situation comes that we need to create a large subset of string by continuous iteration (e.g. a string that contains all numbers from 0 to 10000 or as mentioned above, building an HTML table from database, this approached was proven to be inefficient. According to the Microsoft KB Article # 170964, here's what really happens when we concatentate two strings:
- Allocates temporary memory large enough to hold the result.
- Copies Destination to the start of the temporary area.
- Copies Source to the end of the temporary area.
- De-allocates the old copy of Destination.
- Allocates memory for Destination large enough to hold the result.
- Copies the temporary data to Destination.
Steps 2 and 6 are very expensive and basically result in the entire concatenated result being copied twice with additional overhead to allocate and de-allocate memory. A typical 100K iterations using this string processing will take more or less four minutes to complete.
String Concatenation using StringBuilder Class.
The performance of a concatenation operation for a String or StringBuilder object depends on how often a memory allocation occurs. A String concatenation operation always allocates memory, whereas a StringBuilder concatenation operation only allocates memory if the StringBuilder object buffer is too small to accommodate the new data. Consequently, the String class is preferable for a concatenation operation if a fixed number of String objects are concatenated. In that case, the individual concatenation operations might even be combined into a single operation by the compiler. A StringBuilder object is preferable for a concatenation operation if an arbitrary number of strings are concatenated; for example, if a loop concatenates a random number of strings of user input.
Here's a sample code that I wrote to demostrate the comparison:
using System;
using System.Web;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
string myString = "";
StringBuilder sb = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Start 100K loops
using string catenation:" +
DateTime.Now.ToString("HH:mm:ss:ff")+"<br/>");
Iterate100K_With_StringAppend();
Response.Write("End 100K loops using string catenation :" +
DateTime.Now.ToString"HH:mm:ss:ff") + "<br/>");
Response.Write("Start 100K loops using StringBuilder: " +
DateTime.Now.ToString("HH:mm:ss:ff") + "<br/>");
Iterate100K_With_StringBuilder();
Response.Write("End 100K loops using StringBuilder : " +
DateTime.Now.ToString("HH:mm:ss:ff") + "<br/>");
}
private void Iterate100K_With_StringAppend()
{
for (int i = 0; i < 99999; i++)
myString += i.ToString();
}
private void Iterate100K_With_StringBuilder()
{
for (int i = 0; i < 99999; i++)
sb.Append(i.ToString());
}
}
Your result may be slightly different from my result, but you should see signification difference on the time that it takes to perform string concatenation using string class and the time it took using StringBuilder class. The results on my test are as folows:
Start 100K loops using string catenation: 15:22:48:24
End 100K loops using string catenation : 15:26:45:20
Start 100K loops using StringBuilder : 15:26:45:20
End 100K loops using StringBuilder : 15:26:45:26
Note: Most contents are © 2007 Microsoft Corporation aside from some comments and sample code that I added.
Saturday, November 10, 2007
I'm Alive!
Stay tuned.
Monday, February 13, 2006
My Coding Adventure Begins
This is my first post for this blog. I decided to create a new blog, because I wanted a designated place on the net where I can share my adventures in programming. I am into .NET and MSSQL now and here you will find about my latests projects.
Stay tuned.