13 Mar 2012

Seconds, Minutes, and Hours

I have a little function that converts seconds into other units. Let's take a look at it.


Function FormatTime(TimeElapsed As Integer) As String
   Dim Seconds As Integer
   Dim Minutes As Integer
   Dim Hours As Integer
   
   'Find The Seconds
   Seconds = TimeElapsed Mod 60
   
   'Find The Minutes
   Minutes = (TimeElapsed \ 60) Mod 60
   
   'Find The Hours
   Hours = (TimeElapsed \ 3600)
   
   'Format The Time
   If Hours > 0 Then
      FormatTime = Format(Hours,"00") & ":"
   End If
   FormatTime = Format(Hours, "00")  & ":"
   FormatTime = FormatTime & Format(Minutes, "00") & ":" 
   FormatTime = FormatTime & Format(Seconds, "00")
End Function

Let's take a closer look at this. First, I used the Mod operation to get the seconds. "Mod" finds the remainder when one number is divided by another. In this case, when we divide our time elapsed by 60 (one minute), our remainder is the number of seconds left over.

Then I did a similar process to find the minutes, only this time I had to divide the number of seconds by 60 to get the total number of minutes. Again, I used the Mod operator to find the remainder (in this case, the number of leftover minutes).

Finally, the number of hours is the number of seconds divided by 3600. Once again, I used Integer division ('\' instead of '/') because we don't want fractional hours.

The last step of the process is putting the values together in a string, using the Format function to get the right number of digits in each section.

Creating Random Passwords

Creating a random password is a programming task you may have to handle if you own a website which has membership options. A visitor signs up by entering their email address. Then you create a random password, assign it to that email address, and fire off an email to the visitor with the random password in the email.

Why would you do this? It's a way of verifying that the visitor has entered a valid email address. If they entered a bogus email address, the email will never get to them, and they'll never find out what their password is, and they won't be able to log in.

So, how do you create a randomly generated password

Here's what the code will look like:


Dim RandomLetter As Integer
Randomize Timer
'Get One Random Letter
RandomLetter = Int(Rnd * 26) + 65

Of course, that's just one numeric value, and we need a bunch of them strung together as a string variable. How long do you want your password to be? Let's say it'll be 6 characters. So we need to do a loop six times:

Dim RandomLetter As Integer
Dim ThePassword As String
Dim Index As Integer
Randomize Timer
'Get Random Letters
For Index = 1 to 6
   RandomLetter = Int(Rnd * 26) + 65
   ThePassword = ThePassword & Chr(RandomLetter)
Next Index

That'll do it! You now have a random password containing nothing but upper case letters.

One thing that most people will tell you, though, is that passwords like this are very difficult to remember, so websites will often create random passwords which alternate between consonants and vowels. By doing this, you make it possible for the visitor to pronounce the password, which makes it easier to remember.

So, how do we go about doing this? Well, there are a couple ways you can do it. One way is to create a function that generates vowels:


Randomize Timer

'Get Random Vowel
Function GetRandomVowel() As String
   Dim RandomVowel As Integer
   RandomVowel = Int(Rnd * 5)
   Select Case RandomVowel
   Case 0:
      GetRandomVowel = "A"
   Case 1:
      GetRandomVowel = "E"
   Case 2:
      GetRandomVowel = "I"
   Case 3:
      GetRandomVowel = "O"
   Case 4:
      GetRandomVowel = "U"
   End Select
End Function

Then, of course, you create another function which generates a random consonant (this function will be a lot longer, right?). Once you have both of these functions, creating your random password is simple as:

Dim ThePassword As String
Dim Index As Integer
Randomize Timer
'Get Random Letters
For Index = 1 to 3
   ThePassword = ThePassword & GetRandomConsonant() 
   ThePassword = ThePassword & GetRandomVowel()
Next Index

Sony Ericsson cell phone secret codes

1. IMEI (International Mobile Equipment Identity) Number: *#06#
2. Sony Ericsson Secret Menu (Software version, Service info, Service tests): >*<<*<*
3. View last dialed numbers: 0 then #
4. Change to Default Theme / Language < 0 0 0 0>
5. SIMLOCK / Network information: < * * <
6. Opening phone without a SIM card: **04*0000*0000*0000# followed by on ‘Wrong Pin’ number
7. Shortcut to SIM numbers: On main menu type a number and press #
8. Phone Test: 904059 + > (to exit 3 + <)
9. Lock status: <- * * <-
10. Here below are some of hidden smiles for messages. You wont find them in “Add symbol”
  • :-]
  • :-[
  • :-*
  • [:]
  • :<^
  • ://
  • :&
  • :’(

Samsung cell phone secret codes

Samsung cell phons have good appearances and good build quality, hence it’s very popular. Below are some secret codes for your Samsung cell phone.
IMEI code: *#06#
Help Menu: *#9998*4357#
Java menu (GRPS/CSD settings for JAVA server): *#9998*5282#
Monitor Mode: *#9999#0#
Software Version: *#9999# or *#9998*9999#
Hardware Version: *#8888# or *#9998*8888#
Sim Infos: *#9998*746# or *#9998*0746# or *#0746#
Display Contrast: *#9998*523# or *#9998*0523# or *#0523#
Vibration On (until you push OK): *#9998*842# or *#9998*0842# or *#0842#
Buzzer On (until you push OK): *#9998*289# or *#9998*0289# or *#0289#
Battery & Field Infos: *#9998*288# or *#9998*0288# or *#0288#
Error log: *#9998*377# or *#9998*0377#
Sim Service table: *#9998*778# or *#9998*0778# or *#0778#
Show date and alarm clock: *#9998*782#
Show network information: *#8999*638#
Change operator logo at startup: *#9998*5646#
Production number: *#9998*76#
View melody for alarm: *#9998*968#
Non-Volatile Memory (NVM): *#9998*585#
Digital Audio Interference Off: *#3243948#
Digital Audio Interference On: *#32436837#

Security master code calculator for Nokia cell phones

Almost all Nokia mobile phones have a lock code, once it is enabled, you have to enter it whenever turn your mobile phone on or change the SIM card to block access from others to your personal data and information like SMS, call log and phone book. The default code is 12345 (it may vary depending on the model of your cell phone), while this lock code is different from your service provide unlock code which is used to prevent your from using other service provider’s network.
Many people who enabled lock code usually change the default code, and some people are asking for help on the forum because they forget the new lock code they set. In order to tackle this, someone developed a security master code calculator for Nokia cell phones. You just have to enter your IMEI code (type *#06# and you get it), and it will generate the security master code, you can use this code to unlock your cell phone.
You can find this security master code website here, but before you visit it, check out this compatibility list first.
In case this calculator does not help, you may have to restore to factory settings by pressing simultaneously ‘Green’ + ’3′ + ‘*’ and at the same time when turning your cell phone on, which is similar to type *#7370# on your cell phone.

Nokia cell phones top secret service codes

Below are some top secret service codes for your Nokia cell phone:
*#06# – Shows your International Mobile Equipment Identity (IMEI) number.
*#92702689# (*#WAR0ANTY#) – Shows warranty information. to exit this mode you have to switch your phone off then on again.
*#7370925538# (*#RES0WALLET#) – Resets wallet code with wallet contents.
*#2820# (*#BTA0#) – Shows BlueTooth Address for cell phones with Bluetooth.
*#62209526# (*#MAC0WLAN#) – Shows WLAN MAC for cell phones with Wireless LAN (WiFi).
*#7780# (*#RST0#) – Normal reset, restore your cell phone to factory settings.
*#7370# (*#RES0#) – Deep reset, restore cell phone to factory settings and format all user data.
*#0000# – Shows your cell phone’s firmware version.
*3370# (*EFR0#) – Activates Enhanced Full Rate codec (EFR) (your cell phone uses the best sound quality but talk time is reduced by approx. 5%).
#3370# (#EFR0#) – Deactivate Enhanced Full Rate codec (EFR).
*4720# (*HRA0#) – Activate Half Rate codec (your cell phone uses a lower quality sound but you should gain approx. 30% more talk time).
#4720# (#HRA0#) – Deactivate the Half Rate codec.
*#67705646# (*#OPR0LOGO#) – Removes operator logo on some phones.

Do not want to receive calls

Type **21*999999#, then press the green answering key. If someone is to call you, he / she will hear ‘the number you dialed does not exist’, isn’t it cool? To disable this feature, type ##21#, then press the answering key again, and everything will be normal.

How to Delete Friend’s Hard Disk -Fakely

Here is a funny trick which you will find amazing and frighten your friend with this prank.
1)Download Fake delete.zip and unzip the files.
2)Now open the folder and open the file fakedel.exe. You can see that the deleting seems so realistic. But this is just fake and nothing happens to your computer.
3)Now rename this file with xyz.exe and paste this file on your friend’s desktop or Email it to him/her with some interesting message so that he/she will curiously open the file.
To Stop Fakedel.exe go to Taskbar > TaskManager > fakedel.exe > End Process