Wednesday, November 28, 2012

What people think I do...

I received a mail from my colleague, so true...
Just had to post it :-)


Friday, September 28, 2012

Fun : Carry On & Some Nights & We Are young

Carry On :



Some Nights



We Are Young

Guild Wars II

Guild Wars II really lived up to my expectations, for me this is the best game ever created...

No fees, no typical healer/tank/DPS, new game play, dynamic events, World vs World, impressive evolving story line.
PVE & PVP & WvW just give it a try you'll love it..

Well if you like these kind of MMORPGs that is :-)

Website: https://www.guildwars2.com/en/

Check out the introduction movie below... See you in the game...


Tuesday, September 25, 2012

Jayden

Ever seen such a cutey :-)

My son Jayden (2years old)


Monday, September 17, 2012

Evolution from GSM to GPRS to 3G to LTE

Three-Minute Tech: LTE | TechHive


The evolution of ‘Long Term Evolution’

LTE is a mobile broadband standard developed by the 3GPP (3rd Generation Partnership Project), a group that has developed all GSM standards since 1999. (Though GSM and CDMA—the network Verizon and Sprint use in the United States—were at one time close competitors, GSM has emerged as the dominant worldwide mobile standard.)

Cell networks began as analog, circuit-switched systems nearly identical in function to the public switched telephone network (PSTN), which placed a finite limit on calls regardless of how many people were speaking on a line at one time.

The second-generation, GPRS, added data (at dial-up modem speed). GPRS led to EDGE, and then 3G, which treated both voice and data as bits passing simultaneously over the same network (allowing you to surf the web and talk on the phone at the same time).

GSM-evolved 3G (which brought faster speeds) started with UMTS, and then accelerated into faster and faster variants of 3G, 3G+, and “4G” networks (HSPA, HSDPA, HSUPA, HSPA+, and DC-HSPA).

Until now, the term “evolution” meant that no new standard broke or failed to work with the older ones. GSM, GPRS, UMTS, and so on all work simultaneously over the same frequency bands: They’re intercompatible, which made it easier for carriers to roll them out without losing customers on older equipment. But these networks were being held back by compatibility.

That’s where LTE comes in. The “long term” part means: “Hey, it’s time to make a big, big change that will break things for the better.”

Thursday, September 13, 2012

Chocolatey Linux' Appget for Windows

Chocolatey Brings Lightning Quick, Linux-Style Package Management to Windows

I found this nice article about an appget variant for windows.


Chocolatey puts all of your favorite Windows programs right at your fingertips. With just a few keystrokes, you can have a program up and running on your system without ever needing to open a browser, double-click on an installer, or go through any menus. To install Chocolatey, just run the following command in a Command Prompt:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin 


Then, you can search the chocolatey database for any program using the clist command. For example, clist windirstat will let you know whether WinDirStat is in Chocolatey's database (it is), after which you can install it by typing in cinst windirstat. You may need to say "Yes" to a UAC prompt, but that's all it takes—you'll have WinDirStat up and running on your system in no time. You can even install multiple programs at once, or use Chocolatey in your favorite alternate shell like Cygwin.

-------------------------
Usage
-------------------------
chocolatey [install [packageName [-source source] [-version version] | pathToPackagesConfig]  | installmissing packageName [-source source] | update packageName [-source source] [-version version] | l
ist [packageName] [-source source] | help | version [packageName] | webpi packageName | gem packageName [-version version] |uninstall packageName]

example: chocolatey install nunit
example: chocolatey install nunit -version 2.5.7.10213
example: chocolatey install packages.config
example: chocolatey installmissing nunit
example: chocolatey update nunit -source http://somelocalfeed.com/nuget/
example: chocolatey help
example: chocolatey list (might take awhile)
example: chocolatey list nunit
example: chocolatey version
example: chocolatey version nunit
example: chocolatey uninstall

A shortcut to 'chocolatey install' is 'cinst'
cinst [packageName  [-source source] [-version version] | pathToPackagesConfig]
example: cinst 7zip
example: cinst ruby -version 1.8.7
example: cinst packages.config

Tuesday, July 31, 2012

VB Script : Clean Files Older Then 7 Days

Option Explicit
dim WshShell,fso, file, source, daysBack, toDelete(1000000), toDeleteFolder(1000000), groups, group
dim i, ii, path, copySource, copyDestination, copySource1, copyDestination1, copySource2, copyDestination2,result

Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")

daysBack = 7
Path = "z:\temporary"


listFiles(Path)

for ii = 0 to i-1
 fso.DeleteFile toDelete(ii), true
Next

DeleteFolders(Path)

Set fso = Nothing

'---------------------------------------------

private sub listFiles(folderSpec)
dim file, folder

 For Each file In fso.GetFolder(folderSpec).files
  If (DateValue(file.dateCreated) < DateValue(Now - daysBack)) And (DateValue(file.dateLastModified) < DateValue(Now - daysBack)) Then
   toDelete(i) = file.Path
   i = i + 1
  End If
 Next

 for each folder in fso.GetFolder(folderSpec).SubFolders
  listFiles(folder.path)
 Next

end Sub

Private Sub DeleteFolders(folderSpec)
 Dim folder

 If fso.GetFolder(folderSpec).size = 0 Then
  fso.DeleteFolder(folderSpec)
 End If
 
 On Error Resume Next
 For each folder in fso.GetFolder(folderSpec).SubFolders
  DeleteFolders(folder.path)
 Next
 On Error Goto 0
End Sub 

Sunday, June 17, 2012

Friday, June 15, 2012

BTProximity



BTProximity is an application for Windows Vista and Windows 7 that can detect when your bluetooth-enabled phone has come into range, and unlock your computer.  When the device moves out of range, the computer is automatically locked.  This isn’t a fake lock window, the desktop is actually locked the same as if you pressed Win+L.
http://www.daveamenta.com/btproximity/setup.exe

Friday, May 18, 2012

Belgium eID Card Reader Application

A friend of mine, Tim, asked me to write up a simple application
that's able to read out the Belgium ID cards.

This is what I ended up with...
A few things you need to know:
  • Reference the Interop.EIDLIBCTRLLib.dll
  • Target the x86 platform (the dll only exists in a 32bit flavour)




























eID Reader Binaries
eID Reader Source Code

The actual eID Object : were all the “Magic” Happens…

Friend Class eIDObject

#Region "Events"

    Protected Friend Event Init_Failed()
    Protected Friend Event Exit_Failed()
    Protected Friend Event Finished_InfoRetrieval()

#End Region

#Region "Variables"

    Protected Friend ErrorMessage As String

    Private lHandle As Integer = Nothing
    Private Eidlib1 As New EIDLIBCTRLLib.EIDlib
    Private RetStatus As EIDLIBCTRLLib.RetStatus = Nothing
    Private MapColPicture As New EIDLIBCTRLLib.MapCollection
    Private MapColID As New EIDLIBCTRLLib.MapCollection
    Private MapColAddress As New EIDLIBCTRLLib.MapCollection
    Private CertifCheck As New EIDLIBCTRLLib.CertifCheck

#End Region

#Region "BEID Properties"

#Region "BEID Card Info"

    Private strCardNumber As String
    Protected Friend ReadOnly Property CardNumber() As String
        Get
            Return strCardNumber
        End Get
    End Property

    Private strChipNumber As String
    Protected Friend ReadOnly Property ChipNumber() As String
        Get
            Return strChipNumber
        End Get
    End Property

    Private strIssuingMunicipality As String
    Protected Friend ReadOnly Property IssuingMunicipality() As String
        Get
            Return strIssuingMunicipality
        End Get
    End Property

    'START DATE - INITIAL DATE
    Private dateBeginValidityDate As Date
    Protected Friend ReadOnly Property BeginValidityDate() As Date
        Get
            Return dateBeginValidityDate
        End Get
    End Property

    Private strBegVal As Object

    Private strBegValDag As String
    Protected Friend ReadOnly Property BeginValidityDay() As String
        Get
            Return strBegValDag
        End Get
    End Property

    Private strBegValMaand As String
    Protected Friend ReadOnly Property BeginValidityMonth() As String
        Get
            Return strBegValMaand
        End Get
    End Property

    Private strBegValJaar As String
    Protected Friend ReadOnly Property BeginValidityYear() As String
        Get
            Return strBegValJaar
        End Get
    End Property

    'END DATE - EXPIRE DATE
    Private dateEndValidityDate As Date
    Protected Friend ReadOnly Property EndValidityDate() As Date
        Get
            Return dateEndValidityDate
        End Get
    End Property

    Private strEndVal As Object
    Private strEndValDag As String
    Protected Friend ReadOnly Property EndValidityDay() As String
        Get
            Return strEndValDag
        End Get
    End Property

    Private strEndValMaand As String
    Protected Friend ReadOnly Property EndValidityMonth() As String
        Get
            Return strEndValMaand
        End Get
    End Property

    Private strEndValJaar As String
    Protected Friend ReadOnly Property EndValidityYear() As String
        Get
            Return strEndValJaar
        End Get
    End Property

#End Region

#Region "BEID Person Info"
    Private strName As String
    Protected Friend ReadOnly Property Name() As String
        Get
            Return strName
        End Get
    End Property

    Private strFirstName1 As String
    Protected Friend ReadOnly Property FirstName() As String
        Get
            Return strFirstName1
        End Get
    End Property

    Private strFirstName2 As String
    Protected Friend ReadOnly Property FirstName2() As String
        Get
            Return strFirstName2
        End Get
    End Property

    Private strBirthPlace As String
    Protected Friend ReadOnly Property BirthPlace() As String
        Get
            Return strBirthPlace
        End Get
    End Property

    Private strBirthDate As String
    Protected Friend ReadOnly Property BirthDate() As String
        Get
            Return strBirthDate
        End Get
    End Property

    Private strGender As String
    Protected Friend ReadOnly Property Gender() As String
        Get
            Return strGender
        End Get
    End Property

    Private strNationality As String
    Protected Friend ReadOnly Property Nationality() As String
        Get
            Return strNationality
        End Get
    End Property

    Private strNationalNumber As String
    Protected Friend ReadOnly Property NationalNumber() As String
        Get
            Return strNationalNumber
        End Get
    End Property
#End Region

#Region "BEID Adres Info"
    Private strStreet As String
    Protected Friend ReadOnly Property Street() As String
        Get
            Return strStreet
        End Get
    End Property

    Private strStreetNumber As String
    Protected Friend ReadOnly Property StreetNumber() As String
        Get
            Return strStreetNumber
        End Get
    End Property

    Private strZIPCode As String
    Protected Friend ReadOnly Property ZIPCode() As String
        Get
            Return strZIPCode
        End Get
    End Property

    Private strMunicipality As String
    Protected Friend ReadOnly Property Municipality() As String
        Get
            Return strMunicipality
        End Get
    End Property

#End Region

#Region "BEID Picture Info"

    Private imgPicture As Global.System.Drawing.Image
    Protected Friend ReadOnly Property Picture() As Global.System.Drawing.Image
        Get
            Return imgPicture
        End Get

    End Property

#End Region

#End Region

#Region "Constructor"

    Protected Friend Sub New()
    End Sub

#End Region

#Region "Methods"

    Private Function eID_Init() As Boolean
        Try
            RetStatus = Eidlib1.Init("", 0, 0, lHandle)
            If (RetStatus.GetGeneral = 0) Then
                Return True
            Else
                ErrorMessage = "Unable to initialize eID Reader!"
                RaiseEvent Init_Failed()
                Return False
            End If
        Catch ex As Exception
            ErrorMessage = "Unable to initialize eID Reader!" + vbCrLf + GetErrorInfo(ex)
            RaiseEvent Init_Failed()
            Return False
        End Try
    End Function

    Private Function eID_Exit() As Boolean
        Try
            RetStatus = Eidlib1.Exit()
            Return True
        Catch ex As Exception
            ErrorMessage = "Unable to exit eID Reader!" + vbCrLf + GetErrorInfo(ex)
            RaiseEvent Exit_Failed()
            Return False
        Finally
            'release all objects
            RetStatus = Nothing
            GC.Collect()
            GC.WaitForPendingFinalizers()
        End Try
    End Function

    Protected Friend Function RetrieveInformation() As Boolean
        'reset errormessage
        ErrorMessage = ""
        Try
            If eID_Init() Then
                ' get the info stored on the Belgium eID card & populate the properties
                RetStatus = Eidlib1.GetID(MapColID, CertifCheck)

                'card
                strChipNumber = MapColID.GetValue("ChipNumber")
                strCardNumber = MapColID.GetValue("CardNumber")
                strBegVal = MapColID.GetValue("BeginValidityDate")
                strEndVal = MapColID.GetValue("EndValidityDate")
                strIssuingMunicipality = MapColID.GetValue("IssuingMunicipality")
                '        'Opsplitsen begindatum
                strBegValDag = Microsoft.VisualBasic.Right(strBegVal, 2)
                strBegValMaand = Microsoft.VisualBasic.Mid(strBegVal, 5, 2)
                strBegValJaar = Microsoft.VisualBasic.Left(strBegVal, 4)
                '        'Opsplitsen einddatum
                strEndValDag = Microsoft.VisualBasic.Right(strEndVal, 2)
                strEndValMaand = Microsoft.VisualBasic.Mid(strEndVal, 5, 2)
                strEndValJaar = Microsoft.VisualBasic.Left(strEndVal, 4)
                dateBeginValidityDate = CDate(strBegValDag & "/" & strBegValMaand & "/" & strBegValJaar)
                dateEndValidityDate = CDate(strEndValDag & "/" & strEndValMaand & "/" & strEndValJaar)
                'person
                strName = MapColID.GetValue("Name")
                strFirstName1 = MapColID.GetValue("FirstName1")
                strFirstName2 = MapColID.GetValue("FirstName2")
                strBirthDate = MapColID.GetValue("BirthDate")
                'transform birthdate
                Dim d As String = ""
                Dim m As String = ""
                Dim y As String = ""

                d = Microsoft.VisualBasic.Right(strBirthDate, 2)
                m = Microsoft.VisualBasic.Mid(strBirthDate, 5, 2)
                y = Microsoft.VisualBasic.Left(strBirthDate, 4)
                strBirthDate = CDate(d & "/" & m & "/" & y)
                strBirthPlace = MapColID.GetValue("BirthPlace")
                strGender = MapColID.GetValue("Gender")
                strNationality = UCase(MapColID.GetValue("Nationality"))
                strNationalNumber = MapColID.GetValue("NationalNumber")
                'address
                RetStatus = Eidlib1.GetAddress(MapColAddress, CertifCheck)
                strStreet = Trim(MapColAddress.GetValue("Street")) 'Neerhofstraat 26
                'get street number
                strStreetNumber = strStreet.Substring(strStreet.LastIndexOf(" ") + 1)
                'get street
                strStreet = strStreet.Substring(0, strStreet.LastIndexOf(" "))
                strZIPCode = MapColAddress.GetValue("ZIPCode")
                strMunicipality = MapColAddress.GetValue("Municipality")
                'get picture
                Dim s As IO.MemoryStream = Nothing
                Dim o() As Byte = Nothing
                Dim raw As EIDLIBCTRLLib.Raw = Nothing
                Try
                    Eidlib1.GetRawData(raw)
                    raw.GetPictureData(o)
                    s = New IO.MemoryStream(o)
                    imgPicture = Global.System.Drawing.Image.FromStream(s)
                    s.Dispose()
                    s = Nothing
                Catch ex As Exception
                    ErrorMessage = "Unable to retrieve picture from eID card!" + vbCrLf + GetErrorInfo(ex)
                Finally
                    If Not s Is Nothing Then
                        s.Dispose()
                        s = Nothing
                    End If
                End Try
            Else
                Return False
            End If
            Return True
        Catch ex As Exception
            ErrorMessage = "Unable to retrieve information from eID card!" + vbCrLf + GetErrorInfo(ex)
            Return False
        Finally
            eID_Exit()
            RaiseEvent Finished_InfoRetrieval()
        End Try
    End Function

    Protected Friend Function ExportInformationToFile(ByVal filename As String) As Boolean
        Dim txtwriter As IO.StreamWriter = Nothing
        Try
            If Not String.IsNullOrEmpty(filename) Then

                txtwriter = New IO.StreamWriter(filename)
                txtwriter.WriteLine("CARDNUMBER=" + Me.CardNumber)
                txtwriter.WriteLine("BEGINVALIDITY=" + Me.BeginValidityDate)
                txtwriter.WriteLine("ENDVALIDITY=" + Me.EndValidityDate)
                txtwriter.WriteLine("ISSUINGMUNICIPALITY=" + Me.IssuingMunicipality)
                txtwriter.WriteLine("FIRSTNAME=" + Me.FirstName + IIf(Me.FirstName2 = "", "", " " + Me.FirstName2))
                txtwriter.WriteLine("SURNAME=" + Me.Name)
                txtwriter.WriteLine("GENDER=" + Me.Gender)
                txtwriter.WriteLine("NATIONALITY=" + Me.Nationality)
                txtwriter.WriteLine("BIRTHDATE=" + Me.BirthDate)
                txtwriter.WriteLine("BIRTHPLACE=" + Me.BirthPlace)
                txtwriter.WriteLine("NATIONALNUMBER=" + Me.NationalNumber)
                txtwriter.WriteLine("STREET=" + Me.Street)
                txtwriter.WriteLine("STREETNUMBER=" + Me.StreetNumber)
                txtwriter.WriteLine("ZIP=" + Me.ZIPCode)
                txtwriter.WriteLine("CITY=" + Me.Municipality)
                txtwriter.Close()
                Return True
            Else
                ErrorMessage = "Export Filename is empty!"
                Return False
            End If
        Catch ex As Exception
            ErrorMessage = "Unable to write eID card Information to file : " + filename + GetErrorInfo(ex)
            Return False
        Finally
            If Not txtwriter Is Nothing Then
                txtwriter.Dispose()
                txtwriter = Nothing
            End If
        End Try
    End Function

    Protected Friend Function ExportPictureToFile(ByVal filename As String) As Boolean
        Try
            If Not Me.Picture Is Nothing Then
                Me.Picture.Save(filename, Drawing.Imaging.ImageFormat.Jpeg)
                Return True
            Else
                ErrorMessage = "No picture found!"
                Return False
            End If
        Catch ex As Exception
            ErrorMessage = "Unable to export the picture to : " + filename + GetErrorInfo(ex)
            Return False
        End Try
    End Function

#End Region
   
End Class

GetErrorInfo Function VB.NET

Simple & useful Error Reporting Function... Thought I'd share if with you guys :-)

Module mFunctions
    Public Function GetErrorInfo(ByVal ex As Exception) As String
        Dim sb As New System.Text.StringBuilder()
        Dim st As New System.Diagnostics.StackTrace(ex, True)
        Dim FileName As String = ""
        Dim Method As String = ""
        Dim LineNumber As String = ""

        sb.AppendLine("")
        For Each frame As System.Diagnostics.StackFrame In st.GetFrames()
            FileName = frame.GetFileName
            Method = frame.GetMethod().ToString
            LineNumber = frame.GetFileLineNumber
            If FileName <> "" Then sb.AppendLine("Filename : " + FileName)
            If Method <> "" Then sb.AppendLine("Method : " + Method)
            If LineNumber <> "" Then sb.AppendLine("LineN° : " + LineNumber)
        Next
        Return sb.ToString()
    End Function
End Module

Thursday, May 3, 2012

Create Shortcuts using late binding

Simply create a new shortcut using some late binding, instead of having to reference the Windows Scripting Host : IWshRuntimeLibrary

Usage:
Shortcut.Create_Shortcut(PathtoExecutable, PathToShortcutFolder, ShortCutName,ExecutableFolderPath, Description, "", 0, 0)

 
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic.CompilerServices
Public Class Shortcut
Public Shared Function Create_Shortcut(ByVal Target_Path As String, ByVal Shortcut_Path As String, ByVal Shortcut_Name As String, _
ByVal Working_Directory As String, ByVal Description As String, ByVal Arguments As String, ByVal Window_Style As Integer, ByVal Icon_Num As Integer) As Boolean
Try
Dim objectValue As Object = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell", ""))
Dim objectValue2 As Object = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(objectValue, Nothing, _
"CreateShortcut", New Object() {Shortcut_Path & "\" & Shortcut_Name & ".lnk"}, Nothing, Nothing, Nothing))
NewLateBinding.LateSet(objectValue2, Nothing, "TargetPath", New Object() {Target_Path}, Nothing, Nothing)
NewLateBinding.LateSet(objectValue2, Nothing, "WorkingDirectory", New Object() {Working_Directory}, Nothing, Nothing)
NewLateBinding.LateSet(objectValue2, Nothing, "Arguments", New Object() {Arguments}, Nothing, Nothing)
NewLateBinding.LateSet(objectValue2, Nothing, "WindowStyle", New Object() {Window_Style}, Nothing, Nothing)
NewLateBinding.LateSet(objectValue2, Nothing, "Description", New Object() {Description}, Nothing, Nothing)
NewLateBinding.LateSet(objectValue2, Nothing, "IconLocation", New Object() {Target_Path & "," _
& Conversions.ToString(Icon_Num)}, Nothing, Nothing)
NewLateBinding.LateCall(objectValue2, Nothing, "Save", New Object() {}, Nothing, Nothing, Nothing, True)
Return True
Catch ex As Exception
Return False
End Try
End Function
End Class

A special thanks to Tirthraaj Gobin for comming up with this solution...
http://social.msdn.microsoft.com/Forums/en-US/vbide/thread/126c09a2-6f38-4747-9ddd-55ff977fcba0?prof=required

Wednesday, May 2, 2012

PDF Layer Merger

 

Recently I’ve created a simple .NET tool, to merge 2 PDF files, one as a layer on top of the other.

The reason behind this, was to be able to digitally remark/comment/mark-up on a PDF file using AutoCAD.  People tend to print out a PDF file, use some highlighters and draw some clouds and comments on this PDF, only to re-scan this afterwards.
This is the way we used to work, but today we live in a digital era…

The tool has been built in VB.NET targeting the NET 2.0 framework, with the use of the excellent PDF library iTextSharp (based on iText).

image


Snippet of the actual transformation function:

  
'''
''' Combines two source pdf's to one single pdf.
'''

''' The file-location incl. the name of the original pdf.
''' The file-location incl. the name of the mark-up pdf.
''' The file-location incl. the name of the generated combined pdf.
''' The name which the added mark-up layer will have in the new pdf.
''' The transformation which is executed on the original pdf: rotation, scaleX, scaleY, offsetX, offsetY
''' Return boolean indication whether the combination of the pdf's was successful.
'''
Public Function PDFCombineLayer(ByVal sourceOriginal As String, ByVal sourceMarkup As String, ByVal destination As String, Optional ByVal NewLayer As String = "SOURCE-DRAWING", Optional ByVal Transform As String = "0;1;1;0;0") As Boolean
Dim oPdfOriginal As iTextSharp.text.pdf.PdfReader = Nothing
Dim oPdfMarkup As iTextSharp.text.pdf.PdfReader = Nothing
Dim oPdfStamper As iTextSharp.text.pdf.PdfStamper = Nothing
Dim PDFDirectContent As iTextSharp.text.pdf.PdfContentByte
Dim iNumberOfPages As Integer = Nothing
Dim iPage As Integer = 0
Dim matrix1 As Drawing2D.Matrix = Nothing
Dim matrix2 As Drawing2D.Matrix = Nothing

Try
'Read the source pdf-files and prepare new file.
oPdfOriginal = New iTextSharp.text.pdf.PdfReader(sourceOriginal)
oPdfMarkup = New iTextSharp.text.pdf.PdfReader(sourceMarkup)
oPdfStamper = New iTextSharp.text.pdf.PdfStamper(oPdfMarkup, New IO.FileStream(destination, IO.FileMode.Create, IO.FileAccess.Write))

'Count pages in original pdf and create new pdf wih same amount of pages.
iNumberOfPages = oPdfOriginal.NumberOfPages
oPdfStamper.GetPdfLayers()

'Make transformation matrix
If Transform = "" Then Transform = "0;1;1;0;0" 'Note transform: rotation(degrees), scaleX, scaleY, offsetX, offsetY
Dim ar() As String = Split(Transform, ";")
If Not ar.Length = 5 Then ar = New String() {0, 1, 1, 0, 0}
If ar(1) <= 0 Or ar(2) <= 0 Then Throw New ArgumentOutOfRangeException("transform", "Make sure that scaling factors of the transformation are larger than zero.")
matrix1 = New Drawing2D.Matrix
matrix1.Rotate(-CSng(ar(0)))
matrix1.Scale(CSng(ar(1)), CSng(ar(2)))
matrix1.Translate(CSng(ar(3)), CSng(ar(4)))
matrix2 = New Drawing2D.Matrix

'Add the new layer to each of the pdf-pages.
If NewLayer = "" Then NewLayer = "SOURCE-DRAWING"
Dim PDFNewLayer As New iTextSharp.text.pdf.PdfLayer(NewLayer, oPdfStamper.Writer)
Dim PDFLayerMem As New iTextSharp.text.pdf.PdfLayerMembership(oPdfStamper.Writer)
PDFLayerMem.AddMember(PDFNewLayer)
Do While (iPage < iNumberOfPages)
'Get new page
iPage += 1
Dim iPageOriginal As iTextSharp.text.pdf.PdfImportedPage = oPdfStamper.Writer.GetImportedPage(oPdfOriginal, iPage)
PDFDirectContent = oPdfStamper.GetUnderContent(iPage) 'add page under existing pdf in new layer
matrix2 = matrix1.Clone 'Cloning is necessary, otherwise all adaptations to matrix2 are also done in matrix1.

'Compensate for the orientation of the original pdf-file.
Dim iRotation As Single = oPdfOriginal.GetPageRotation(iPage)
Select Case iRotation
Case Is = 90
matrix2.Rotate(-iRotation)
matrix2.Translate(-oPdfOriginal.GetPageSize(iPage).Width, 0)
Case Is = 180 'Not tested yet.
matrix2.Rotate(-iRotation)
matrix2.Translate(-oPdfOriginal.GetPageSize(iPage).Width, -oPdfOriginal.GetPageSize(iPage).Height)
Case Is = 270 'Not tested yet.
matrix2.Rotate(-iRotation)
matrix2.Translate(0, oPdfOriginal.GetPageSize(iPage).Height)
Case Else
End Select

'Add the new layer ot this page.
PDFDirectContent.BeginLayer(PDFNewLayer)
PDFDirectContent.AddTemplate(iPageOriginal, matrix2)
PDFDirectContent.EndLayer()
Loop
oPdfStamper.SetFullCompression()
Return True
Catch ex As Exception
Return False
Finally
oPdfMarkup.Close()
oPdfOriginal.Close()
oPdfStamper.Close()
matrix1.Dispose()
matrix2.Dispose()
End Try
End Function

Code has been posted on Google Code http://code.google.com/p/pdflayermerger/


Many thanks to iText for the excellent library and to Lukasz Swiatkowski for the glass button component (http://www.codeproject.com/Articles/17695/Creating-a-Glass-Button-using-GDI).

Thursday, April 26, 2012

Apple is 10 years behind Microsoft when it comes to security. Time to face the music…

 

http://malware.cbronline.com/news/apple-10-years-behind-microsoft-on-security-kaspersky-250412

Credits goto Steve Evans & CBR Online
http://malware.cbronline.com/archive/4294941974

It seems it’s time to face the music for Apple..

Kaspersky founder and CEO Eugene Kaspersky,
speaking exclusively to CBR at Info Security 2012, Kaspersky told us that Apple is a long way behind Microsoft when it comes to security and will have to change the ways it approaches updates following the recent malware attacks.

"I think they are ten years behind Microsoft in terms of security," Kaspersky told CBR. "For many years I've been saying that from a security point of view there is no big difference between Mac and Windows. It's always been possible to develop Mac malware, but this one was a bit different. For example it was asking questions about being installed on the system and, using vulnerabilities, it was able to get to the user mode without any alarms."

Kaspersky added that his company is seeing more and more malware aimed at Macs, which is unsurprising given the huge number of devices being sold. Its most recent quarter revealed Mac sales of 4 million, a 7% rise on the year ago quarter. These figures are still dwarfed by PC sales of course, and Kaspersky said Windows will remain the primary target for cyber criminals.

However he added an increase in Mac malware was, "just a question of time and market share. Cyber criminals have now recognised that Mac is an interesting area. Now we have more, it's not just Flashback or Flashfake. Welcome to Microsoft's world, Mac. It's full of malware."

"Apple is now entering the same world as Microsoft has been in for more than 10 years: updates, security patches and so on," he added. "We now expect to see more and more because cyber criminals learn from success and this was the first successful one."

Tuesday, April 17, 2012

Springpad : Make your live easier

Springpad helps you share & discover with the people you trust.

Create notebooks for recipes, books, movies or anything else that matters to you, together with friends, family and co-workers. Save ideas and info from anywhere, access them whenever, and start getting more from life.
Get Started



Collaborate with your friends and family.



Start a notebook for any interest, any project, any “I’ve got to do this!” list. Then invite the right people to help with each one – your foodie friends, your book club buddies, your mom – anyone! Comment on each other’s contributions and build something great together.


Save anything to Springpad, from anywhere.

Fill your Springpads with things you find on the web or on the go. Clip an article, snap a photo, scan a product barcode, record a voice memo, or save a place nearby. Then access it anytime, anywhere you need it.


Whatever you save, we’ll make even better.

Add something to your Springpad, and we’ll instantly enhance it with more information. Save a restaurant and we’ll give you a map and reviews. Save a movie, and we’ll give you the showtimes near you. Save a book, and we’ll link you to where you can buy it. Save a product, we’ll tell you when there’s a price drop. Get the idea?




Monday, April 16, 2012

Chronology of Programming Languages

Found a nice article check it out : The Semicolon Wars » American Scientist





A chronology of selected programming languages shows a few of the links between them. The diagram is not a genealogy but merely indicates major patterns of influence. The classification of languages as imperative, functional, object-oriented or declarative is also approximate; only a few "pure" languages belong exclusively to one of these categories. The chronology is based in part on time lines constructed by Éric Lévénez and by Pascal Rigaux and on information from the Association for Computing Machinery History of Programming Languages conferences.
Brian Hayes