Tuesday, April 5, 2011

Restore MS SQL Server Backup file

Recently I was faced with a dilemma - a friend of mine had a M$ SQL Server backup file and wanted me to extract some data from it. Since I work on Ubuntu & LAMP stack, I had to grab hold of a Win7 laptop and then follow the below steps.

To restore a database you need to do three things:
  1. Install MS SQL Server Express
  2. Interrogate the backup file to find the logical file names it contains
  3. Restore the file into the appropriate database

Assume: For this example, the backup file is C:\Backups\DB_Backup_20110131.bak

Step 1: Install MS SQL Server
Go to Micro$oft site using the direct link http://www.microsoft.com/express/Database/I-nstallOptions.aspx and download and install the most appropriate version of SQL Server Express.

Step 2: Interrogate Backup File
RESTORE FILELISTONLY FROM DISK = 'C:\Backups\DB_Backup_20110131.bak'

This will return something like the below set of rows which represent the internal logical composition of the backup file:

LogicalName        PhysicalName                 Type FileGroupName Size      MaxSize
------------------ ---------------------------- ---- ------------- --------- --------------
SourceDatabase_data C:\SqlServer\Src_DB_Data.mdf D    PRIMARY       836461765 35184372080640
SourceDatabase_log  C:\SqlServer\Src_DB_Log.ldf  L    NULL           91592723 35184372080640

Step 3: Restore from Backup File

RESTORE DATABASE Destination_DB
FROM DISK = 'C:\Backups\DB_Backup_20110131.bak'
WITH 
     REPLACE, -- Overwrite DB - if one exists
     RECOVERY, -- Use if this is the only file to recover
     STATS = 10, -- Show progress (every 10%)
     MOVE 'SourceDatabase_data' TO 'C:\SqlServer\Src_DB_Data.mdf', 
     MOVE 'SourceDatabase_log' TO 'C:\SqlServer\Src_DB_Data.mdf'

Array Equality in JUnit

Till JUnit4.2.*, the only way to compare equality of arrays was to use the following snippet of code:

assertTrue(java.util.Arrays.equals(primitiveArray1, primitiveArray2));

JUnit4.3.* added the assertArrayEquals methods but surprisingly omitted a method to compare arrays of primitive doubles so, one had to fall back to the above mentioned way to compare them.

This important feature was added in JUnit4.6 so if you are using that or a later version, you can do the following:
assertArrayEquals(doubleArray1, doubleArray2, delta)
where delta is the allowed tolerance.

The advantage with using the assertArrayEquals method over the previous method is that this method clearly indicates the first element which differed. For example, when the below basic test is run, it gives the error message:
arrays first differed at element [2]; expected:<2.3124> but was:<2.3224>

Here is a sample class file showing implementation of the above test:

import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;

public class AAETest {

    @Test
    public void testAAEDouble() {
     double[] da1 = {1.002d, 1.234d, 2.3124d, 3.91293d};
     double[] da2 = {1.003d, 1.2345d, 2.3224d, 3.91293d};
     double tol = 0.001d;
     assertArrayEquals(da1, da2, tol);
    }
}

Comparison of Intel Atom processors

With the various Atom Processor based netbooks and nettops being available these days, it becomes very difficult to decide which one to go for. Searching for the differences between the processors, I found the following comparison chart:

Product NameMax TDPCores /
Threads
Intel® VT-xIntegrated
Graphics
Intel® Turbo Boost
Technology
Status
Intel® Atom™ Processor Z560
(512K Cache, 2.13 GHz, 533 MHz FSB)
2.5 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z550
(512K Cache, 2.00 GHz, 533 MHz FSB)
2.4 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z540
(512K Cache, 1.86 GHz, 533 MHz FSB)
2.4 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z530P
(512K Cache, 1.60 GHz, 533 MHz FSB)
2.2 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z530
(512K Cache, 1.60 GHz, 533 MHz FSB)
2 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z520PT
(512K Cache, 1.33 GHz, 533 MHz FSB)
2.2 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z520<
(512K Cache, 1.33 GHz, 533 MHz FSB)
2 Watts1C / 2TYes   NoLaunched
Intel® Atom™ Processor Z515
(512K Cache, 1.20 GHz, 400 MHz FSB)
1.4 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor Z510PT
(512K Cache, 1.10 GHz, 400 MHz FSB)
2.2 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor Z510P
(512K Cache, 1.10 GHz, 400 MHz FSB)
2.2 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor Z510
(512K Cache, 1.10 GHz, 400 MHz FSB)
2 Watts1C / 1TNo   NoLaunched
Intel® Atom™ Processor Z500
(512K Cache, 800 MHz, 400 MHz FSB)
0.65 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor N570
(1M Cache, 1.66 GHz)
8.5 Watts2C / 4T       Launched
Intel® Atom™ Processor N550
(1M Cache, 1.50 GHz)
8.5 Watts2C / 4TNoYesNoLaunched
Intel® Atom™ processor N475
(512K Cache, 1.83 GHz)
6.5 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ Processor N470
(512K Cache, 1.83 GHz)
6.5 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ processor N455
(512K Cache, 1.66 GHz)
6.5 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ Processor N450
(512K Cache, 1.66 GHz)
5.5 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ Processor N280
(512K Cache, 1.66 GHz, 667 MHz FSB)
2.5 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor N270
(512K Cache, 1.60 GHz, 533 MHz FSB)
2.5 Watts1C / 2TNo   NoLaunched
Intel® Atom™ Processor E680T
(512K Cache, 1.60 GHz)
4.5 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E680
(512K Cache, 1.60 GHz)
4.5 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E665CT
(512K Cache, 1.3 GHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E665C
(512K Cache, 1.3 GHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E660T
(512K Cache, 1.30 GHz)
3.6 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E660
(512K Cache, 1.30 GHz)
3.6 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E645CT
(512K Cache, 1.0 GHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E645C
(512K Cache, 1.0 GHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E640T
(512K Cache, 1.00 GHz)
3.6 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E640
(512K Cache, 1.00 GHz)
3.6 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E625CT
(512K Cache, 600 MHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E625C
(512K Cache, 600 MHz)
7 Watts1C / 2TYesYes   Launched
Intel® Atom™ Processor E620T
(512K Cache, 600 MHz)
3.3 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ Processor E620
(512K Cache, 600 MHz)
3.3 Watts1C / 2TYesYesNoLaunched
Intel® Atom™ processor D525
(1M Cache, 1.80 GHz)
13 Watts2C / 4TNoYesNoLaunched
Intel® Atom™ Processor D510
(1M Cache, 1.66 GHz)
13 Watts2C / 4TNoYesNoLaunched
Intel® Atom™ processor D425
(512K Cache, 1.80 GHz)
10 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ Processor D410
(512K Cache, 1.66 GHz)
10 Watts1C / 2TNoYesNoLaunched
Intel® Atom™ Processor 330
(1M Cache, 1.60 GHz, 533 MHz FSB)
8 Watts2C / 4TNo   NoEnd of Life
Intel® Atom™ Processor 230
(512K Cache, 1.60 GHz, 533 MHz FSB)
4 Watts1C / 2TNo   NoEnd of Life

This is taken from the Intel Ark site.

Now based on the above table, the decision making process is slightly easier!

Friday, February 25, 2011

Fix Magento Invalid model for shipping method

Since a couple of days I had been playing around with various shipping method modules and installing & uninstalling them to see which fit the requirements. Then when I tried to ship an order from the backend, I would just get the error and on checking the logs, saw the error message "Invalid model for shipping method:" with a huge unintelligible stack trace.

I suspected foul play between my custom theme and the various shipping methods modules that I had tried so I removed all of them and then tried but got the same result. On reinstalling the modules, I noticed that the configuration data was being pre-populated automatically and this got me thinking.

I poked around in the database and found that the configuration info is stored in the table core_config_data.  In this table, I saw rows of data for all the modules that I was playing around with!

I deleted all these errant rows carefully, then cleared Magento cache and tried again and eureka! The order was processed & completed successfully!

Wednesday, February 23, 2011

Set Default Quantity to 1 in Magento

By default, the quantity box on the product page is always blank and that is not very user friendly. It would be great if the box would be set to "1" by default .

Now this can be done without any programming - only through configuration changes in the backend as follows:


  1. Go to Admin Panel -> System -> Configuration -> Inventory-> Product Stock Options from the Menu
  2. Click on Add Minimum Qty button (next to Minimum Qty Allowed in Shopping Cart option)
  3. Choose Customer Group: ALL GROUPS as you want this to be applied to all users
  4. Enter 1 for Minimum Qty
  5. Save Config

Abracadabra! The work is done - now products page quantity box is defaulted to 1.

Saturday, January 22, 2011

Flying with Froyo on Vibrant

Froyo is now available for T-Mobile Samsung Galaxy S Vibrant, however to really get it, you need to have the charged to more than 75% and have the Samsung Kies Mini downloaded & installed. This release is not OTA and the full fledged Samsung Kies software dos not work for USA hence the Mini is required.

Downloading Kies downloader was quite fast, however the actual installer download took some time but the install was a breeze. Hooked up my phone to the laptop and was told that an update is available and I started it. The downloading took about 15 minutes and then the actual install another 7 minutes. Here are the steps:

  1. Setup Vibrant as follows:
    1. Go to Menu > Settings > Applications and check the box beside "Unknown Sources"
    2. Go to Menu > Settings > Applications > USB Settings and select "Ask on connection"
  2. Download Samsung Kies Mini from Samsun website.
  3. Install Kies Mini
  4. Ensure that the battery on your phone is more than 75% charged
  5. Take a backup of your data from the phone
  6. Start Kies Mini and connect the phone to the PC
  7. On phone prompt, choose "Samsung Kies" as the connect method on the phone
  8. Kies will show that an update is available, click on the "Phone Upgrade" button on the left
  9. A disclaimer Caution screen pops up - Read the Caution statements
  10. Click the checkbox for "I have read and understood...", and click the Upgrade button
  11. Kies will download the upgrade from the server - this took about 15 minutes for me
  12. Once the files are downloaded, Kies will start the upgrade process and the phone screen will change to reflect this with icons and info of what step is being performed
  13. After the installation finishes, click on the "Ok" button in the last screen to complete it.
  14. Now the phone should reboot by itself and now you can disconnect your phone from the PC
My phone just kept waiting for about 5 minutes in the initial screen that displays the Vibrant logo and then came up.

Here are the differences that I see right off the bat:
  1. Menu icons are colorful
  2. Phone seems to be a bit faster than before
  3. T-Mobile TV is now available - this is a pad service so not that interesting for now
  4. Option to add Samsung widgets on the home screen using the long press is not available any more
  5. WiFi calling is now available - but this still uses plan minutes so is useful only in places where T-Mobile or any other roaming GSM signal is not available, but a Wi-Fi signal is available.
  6. There is a new app for Google Search
  7. USB / Wi-Fi tethering is now available from Settings > Wireless and network > Mobile AP and Settings > Wireless and network > Tethering 
  8. In the pull down menu from the top notification bar, there is a new icon to control Auto-Rotation
Here are the current version numbers:
  • Firmware version: 2.2
  • Baseband version: T959UVKA6
  • Kernel version: 2.6.32.9
  • Build number: FROYO.UVKA6

Yay!!! Finally on Froyo!!!

Friday, January 21, 2011

Android 2.2 Froyo now available on T-Mobile Samsung Galaxy S

Good news !!! Finally Android 2.2 Froyo is now made available to T-Mobile Samsung Vibrant Galaxy S users after months of waiting.
Sad part is that this update is not available over the air (OTA) so the user needs to download Samsung Kies Mini from Samsung website and install it. This upgrade includes Wi-Fi calling, USB / Wi-Fi tethering, and various software enhancements. The update is build number T959UVKA6 also known as KA6.
The full instructions for the update are available on the T-Mobile site.
Note that AT&T Samsung Captivate is still  not ready for Froyo as the update is only a maintenance release as per Samsung website.

Tuesday, December 21, 2010

11 Free Productivity Tools for the office

Here's a list of 11 Free Tools to increase productivity at Work:
  1. 7-Zip:
    Category: Compression/Decompression
    Details: Compression utility that can handle almost all possible formats
    URL: http://www.7-zip.org
  2. Eclipse:
    Category: IDE
    Details: Very popular IDE that supports a vast array of languages and configurations
    URL: http://www.eclipse.org
  3. FileZilla:
    Category: FTP Client (& Server)
    Details: FTP Client and server with lots of options
    URL: http://filezilla-project.org
  4. PuTTY:
    Category: Telnet/SSH
    Details: Very simple but powerful Telnet/SSH client
    URL: http://www.chiark.greenend.org.uk/~sgtatham/putty/
  5. PuTTy Connection Manager:
    Category: Telnet/SSH
    Details: Allows docking of multiple PuTTY session windows as Tabs and allows user to create a database of connections that includes user names, passwords, script to run after login, etc.
    URL: http://puttycm.free.fr
  6. Notepad++:
    Category: Editor
    Details: Very simple, but powerful and full featured editor that supports syntax highlighting, plug-ins, macros, regexes, etc.
    URL: http://notepad-plus-plus.org
  7. OpenOffice:
    Category: Office Software
    Details: Full featured replacement for the cos$tly M$ Office Suite of products. Includes software for word processing, spreadsheets, presentations, graphics, databases and more.
    URL: http://www.openoffice.org
  8. PDFCreator:
    Category: Office Software
    Details: Create PDF files from any application.
    URL: http://www.pdfforge.org/pdfcreator/
  9. VirtualDimension:
    Category: Desktop Manager
    Details: Fast and full-featured virtual desktop manager that allows you to create virtual desktops on Windows just like X-Win.
    URL: http://virt-dimension.sourceforge.net
  10. VistaSwitcher:
    Category: Task Manager
    Details: Replaces the default Windows Alt-Tab dialog with a nice box that shows a list of all running tasks, with their names and preview snapshots, and enables the user to take actions on them using the mouse and keyboard shortcuts.
    URL: http://www.ntwind.com/software/vistaswitcher/
  11. WinMerge:
    Category: Development
    Details: Visual diff and merge tool for Windows that can compare both folders and files
    URL: http://winmerge.org

Other good free softwares that I also considered were:
  1. PSPad:
    Category: Editor
    Details: Another powerful and full featured editor that supports syntax highlighting, plug-ins, macros, regexes, etc.
    URL: http://www.pspad.com
  2. PDFReDirect:
    Category: Office Software
    Details: Another simple software to create PDF files.
    URL: http://www.exp-systems.com
  3. DiffMerge:
    Category: Development
    Details: Visual diff and merge tool for Windows, Mac OS X and Linux that can compare both folders and files
    URL: http://www.sourcegear.com/diffmerge/
  4. Toad Free:
    Category: Database Access
    Details: Free version of the powerful Toad for Oracle with a few features disabled.
    URL: http://www.toadworld.com/Freeware/tabid/680/Default.aspx
  5. SQLDeveloper for Oracle:
    Category: Database Access
    Details: Oracle client provided by Oracle
    URL: http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html

Please let me know if you see other good free software worthy of including in the above list!

Friday, October 8, 2010

S/W Update for T-Mobile Samsung Vibrant Galaxy S

This morning, T-Mobile pushed a software update to my Samsung Vibrant Galaxy S - however, the phone would not install it as the battery level was lower than 75%!

After the install, here are the major changes that I noticed:
  1. HD Camcorder is now available in the list of applications
  2. Media Hub now works but the previews work only on Wi-Fi :(  This should have been allowed on 3G - I would sure like to watch the preview while traveling on the bus/train!
  3. Task Manager app is provided, however, I did not find it very useful as it did not show many of the running applications which the Advanced Task Killer free app shows.
Here are the current version numbers:
  • Firmware version: 2.1-update1
  • Baseband version: T959UVJI6
  • Kernel version: 2.6.29
  • Build number: ECLAIR.UVJI6
Now let's see when Froyo gets pushed - waiting for Android 2.2 for a lot of kool features to be enabled!

Tuesday, October 5, 2010

Created a simple TTS app with App Inventor

With my Samsung Vibrant phone, even though I am still struggling with connectivity to Ubuntu 9.04, I was able to connect very smoothly to Windows7!!!

So to test it out, I created a simple app that has a text box and a button. On pressing the button, the text that was entered in the text box is spoken out aloud by the app. If there is no text in the box, then a default message is read out.

To create this first app, it took only 2 minutes!!!
This shows that the App Inventor is pretty good and quite promising.

However, there are a few cons as well - the created software when installed on the phone, takes a huge amount of space; 3.55Mb to be precise for this simple app! Also, I cannot share this app with others or upload it to the Android Marketplace - it can only be shared with others who have an App Inventor account. Well, you can't have your cake and eat it too!

LinkWithin

Related Posts Plugin for WordPress, Blogger...