Wednesday, December 21, 2011

Windows 7 Backup with DriveImage XML

Recently go a new Dell Latitude E5420 and wanted to use the machine with dual boot option (XP and Win 7) . Have already been using DriveImage XML to take full system image backup (and restore) on Windows XP for a couple of years now, so wanted to see if you can do the same thing with Windows 7.

Turns out, in Windows 7 you can create a system image and restore the whole system with the windows 7 installation disk.

There are problems though:
  • In Home Premium edition ( the one that came pre-installed on my laptop) , you cannot exclude your windows xp partition from your system image, which makes my backup size more than double and takes twice as much time too.
  • "Restore" from the the installation disk will wipeout all the partition and recreate the partition map to what it used to be whne you created the system image. That means, any other OS partition will be completely gone/over-written.
These are major issues AFAIAC, hopefully, Microsoft will make their process better in subsequent Windows OS.

Anway, creating a System image using DriveImage was easy enough.
Run something like this will create an image on an external USB drive:
"C:\Program Files\Runtime Software\DriveImage XML\dixml.exe" /bc /tG:\Images\KAUSHAL /r- /s- /c /v

And then used the Ultimate Boot CD for Windows to restore the Windows 7 partition.
Did run into "boot error" after the restore, then, runnng the following fixed the issue:

Boot with Windows 7 disc, Choose "Repair Option", Click on Command Prompt.
  • Type C: ( or drive where Windows 7 is installed ) and press <Enter>.
  • At the C:\ prompt, type cd boot and press <Enter>.
  • At the C:\Boot prompt, type the following commands and press Enter after each command.
bootrec /RebuildBcd
bootrec /FixMbr
bootrec /FixBoot
 
That should fix boot problems.
 

Tuesday, September 27, 2011

Deleting The Dreaded _vti_cnf folders recursively Created by FrontPage

Recently installed the FrontPage extension on my old Windows XP box. Turns out, each of the folder under C:\Inetpub\wwwroot directory now has a folder called _vti_cnf .
It doesn't hurt anything, just annoying.

If you have Windows Powershell installed, you're lucky. Just open a Powershell window and issue the following commands:

cd C:\Inetpub\wwwroot

Get-ChildItem $RootDir "_vti_cnf" -recurse | Remove-Item -recurse


That's it, it's all gone.

Tuesday, August 30, 2011

Setting 32-bit mode for PHP on Wondows Server 2003 R2 64-bit



Open a command Window

cd C:\Inetpub\AdminScripts

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true

Tuesday, August 9, 2011

United BMW has Express Price Now!

.. which still sucks just as bad as their Sale Pricing!

Just look at the picture below:

What kind of scam they are running? Could this be bad website provider for them? I could probably do a much better job as far as the website goes.

Expected better from a "premier" BMW dealership in Atlanta area.Sadly, they are closest from where I live, guess I will need to drive a little further if I have to buy a car.

Here is the URL btw:

.. and another one:

.. and the Google Cache, in case these idiots try to change the page:

http://webcache.googleusercontent.com/search?q=cache:F2xblpe7MpAJ:www.gwinnettbmw.com/detail-2007-bmw-3_series-4dr_sdn_335i_rwd-used-7268405.html+http://www.gwinnettbmw.com/detail-2007-bmw-3_series-4dr_sdn_335i_rwd-used-7268405.html&cd=1&hl=en&ct=clnk&gl=us&source=www.google.com



Saturday, April 30, 2011

So much for the "Sale" @ United BMW, Roswell

Thinking about trading in my 2003 for another late model 3-series . Browsing through local bmw dealerships' Used Car inventories and I come across this gem at United BMW of Roswell's site. So much for aggressive internet-only pricing!

This is the first "Sale Price" I have ever seen that's more than the List price of the car. What about other listings, can they be trusted?

What a scam!

Checkout the following URL:

http://www.bmwroswell.com/inventory.aspx?_vstatus=3,4,5&_cpo=true&_makef=BMW&_model=3+series&_yearfrom=2008&_yearto=2008









... and the direct URL:
http://www.bmwroswell.com/detail-2008-bmw-3_series-4dr_sdn_328i_rwd-used-6909726.html



Sunday, March 6, 2011

Calling a Java SOAP Web-service from Android and iOS apps - Part 1

Objective of this series of tutorials is to:
  • Create a SOAP web-service to convert a temperature in Fahrenheit to Celsius in Java using Eclipse, Tomcat and Axis
  • Create and Android app that uses ksoap2 library to call the web-service and shows the result on screen.
  • Create and iPhone (iOS) app that calls the same web-service and shows the result on screen.
In this part I will show hot to build the web-service from ground up.

Pre-requisites:
3. Axis2 1.4.1 (I had trouble with the latest version)

Once both Tomcat and Axis2 have been configured in Eclipse Workspace, go ahead and create a Dynamic Web Project as follows:
























Add a new Class called Temperature to Java Resources of your project:

package org.ushasoft;
import java.text.DecimalFormat;
public class Temperature {
private static final DecimalFormat TWO_D_FORM = new DecimalFormat("#.#");
public String Convert(String fahrenheit) {
try {
double f = Double.parseDouble(fahrenheit);
//return Double.toString( TWO_D_FORM.format(((f - 32) * 5)/9));
return TWO_D_FORM.format(((f - 32) * 5)/9);
} catch (Exception e) {
return "Invalid";
}
}
}

Save the file, then select this newly created class and right click on it, Select "Web Services" from the context menu and then "Create Web Service" 



































Make sure all of the parameters are set accordingly and just go through the subsequent screens, selecting default values everywhere.






































Once the Web-service has been generated and deployed to Tomcat, Launch the Web Services Explorer (it's under "Run" menu when you're in Java EE perspective)

Select the Web Page option and paste the WSDL URL 
 http://localhost:8080/Temperature/services/Temperature?wsdl and hit Go

You should be able to test your Web-service with an input:
































So, we have our Service working. Let's get the Android app going.

First of, you will need the ksoap2 library for Android, download the latest jar from here.
I'm assuming you have Android SDK already installed for Eclipse.

Now switch over to Java perspective and create a new Android Project :










































Add INTERNET permission to your Android App Manifest, you will need that to make the Web-service call.

Update the main.xml in "res/layout" folder of your project as follows:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:padding="30dip">
    <TableLayout android:stretchColumns="*" android:layout_width="fill_parent" android:layout_height="wrap_content">
     <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
     <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:textStyle="bold" android:text="@string/label_fahrenheit" android:padding="5dip"/>
     <EditText android:id="@+id/inputFahrenheit" android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:imeOptions="actionDone" android:inputType="number"/>
     </TableRow>
     <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
     <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:textStyle="bold" android:text="@string/label_celsius" android:padding="5dip"/>
     <EditText android:id="@+id/txtCelsius" android:layout_width="wrap_content" android:layout_height="wrap_content" 
     android:inputType="none" android:editable="false" />
     </TableRow>
     <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
     <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=""/>
     <Button android:id="@+id/btnConvert" android:text="Convert" 
     android:layout_width="wrap_content" android:layout_height="wrap_content"/>
     </TableRow>
    </TableLayout>
</LinearLayout>

And your Activity class should like the following:

package org.ushasoft.temperature;
import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ConverterActivity extends Activity {
    /** Called when the activity is first created. */
TextView inputFahrenheit;
TextView txtCelsius;
Button btnConvert;
public final static String URL = "http://10.0.2.2:8080/Temperature/services/Temperature?wsdl";
public static final String NAMESPACE = "http://ushasoft.org";
public static final String SOAP_ACTION_PREFIX = "/";
private static final String METHOD = "Convert";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        inputFahrenheit = (TextView) findViewById(R.id.inputFahrenheit);
        txtCelsius = (TextView) findViewById(R.id.txtCelsius);
        btnConvert = (Button) findViewById(R.id.btnConvert);
        
        btnConvert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
doConvert();
}
});
    }
    private void doConvert() {
     if (inputFahrenheit.getText() == null || inputFahrenheit.getText().toString().length() == 0) {
     return;
     }
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapObject request = new SoapObject(NAMESPACE, METHOD);
request.addProperty("fahrenheit", inputFahrenheit.getText().toString());
envelope.bodyOut = request;
HttpTransportSE transport = new HttpTransportSE(URL);
try {
transport.call(NAMESPACE + SOAP_ACTION_PREFIX + METHOD, envelope);
} catch (IOException e) {
e.printStackTrace();
System.out.println("SOAP Error : " + e.getMessage());
System.out.println("SOAP Response : " + transport.responseDump);
} catch (XmlPullParserException e) {
e.printStackTrace();
System.out.println("SOAP Error : " + e.getMessage());
System.out.println("SOAP Response : " + transport.responseDump);
}
if (envelope.bodyIn != null) {
SoapPrimitive resultSOAP = (SoapPrimitive)((SoapObject)envelope.bodyIn).getProperty(0);
txtCelsius.setText(resultSOAP.toString());
}
    }
}

That's pretty much it. Run the application and it should work as shown:































You can download the source code below: