Monday, December 31, 2007

Intelligent Mirror !




A
n Intelligent Mirror also produced by Living Tomorrow to show an idea for a home of future. It can measure your blood pressure, heart rate - measured by the handle of tooth-brush, remind you to have your medicine etc can be a very helpful gadget for those who want to monitor their health.

Smart Board By Living Tomorrow !



Living Tomorrow along with Microsoft(r) has developed a 'Smart Board' a big touch Screen with a range of different purpose application to be used at home. This version is basically made for you to be used in kitchen you can keep track of your stock by just scanning your purchased product through RFID. It has also an application which can be used to test carbon percentage your house is producing at a specified time.

Future is Here !



Microsoft(r) research team from Cambridge on fourth innovation Day held by Microsoft(r) showed a game in which the car drives itself and hopefully to test the same technology on a real vehicle. The green laser lines measure the time to impact to objects and other show the different routes by the car to pick a prefect line.

Friday, December 7, 2007

Accessing Controls !

You might have had some problem in the past in accessing the controls on the Main form, where you want to set properties of controls on your Main form if you are thinking to instantiate the object of Main class and then setting properties of controls then you are thinking wrong because by following this way you are actually creating a new instance of the form and not accessing the instance which is already in Memory. So, in order to solve this problem the following trick will do the work for you.

In your form2 declare a Class level variable of form type e.g.

Dim oForm as Form

now in the Load event of form2 just make this equal to the 'ActiveForm' property of 'Form1' e.g.

oForm = Form1.ActiveForm

Now just enter the following code in the Button Click event handler or in whatever event you want to use in order to add items to the Listbox or whatever you want to do with the control on the form e.g.

Private Sub btnOK_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnOK.Click

CType(oForm, Form1).ListBox1.Items.Add(Me.TextBox1.Text)
'Like this you can now access any control on the Form
'Who's instance is already in memory.

End Sub

I hope this will help you !

Trace Your Code Effectively !

Here is quick and nice trick to trace your code and append the values in the Textbox. For this we have to design a class which inherits from 'TraceListener' Class then we must override the 'Write' and 'WriteLine' method to give it our own logic. So, here it is:

Public Class TraceLogSupport
......Inherits TraceListener

......Private _Targettextbox As RichTextBox
......Private _Targetfrm As Form

......Public Sub New()
............MyBase.New()
............'default constructor
......End Sub

......Public Sub New(ByVal txtbox As RichTextBox, ByVal frm As Form)
............MyBase.New()

......If txtbox IsNot Nothing Then

............_Targettextbox = txtbox

......Else

............MyBase.Dispose()
............Throw New ArgumentNullException("Must specify which Textbox to append text to.")

......End If

......_Targetfrm = frm

......End Sub

......Delegate Sub SetTextCallBack(ByVal text As String)

......Public Overloads Overrides Sub Write(ByVal message As String)
............SetText(message)
......End Sub

......Public Overloads Overrides Sub WriteLine(ByVal message As String)
............SetText(message + Environment.NewLine)
......End Sub

......'Just to make it thread safe.
......Sub SetText(ByVal txt As String)
............If Me._Targettextbox.InvokeRequired Then
..................Dim stcallback As New SetTextCallBack(AddressOf SetText)
.................._Targetfrm.Invoke(stcallback, New Object() {txt})
......Else
..................Me._Targettextbox.AppendText(txt)
......End If

......End Sub

End Class

Now just instantiate the object of this class and add it to Trace's or Debug's listener's collection (Both share the same Listener's collection). Trace and Debug classes can be accessed from anywhere in your code in this way you can easily display the result of your code execution. This is just to make your execution live !

Thursday, December 6, 2007

Ale - Latest in Technology !



FuelVapor Technologies has produced a car called 'ale' that can run on vapors rather than on liquid fuel. But it isn't only designed for fuel effeciency but also for performance and according to the company this can pick up speed from 0 to 60 mph in just 5 seconds !

Tuesday, December 4, 2007

Micro-Robotic Hex Bugs !


Robots can also be toys. The micro-robotic Hex Bugs from Bandai will react to sound and change direction when you clap at them.

Credit: Bandai/AudioCubes

ASIMO !


Honda's ASIMO (Advanced Step in Innovative Mobility) robot can run 4 miles per hour, according to Honda.

Robots in Action !




Like something out of a movie, the Quattro s650 robot from Adept is an "intelligent" vision-guided multi-arm robot that can be used in place of a person in a factory or assembly line. The robot, which the company says can operate at a very fast speed with accurate precision, has four arms that each rotate on a multiple-axis. The entire base can also rotate, making the robot ideal for manufacturing, assembling, packaging, and even putting together kits of items.

Sunday, December 2, 2007

10 Quick Tips for VB Developers !

Generics. The Generics class in .NET 2.0 gives developers the flexibility to write methods once and let the .NET Framework handle type issues. There is no boxing of objects or casting of exceptions, which improves performance, and compile errors show up earlier in the coding process.

Debugger ToolTips. Debugging in Visual Basic 2003 was "pretty vanilla," as developers had to go to the Watch window to find it and it didn't say much. In VB 2005, users can expand the box, to see the properties of a particular type, or hold down Ctrl to male the box transparent.

Edit and Continue. Speaking of debugging, this feature lets developers edit code while they're debugging it. "You don't have to keep stop-starting all the time. That can be a very laborious process".

The My namespace. Along with giving developers a place to find and store "the stuff you're going to do 90% of the time," the My namespace lets developers do things like retrieve information with a single line of code -- My.Computer.FileSystem.ReadAllText(filename.txt) --

Templates. These are stored as zip files containing an XML file, a VB file set to transport, a designer file and all other files related to the template. To add a template, just go to "Add New Item" and the appropriate file from the template will appear there.

Snap lines. This graphical form-building tool, likely familiar to designers, gives developers granular control, such as alignment to the top left of a form or to existing controls.

Application settings. With this feature, a developer can name a pointer variable, indicating the location of a stored form. Thus the values of a property, set up once, can be used in many places.

Renaming. By right-clicking on a code identifier like a class name, field or type, a developer can rename it and update all calls and references to that identifier.

Refactoring. This functionality is not available from Microsoft, but third-party vendors like Developer Express.

Snippets. Visual Basic 2005 comes with 500 pre-installed code snippets, categorized by task. They are accessible by right-clicking, by the keyboard shortcut "Tab+?" or by typing the individual snippet's shortcut. Developers can also create snippets for the custom code they use regularly.

Wicked Lasers

Wicked Lasers provides the world's most powerful hand held laser. Check it out you'll be amazed!



Site: http://www.wickedlasers.com/

near-field-communication technology !

O2 have partnered up with Nokia to offer a handset with near-field-communication technology. The NFC chip talks to a nearby reader and credit is then deducted from the phone. Japanese are using this technology already !

Learn More about this technology...

Thursday, November 29, 2007

Ideas !

Check out the new ideas which the Microsoft(r) is currently working on. You can help them test these ideas to make them better for everyone.

Site: http://get.live.com/betas/home

VB 9 Series - Friend Assemblies

Welcome to the 3rd Article in the Series of VB 9. In this article we'll look at a new feature added to the VB language i.e. InternalsVisibleTo Attribute - 'Friend Assemblies'.

You might have had some problem in the past where you want to share methods of your 'Friend Assembly' to a particular assembly or assemblies. Now in VB 9.0 you have a way! for this you just have to use an assembly level attribute 'InternalsVisibleTo' (can be found under System.Runtime.ComplierServies) which takes the name of the assembly to which you want to share your methods without extension.

To understand this suppose you have made a Class Library Project say 'testFriend' and write the following code for the class:

Friend Class FriendofDemoClass

.......Function SomeFunction() As Integer

..............Return 0

.......End Function

End Class

Now create a 'Console Application' 'Demo' and after adding the refrence of 'testFriend' make an object of 'FriendofDemoClass' when you make an object of this class outside its scope ('Friend' can only be accessed within the scope of its assembly) you get this error.



Now go back to your 'testFriend' Library and add the 'InternalsVisibleTo' attribute which can be found under System.Runtime.CompilarServices.

Imports System.Runtime.CompilarServices

< InternalsVisibleTo.("Demo") > _
Friend Class FriendofDemoClass

.......Function SomeFunction() as Integer

..............Return 0

.......End Function

End Class

Now everything works fine !

Photosynth - Changing the way you think about Digital Photos !

Photosynth is an amazing new technology from Microsoft(r) Live Labs that will change forever the way you think about digital photos.

Introducing Photosynth

Their software takes a large collection of photos of a place or an object, analyzes them for similarities, and displays them in a reconstructed three-dimensional space.

With Photosynth you can:

  • Walk or fly through a scene to see photos from any angle.
  • Seamlessly zoom in or out of a photo whether it's megapixels or gigapixels in size.
  • See where pictures were taken in relation to one another.
  • Find similar photos to the one you're currently viewing.
  • Send a collection - or a particular view of one - to a friend.
Site: http://labs.live.com/photosynth/

YamiPod - Mange your iPod

YamiPod is a freeware application to efficiently manage your iPod under Mac OS X, Windows and Linux. It can be run directly from your iPod and needs no installation. Take a look at the feature list to find out what it can do and feel free to suggest anything that might be missing.

Site: www.YamiPod.com

Wednesday, November 28, 2007

GameFAQs...!

GameFAQs is an online archive of video and computer game information, codes, walkthroughs, hints, message boards, save games files, and of course, FAQs. Everything on the site is contributed freely by various members of the public and is available for free private use to all visitors. If you're stuck on a game, want to find out more information about it, or just like reading about upcoming and past games, you'll likely find what you're looking for here !

Site: www.gamefaqs.com

Cocolico.info !

Cocolico is a design magazine, with an insane preference for crazy, smart ideas that won�t spoil the environment. Here, you will meet some products, sometimes internationally acclaimed, that could land one day in your home. They also report innovative and environmentally friendly concepts. Check out some cool and amazingly crazy concepts here.

Site: www.Cocolico.info

Spider !

Very soon AMD will be delivering its new high-end gamer system, Spider, which is a combination of some seriously heavy duty graphics card with its new desktop Pheonom quad-core processor.

Site: http://www.reghardware.co.uk/2007/10/26/amd_to_show_spider/

Jaxtr.com - Make free Landline or Mobile Calls !


Jaxtr links your phone to the web, so you can hear from callers worldwide while keeping your existing phone number private. You can use your Land line Phones or Mobile phone to make calls to your friends and family on their mobiles or Land line phones. When you sign up you get 100 jax which is what you need in order to make phone call and every month 100 jax added in your account so just sign up and make some free calls to your loved ones. ;)

Web Operating System !



eyeOS
is an Open Source Platform designed to hold a wide variety of Web Applications over it. eyeOS was thought as a new definition of Operating System, where everything inside it can be accessed from everywhere. Just open your browser and point it to your eyeOS Server. Log in and you will access your Desktop, with your applications, documents, music, movies...

Source Code for .NET 3.5 Libraries !

Microsoft is now about to release source code of .NET Framework 3.5 Libraries later this year with the release of Visual Studio 2008 at first Source code of following libraries will be released under Microsoft Reference License (MS-RL)

  1. System, System.IO,
  2. System.Collections,
  3. System.Configuration,
  4. System.Threading,
  5. System.Net,
  6. System.Security,
  7. System.Runtime,
  8. System.Text, etc),
  9. ASP.NET (System.Web),
  10. Windows Forms (System.Windows.Forms),
  11. ADO.NET (System.Data),
  12. XML (System.Xml),
  13. and WPF (System.Windows).

You'll be able to download the .NET Framework source libraries via a standalone install (allowing you to use any text editor to browse it locally). They will also provide integrated debugging support of it within VS 2008.

So, hoping to see the work of professionals and learn from them...!!!

VB 9 Series - Object Initializers

Welcome to the second article of VB 9 Series. In this article I'll try to explain the new functionality introduced in Visual Basic 9 i.e. Object Initialization... with the help of this technology you can very well separate object Initialization logic, you may had some problem or have to write long code to initialize certain values in your object and can't find those in the constructor consider the following example code:

Public Class
Customer

.........Private _name As String
.........Private _address As String
.........Private _City As String

.........Public Sub New()
..................'default constructor
.........End Sub

.........Public Sub New(ByVal Name As String)
.................._name = Name
.........End Sub

.........Public Property CustomerName() As String
.........Get
..................Return _name
.........End Get
.........Set(ByVal value As String)
.................._name = value
.........End Set
.........End Property

......... Public Property Address() As String
.........Get
..................Return _address
.........End Get
.........Set(ByVal value As String)
.................._address = value
.........End Set
.........End Property

.........Public Property City() As String
.........Get
..................Return _City
.........End Get
.........Set(ByVal value As String)
.................._City = value
.........End Set
.........End Property

End Class

And then you Instantiate the object of this class like this:

.........Dim MyCustomer As New Customer("Ali")
.........MyCustomer.Address = "xxx"
.........MyCustomer.City = "Lahore"

Or can also use the bellow code to initialize the values:

.........Dim MyCustomer As New Customer("Ali")
.........With MyCustomer
...................Address = "xxx"
...................City = "Lahore"
.........End With

But to keep the initialization logic togather VB 9 has introduce new functionality now you can use the bellow code to set the values while instantiating an object:

.........Dim myCustomer As New Customer("Ali") With {.Address = "xxx", .City = "Lahore"}

IntelliSense will help you to set the different properties related with the object.

I hope you get the idea of this yet new powerful feature of VB 9.

Good Luck !

Tuesday, November 27, 2007

If Ternary Operator

This Article is first in the series of VB 9 articles. In this article I'll introduce you to the If Ternary Operator which the VB language lacks in its previous versions. You as a VB Programmer some how familiar with the Iif function or 'Immediate If'. The syntax of 'If Ternary Operator' is the same as compared to Iif i.e. Iif(Boolean,True,False) and you use it this way:

Dim
Amount As Integer = 100
Dim
ASign As Integer = Iif(Amount < 0, -1, 1)

When you execute the code the Iif function checks the condition, if the value of 'Amount' is greater than 'zero' it will return '1' otherwise '-1' pretty basic but what's the problem? actually the problem is that as it is a function which belongs to some library not a built-in operator or function of VB language therefore in VB all of the arguments evaluates before execution. Look at the following example:

Sub Main()

Dim Amount As Integer = 100
Dim ASign As Integer = IIf(Amount < 0, Negative, Positive)
Console.WriteLine(ASign)
Console.ReadLine()

End Sub

Function Negative() As Integer
MsgBox("In Negative Function")
Return -1
End Function

Function Positive() As Integer
Return 1
End Function

Although we are only interested in the Positive Funtion but as it's a function it will evaluate all the arguments here is the output of this code:



Therefor, Iif is not equal to the following code:

Dim Amount As Integer = 100
If i < 0 Then
Negative()
Else
Positive()
End If

But now we have the solution in VB in spite of writing the above code the same objective can be accomplished with the help of 'If Ternary Operator':

Dim Amount As Integer = 100
Dim Asign As Integer = If(Amount < 0, Negative, Positive)

And also look at the following code example:

Dim CustomerName As String = Nothing
Dim Value As String = If(CustomerName, "Not Set")

Actually the above code is equivalent to the following Code:

Dim CustomerName As String = Nothing
Dim Value As String = If(CustomerName IsNot Nothing, name, "Not Set")

Hope you get the idea of this powerful operator.

Good Luck !

Visual Basic 9 released !!!

Productivity that is ideal for first time or casual Windows programming. Get the new Version of Visual Basic from here. Following are the new features added in this Language I'll soon write a series of articles in which I'll try to explain each of these feature.

  • A true ternary operator If(boolean, value, value) to replace the IIF function.
  • Support for LINQ
  • Lambda expressions
  • XML Literals
  • Type Inference
  • Improved IntelliSense
  • Extension Methods
And many others....

Surface Computer - The Magic

Check out this new Cool and Magical Surface(r) Computer by Microsoft(r).

What this blog is All About ???

I'll try to tell you and explain various new features added to Visual Basic and .NET family and will also share with you latest news related to technology. You can always asks questions to me related to Visual Basic .NET or anything about .NET technology.


AliAmjad(MCP)
Windows Application Developer
yehpal@gmail.com