Saturday, April 15, 2017

SQL Server OPENROWSET Excel using Microsoft.ACE.OLEDB

This on SQL Server 2016:

Download file AccessDatabaseEngine_X64.exe from Microsoft Access Database Engine 2010 Redistributable

Open an Administrator Command Window and install with the following command:

C:\Users\kaushalsinha\Downloads\AccessDatabaseEngine_X64.exe /passive


/passive switch is the key.

Once installed, the query in SQL Server Management Studio:

sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1;
GO
EXEC sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParam', 1;
GO

SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0 Xml;HDR=YES;Database=F:/2011-12 CRDC/SCH/data for Schools/Pt 1-Enrollment/Overall Enrollment.xlsx','SELECT * FROM [Suppressed Data$]');

... and the result:



 

Sunday, June 1, 2014

Why my next phone won't be a Motorola

Contrary to what Motorola/Google will have you believe, you can apparently get bootloader of your Motomaker MotoX unlocked by some person in china by paying him/her $45.

What that means is that this person has access to some/all of your personal information. He certainly has access to your MEID number which is supposed to a global unique number for each Mobile device.

I have yet to receive any formal notification from Motorola regarding my information being compromised partially/completely. I am going lodge a complaint with FTC and see if they can find if another corporation is trying to mislead it's customers. I am still suffering as a result of that Target data breach. Hopefully, I don't have to go through changing my credit card info at 15 different sites again!

Ever since I started using a "smartphone", I have only used Motorola phones(DroidX, X2, RAZR Maxx, MotoX), guess, it's time to switch device once iPhone 6 is out :)


Sunday, February 3, 2013

Windows 8: File Access Denied

Wanted to try some Windows Phone 8 App development, so Microsoft forced me to install Windows 8 on one of my partitions since you can install WP8 SDK only on Windows 8 OS.

That's stupid on Microsoft part, when you come up with a new Mobile platform and want developers to build apps for your platform, you want to make it easier for them and NOT create stupid roadblocks in the way. But, I guess, that's why the response to Windows Phone 8 is less than expected at best.

Anyways, now on to more Windows 8 stupidity:

I am logged in to my machine as an administrator (heck, I am the only user) and I am trying to copy a file from one of my other machines on the network to a local drive and I get this message.

File Access Denied
You require permission from computer's administrator to make changes to this file.




Again, I am logged in as an administrator, so what gives.

Anyway, after a little googling, I did find a solution to the problem.

Open the command prompt with elevated privileges by clicking the Start orb, All Programs, Accessories, right-click Command Prompt and then select Run as administrator.

Type the following command:
net user administrator /active:yes

Type the following command to Map the network drive:
net use K: \\[Machine Name]\[Share Name] /u:[UserName]

Once, that's done you should be able to copy files.

Monday, November 19, 2012

Enabling generic SATA AHCI in Windows 7

After you use the BIOS setup of a Windows 7-based computer or a Windows Vista-based computer to change the Serial Advanced Technology Attachment (SATA) mode of the boot drive to use either the Advanced Host Controller Interface (AHCI) specification or redundant array of independent disks (RAID) features, you receive the following error message when the computer is restarted: 

STOP 0x0000007B INACCESSABLE_BOOT_DEVICE

http://support.microsoft.com/kb/922976

Thursday, August 16, 2012

Installing sqlite3 binary on Android RAZR MAXX (Running ICS)

Download SuperOneClick from cnet

You will need adnroid sdk tools, I am using version 10

A rooted RAZR Maxx with ICS

Turn on "USB Debugging" on your phone.

Copy sqlite3 binary from the SuperOneClick package above to the SD Card of your phone.

The open a command window and change directory to wherever you have extracted the sdk tools zipped file.
Then run the following commands

adb shell
su
mount -o remount,rw -t yaffs2 /dev/mtdblock3 /system
cp /mnt/sdcard-ext/sqlite3 /system/bin
chmod 4755 /system/bin/sqlite3
mount -o remount,ro -t yaffs2 /dev/mtdblock3 /system

.. and you are done.
I needed to do this to use sqlite to turn on the Mobile Hotspot on my phone.

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:



Saturday, December 25, 2010

Trip Recorder for Android

Record, Map, Export & Email a Car Trips.

Requirements:
  • GPS must be enabled for Trip Routing, Recording Speed, distance etc.
  • An Existing Email account is required for Emailing Trip Route information.

Features:
  • Shows GPS preferences menu to enable GPS.
  • Show live Location updates with Time, Speed, accuracy etc.
  • Summary information for Saved Trips.
  • Map any of the existing Trips with start and end points with route overlays.
  • Option to delete old Trips.
  • Backup database to SD Card.
  • Shows GPS Preferences on Applicatin exit so that you can turn GPS off to save battery.
  • Export trip to CSV format and email for future reference.
Future Plans:
  • Have a cloud-based website where users can upload their trips right from their mobile devices and use web-based maps with enhanced overlays to analyze and print trip details in PDFs, Excel etc.
Version 1.04 Changes:
  • Added Options to maintain multiple Cars
  • Manage Trip Categories
  • Edit previously saved trips to add description, Category and Car
Version 1.05 Changes:
  • Added options to display in Metric units (Kilometers)
  • Option to Export trips in either CSV or KML formats
  • Preference screen
  • Option to use 24-hour time format
  • Option to print Tip description, Car details, category etc. in header rows for CSV email option.
Version 1.08 Changes:
* Added Odometer reading.
* Also, once you save Odometer reading, next time the application Defaults that to your last Saved Odometer reading + Length of the Trip.


Also, if you want to analyze the Trip Recorder database further, you should use the "Backup" option of the app. Download the file called "triprecorder.db" from you SDCARD and open the Database using the Trip Recorder Desktop application (Adobe AIR runtime) required.

The AIR Installer can be found below:
Screenshots:

Friday, October 22, 2010

Android App

Really liking my new Droid X.
Also, it really helps that I can connect my phone to my laptop via USB and start testing any apps I am writing using the Eclipse and Android SDK.
Like the fact that, I have real ownership of the device that I paid hundreds of dollars for, I don't have to register it with anybody to start using the device for developing apps.

Just released a Desi News reader app . Click on http://market.android.com/search?q=pname:org.ushasoft.news from your Android browser to access the Free app.

Feel free to send me links to the News sites you want added to the list of sites available thru the App.