Friday, July 29, 2011

Java 7 GA release finally available

Java 7 was finally release into the wild today and made "GA" - Generally Available!
Download the latest from here.
Here's a very high level list of the new features/changes that made into Java7:

VM
  • Support for dynamically-typed languages using the new InvokeDynamic instructions
  • Strict class-file checking

Language
  • Small language enhancements from Project Coin like Strings in switch statements, try-with-resources statements, diamond operator, etc.

Core
  • Upgrade class-loader architecture to avoid deadlocks in non-hierarchical class-loader topologies
  • Concurrency and collections updates in form of a lightweight fork/join framework, flexible and reusable synchronization barriers, transfer queues, concurrent linked double-ended queues, and thread-local pseudo-random number generators

Internationalization
  • Support for Unicode 6.0
  • Separate handling of locales to separate formatting locales from user-interface language locales

I/O & Networking
  • New APIs for filesystem access, scalable asynchronous I/O operations, etc
  • New NIO.2 filesystem provider for zip and jar files
  • API for the Stream Control Transmission Protocol (SCTP) on Solaris
  • SDP (Sockets Direct Protocol) support for reliable, high-performance network streams over Infiniband connections on Solaris and Linux
  • Networking code modified to use the Windows Vista IPv6 stack, when available, in preference to the legacy Windows stack
  • Support for Transport Layer Security version 1.2

Security & Cryptograpphy
  • Implementation of the standard Elliptic Curve Cryptographic (ECC) algorithms to allow Java programs to support it out of the box

Database Connectivity
  • JDBC 4.1 and Rowset 1.1

Client
  • New Java2D graphics pipeline based upon the X11 XRender extension, which provides access to much of the functionality of modern GPUs
  • New platform APIs for features originally implemented in the 6u10 release namely Translucent and shaped windows, and heavyweight/lightweight component mixing
  • Cross-platform Nimbus look-and-feel for Swing
  • SwingLabs JXLayer component decorator added to the platform
  • New Gervill sound synthesizer created and made available

Web
  • Upgrade of the components of the XML stack to the most recent stable versions: JAXP 1.4, JAXB 2.2a, and JAX-WS 2.2

Management
  • Enhanced MBeans to report the recent CPU load of the whole system, the CPU load of the JVM process, and to send JMX notifications when GC events occur 

Pheww - that was a long list to say the least ;) No wonder the release date for Java7 was a very difficult moving target.
I will be putting out a detailed post on each of the features soon - so keep watching this space!

Thursday, July 21, 2011

Conditional Breakpoints in Eclipse

If you have a big data set that you are using to test changes that apply to specific scenarios or rows, Eclipse conditional breakpoints can help to make life easier and simpler.

In Debug View (obviously!), right-click on the breakpoint that you want to make conditional and in the window that opens up, check "Enabled" box and then the "Conditional" box. This enables the textarea below it where you can enter any valid java expression which should trigger this breakpoint when true.

Optionally, you can also check the "Hit count" box and enter a positive number to make this breakpoint trigger after that many number of iterations.

Wednesday, May 25, 2011

Change format of Date displayed in SQL Developer

To change the format of Date column displayed in SQL Developer worksheets (output of SQL queries) do the following:
  1. Select Tools > Preferences
  2. Expand the Database section
  3. In the NLS Date format field, enter the desired date format as supported by Oracle
My preferred format is DD-MON-RR HH24:MI:SS

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.

LinkWithin

Related Posts Plugin for WordPress, Blogger...