Tuesday, August 2, 2016

How to view table schema in SQLite

Normally you can

sp_help '<TableName>' will give you the structure of a table in SQL Server but how to do this in SQLite ?

Use

PRAGMA table_info(<table_name>)

eg:
PRAGMA table_info(ImgInfo2)

Tuesday, July 12, 2016

How to add current path to .bashrc


Go to the path and then:

echo "export PATH=$(pwd):\${PATH}" >> ~/.bashrc

Wednesday, March 23, 2016

How to make a rounded bitmap in Android

    public static Bitmap getRoundedBitmap(Bitmap bitmap, int i, int i2) {
        if (bitmap == null) {
            return null;
        }
        Bitmap createBitmap = Bitmap.createBitmap(i, i2, bitmap.getConfig());
        Canvas canvas = new Canvas(createBitmap);
        Paint paint = new Paint();
        canvas.drawARGB(0, 0, 0, 0);
        paint.setAntiAlias(true);
        canvas.drawOval(0.0f, 0.0f, (float) i, (float) i2, paint);
        paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        float min = Math.min(((float) width) / ((float) i), ((float) height) / ((float) i2));
        int i3 = (int) ((((float) i) * min) / 2.0f);
        int i4 = (int) ((min * ((float) i2)) / 2.0f);
        canvas.drawBitmap(bitmap, new Rect((width / 2) - i3, (height / 2) - i4, (width / 2) + i3, (height / 2) + i4), new RectF(0.0f, 0.0f, (float) i, (float) i2), paint);
        return createBitmap;
    }

Sunday, February 28, 2016

How to change the auto rotation feature to potrait using adb shell ?

content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0

Thursday, February 4, 2016

how to turn mobile data on or off using adb shell root

root@j2lte:/ # svc data
Control mobile data connectivity

usage: svc data [enable|disable]
         Turn mobile data on or off.


root@j2lte:/ # svc data enable

how to switch off or reboot phone using root ?

root@j2lte:/ # svc power
Control the power manager

usage: svc power stayon [true|false|usb|ac|wireless]
         Set the 'keep awake while plugged in' setting.
       svc power reboot [reason]
         Perform a runtime shutdown and reboot device with specified reason.
       svc power shutdown
         Perform a runtime shutdown and power off the device.

root@j2lte:/ # svc power reboot becauseican

Monday, February 1, 2016

Unable to load DLL (Module could not be found HRESULT: 0x8007007E)

I am using a .dll file that is written using C++ in my C# application. When I deployed it test PC I started seeing this error in Event Log.


So, I used Dependency Walker to check the missing dependencies and I was missing `msvcp110d.dll` and `msvcr110d.dll` in the test PC

I copied these two files from my dev PC to test PC's `C:\Windows\SysWOW64`  PC and worked!