Author: Peanuts

How to enable mod_rewrite on MacOSX, Mountain Lion

After having to repeatedly enable it on a couple of my laptops, I decided to back up the 3 steps for future use. Step 1: /etc/apache2/users/username.conf

Step 2: /etc/apache2/httpd.conf

Step 3: Restart apache

Read more →

MySQL command via shell script (using variables in SQL)

Running mysql commands on the shell is pretty simple. However, things can get tricky if you need to enclose variables within those aprostophes in your script. Spend some time trying to figure this out. The short sample code below shows how it can be done. Note the cats on “echo $1“. Hope this helps you as well.

Read more →

Shadowing vs Hiding vs Overriding

In C#, it is easy to confuse hiding with overriding. Both are ways to change the implementation of elements from a base class. But there are some significant differences between the two. A further confusion steps in with the term shadowing. Shadowing is a VB concept. In C#, this concept is called hiding, though there is a subtle difference between… Read more →

Multi-threading in C Sharp (C#)

Threading is fun, because with it you can do a lot more stuff at the same time. For example, keeping your UI updated while your background tasks are running. C# supports parallel execution of code through multi-threading. A thread is an independent execution path, able to run simultaneously with other threads. Here, we examine three simple C# approaches to help… Read more →

Disappearing Nested User Controls in VS2005

When trying to nest usercontrols, the child usercontrol sometimes disappears off the parent usercontrol. This is a commonly reported bug on the internet, and there’s a hotfix FIX:#842706 for vs2003 but not for vs2005, and its extremely annoying. What happens is that after placing the MyControl on your MyForm.designer.cs, it just disappears when you save MyParentControl in wysiwyg mode.

For me, the problem occurs because the Component Designer auto-validates & re-generates your MyParentControl.designer.cs code again. And, if your MyControl constructor requires initializing parameters, vs2005 will just delete that instantiation in MyParentControl.designer.cs. Read more →