Friday, 21 December 2012

Travel Tip: Miles and More, EgyptAir & EgyptAir Plus

Lufthansa Miles and More:
Classes not eligible for Mileage Credit on Egypt Air: 

G - L- N - R- S - T- U - V -W

Egypt Air Plus:
Classes not eligible for earning miles on Egypt Air:

X - I - O - R - N

Tuesday, 18 December 2012

PDUs for maintaining PMP credentials

For me, my best are:
1- PMI Webinars.
2- Working as a practitioner within the profession.
3- Self learning through reading PMI publications.
4- Voluntary work with the PMI CoP(Community of Practice)

Good link from Intel:
"How to Progressively Obtain PDU’s For Your Maintaining Your PMP Credential" by Jeff Hodgkinson

Sunday, 16 December 2012

image/pjpeg vs. image/jpg MIME types

If you got into this nasty issue that IE uploads your jpeg images as pjpeg (progressive jpeg).

My solution was just to ignore it when displaying it, since for instance I was displaying it on an rdlc report which does not support pjpeg

   CASE WHEN U.SignatureContentType = 'image/pjpeg'
       THEN 'image/jpeg' ELSE U.SignatureContentType END SignatureContentType,

Another screaming developer from this issue ;)

Thursday, 13 December 2012

ASP.NET: Display an image from database within rdlc report using Report Viewer

1) Make sure that the image in the DB (MS SQL Server):

FileContentType nvarchar(255)
FileContent varbinary(MAX)

2) Load the dataset with the above columns within your Dataset.

3) Add an "Image" report item to the rdlc report file to display the image:

Please refer to this post if you are having an issue with pjpeg MIME types:

Monday, 10 December 2012

Upload image using ASP.NET and SQL Server

1) Create the below columns:

CREATE TABLE [dbo].[User](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FileName] [nvarchar](max) NULL,
[ContentType] [nvarchar](255) NULL,
[FileContent] [varbinary](max) NULL)

2) Add upload control to your web page:
<asp:FileUpload ID="FileUpload_Image" runat="server"  />

3) Add the following handler class to your project:

FileName: Handler_Image.ashx

<%@ WebHandler Language="VB" Class="Handler_Image" %>

Imports System
Imports System.Web
Imports System.Data

Public Class Handler_Image : Implements IHttpHandler
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        'Byte[] content = GetImageFromDB(id)
        Dim Content() As Byte
        Dim ContentType As String
        Dim oID As Object = context.Request.QueryString("ID")
        Dim oType As Object = context.Request.QueryString("Type")
        If Not IsNothing(oID) And Not IsNothing(oType) Then
            Dim ID As Integer = Convert.ToInt32(oID.ToString())
            Dim Type As Integer = Convert.ToInt32(oType.ToString())            
                    If Not IsNothing(ID) And IsNumeric(ID) Then
                        Dim Dataset_File As DataSet = DBHelper.RunSQLQuery("SELECT FileName, ISNULL(ContentType,'') ContentType ,FileContent FROM [User] WHERE ID=" & ID)
                        If Not IsDBNull(Dataset_File.Tables(0).Rows(0).Item("FileContent")) Then
                            ContentType = Dataset_File.Tables(0).Rows(0).Item("ContentType")
                            Content = Dataset_File.Tables(0).Rows(0).Item("FileContent")
                        End If
                    End If
        End If

        If Not IsNothing(Content) Then
            context.Response.ContentType = "text/plain"
            context.Response.Write("Hello World")
        End If
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Return False
        End Get
    End Property

End Class

4) On Save Event:

If FileUpload_Image.HasFile Then
Dim contentType As String = FileUpload_Image.PostedFile.ContentType

Dim FileName As String = System.IO.Path.GetFileName(

Dim byteArray As Byte() = 

e.Command.Parameters("@FileName").Value = FileName
e.Command.Parameters("@ContentType").Value = contentType
e.Command.Parameters("@FileContent").Value = byteArray
End If

N.B. for pjpeg:

--22nd May, 2013

This is to answer the question of how to display this uploaded image:

<asp:Image ID="Image_Signature" runat="server" Height="100px" Width="200px" ImageUrl='<%# Eval("ID", "Handler_Image.ashx?ID={0}&Type=10&Unique=") + Now().ToString()%>' />

Synchronizing iphone, ipad with multiple computers

So far, I am getting the the same delete message; however, it allows me to sync specific categories like applications and TV Shows and configure my device screens!

Later, I found this article which looks reasonable; however, I did not try it yet!

Sunday, 9 December 2012