Why database should be taught before programming in universities?

Database Programming
Learn Database before Coding

Often students from the initial semester ask me how do we store our data in our programming projects? When students join university to learn about computer science and technology they are usually taught programming first in courses like introduction to programming. As part of the coursework, students are required to work on a project. The majority of the projects, in fact almost all projects involve data handling and that data needs to be stored somewhere, usually in databases.

Problems Students Face

As a novice students don’t know how to store data. One option is to store data in plain text files if filing is taught to them but in that case, their project becomes too complex for them. In my opinion, file format is an advanced topic for students that have just started learning how to program. So, students get stuck on where and how to store data. They create variables and arrays to store data in memory but that is not very useful until they have the option to store their data somewhere permanently that they can retrieve later. Otherwise, every time they run their project they have to feed data from the beginning.

Teach Database Before Programming

If universities modify their courses and add database in the first semester and replace programming courses with it then it would be easier for students to get started in computer science degree. Introduction to databases is a relatively easier course than programming and students will know what a database is, how to store data in the database, and how to retrieve it later using SQL. Then in the next semester if they do a programming course then it will require only one lecture to teach them how to access a database from your code and how to store and retrieve data. That will make their projects more valuable and make more sense to them and they can take it to an advanced level in forthcoming courses.

Your Take?

What is your opinion? Please, let me know in the comments.

Click here to read more about Databases.

Unlocking HTC Sensation Z710e Bootloader for Android

Take the following steps to Unlock your Device’s Bootloader.

  1. Step 1

     After powering down, press Volume Down and while pressing Volume Down, press Power holding both buttons to start the device into Bootloader mode. If you have difficulty, power up normally, go to Settings->Battery and deselect Fast boot. Power down and try again.


  2. Step 2

    Use the Volume buttons to select up or down. Highlight Fastboot and press the Power button.


  3. Step 3

    Connect the device to the computer via a usb cable

  4. Step 4

    Download the following fastboot binary for your OS using the following links:

    Platform Download Size (bytes) Checksum
    Fastboot binary, Linux
    (Unzip the file before executing)
    fastboot 61887 ffd3b02cdf9aa7609462e3957663d238
    Fastboot binary, OS X
    (Unzip the file before executing)
    fastboot-mac 59071 0b3e2a8c5cfeb7c23b362483b93f7dd6
    Fastboot binary, Windows
    (Unzip the file before executing)
    fastboot-win 83753 a90c25141e306b3062dc8e47e14a1005
    1. Step 5

      Open a command Prompt: Windows: Start->”cmd” Mac: Applications->Utilities->Terminal.app Linux: Terminal

      Type in Command Prompt: fastboot oem get_identifier_token.

    2. Step 6

      You will see a long block of text. Copy and paste this text into the the token field below (in the Windows command prompt: Right Click > Mark > highlight the block of text > Right click to copy. Mac users can use cmd-option to mark and select text.).

      You will see one of the following two screens:

      Ref. 6a

      Ref. 6b

      When copying the token, start with this line:

      <<<< Identifier Token Start >>>> 

      And end with this line:

      <<<<< Identifier Token End >>>>> 

      (Note: Only copy the highlighted sections above. Do not copy the INFO or (bootloader) prefix)

    3. Step 7

      Paste this string of text into the token field and hit Submit in order to receive your unlock code binary file. You will receive this information in your email.

      Example:

Next you need to go to http://www.htcdev.com/bootloader/unlock-instructions/page-2 and enter you identification token there and click sumbit. HTC Dev will take you further from there.

Were you able to unlock your bootloader? Share with me your experience in the comments below. Don’t forget to read more articles on Android.

Android? Too many pattern attempts? Can’t hard reset?

htconexI had a pattern screen lock on my HTC One X Android phone. Yesterday my nephew tried to unlock it too many times and it got permanently locked.

Too many pattern attempts

After too many attempts, my phone got locked and asked for my Google username and password. But unfortunately, I wasn’t connected to Wifi due to which whenever I entered my login details it says invalid username and/or password. Since it tries to connect to the Google server to authenticate and it couldn’t.

Master Reset

OK, since my phone wasn’t asking me for a pattern and it wasn’t connected to the internet so it was also not able to authenticate my logins. So doing a master/hard reset was the only option left. To hard reset phone, you have to power off your phone and then turn it on in recovery/bootloader mode. To do this you have to follow these steps.

  1. Press and hold the VOLUME DOWN button, and then press and hold the POWER button.
  2. Wait for the screen with the three Android images to appear, and then release the POWER and VOLUME DOWN buttons.
  3. Press VOLUME DOWN to select FACTORY RESET, and then press the POWER button.

But for this to work the Fast boot option in Settings > Battery Manager must not be selected. Oops! I remember I selected that option so I was out of luck and this didn’t work and my phone keep starting in normal mode leaving me on the same login screen.

Big Problem!

So, now I was stuck and there were several problems.

  1. I couldn’t enter my pattern since it wasn’t asking due to too many attempts
  2. It wasn’t connected to Wifi or my phone data plan so there was no internet due to which it wasn’t authenticating from Google.
  3. The fast boot was selected so I was unable to restart my phone in recovery mode.

Now what? I tried to Google solution but all I was getting is to go in recovery mode to hard reset my phone to make it reusable and I was unable to do that as well. Then suddenly I found the solution!

The Solution!

The solution to this was when your phone is switched on and you are on the login screen do the following:

  • Press and hold both Volume down button as well as the power button until the screen goes completely black.
  • Once it is black release the power button only. Do not release the volume down button.
  • You will be booted into the bootloader mode.

Woala! That’s it! Now you can select Factory reset from the menu and wow, finally I made my phone reusable again. 🙂

CyanogenMod Unveils New User Accounts for Remote Find and Wipe

The team behind CyanogenMod, one of the most popular Android ROMs available, took the wraps off of their new CyanogenMod Accounts feature last night, where users can update, sign up, and access new features like the ability to remotely track, find, and wipe their device if it’s lost or stolen.

The big new feature now is the ability to find and wipe your device, but the dev team says that they have plans to offer more remote management features in the future, and all of them will be associated with your CM account. They also point out that they’ve built the new account system in a way that prohibits them from touching your device. The whole system is open source, optional, and completely free.

The new accounts feature is available now, but to use it you’ll have to download and build it yourself from the source code, up at Github. The team wants the community to try it out, test it, and poke through it before they start rolling it into the nightly builds. Hit the link below to read more about it.

[Ref: http://lifehacker.com/cyanogenmod-unveils-new-user-accounts-for-remote-find-a-1170981365?utm_campaign=socialflow_lifehacker_twitter]

Set up Microsoft Office365 email on an Android

  1. From the Applications menu, select Email. This application may be named Mail on some versions of Android.
  2. Type your full email address, for example [email protected], and your password, and then select Next.
  3. Select Exchange account. This option may be named Exchange ActiveSync on some versions of Android.
  4. Enter the following account information and select Next.
  • Domain\Username Type your full email address in this box. If Domain and Username are separate text boxes in your version of Android, leave the Domain box empty and type your full email address in the Username box.

NOTE    On some versions of Android, you must use the domain\username format. For example, if your email address is [email protected], type contoso.com\[email protected] Your username is your full email address.

  • Password Use the password that you use to access your account.
  • Exchange Server Use the address of your Exchange server. If you’re connecting to your Office 365 email, use outlook.office365.com for your server name.
  1. As soon as your phone verifies the server settings, the Account Options screen displays. The options available depend on the version of Android on your device. The options may include the following:
  • Email checking frequency The default value is Automatic (push). When you select this option, email messages will be sent to your phone as they arrive. We recommend only selecting this option if you have an unlimited data plan.
  • Amount to synchronize This is the amount of mail you want to keep on your mobile phone. You can choose from several length options, including One day, Three days, and One week.
  • Notify me when email arrives If you select this option, your mobile phone will notify you when you receive a new email message.
  • Sync contacts from this account If you select this option, your contacts will be synchronized between your phone and your account.
  1. Select Next and then type a name for this account and the name you want displayed when you send e-mail to others. Select Done to complete the email setup and start using your account.

NOTE    You may need to wait ten-to-fifteen minutes after you set up your account before you can send or receive e-mail.

How to partition SD Card

If you’ve rooted your phone using Revolutionary you can partition your SD Card from the Recovery menu. After booting into recovery (Revolutionary CWM), you have an option Partition SD Card. It will ask you how big the EXT partition should be, and how big the Swap partition should be. After selecting the right values, it will automatically partition your SD Card.

If you didn’t use Revolutionary to root your phone, you can still follow the tutorial from here, and after inserting the key, it says that your phone is S-OFF, but it still asks you if you want to install Clockwork Mod. Press y and Enter and wait until the CMD disappears. Reboot into recovery once again and you should see the Partition SD Card option that I was talking about in the first paragraph.

Note that creating partitions this way will result having an EXT3 partition. If you want an EXT4 partition, connect to the phone with adb shell and follow only the 6th step of the following tutorial.

How manually partition SD Card

Don’t be afraid to do something manually. It may be a little bit harder than using a specialized software, but you can learn new things and you know you did it and it worked. For example, partitioning from ROM Manager proved to be a mistake, because I couldn’t select an EXT Partition bigger than 512Mb and it practically messed up my partitions… and using gParted to partition your SD Card is a little bit difficult since you have to install the image on a CD or stick, reboot your PC in gParted and try to get things working from there. From my experience, every time I’ve tried this using a stick to load the image, I couldn’t see the SD Card.

So.. doing something manually is better Smile

Step 1 – Connect to Phone

Restart your phone to recovery mode. Connect your phone to the PC via USB Cable. Use adb shell to connect to the phone

Step 2 – Display the partitions

Open parted (an application from the Android OS) to partition your SD Card
After you connect with adb shell write parted /dev/block/mmcblk0 and then <Enter>. Wait until you see (parted) in the left if your cursor and write print and <Enter>. You should get something like this:

parted_1

As you can see, I’ve got a 3942MB SD Card. It has 3 partitions

  • Number 1 – 2886MB FAT32
  • Number 2 – 1024MB EXT3
  • Number 3 – 31.6MB linux-swap

I’m going to remove all these partitions in order to repartition the card. Note that you’ll lose all your data from the card.

Step 3 – Remove the existing partitions

You’ll have to remove the existing partitions first. So.. look at how many partitions you have, and then write remove <space> partition number <Enter>. 
For example:
rm 1
rm 2
rm 3

parted_2

You can run the print command again to make sure everything was deleted. Now I have an empty unpartitioned SD Card

Step 4 – Create the partitions

Ok, let’s start computing the partitions size. For most of the custom ROM, you need an 1GB EXT partition, and a FAT32 partition.. You’ll also need a swap of 32 or 64MB. So, let’s say that you want to create a 1024MB EXT and a 32MB swap partition. Subtract these values from the entire partition size, and you’ll get the needed size of your FAT32 partition. In my case, I have a3942MB card, so 3942-1024-32 = 2886MB for FAT32

In conclusion, we’ll have to create:

  • 2886MB FAT32
  • 1024MB EXT2 (because parted only allows us to create EXT2 partitions, but we’ll convert it to EXT3 or EXT4 at the end of the tutorial)
  • 32MB swap

Now run the following commands in the (parted) shell:

  • mkpartfs primary fat32 0 2886 (first value is 0, second value is the size of FAT32 partition)
  • mkpartfs primary ext2 2886 3910 (first value is the size of FAT32 partition, second value is EXT4 partition> in our case 2886+1024=3910)
  • mkpartfs primary linux-swap 3910 3942 (first value is EXT4 partition>, in our case 2886+1024=3910, second value is the size of the entire SD Card, in our case 3942)

Note that for every command, the first value is the second value from the previous command. The first value from the first command should be 0 and the second value from the last command should be the size of the entire SD Card.

After you finish with creating the partitions, run print again and you’ll see the newly created partitions:

parted_3

If everything is ok, run quit to exit the parted, and return to the adb shell

parted_4

Step 5 – convert your EXT2 partition to EXT3 (skip it if you don’t want to do this)

In the adb shell, run the following command to convert your EXT2 partition to EXT3

Note that the last number from the command, 2, refers to the second partition. If your EXT2 partition has another number assigned (you can view the number using the print command), replace the “2” with your number, but if you’ve followed the tutorial and you didn’t create more or less partitions, it should be 2 )

tune2fs -j /dev/block/mmcblk0p2

toext3

Step 6 – convert your EXT3 partition to EXT4 (skip it if you don’t want to do this, but you must follow Step 5 if you have an EX2 partition to convert it to EXT3)

In the adb shell, run the following command to convert your EXT2/3 partition to EXT4

Note that the last number from the command, 2, refers to the second partition. If your EXT partition has another number assigned (you can view the number using the print command), replace the “2” with your number, but if you’ve followed the tutorial and you didn’t create more or less partitions, it should be 2 )

tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2

toext4

If you want to check your filesystem too, you should run e2fsck -fpDC0 /dev/block/mmcblk0p2too

Step 7 – Finish

Finished. Check your work with print.

  • command:  parted /dev/block/mmcblk0 (open parted again)
  • command:  print (check all your system partitions and their sizes)
  • command:  quit (exit parted)
  • command:  reboot (reboot your system to the operating system)

Step 8 – Align your SD Card (optional)

In order to increase the access time, write speed and read speed of your SD Card, you may want to follow this tutorial

[Ref: http://android.bytearrays.com/android/how-to-partition-sd-card/]

How to install new ROM on Android phone

Following are the instructions to install new ROM on your Android phone using ClockworkMod recovery touch method.

-Download Appropriate Rom
-Place on root of your sdcard
-Reboot Recovery
-Select “wipe data/factory reset”
-Select “mounts and storage” category
-Select “format /boot”
-Select “format /system”
-Return to main page
-Select “advanced” Category
-Select “wipe dalvik cache”
-Select “wipe battery stats”
-Return to main page
-Select “install zip from sdcard”
-Select “choose zip from sdcard”
-Select “CronMod-3.x.x-x-rc_signed.zip”
-Answer when promted
-Reboot
-Enjoy 

[Ref: http://forum.xda-developers.com/showthread.php?t=1946517]

Root Android HTC Desire using REVOLUTIONARY method

Easiest Root Method

– The easiest root method for the HTC Desire Android phone

[STEP1]- Check Hboot version. Poweroff, and hold Volume Down & Power (it’s the number after “HBOOT”. Examples are 0.75xxxxx, 0.83xxxxx, 0.93xxxxx, 1.02xxxxx)

REVOLUTIONARY

[REVOLUTIONARY]- If your HBOOT version is 0.93 or above (NOTE: Version 1.03 is NOT supported) then continue, if it is below then use the Alpharev method.

[REVOLUTIONARY][STEP1]- Go to revolutionary.io and go to the “Downloads” section, Pick your operating system, choose device as HTC Desire, and choose your HBOOT version (you should already know this from STEP1). Then enter your serial number, it can be found in “about phone” or behind the battery.

[REVOLUTIONARY][STEP2]- Read the documentation page and download these fastboot drivers.

[REVOLUTIONARY][STEP3]- Make sure HTC Sync is disabled, if you have it installed on your PC. Plug your phone in via USB and make sure USB debugging is turned ON (settings> applications)

[REVOLUTIONARY][STEP4]- Extract all of the tools from the revolutionary.zip file and run revolutionary.exe. A CMD window should pop up and show you the progress (See [3] for how it should look like).

[REVOLUTIONARY][STEP5]- When the process is almost finished, it will prompt you to flash a custom recovery, type YES or Y. Follow tutorial number [10] if you would like to flash a different recovery – This is optional and not required if you decide to flash recovery during the revolutionary process.

[REVOLUTIONARY][STEP6]- Download superuser.zip, put it anywhere on your sd-card (preferably in a path you can remember). Boot into recovery by holding Volume Down & Power (You will see lines of green text flash, this is normal), then using the volume keys to navigate to RECOVERY, and use POWER to select. The phone will now boot into recovery.

[REVOLUTIONARY][STEP7]- Once you are in recovery, use the trackball (if it’s broken then use volume keys) to navigate to “install zip from sd-card > choose zip from sd-card > #directory where you put superuser.zip# > superuser.zip > yes”

[REVOLUTIONARY][STEP8]- After the process is finished, reboot, and your phone will now be rooted.

[Ref: http://forum.xda-developers.com/showthread.php?t=1275632]

Downgrade HTC Desire Hboot 1.03

If you want to downgrade Android Desire Hboot 1.03, then using revolutionary to s-off, please follow the instructions below.

Steps:

1. Download tools package. THIS LINK
2. Download this HTC Desire ROM (RUU)
3. For branded phones create GoldCard (How to)
4. Extract the tools any where at your computer.
5. Run RUU and wait to appear Android rom update utility screen. Don’t hit Next.
6. Go to Temp directory on C drive (Press Window+R and type %TEMP%, then hit enter) on your computer and find folder that RUU extracted in it.
7. Copy the rom.zip and paste it to sdcard and rename it to PB99IMG.zip
8. Connect your phone to computer via USB as charge only and enable USB debugging and Unknown Sources.
9. Run DOWNGRADER on tools folder that you downloaded and extracted it. If it gives any error try running it as Administrator.
10. Follow the instructions on screen (This may take a minute or tow)
11. Your phone will be reset, wait for detect and check the Update Package.
12. After checking update package, press vol-up to begin update process, IN FIRST TIME AFTER PRESSING VOL-UP YOUR PHONE WILL RESET AND DO NOTHING, YOU SHOULD DO AGAIN FOR STEPS 11,12

Notes

The process will flash your recovery partition back to stock
This process will wipe all the data from your phone
The downgrade installs an official stock HTC ROM with Hboot1.02 (You can s-off with revolutionary and after it You can flash any version of Hboot)
Your sdcard should be fat32 formatted

[Ref: http://forum.xda-developers.com/showthread.php?t=1564644]

How to know your current HBOOT version of your Android phone?

To know your Android phone’s HBOOT version do the following.

When the phone is off, hold the volume down button and while holding press the power button. You will see a white screen and up the top you should see your hboot version. To exit, press the power button to select FASTBOOT and then use the volume down to select reboot.

That simple 😉