New Facebook App for Windows Mobile 6 (OMNIA i900, OmniaHD, Omnia II…) Smart, Useful and Free!!!
a free uptodate Facebook application by Microsoft for your WM6 phone!
Download the new Facebook application for Windows Mobile at
http://www.microsoft.com/windowsmobile/en-us/downloads/facebook.mspx
What You can do…
- Send messages to any of the people in your Friends list.
- Take pictures and videos on your phone, then upload them right to Facebook.
- Send messages or call people in your Friends list.
- Manage your profile and post anytime, anywhere.
Keep up with the latest news and posts with Facebook on your phone. Now your status updates can be up-to-the moment accounts of what you’re doing. Photos and videos are about as close to live-action as you can get. Show your friends what you’re up to, while you’re out and about. Connecting and sharing on Facebook just got a lot livelier.
Happy Facebook!
Max
How to draw a shadow for a bitmap (Drop Shadow Effect in VB.NET/ASP.NET)
I wrote a vb.net subroutine to draw easly a shadow for a Bitmap object; It is possible get a charming shadow in different ways…
| Normal black shadow to the bottom right corner | ![]() |
| Red shadow to the bottom right corner | ![]() |
| Shadow to the bottom left corner | ![]() |
| Shadow to the top left corner | ![]() |
| Shadow to the top right corner | ![]() |
| Shadow with Opacity: “128″ | ![]() |
| Shadow with Opacity: “128″ and Softness: “8″ | ![]() |
| Shadow with Opacity: “128″, Softness: “8″ and Distance: “10″ | ![]() |
| Shadow without rounded edges | ![]() |
Copy and paste my following vb.net code in your application. it does all the hard job…
'ShadowDirection:
' TOP_RIGHT = 1
' BOTTOM_RIGHT = 2
' BOTTOM_LEFT = 3
' TOP_LEFT = 4
'ShadowOpacity: from 0 to 255
'ShadowSoftness: from 1 to 30
'ShadowDistance: from 1 to 50
'ShadowRoundedEdges: True or False
'Note:
'If You set "transparent" as background color, this is replaced with white color.
Public Enum ShadowDirections As Integer
TOP_RIGHT = 1
BOTTOM_RIGHT = 2
BOTTOM_LEFT = 3
TOP_LEFT = 4
End Enum
<STAThread()> _
Public Sub DropShadow(ByRef SourceImage As Drawing.Bitmap, _
ByVal ShadowColor As Drawing.Color, _
ByVal BackgroundColor As Drawing.Color, _
Optional ByVal ShadowDirection As ShadowDirections = _
ShadowDirections.BOTTOM_RIGHT, _
Optional ByVal ShadowOpacity As Integer = 190, _
Optional ByVal ShadowSoftness As Integer = 4, _
Optional ByVal ShadowDistance As Integer = 5, _
Optional ByVal ShadowRoundedEdges As Boolean = True)
Dim ImgTarget As Bitmap = Nothing
Dim ImgShadow As Bitmap = Nothing
Dim g As Graphics = Nothing
Try
If SourceImage IsNot Nothing Then
If ShadowOpacity < 0 Then
ShadowOpacity = 0
ElseIf ShadowOpacity > 255 Then
ShadowOpacity = 255
End If
If ShadowSoftness < 1 Then
ShadowSoftness = 1
ElseIf ShadowSoftness > 30 Then
ShadowSoftness = 30
End If
If ShadowDistance < 1 Then
ShadowDistance = 1
ElseIf ShadowDistance > 50 Then
ShadowDistance = 50
End If
If ShadowColor = Color.Transparent Then
ShadowColor = Color.Black
End If
If BackgroundColor = Color.Transparent Then
BackgroundColor = Color.White
End If
'get shadow
Dim shWidth As Integer = CInt(SourceImage.Width / ShadowSoftness)
Dim shHeight As Integer = CInt(SourceImage.Height / ShadowSoftness)
ImgShadow = New Bitmap(shWidth, shHeight)
g = Graphics.FromImage(ImgShadow)
g.Clear(Color.Transparent)
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.SmoothingMode = SmoothingMode.AntiAlias
Dim sre As Integer = 0
If ShadowRoundedEdges = True Then sre = 1
g.FillRectangle(New SolidBrush(Color.FromArgb(ShadowOpacity, ShadowColor)), _
sre, sre, shWidth, shHeight)
g.Dispose()
'draw shadow
Dim d_shWidth As Integer = SourceImage.Width + ShadowDistance
Dim d_shHeight As Integer = SourceImage.Height + ShadowDistance
ImgTarget = New Bitmap(d_shWidth, d_shHeight)
g = Graphics.FromImage(ImgTarget)
g.Clear(BackgroundColor)
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.SmoothingMode = SmoothingMode.AntiAlias
g.DrawImage(ImgShadow, New Rectangle(0, 0, d_shWidth, d_shHeight), _
0, 0, ImgShadow.Width, ImgShadow.Height, GraphicsUnit.Pixel)
Select Case ShadowDirection
Case ShadowDirections.BOTTOM_RIGHT
g.DrawImage(SourceImage, _
New Rectangle(0, 0, SourceImage.Width,SourceImage.Height), _
0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)
Case ShadowDirections.BOTTOM_LEFT
g.Dispose()
ImgTarget.RotateFlip(RotateFlipType.RotateNoneFlipX)
g = Graphics.FromImage(ImgTarget)
g.DrawImage(SourceImage, _
New Rectangle(ShadowDistance, 0, SourceImage.Width, SourceImage.Height), _
0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)
Case ShadowDirections.TOP_LEFT
g.Dispose()
ImgTarget.RotateFlip(RotateFlipType.Rotate180FlipNone)
g = Graphics.FromImage(ImgTarget)
g.DrawImage(SourceImage, _
New Rectangle(ShadowDistance, ShadowDistance, _
SourceImage.Width, SourceImage.Height), _
0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)
Case ShadowDirections.TOP_RIGHT
g.Dispose()
ImgTarget.RotateFlip(RotateFlipType.RotateNoneFlipY)
g = Graphics.FromImage(ImgTarget)
g.DrawImage(SourceImage, _
New Rectangle(0, ShadowDistance, SourceImage.Width, SourceImage.Height), _
0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)
End Select
g.Dispose()
g = Nothing
ImgShadow.Dispose()
ImgShadow = Nothing
SourceImage = New Bitmap(ImgTarget)
ImgTarget.Dispose()
ImgTarget = Nothing
End If
Catch ex As Exception
If g IsNot Nothing Then
g.Dispose()
g = Nothing
End If
If ImgShadow IsNot Nothing Then
ImgShadow.Dispose()
ImgShadow = Nothing
End If
If ImgTarget IsNot Nothing Then
ImgTarget.Dispose()
ImgTarget = Nothing
End If
End Try
End Sub
Besides, You can use this sub as in the following example (take a look at the comments…) :
Dim file_input As String = "c:\myfile.jpg"
Dim file_output As String = "c:\myfilewithshadow.jpg"
'get bitmap...
Dim sourceImage As System.Drawing.Image = System.Drawing.Image.FromFile(file_input)
Dim format As System.Drawing.Imaging.ImageFormat = sourceImage.RawFormat
Dim bmpOut As System.Drawing.Bitmap = New Bitmap(sourceImage)
'release any reference to the original file...
While sourceImage IsNot Nothing
sourceImage.Dispose()
sourceImage = Nothing
End While
'drop black shadow on new bitmap with white background...
DropShadow(bmpOut, Color.Black, Color.White)
'save file...
If bmpOut IsNot Nothing Then
bmpOut.Save(file_output, format)
bmpOut.Dispose()
bmpOut = Nothing
End If
PS:
The subroutine executes only in “STAThread” so it’s thread-safe drawing.
Happy coding…
Max
vb.net Bitmap object locks images (impossible to move/delete jpg/gif files) – .Dispose() Method common problem
Many people are in trouble and on forums asking why the .Net Bitmap object does not release an image with its .Dispose() method. The Bitmap object (after its destruction too) seems to lock the image file, then we are not able to move or delete that image file through the file system.
This is a known problem and it occurs when we declare and instantiate a Bitmap object and destruct that like in the following code:
'create a bitmap object
Dim myBitmap As New Bitmap("c:\myimage.jpg")
'editing image routines, right here
'...
'release all Bitmap object resources
myBitmap.Dispose()
The above code it is formally correct, however in same circumstances the .net garbage collector cannot recognize bitmap’s disposing; Dispose() method leaves the image file in an unusable state, then as MSDN said, we MUST release explicitly any reference after a Dispose() call;
with the following code, You will not encounter any problem, and after Dispose() You can edit, move, delete the image file by the filesystem functions…
'create a bitmap object
Dim myBitmap As New Bitmap("c:\myimage.jpg")
'editing image routines, right here
'...
'release image reference
While myBitmap IsNot Nothing
myBitmap.Dispose()
myBitmap = Nothing '<-- tells .net garbage collector to release resources
End While
Happy image editing!
C# code to VB.NET free online converter
Simply paste your C# code and this free online utility will automatically convert it to its equivalent in VB.NET. This utility now support .NET 3.5 syntax:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
You can reverse code from VB.NET to C# too.
New Associative Array Class for VB.NET and ASP.NET
I have coded the ”Associative Array Class” also for VB.NET and ASP.NET so You can add this class to your .NET projects;
Download the VB.NET/ASP.NET Associative Array Class from:
https://sourceforge.net/projects/vbnetassocarray/
You will find a tutorial inside the archive.
Export an ASP Associative Array to XML
“Asp Associative Array Class” provides a method to easly export all items to a well formatted XML string. For example, You can create a new *.ASP file :
<!--#include file="AssociativeArrayClass.asp" -->
<%
Dim Person, God
Set Person = New AssociativeArray
Set God = New AssociativeArray
Person("name") = "Max"
Person("surname") = "Vergelli"
God("name") = "Jesus"
God("surname") = "Christ"
Dim World
Set World = New AssociativeArray
World(1) = Person
World(2) = God
response.Write World.ToXML()
%>
And You will get out the following XML:
<?xml version="1.0" encoding="utf-8"?>
<array>
<key>
<name><![CDATA[1]]></name>
<value>
<key>
<name><![CDATA[name]]></name>
<value><![CDATA[Max]]></value>
</key>
<key>
<name><![CDATA[surname]]></name>
<value><![CDATA[Vergelli]]></value>
</key>
</value>
</key>
<key>
<name><![CDATA[2]]></name>
<value>
<key>
<name><![CDATA[name]]></name>
<value><![CDATA[Jesus]]></value>
</key>
<key>
<name><![CDATA[surname]]></name>
<value><![CDATA[Christ]]></value>
</key>
</value>
</key>
</array>
How to populate an ASP Associative Array with records from MySQL/Access database Table
In this example, You can learn how to populate an ASP Associative Array with the records of a database table (MS Access or MySQL); then, how to programmatically manage well structured data without any extra SQL.
Before to start:
For this tutorial, You need to download this MS Access database example or You can create a new one in MySQL executing this SQL:
CREATE TABLE `myTable` ( `myField1` INT( 11 ) NOT NULL , `myField2` VARCHAR( 255 ) NULL DEFAULT 'test', `myField3` VARCHAR( 255 ) NULL DEFAULT 'test', PRIMARY KEY ( `myField1` ) ) TYPE = MYISAM ; INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`) VALUES(1, 'rec1 Text2', 'rec1 Text3'); INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`) VALUES(2, 'rec2 Text2', 'rec2 Text3'); INSERT INTO `myTable` (`myField1`, `myField2`, `myField3`) VALUES(3, 'rec3 Text2', 'rec3 Text3');
Besides, to create an “AssociativeArray” object, You need to include the “ASP Associative Array Class” file in your asp page with an include statement:
<!--#include file="AssociativeArrayClass.asp" -->
Tutorial:
The target is to grab data from a database Table and save records in an Associative Array, then You need to create a Database connection by ADODB…
Set DbConnection = Server.CreateObject("ADODB.Connection")
Select a Provider for MS Access or MySQL:
dbConnectionString = _
"driver={Microsoft Access Driver (*.mdb)}; DBQ=" & _
Server.MapPath("myDatabase.mdb")
For MySQL Databases You can also use a connection string like the following:
"driver={MySQL ODBC 3.51 Driver}; Server=; Uid=; Pwd=; Database=;"
Open a database connection and create a SQL Select:
DbConnection.Open dbConnectionString
Dim sql : sql = "SELECT * FROM myTable"
Create and Populate the Associative Array with selected Records and close database connection:
Dim Table
Set Table = New AssociativeArray
Table.Fill DbConnection, sql
Set DbConnection = Nothing
Manage Records inside the Associative Array:
Right now, You can manage each record (and its values) inside the Associative Array. For example, You could get the first Record and its Values in each Field:
Response.Write( _
Table(0)("myField1") & " , " & _
Table(0)("myField2") & " , " & _
Table(0)("myField3") & "<br />")
the following code gets the second Record and its Values in each Field:
Response.Write( _
Table(1)("myField1") & " , " & _
Table(1)("myField2") & " , " & _
Table(1)("myField3") & "<br />")
it gets the total Records Count
Response.Write("<p>Total Records: " & Table.Count & "</p>")
this enumerates all Records inside the Associative Array:
Response.Write("<ul>")
For Each row In Table.Items
Dim record
Set record = row.Value 'get current Record Object
Response.Write("<li>" & record("myField1") & " : " & _
record("myField2") & " : " & _
record("myField3") & "</li>")
Next
Response.Write("</ul>")
Response.Write("<ul>") For n = 0 To Table.Count - 1 Response.Write("<li>" & Table(n)("myField1") & " : " & _ Table(n)("myField2") & " : " & _ Table(n)("myField3") & "</li>") Next Response.Write("</ul>")
That’s all,
Get the full example at http://sourceforge.net/projects/asp-assoc-array/
Max
How to use Associative Arrays in ASP
First of all, You need to download the “Asp Associative Array class” then include the file “AssociativeArrayClass.asp” in your asp page.
Right now, You can start declaring associative arrays in ASP with the following syntax:
Dim Person
Set Person = New AssociativeArray
Person("name") = "Max"
Person("surname") = "Vergelli"
Response.Write Person("name") & " " & Person("surname")
In the above example, the key “name” in “Person” object, stores “Max” value. You can set strings or integers for the key and any object/variant type for the relative value. However, You can not set key with Null or “” strings like the following:
'invalid keys...
Person(Null) = "Null Key"
Person("") = "Empty String"
Dim undefined
Person(undefined) = "Variable Not Initialized"
Response.Write Person("") & Person(Null) & Person(undefined)
How to get every item of the associative array:
You can make a “For Each” loop on the array like in the following code
For Each element In Person.Items
Response.Write element.Key & " : " & element.Value & vbCrLf
Next
“Person.Items” gets all the items inside the associative array and for each item You can get “Key” and “Value” properties.
How to copy an associative array:
Dim Person_Clone 'it's a Variant type Set Person_Clone = Person 'NOTE: Use "Set" statement! 'print values Response.Write Person_Clone("name") & " " & Person_Clone("surname") & vbCrLf 'get each key/value For Each element In Person_Clone.Items Response.Write element.Key & " : " & element.Value & vbCrLf Next
How to create nested associative arrays…
You can create infinite nested associative arrays and accessing them like the following:
Dim Person
Set Person = New AssociativeArray
Person("name") = "Max"
Person("surname") = "Vergelli"
Dim People
Set People = New AssociativeArray
People(1) = Person
People(2) = Person
People(3) = Person
Response.Write People(1)("name") & " " & People(1)("surname")
Besides, You can enumerate all the keys/values inside the “People” associative array object
For Each element In People.Items
Dim el_person
Set el_person = element.Value
Response.Write el_person("name") & " : " & el_person("surname") & vbCrLf
Next
VBScript Class to create easly Associative Arrays in ASP like in PHP
I’ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit http://sourceforge.net/projects/asp-assoc-array/
It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You can programmatically manage the structured data; You can also export associative arrays to XML.
Associative arrays are usefull when it is necessary manage many variables at once (for example when we pass multiple values at once to a method/function) or just to store data in a well structured array and reusing its values anytime.








