Wednesday, October 20, 2010

How to Turn Your iPod touch into an iPhone: 4G Edition


The latest iPhone and iPod touch are nearly identical devices, ignoring the pesky reality that the latter isn't a phone. We can fix that. Here's how to turn your iPod touch into a viable (and cheaper) iPhone alternative out of the box.
Back in the day, turning your iPod touch into an iPhone required a jailbreak, but now, thanks to some wonderful apps and other tools, using your iPod touch as an iPhone alternative is a piece of cake.

Wednesday, October 13, 2010

VB Lesson2 for SYBCA Students

What an event?

The ‘look’ of a Visual Basic application is determined by what controls are used, but the ‘feel’ is determined by the events. An event is something which can happen to a control. For example, a user can click on a button, change a text box, or resize a form. As explained in Creating a Visual Basic Application, writing a program is made up of three events: 1) select suitable controls, 2) set the properties, and 3) write the code. It is at the code writing stage when it becomes important to choose appropriate events for each control. To do this double click on the control the event will be used for, or click on the icon in the project window (usually top right of screen). A code window should now be displayed similar to the one shown below.

The left hand dropdown box provides a list of all controls used by the current form, the form itself, and a special section called General Declarations. The corresponding dropdown box on the right displays a list of all events applicable to the current control (as specified by the left hand dropdown box). Events displayed in bold signify that code has already been written for them, unbold events are unused. To demonstrate that different events can play a significant role in determining the feel of an application, a small example program will be written to add two numbers together and display the answer. The first solution to this problem will use the click event of a command button, while the second will the change event of two text boxes.

Click Event

Before any events can be coded it is necessary to design the interface from suitable controls. As shown in the screen shot below use: 2 text boxes to enter the numbers, a label for the ‘+’ sign, a command button for the ‘=’ sign, and another label for the answer.
Making the click event is very simple just select the button with the mouse and double click visual basic will generate
You can see on the top right there is a 'click' dropdown list this is known as a event handler.

Writing your own even

In the first example the user has to enter two numbers and then click on the equals button to produce an answer. However, the program can be changed so that the answer will be calculated every time either of the two numbers are changed without requiring an equals button.
To do this first remove the equals command button and replace it with a label with the caption set to ‘=’. Now, bring up a code window and copy to the Windows clipboard the line lblAnswer = Str$(Val(txtNumber1.Text) + Val(txtNumber2.Text)). Using the left hand dropdown box select the first text box and then select the Change event from the right dropdown box. Then paste the code from the clipboard into the empty subroutine. Select the second text box and do the same. The same line is required twice because the two click events belong to two separate controls. The final code should look like:
Private Sub txtNumber1_Change()
    label2.Caption = Str$(Val(text1.Text) + Val(text.Text))
  End Sub

  Private Sub txtNumber2_Change()
    label2.Caption = Str$(Val(text1.Text) + Val(text2.Text))
  End Sub
Run the program again, enter the two numbers and observe what happens. Each time a digit changes the answer is recalculated.
Note: There may be times when recalculating more advanced problems takes too long on each change and so requiring the user to enter all the data first and then click on an answer button might more appropriate.

Using the event GotFocus event

So far only one event has been used per control, however this does not have to be the case! Add a StatusBar control to the bottom of the form, bring up the code window using , select the first text box (txtNumber1) from the left hand dropdown box, and then select the GotFocus event from the right hand dropdown box. Now some basic instructions can be written in the status bar so that when the cursor is in the text box (the text box has focus) the status bar reads “Enter the first number”. After completing this change to the second text box and using the same GotFocus event change the statusbar text to “Enter a second number”. The code to set the status bar can be seen below.

CheckBoxes

Option bars are used quite often in the windows environment as they can only have two outputs 0 and 1 these get used to process the form. In this example it will be used to change the some text from normal to bold or to italic.
Private Sub chkBold_Click()
If chkBold.Value = 1 Then ' If checked.
txtDisplay.FontBold = True
Else ' If not checked.
txtDisplay.FontBold = False
End If
End Sub

Private Sub chkItalic_Click()
If chkItalic.Value = 1 Then ' If checked.
txtDisplay.FontItalic = True
Else ' If not checked.
txtDisplay.FontItalic = False
End If
End Sub

This example can be found at "smaples/PGuide/controls/Controls.vbp" or downloaded free from the download page.
The checkboxes can be turned on at runtime by simply typing
name.value = 1 ' 1 On , 0 off
Note: If you create the frame first and then add the option buttons by single clicking on the toolbox and dragging the cross hair cursor on the frame to create the controls, they will be attached to the frame and will move with it if you decide to re-position the frame. Notice, however, that if you create the frame first and double click the screen controls, then drag them from the centre of the form on to the frame, they will not be attached to it and will be left behind when you try to move the frame. Try this out.
Notice that when you run your application the same icon is loaded first (probably the clipboard, if you created that option button first). You can alter the option that has the focus first, by selecting one of the other option buttons and setting its property tabindex to 1.

Option Buttons

Changing the background colour

Changing the background colour gets used mostly by freeware, or the type of programs you generate for use with banners or adverts, anyway it might come in useful sometime. This example shows an ordinary picture of a smiley face then I put in some nice background colours to make it stand out more.

Private Sub Form_Load()
BackColor = QBColor(Rnd * 15)
ForeColor = QBColor(Rnd * 10)
Picture1.BackColor = QBColor(Rnd * 15)
Picture1.ForeColor = QBColor(Rnd * 10)
End Sub

List boxes

Note :
List boxes and combo boxes are used to supply a list of options to the user. The toolbox icons representing these two controls are for list box and for combo box.
A list box is used when the user is to be presented with a fixed set of selections (i.e. a choice must be made only from the items displayed, there is no possibility of the user typing in an alternative).
Examples might be offering a list of the days in a week, the available modules in an elective catalogue, the holiday destinations available from a particular airport or the types of treatment offered by a beauty salon.
To create a list box, double click on the toolbox icon . Drag the resulting box into place on the form and size it according to the data it will hold. The left hand picture below shows a list box that has been created and sized on Form1. In the middle is the code that is required to load a selection of cars into the list. The data has been included in the procedure Sub Form_Load so that it appears when Form1 is loaded. Finally, the picture on the right shows what appears on the form when the application is run. Notice that vertical scroll bars are added automatically if the list box is not deep enough to display all the choices.

If you however add the following source code to this project

Add to a Lisbox


Private Sub Form_Load() List1.AddItem "Monday"
List1.AddItem "Tuesday"
List1.AddItem "Wedsday"
List1.AddItem "Thursday"
List1.AddItem "Friday"
List1.AddItem "Saturday"
List1.AddItem "Sunday"
End Sub The source code should look somthing like this :


Removing & Advanced Options

Note: They appear in the order they were typed if you changed the properties window by changing sort order = true then they will go into alpaetical order. List items can be added and deleted all the list is counted as the order they are in so for exapmple if you wanted to delete "Tuesday" you would type list1.RemoveItem 1
And to add to the list in a paticular order just add
list1.additem "My Day", 5
This will be added after saturday.
And finally to clear the lisbox type
List1.clear This will completly clear the contence of the listbox.
Note: The property ListCount stores the number of items in a list, so list1.ListCount can be used to determine the number of items in list box list1.
The property ListIndex gives the index of the currently selected list item. So the statement list1.RemoveItem List1.ListIndex removes the currently highlighted list item.
Adding an item can be accomplished very neatly using an input dialog box. Try this:
list1.AddItem InputBox("Enter a day", "Add a Day")
This will open a message box and prompt you for a new day to enter this will then be added to the list index at the bottem unless you specify were it should go.

Combo Boxes

Combo boxes are of three types (0,1 and 2), setting their properties/styles determines the type. Combo boxes (style 0 and 2 ) are a good choice if space is limited, becaue the full list is displayed as a drop down list, it does not occupy screen space until the down arrow is clicked. Picture of combo box style 0

The user can either enter text in the edit field or select from the list of items by clicking on the (detached) down arrow to the right. The drop-down Combo box, list is viewed by clicking on the down arrow. This type of combo box does not have a down arrow because the list is displayed at all times. If there are more items than can be shown in the size of box you have drawn, vertical scroll bars are automatically added. As with previous type, users can enter text in the edit field.
Drop-down List box (Style=2)
It is slightly confusing to find this control under combo box. This control behaves like a regular list box except that the choices are not revealed until the down arrow is clicked. The user can select only from the choices given, there is no text entry facility.
Note: Combo boxes of style 0 and 2 cannot respond to double click events.

VB Lesson 1 For SY BCA students

The Development Environment

Learning the ins and outs of the Development Environment before you learn visual basic is somewhat like learning for a test you must know where all the functions belong and what their purpose is. First we will start with labelling the development environment.
323kb
The above diagram shows the development environment with all the important points labelled. Many of Visual basic functions work similar to Microsoft word eg the Tool Bar and the tool box is similar to other products on the market which work off a single click then drag the width of the object required. The Tool Box contains the control you placed on the form window. All of the controls that appear on the Tool Box controls on the above picture never runs out of controls as soon as you place one on the form another awaits you on the Tool Box ready to be placed as needed.

The project explorer window

The Project explorer window gives you a tree-structured view of all the files inserted into the application. You can expand these and collapse branches of the views to get more or less detail (Project explorer). The project explorer window displays forms, modules or other separators which are supported by the visual basic like class'es and Advanced Modules. If you want to select a form on its own simply double click on the project explorer window for a more detailed look. And it will display it where the Default form is located.

Properties Window

Some programmers prefer the Categorisized view of the properties window. By defaulting, the properties window displays its properties alphabetically (with the exception of the name value) when you click on the categorized button the window changes to left picture.

The Default Layout

When we start Visual Basic, we are provided with a VB project.A VB project is a collection of the following modules and files.
  • The global module( that contains declaration and procedures)
  • The form module(that contains the graphic elements of the VB application along with the instruction )
  • The general module (that generally contains general-purpose instructions not pertaining to anything graphic on-screen)
  • The class module(that contains the defining characteristics of a class, including its properties and methods)
  • The resource files(that allows you to collect all of the texts and bitmaps for an application in one place)
On start up, Visual Basic will displays the following windows :
  • The Blank Form window
  • The Project window
  • The Properties window
It also includes a Toolbox that consists of all the controls essential for developing a VB Application. Controls are tools such as boxes, buttons, labels and other objects draw on a form to get input or display output. They also add visual appeal.

Understanding the tool box.

You may have noticed that when you click on different controls the Properties Window changes slightly this is due to different controls having different functions. Therefore more options are needed for example if you had a picture then you want to show an image. But if you wanted to open a internet connection you would have to fill in the remote host and other such settings. When you use the command () you will find that a new set of properties come up the following will provide a description and a property.

Opening an existing Visual Basic project.

Microsoft have included some freebies with visual basic to show its capabilities and functions. Dismantling or modifying these sample projects is a good way to understand what is happening at runtime. These files can be located at your default directory /SAMPLES/
To Open these projects choose 'Open Project' from the 'File' menu. Then Double click on the samples folder to open the directory then Double click on any project to load it.

Opening a new visual basic file & Inserting Source code.

From looking at the examples it time to make your own application. Choose 'New Project' from the 'File' menu. Use the blank form1 to design a simple interface for an estate agents database, have some textboxes for names and other details. Insert some controls and make it look professional. Textboxes can be used to store there name and other details, make sure you put a picture box in for a picture of the house.
Now insert the following source code for your application.
Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\Program Files\VB\Graphics\Icons\Misc\MISC42.ICO")
End Sub

Running and viewing the project in detail.

Once an application is loaded it can be run by click on the icon from the toolbar, to pause press and to terminate use .
Once a project is loaded, the name of the form(s) that it contains is displayed in the project window. To view a form in design mode, select the form required by clicking with the mouse to highlight its name, then clicking on the view form button.

In this example the project has been loaded and the maillist.frm has been selected for viewing. This Ms Mail example project useds 6 forms and 1 modules. In Design mode, when the form is viewed, the code attached to any screen object may be inspected by double clicking on that object. The screen shots below show the interface of the Ms Mail example (.../samples/Comtool/VBMail/MaiLLST.FRM) to view the code for this form select from the project window item.

Private Sub SetupOptionForm(BasePic As Control)
BasePic.Top = 0
BasePic.Left = 0
BasePic.Visible = True
BasePic.enabled = True
OKBt.Top = BasePic.Height + 120
Me.width = BasePic.Width + 120
Me.Heigh = OkBt.Top + OkBt.Height + 495
End Sub

Making your first *.exe!?

To make an excutable from a project choose 'MakeMake project.exe from the 'File' menu. Then click once on the Make project.exe choose a default location to store your executable, you can also change some advanced options by clicking on the Options.. tag before saving your exe
The above image will be displayed in the comment's value type some comments company name name etc... The Title tag represents the caption you will see if you press Control + Alt + Del. And the icon is the icon that will be available on the execute icon. As you can see it is quite simple to understand. All the comments, data and name appear when you click on the compiled (execute) exe and click properties.

Saving your visual basic project.

Save your work to disk. Use the Windows Explorer or any desktop windows to check that all files have been saved. There should be one Visual Basic Project (.VBP) file and separate Form (.FRM) and Module (.BAS) files for each form and module used in the current project.

Button Properties for reference

,Command Button & labels properties
PropertyDescription
Name The name of the object so you can call it at runtime
BackColorThis specifies the command button's background color. Click the BackColor's palette down arrow to see a list of common Windows control colours, you must change this to the style property from 0 - standard to 1 - graphical
CancelDetermines whether the command button gets a Click event if the user presses escape
CaptionHolds the text that appears on the command button.
DefaultDetermins if the command button responds to an enter keypress even if another control has the focus
EnableDetermines whether the command button is active. Often, you'll change the enable property at runtime with code to prevent the user pressing the button
FontProduces a Font dialog box in which you can set the caption's font name , style and size.
HeightPositions the height of the object - can be used for down
LeftPositions the left control - can be used for right
MousePointerIf selected to an icon can change the picture of the mouse pointer over that object
PictureHold's the name of an icon graphic image so that it appears as a picture instead of a Button for this option to work the graphical tag must be set to 1
StyleThis determins if the Command Button appears as a standard windows dialog box or a graphical image
Tab indexSpecifies the order of the command button in tab order
Tab StopWhether the object can be tabbed to ( this can be used in labels which have no other function )
Tool Tip TextIf the mouse is held over the object a brief description can be displayed (for example hold your mouse over one of the above pictures to see this happening
VisibleIf you want the user to see the button/label select true other wise just press false
WidthShow the width of the object

Friday, October 8, 2010

How to extend laptop battery life

a Windows 7/Vista app that changes additional power settings on a laptop depending on whether it is running on its battery or plugged into a power outlet. Having failed to get it to work on my own laptop because of a missing and uninstallable .dll file, I gave up trying and turned to the web to find a way to copy the tweaks it implements without actually using Aerofoil.
One of the big energy savers that supposedly contributes to the 25% extended battery life that is possible using Aerofoil is to switch off transparency, the so-called Aero effects in Windows 7 or Vista. To be honest, there’s no reason to have Aero effects running at all, they’re almost entirely an aesthetic affectation and switching them off permanently could save power.
But, if you really do like to have them running at least automate their toggling on and off when you switch from outlet to battery. It could be 20 minutes extra juice, which might make all the difference between meeting a deadline and not. Here’s how:

  1. Disconnect from the power outlet
  2. Right click desktop and choose Personalize option
  3. Click “Window Color”
  4. Uncheck “Enable Transparency”
  5. Save changes and exit back to Desktop
  6. Connect to power outlet and repeat steps 1-3
  7. Check the box to “Enable Transparency”
  8. Save changes and exit “Personalize” back to desktop
Aero should now be enabled while you are plugged in but will automatically be disabled if you unplug and run the laptop on battery power.

Thursday, October 7, 2010

Publish your blogs using MS Word




  • Start MS Word and click on New and you will find new window as below. Select New Blog Post and click on to Create






    • Now Register you blog as per image and click on Register Now


    • Select your blog as per below
       


    • Enter your authentication as per displayed image  

      Tuesday, October 5, 2010

      Wireless – the next generation

      Many observers suggest that the next generation wireless networks (NGWNs) will see the convergence of all the different wireless technologies, from 3G and 4g cellular networks, WiMAX, LTE and other protocols and somehow these systems will have to remain interoperable with the traditional IP-based wired networks that underpin telecommunications of all flavors. The advent of NGWNs will mean that the nodes in a given network will suddenly be mobile where they were essentially fixed geographically.
       

      Mobility might mean disconnectivity unless the issues of wireless data transmission, signal strength and interference can be circumvented. Mobility also brings with it the problem of place privacy. To remain connected to a network, the wireless connection device will more often than not need to reveal its exact location to the correspondents. For some applications video, TV broadcasting, online games that might not be a problem but for voice and data and medical applications place privacy could be critical.
      Place privacy probed

       “Current networking protocols designed around single interface stationary end-systems clearly fail to represent the present communication context of mobile, multi-interface end-systems.”
      In other words, all these different gadgets and computers are not good at talking nicely to each other at the moment. They point out that the convergence of wired and wireless technologies into an all-IP (AIP) next generation network could remedy the situation and at the same time develop better fault tolerance, boost uptime and improve performance of end-to-end communications. But, we are a long way from effective convergence partly because we are running out of IP addresses and mobile IP (MIP) is not yet up to the task.
      Jain and colleagues have developed the concept of a virtual identity (ID), that could facilitate the next generation connectivity by extending the explicit ID and location tag of mobile IP for IPv6. The Mobile IP (or IP mobility) from the Internet Engineering Task Force is a standard communications protocol that allows mobile devices to retain their permanent, unique IP address even when they skip from one network to another.
      “With a wired phone, it is easy to determine location of the caller from their phone number unless they are calling from special numbers (such as toll free 800 number in the United States),” explains Jain. “A virtual ID is a specially reserved subset of IPv6 address space that gives no indication of location.”
      A virtual ID will fully support MIP for mobility, multihoming (multihoming increases Internet connection reliability on an IP network), and location privacy, the team says; all under the standard connection protocol mobile IPv6.
      With such a virtual ID in place, users will be able to use devices with a variety of networking technologies and remain highly mobile

      Monday, October 4, 2010

      Embed a video in Two Seconds

      if you want to embed a video in your own blog.  done. All you have to do to make it work for the video of your choice is change http://www.yoursite.com/video.mpg to the appropriate URL. It should also work for avi files. Be sure to enclose the embed functions in a surrounding <div></div> otherwise the code will disrupt the layout of your blog.
      <div>
      <object id=”MediaPlayer1″ CLASSID=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″ codebase=”http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701″ standby=”Loading Microsoft WindowsĂ‚® Media Player components…” type=”application/x-oleobject” width=”280″ height=”256″>
      <param name=”fileName” value=”http://www.yoursite.com/video.mpg”>
      <param name=”animationatStart” value=”true”>
      <param name=”transparentatStart” value=”true”>
      <param name=”autoStart” value=”true”>
      <param name=”showControls” value=”true”>
      <param name=”Volume” value=”-450″>
      <embed type=”application/x-mplayer2″ pluginspage=”http://www.microsoft.com/Windows/MediaPlayer/” src=”http://www.yoursite.com/video.mpg” name=”MediaPlayer1″ width=280 height=256 autostart=1 showcontrols=1 volume=-450>
      </object>
      </div>

      Friday, October 1, 2010

      windows Essential 2011


      Microsoft is set to release the final version of Windows Live Essentials later today, Neowin has learnt.

      The complete package comes just over a month after a beta refresh was issued on August 17. Microsoft originally released a Windows Live Essentials beta on June 24. Essentials includes the popular programs Windows Live Movie Maker, Mail, Messenger, Writer, Sync, and Family Safety. The Windows Live team has aimed to ensure that the next version of Windows Live Essentials takes advantage of Windows 7 fully. All applications now use the new ribbon UI and integrate further into Windows 7 by using Jumplists. Windows Live Sync is also included which keeps your files synchronized on the web and across multiple PCs.

      Microsoft also introduced several new features for Windows Live Photo Gallery, including photo fusing to blend photos together and improved facial recognition. Expect the final version to land around 10AM PST.

      wle2011.png