To update one table using values from another table with a simple join, you can use the following query:
UPDATE Table1, Table2 SET Table1.Field1 = Table2.Field1 WHERE Table1.ID = Table2.ID;
(Source)
To update one table using values from another table with a simple join, you can use the following query:
UPDATE Table1, Table2 SET Table1.Field1 = Table2.Field1 WHERE Table1.ID = Table2.ID;
(Source)
When you have wamp/mamp local installation of PHP, MySQL & Apache server, you might have used phpMyAdmin by opening http://localhost/phpmyadmin directly without providing username or password. But when you need to prevent this auto login and make phpMyAdmin ask you the username and password when you hit that link, you need a make a small change in the configuration file. Locate the configuration file (config.ini.php) in C:\wamp\apps\phpmyadmin3.5.1\ or wherever you installed wamp server.
Change the following line:
$cfg['Servers'][$i]['auth_type'] = ‘config’;
to
$cfg['Servers'][$i]['auth_type'] = ‘cookie’;
This change make phpMyAdmin to use cookie based authentication instead of using the configuration file. (Source)
Say you have a amount as Decimal = 437861 and when you want to convert it into words like Four Lakh Thirty Seven Thousand Eight Hundred and Sixty One, you can use the following snippet. This code supports upto 9 digits.
Public Function convertNumberToWordsForIndia9Digits(ByVal number As Decimal)
'Based on this - http://www.php.net/manual/en/function.number-format.php#108532
'If you know the C# version, share it here http://blog.emaillenin.com
Dim words As New Hashtable
words.Add("0", "")
words.Add("1", "One")
words.Add("2", "Two")
words.Add("3", "Three")
words.Add("4", "Four")
words.Add("5", "Five")
words.Add("6", "Six")
words.Add("7", "Seven")
words.Add("8", "Eight")
words.Add("9", "Nine")
words.Add("10", "Ten")
words.Add("11", "Eleven")
Complete source code available here in my gist.
Have a C# version or a better way to do the same thing? Share in the comments.
Does it suck to see a run time error in your production ready app at your client location?
Yes, it sucks! But as a great programmer, we need to ensure that our clients don’t see such run time errors. All possible exceptions need to handled well during our development. But in such scenarios, we need to understand what went wrong. To dig into the problem, we need to know the exact line number of the file that caused the exception. To make sure JIT debugger captures those info and displays them, ship your “<App_Name>.pdb” file along with your application.
I usually ship only my .exe file and any additional .DLL files during my software update. Only when I realized that .PDB file is essential for tracking line numbers during run time errors, I started including them in my shipping.
I often run into boot issues in my laptop as it is pretty old. So I keep a bootable Windows DVD or USB with me always. Windows 7 Installation is pretty quick. I usually do a clean install – formatting the drive that currently holds my Windows. It takes just 20 minutes and Windows installs the necessary drivers for me automatically.
First things first, install an anti virus software. I use Avast.
And some of the essentials for every computer:
Let Windows Update do its job in the background.
Newer modems such as teracom has issues with older laptop models. The wifi network does not appear in the network list. To fix it, go to model settings, change the channel mode to “Manual” and set the channel value same as what you have in your WiFi adapter properties. Restart your modem and now you should see your modem in the network list and able to connect to it.
Source – http://www.computing.net/answers/programming/how-to-set-a-default-choice-in-bat/17081.html
SQL to find the table space of a table in each AMP -
SELECT DATABASENAME, TABLENAME, CURRENTPERMFROM DBC.TABLESIZEWHERE TABLENAME = ‘TABLE_NAME’;
SQL to find Skew factor of a table for a set of columns in the table –
SELECT (100 – (AVG(T1.TOTAL)/MAX(T1.TOTAL)*100)) SKEW_FACTOR FROM (SEL (HASHAMP(HASHBUCKET(HASHROW(