Tuesday, 4 December 2012

Update Table from other DB table

use TV_Guide
update Countries
set  country_FlagIcoLinkEncryptionInfo= d.couFlagIcoLinkEncryptionInfo

from DishesOnline.dbo.Countries d
where country_NameEn = d.couNameEn

Sunday, 25 November 2012

the setup routines for the sql server odbc driver could not be found

error "the setup routines for the sql server odbc driver could not be found. please reinstall the driver"

error: "data source name not found and no default driver specified"

The Magic solution is 
windows start>run>regsvr32 odbcconf.dll

everything will be OK In sha' Allah

Tuesday, 6 November 2012

Install android Market on android emulator


  1. Create Android Emulator on android 4.1 or greater, assume its name is "Android_JellyBean"
  2. Copy the android tools uri and past it at the end of the environment path key
  3. start the command prompt 
  4. type emulator -avd Android_JellyBeans -partition-size 400 -no-audio -no-boot-anim
  5. wait while the emulator start 
  6. type the following in command prompt 
        adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
        adb shell chmod 777 /system/app

     7. Download GoogleLoginService.apk 
                         GoogleServicesFramework.apk
                         Vending.apk 
      8.  Run eclipse and open DDMS and open file explorer, go to system folder open it, and open app 
           folder, and push the downloaded files respectively
      9.  Type adb shell rm /system/app/SdkSetup* in the command prompt 
     10. Create android fake account and enjoy 

Wednesday, 31 October 2012

Eclipse (Ctrl + Space) Is Not Working

  1. Start Eclipse.
  2. Go to "Window> Preferences > Java > Editor > Content Assist 
  3. Insert this line in "Auto Activation Trigger for Java" box : ._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  4. You are on Content Assist, open it, and press on advanced Check all check boxes. Look at the figures bellow.


Tuesday, 11 September 2012

Android, Create File

How to create Folder on External Memory in Android.

public boolean isExternalStorageWritable() {
  if (Environment.MEDIA_MOUNTED.equals(Environment
                        .getExternalStorageState()))
     return true;
   else
       return false;
   }

File folder;

if (isExternalStorageWritable()) {
      dbFolder = new File(
                    Environment.getExternalStorageDirectory()
                               + File.separator + "Mohammad");                
   }
  boolean success = false;
  if (!dbFolder.exists()) {
      success = dbFolder.mkdir();//one directory
// success = dbFolder.mkdir(); to create more than one directory 
//                        like "Mohammad/kaied/abuhmead"
  }
  if (!success) {
            DB_DIRE=null;
         }
  

Mohammad Abu Hmead

Tuesday, 4 September 2012

Android; Read file from Assets into Byte Array

Sometimes you want to place an encrypted file in the assets folder, and you want to read it in correct and unencrypted, so, you want to read it into byte array and edit the byte array to the correct format, here is the way


InputStream is=getAssets().open("fileName.extension");
byte[] fileBytes=new byte[is.available()];
is.read( fileBytes);
is.close();

Now you edit the byte array as you want, and you can create original file with the current bytes if it was encrypted



Mohammad Abu Hmead

Wednesday, 29 August 2012

Backup MSSQL Database from Command Prompt

Start the command prompt and type the following:

C:\Users\Administrator>sqlcmd -E -Q "backup database databaseName to disk='C:\backups\ databaseName.bak' with format" > "C:\backups\backUpLog.log"

The text which hi-lighted by green color it is the cmd default 

Hintwith format is used to delete the previous backup and create new one, if you want the current backup to be pushed to the previous one just don't type-write- it.



You can backup more than one database in the same command like the following
"backup database databaseName to disk='C:\backups\ databaseName.bak' with format backup database databaseName to disk='C:\backups\ databaseName.bak' with format" and so on

Backup using Batch file:
You can Create sql query file like"backupDBs.sql" and type in it
backup database databaseName to disk='C:\backups\ databaseName.bak' with format
and call it to be executed from batch file which contains the following command
sqlcmd -s . -i "C:\backupDBs .sql" > "C:\backupDBLog.log"
and you can  Schedule it as you want via Scheduled Tasks

or you can place sqlcmd -E -Q "backup database databaseName to disk='C:\backups\ databaseName.bak' with format" > "C:\backups\backUpLog.log" in the batch file

1- Navigate to Control Panel, Scheduled Tasks, Add New Task, and select Command Prompt
2- Change the task path to backupdb.bat, start path to C:\ and set how often you want to backup


Mohammad Abu Hmead