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


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



Another screaming developer from this issue ;)
http://www.zigpress.com/2010/01/14/non-standard-imagepjpeg-mimetype-on-ie

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:
http://afsawaf.blogspot.com/2012/12/imagepjpeg-vs-imagejpg-mime-types.html

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.BinaryWrite(Content)
        Else
            context.Response.ContentType = "text/plain"
            context.Response.Write("Hello World")
        End If
        
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            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(

FileUpload_Image.PostedFile.FileName)
Dim byteArray As Byte() = 
FileUpload_Image
.FileBytes

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


N.B. for pjpeg:
http://afsawaf.blogspot.com/2012/12/imagepjpeg-vs-imagejpg-mime-types.html


--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!
http://iphone.pandaapp.com/news/03012012/025110673.shtml

Sunday, 9 December 2012

Wednesday, 28 November 2012

TSQL Insert multiple values using a single insert statement


INSERT INTO TargetTable (Column1, Column2)
SELECT 'Value1', 'Value1'
UNION
SELECT 'Value2', 'Value2'
UNION
SELECT Column1, Column2
FROM SourceTable

Monday, 12 November 2012

ASP.NET: System.Web.HttpException (0x80004005)

Error:
System.Web.HttpException (0x80004005): The URL-encoded form data is not valid. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)


Resolution:
Web.config:

<configuration>
<appSettings>


            <add key="aspnet:MaxHttpCollectionKeys" value="5000" />
            <add key="aspnet:MaxJsonDeserializerMembers" value="5000" />



If ASP.NET 1.1:
Add the following key to the registry:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\1.1.4322.0\MaxHttpCollectionKeys

Value: 5000

Reference:
http://support.microsoft.com/kb/2661403

VS.NET 2003 Error: The project you are trying to open is a Web project. You need to open it by specifying its URL path.

- Create a new webinfo file, for example for the project file: proj.vbproj:
"proj.vbproj.webinfo":
<VisualStudioUNCWeb>
    <Web URLPath = "http://localhost/CAMS/Workflow/proj.vbproj" />
</VisualStudioUNCWeb>

 - Open the solution and "Add Existing project"

Sunday, 11 November 2012

Date validation using JavaScript function


sub isvaliddate {
  my $input = shift;
  if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$!) {
    # At this point, $1 holds the year, $2 the month and $3 the day of the date entered
    if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) {
      return 0; # 31st of a month with 30 days
    } elsif ($3 >= 30 and $2 == 2) {
      return 0; # February 30th or 31st
    } elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100 <> 0 or $1 % 400 == 0))) {
      return 0; # February 29th outside a leap year
    } else {
      return 1; # Valid date
    }
  } else {
    return 0; # Not a date
  }
}



This is an excerpt from another community work.

Execute an application in another security context on Windows

runas /user:test@domain iexplorer.exe

Identifying Active directory group members using TSQL on MS SQL Server

exec master.dbo.xp_logininfo 'DomainName\GroupName','members'

Prerequisites: Requires membership in the sysadmin role for the database server.
Requires EXECUTE permission for this stored procedure within the master database.

P.S.
By experiments, I  noticed that I could enumerate only members for groups to which I belong.

TSQL update sample using Join (Update multiple rows)



Update PA
SET PA.ActionID= A.ID
FROM ActionDates PA
LEFT JOIN Action A ON PA.Action = A.Name
AND PA.PhaseID=A.PhaseID

Saturday, 27 October 2012

Messages stuck in the outbox, not sent even when trying Send All

Delete the .ost file @:
C:\Users\CurrentUsername\AppData\Local\Microsoft\Outlook

N.B.
1- Non-server side data will be deleted, such as previously unsent items in the outbox.
2- All outlook cached items are going to be automatically downloaded which can be as big as 200 or 400 MBs.

Sunday, 21 October 2012

SSRS: Show \ Hide chart gridlines


Right click the axis for which you would like to show\hide the grid-lines:

Context menu will display:
        Show Major Gridlines
        Show Minor Gridlines

Friday, 12 October 2012

Cannot connect Apple Remote Application to iTunes 10.x library on windows 7

Just unplug your computer (Ethernet cable) which contains the library and connect it through the wireless connection! [They really mean it: AirPlay]

The easiest way to overcome the firewall issues is to turn it OFF for "Home or work (private) networks"

Proof:
You won't see the bottom button unless you are connected through WiFi! Didn't I mention AirPlay before?!




Monday, 8 October 2012

Switch SSIS package from 64bit to 32bit


[Connection manager "xxx"] Error: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".


Sunday, 7 October 2012

Execute client side script using server side code


Dim ScriptString As String = "alert();"
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Closing", ScriptString, True)

Thursday, 4 October 2012

Apache: Deny access from certain IP

C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf

<Directory />

   Order Allow,Deny
   Deny         from n.n.n.n
   Allow from All
   AllowOverride All 
</Directory>



Monday, 24 September 2012

SSRS: Page break following a TextBox

Yes, the TextBox should be placed in a rectangle first then its properties has to be updated for placing a page break after that control.

Sunday, 23 September 2012

Optional\Default ASP.NET parameters

Protected Sub DisplayControls( Optional param As Boolean = False)
.
.
.
End Sub



Call DisplayControls(True)


or 

Call DisplayControls(True)

GridView with static images

First: this should not be an image filed!
Second: Template Field



<Columns>
    <asp:TemplateField>
 <ItemTemplate>
  <img src="Images/Application_16.gif" />
 </ItemTemplate>
    </asp:TemplateField>
.
.
.
.
</Columns>

Wednesday, 5 September 2012

Indicators for success as a project manager

Externally: Customer Satisfaction.

Internally: Compliance to Scope, time, cost and quality

Tuesday, 4 September 2012

Compiler Error Message: BC30456: 'Theme' is not a member of ...


Placing an image (element) in front of another on a webpage

If you would like to position an object\element in front of another one, you can use the very handy style property z-index to a higher number

style="z-index:2; position:absolute;"


N.B.: z-index works only on positioned elements

Sunday, 2 September 2012

Regular Expression for date validation

For the format dd/mm/yyyy:

ValidationExpression="^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$"

TSQL Unique Constraint


Samples:

ALTER TABLE [PermissionsRequest] ADD CONSTRAINT UNIQUE_EMail UNIQUE (EMail)

ALTER TABLE [Schedule] ADD CONSTRAINT UNIQUE_Registration UNIQUE ( RoundNo, ClassNo)



Thursday, 30 August 2012

Formatting a FormView data bound string


Instead of:
<asp:Label ID="Label_Age" runat="server" 
Text='<%# Eval("CalculatedAgeMonths") %>' />

Use:
<asp:Label ID="Label_Age" runat="server" 
Text='<%#  ConvertToYearsMonths(Eval("CalculatedAgeMonths")) %>' />


And in your code behind:
Function ConvertToYearsMonths(CurrentMonths As Integer) As String

     Return "in Years!!"

End Function

Microsoft IIS Versions


MS IIS: Microsoft Internet Information Server

XP       = IIS 5.1
Server 2003 = IIS 6
Server 2008 = IIS 7
Windows 7   = IIS 7.5

Microsoft Egypt announces the Windows Server 2012 online global launch! :(


Will that mean that there will be no day off to enjoy the event at a splendid site?!

Virtual Launch events are nice; however, they for sure exclude may opportunities for physical interactions. Getting together semi-formally with x-colleagues in the industry, getting an opportunity to meet the masters of the technology, whom you, might already, are virtually dealing with them on frequent basis in the day-to-day operations.

What about the guys presenting their efforts? They deserve feeling appreciated from the community and looked at with proud from their peers and sub-ordinates.

Algorithms: Banana problem

From an old story about a girl who can pronounce banana; however, she just doesn't know when to stop!

This can be used to describe algorithms with termination problems.

ALV

The term:
A: Application
L: List 
V: Viewer
 A term specially used for reports analyzers.


The product ;)
Apache Log Viewer
http://www.apacheviewer.com/function.php
This is a nice free log analyzer

Wednesday, 29 August 2012

No! Don't accept responsibility without authority

That's actually, one of the highest risk decisions:

Taking a responsibility to deliver a project which involves resources  whom\which you have no official control upon. At time, you can consider yourself working on good will basis! Good luck!

Sunday, 26 August 2012

Difference between SharePoint "View Only" & Read permissions

View Only: Can view all site objects within the application; however, unable to open content within client side applications.
Quote:
"If the document has a server-side file handler available, they can only view the document using the server-side file handler."
UnQuote


Read: View Only + open content within client side applications, such as word documents from Ms Office Word application on the client.



Saturday, 25 August 2012

Installing unsupported HP Laserjet 1010 within Windows 7 x32 or x64

For HP, you have to go to the trade-in program:
http://www.hp.com/united-states/tradein/home_flash.html


Within the community, of course that is not the perfect choice:

Thanks goes for the post by Michael Westphal:

http://h30499.www3.hp.com/t5/Printers-LaserJet/LaserJet-1010-Windows-7-X64-Drivers/td-p/1124953

Steps are:

1) "Install new printer" in Windows control center.
2) "Local printer"
3) "DOT4_001 (Generic IEEE....)"


4) "HP Jaserjet 3055 PCL5"


Done!

Tuesday, 21 August 2012

Calculate Age using TSQL

This is a modified version from the original post by Michael Valentine Jones Yak DBA Kernel 


CREATE function [dbo].[fn_Age](@START_DATE datetime, @END_DATE datetime)
returns  varchar(9) 
as
-- Original version @http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62729
-- Calculates age in years, months and days from @START_DATE through @END_DATE and
-- Returns the age in format YYY MM DD.

-- Years is the number of full years between @START_DATE and @END_DATE.
-- Months is the number of full months since the last full year anniversary.
-- Days is the number of days since the last full month anniversary.
BEGIN
--([dbo].[fn_Age](isnull([DOB],getdate()),getdate()))

declare @AGE varchar(9)

declare @AGE_YEARS int
declare @AGE_MONTHS int
declare @AGE_DAYS int

-- Return null if @START_DATE > @END_DATE
IF @START_DATE > @END_DATE BEGIN RETURN @AGE END

SELECT @AGE_YEARS = AGE_YEARS,
@AGE_MONTHS = AGE_MONTHS,
@AGE_DAYS = datediff(dd, dateadd(mm, AGE_MONTHS, dateadd(yy, AGE_YEARS, START_DATE)),END_DATE)
FROM (SELECT AGE_MONTHS = CASE WHEN AnniversaryThisMonth <= END_DATE
THEN datediff(mm,dateadd(yy,AGE_YEARS,START_DATE),END_DATE)
ELSE datediff(mm,dateadd(yy,AGE_YEARS,START_DATE),END_DATE)-1
END, *
FROM (SELECT AGE_YEARS = CASE WHEN AnniversaryThisYear <= END_DATE
THEN datediff(yy,START_DATE,END_DATE)
ELSE datediff(yy,START_DATE,END_DATE)-1
END, *
FROM (SELECT AnniversaryThisYear = dateadd(yy,datediff(yy,START_DATE,END_DATE),START_DATE),
AnniversaryThisMonth = dateadd(mm,datediff(mm,START_DATE,END_DATE),START_DATE), *
FROM (Select START_DATE = dateadd(dd,datediff(dd, 0, @START_DATE),0), END_DATE = dateadd(dd, datediff(dd, 0, @END_DATE),0)) Temp4
) Temp3
) Temp2
) Temp1

SELECT @AGE = right('000'+convert(varchar(4),@AGE_YEARS),3) + ' ' +
right('00'+convert(varchar(4),@AGE_MONTHS),2) + ' ' +
right('00'+convert(varchar(4),@AGE_DAYS),2)

RETURN @AGE
END

SQL Server Computed column drawback

On creating a computed column using a function, you will no longer be able to alter this function, unless you remove it from the computed column expression.

Otherwise you will get the error message:
Cannot ALTER 'dbo.fn_test' because it is being referenced by object 'Tester'

Saturday, 18 August 2012

outlook.com

The really killer feature from my point of view is editing few office documents online!

Outlook.com

The really killer drawback, if not remedied the earliest is the performance. It requires a lot of tweaking; for example, saving to skydrive  requires a significant amount of time!


Another important but acceptable issue with this revolutionary interface is the lack of most features in the office applications, frankly, I only played for some time with Work and PowerPoint. 

Thursday, 16 August 2012

Sending e-mails with attachments using ASP.NET

Public Shared Sub SendEmail
(ByVal recipientToCsv As String, 
ByVal subject As String, 
ByVal body As String,
Optional ByVal isHtml As Boolean = True, 
Optional ByVal recipientCCCsv As String = "", 
Optional ByVal recipientBCCCsv As String = "", 
Optional ByVal Attachment1_Stream As Stream = Nothing, 
Optional ByVal Attachment1_filename As String = "")

'Create the email object
Dim newEmail As New MailMessage()

' From
newEmail.From = New MailAddress(System.Configuration.ConfigurationManager.AppSettings.Item("AppMailboxAddress"), System.Configuration.ConfigurationManager.AppSettings.Item("AppMailboxAddressName"))

' To
If String.IsNullOrEmpty(recipientToCsv) Then
recipientToCsv = System.Configuration.ConfigurationManager.AppSettings.Item("AppMailboxAddress")
End If
newEmail.To.Add(recipientToCsv)

' CC
If Trim(recipientCCCsv) <> "" Then newEmail.CC.Add(recipientCCCsv)
If Trim(System.Configuration.ConfigurationManager.AppSettings.Item("CCMailboxAddress")) <> "" Then newEmail.CC.Add(System.Configuration.ConfigurationManager.AppSettings.Item("CCMailboxAddress"))

' BCC
If Trim(recipientBCCCsv) <> "" Then newEmail.Bcc.Add(recipientBCCCsv)
If Trim(System.Configuration.ConfigurationManager.AppSettings.Item("BCCMailboxAddress")) <> "" Then newEmail.Bcc.Add(System.Configuration.ConfigurationManager.AppSettings.Item("BCCMailboxAddress"))

' Subject
newEmail.Subject = subject

' Body
newEmail.IsBodyHtml = isHtml
newEmail.Body = body

' Attachment
If Not IsNothing(Attachment1_Stream) Then
   Dim Attachment1 As Attachment = New Attachment(Attachment1_Stream, Attachment1_filename)
   newEmail.Attachments.Add(Attachment1)
End If

'Send the email
Dim smtp As New SmtpClient
smtp.Send(newEmail)

End Sub

Disseminating accountability among sub-ordinates

1) Give them the responsibility.
2) Define the task.
3) Speak it out.
4) Guidance and mentoring on request.

5) Transparent evaluation: Specific performance and attitude resulted in judged outcomes
6) Share finals: Success\Failure

7) Patience: The above steps are not once and for all, they are iterative per task!

Wednesday, 15 August 2012

AJAX Control Toolkit Resizable Control handle disappears behinde Control

Increase X and\or Y offsets:


<ajaxToolkit:ResizableControlExtender ID="ReportViewer_Main_ResizableControlExtender" runat="server" Enabled="True" TargetControlID="ReportViewer_Main" HandleCssClass="HandleHand" HandleOffsetX ="16" HandleOffsetY ="0" MaximumHeight="600" MinimumHeight="600">



Note: Microsoft Report Viewer did not scale well when vertically re-sized, therefore I limited the re-size horizontally!

[OLE DB Source_Access [29]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.


That was an SSIS to transfer data from an Access DB 2007 into SQL Server 2012 using SSIS


[OLE DB Source_Access [29]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.
The AcquireConnection method call to the connection manager XXX"" failed with error code 0xC0209303.
There may be error messages posted before this with more information on why the AcquireConnection method call failed.


SET RUN 64 to False from the project properties:






Tuesday, 14 August 2012

Unable to open an Access .mdb file

This is not the main cause; however, read this strange scenario, you might be another victim:

When I double clicked an .mdb file to open it on my new machine which have MS Office 2010 installed, including Access, it just opened another Office interface rather than Access without any  access features and in the status bar, it was written, "Powered by Microsoft Access".

When I open the Access application from the Start Menu, it initiated the Setup application and configured itself.

Back to the .mdb, when I clicked it, it opened like a charm!!!

Thursday, 9 August 2012

.htaccess case insensitive redirection

RedirectMatch (?i)\/abc http://applications.mysite.com/NewABC

ASP.NET Error: The MaximumValue 150 cannot be less than the MinimumValue 38 of RangeValidator


Just specify the comparison type

Type="Double"  

Manipulate FormView values in the code behind

Instead of:
<asp:Label ID="Label_Age" runat="server" Text='<%# Eval("CalculatedAgeMonths") %>' />

Use:
<asp:Label ID="Label_Age" runat="server" Text='<%# ConvertToYearsMonths(Eval("CalculatedAgeMonths")) %>' />

And in your code behind:

Function ConvertToYearsMonths(CurrentMonths As Integer) As String
     Return "in Years!!"
End Function

Wednesday, 8 August 2012

Can't edit photos copied from iPhone 4S iOS 5 to Windows 7 in Windows Photo viewer

Unfortunately, me too!!

Workaround, right click the photo and click Edit to open it in "Paint" application where you will be able to rotate and save.

Thursday, 2 August 2012

Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider.


Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider. Otherwise, set the EnableSanitization property to false.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider. Otherwise, set the EnableSanitization property to false.




Place the below section just below the openieng of "<configuration>" tag within the file "web.config"


<configSections>
        <sectionGroup name="system.web">
            <section name="sanitizer" requirePermission="false" type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit"/>
        </sectionGroup>
    </configSections>
    <system.web>
        <sanitizer defaultProvider="AntiXssSanitizerProvider">
            <providers>
                <add name="AntiXssSanitizerProvider" type="AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider"></add>
            </providers>
        </sanitizer>
    </system.web>


Anti-XSS can be easily obtained using NuGet. (Similar to previous post for installing AjaxControl Toolkit)

Visual Studio 2010 --> Tools --> Library Package Manager --> Package Manager Console -->
PM> Install-Package AntiXSS

You will get the below error if Anti-XSS is not installed:

Could not load type 'AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider'


Wednesday, 1 August 2012

Easy way to install AjaxControlToolKit for Visual Studio 2010



Now you have new menu item "Library Package Manager" inside "Tools" menu for Visual Studio 2010.
Visual Studio 2010--> Tools --> Library Package Manager


PM> Get-Package -Filter AjaxControlToolkit -ListAvailable
PM> Install-Package AjaxControlToolkit 

If you are behind a proxy, most probably you will be prompt for your account to pass it into downloading the package.

"Downloading..." in Visual Studio Status bar

Successfully installed 'AjaxControlToolkit 4.1.60623'.
Successfully added 'AjaxControlToolkit 4.1.60623' to Source.

References:
http://docs.nuget.org/docs/start-here/using-the-package-manager-console

e.AffectedRows usually returns -1 (SqlDataSource_Inserting)

In your stored procedure, enable the counting:

SET NOCOUNT OFF;


It is ON by Default in the stored procedure template.

SharePoint: Permitting users to edit their list items only

SharePoint List --> Settings --> Advanced Settings:

Tuesday, 31 July 2012

Windows 7 automatic logon

1- cmd.exe
2- Tyep: "control userpasswords2"
3- "Uncheck "Users must enter a user name and password to use this computer"


Note: This option might not be available to computers belonging to domains.


AJAX TabContainer within FormView fails to insert\update data


Unfortunately that is true, you have to transfer the data manually as below:

Protected Sub SqlDataSource_Updating(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource_Patient.Updating

The following is how to reference a TextBox from a TabContainer inside a FormView:
Dim TabContainer_CaseInfo As TabContainer =                        CType(FormView_Main.FindControl("TabContainer_CaseInfo"), TabContainer)

Dim TabPanel_Basic As TabPanel =  
     CType(TabContainer_CaseInfo.FindControl("TabPanel_Basic"), TabPanel)

Dim DOBTextBox As TextBox = CType(TabPanel_Basic.FindControl("DOBTextBox"), TextBox)


More references:
http://stackoverflow.com/questions/969784/ajax-tabcontainer-inside-formview-not-inserting-values

Monday, 30 July 2012

Microsoft IIS Versions


XP  = IIS 5.1
Server 2003 = IIS 6
Server 2008 = IIS 7
Windows 7   = IIS 7.5

Disable line wrap in Visual Studio 2010


Tools -> Options -> Text Editor -> HTML -> Formatting -> Tag Wrapping -> Wrap tags when exceeding specified length (uncheck, or adjust length)

Thursday, 26 July 2012

Accessing host HDD from Remote Desktop Connection


From the guest OS: 
\\tsclient\C

SSMS changing logged in Windows Authentication account

Use the other account to open the SSMS:

1- Open command prompt: cmd.exe
2- 
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE>
runas /netonly /user:DomainName\NewUsername ssms.exe

Monday, 23 July 2012

Failing to extend iOS 5 "Require passcode" value

If you are among those thousands suffering from this same symptom, then you are most probably among the victims of an Exchange mail policy!

My advise would be to head to your Exchange Mail Server Administrator and ....%^&^&**:(...
And report it to Apple in hope they release this silly restriction!


Initially (Before Exchange) that displayed up to 4 hours!!!

Saturday, 21 July 2012

iPad 2 iOS 5 Airplane mode behavior


Both Airplane Mode and WiFi are ON


This turned out to be a very nice feature while on board disabling your mobile line and using the provided WiFi! :)

Thursday, 19 July 2012

Audit Folder\File actions such as copy move

- Administrative Tools --> Local Security Policy --> Local Policies --> Audit Object Access
- Folder\File properties --> Security Tab --> Auditing Tab

Note:
Folder\File can be set only on NTFS drives

Tuesday, 17 July 2012

Error connecting Jabra headset to the cellphone

Plug the headset into power for few seconds.
Turn OFF\ON the Bluetooth after removing the current device from the cellphone list if it exists.
Press the answer/end button until you receive a solid blue light. This may take up to 10 seconds.
Pair, using the device PIN, usually "0000"

Monday, 9 July 2012

Using iTunes behind a proxy frustration

Yes, me too is fed up with the number of times I have to enter the proxy account, even remember password has no value!

iTunes 10.6.3

Monday, 2 July 2012

GridView Delete Confirmation

<asp:GridView ID="GridView_Main" runat="server" ...>
<Columns>
.....

<asp:CommandField ButtonType="Image" DeleteImageUrl="Images/Delete_16.gif" ShowDeleteButton="true" CausesValidation="true" >
<HeaderStyle Width="16px" />
<ItemStyle Width="18px" />
</asp:CommandField>
</Columns>

</asp:GridView>



Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView_Main.RowDataBound
.....

Dim ImagButton_Delete As ImageButton = e.Row.Cells(6).Controls(0)
ImagButton_Delete.OnClientClick = "if (!confirm('Delete?!')) return;"
.....

End Sub

Saturday, 23 June 2012

adding .wmv movie files to iTunes library

As .wmv file format is not natively supported in iTunes, all you need to do is to convert them to .MP4 format.

You can use this so simple free application:
http://www.videora.com

Friday, 22 June 2012

Wow iPad Keyboard tip: Type using thumbs!

Press both letters 'G' and 'H' together
Of course 'G' to the left and 'H' to the right.


And voila, you have the keyboard in two pieces to be able to type using your thumbs!


Wednesday, 20 June 2012

Windows Azure: Welcome to Egypt!

With the first first introduction of Microsoft cloud platform in Egypt in June, I have just started their free-trail after validating my mobile number and credit card. One weird thing to note is that although this trial is free, my credit card was charged 1$!!   For what reason I don't know, I only got an SMS on my mobile with the transaction on completing the subscription.It is worth mentioning that the bill I received in my e-mail included a total: 0$.:)) 


Now, I'm too eager to get my hands wet in the cloud, they have a very nice portal which took me through creating my first website instance in a matter of seconds!


Hope that would turn out to be an enjoyable experience!


You can start your free trial from here:
https://www.windowsazure.com/en-us/pricing/free-trial

Wednesday, 13 June 2012

Visual Studio Load Test not recorded

Make sure to enable the Internet Explorer Add-on:

Microsoft Web Test Recorder 10.0Helper
Web Test Recorder 10.0

Building Visual Studio 2010 Load Test database

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\loadtestresultsrepository.sql

Tuesday, 12 June 2012

Enabling PHP error logging

Within the PHP directory, open php.ini



display_errors = Off (This will redirect the errors from end users)
error_log = "php_error_log .log"


Then restart the Apache server, you should now find the log file within the PHP folder.

Monday, 11 June 2012

Knowing installed Joomla version

That is explicitly available in the Joomla file:

Joomla Root Directory\libraries\joomla\version.php


var $PRODUCT = 'Joomla!';
var $RELEASE = '1.5';
var $DEV_STATUS
var $DEV_LEVEL
var $BUILD
var $CODENAME
 var $RELDATE
var $RELTIME

Difference between PHP VC6 and PHP VC9

VC6: Compiled using Microsoft ver. 6 C++ compiler
VC9: Compiled using Microsoft 2008 C++ compiler

Of course VC9 provides improvements in performance and stability.
http://php.net/manual/en/install.windows.manual.php

However, if you are using Apache 1 or 2, you have to choose VC6.

Saturday, 12 May 2012

Windows 7 Quick Lauch toolbar

Just add a new toolbar in the windows taskbar for the following location:

%appdata%\Microsoft\Internet Explorer\Quick Launch


Another related tip:
My favorite is the locked windows taskbar since it prevents changing the positions of items within the taskbar and resizing it by mistake!


Pre-Windows 7, that was at:

C:\Documents and Settings\myUsername\Application Data\Microsoft\Internet Explorer\Quick Launch

Thursday, 12 April 2012

Hiding Windows live mail to system tray on Windows 7

You have to click the shortcut for the applicationa and from the properties tab, select to run in comptability mode for Windows Vista SP2, this will allow you to find the item "Hide window when minimized" which is missing for Windows 7.

Thanks to the following detailed article:
http://www.howtogeek.com/howto/19438/minimize-windows-live-mail-to-the-system-tray-in-windows-7/

Thursday, 5 April 2012

Uninstalling Windows Live Essentials 2011

After faulty installation...No way I could login to my mailbox or to using MS Messenger!!!
Trials and trials following in troubleshooting this problem, uninstalled and re-installed and wasted hours trying to fix it until I found this simple straightforward article..
Really thanks to the author "Capt.Jack Sparrow", I only added it here as a way of appreciation.


http://www.sevenforums.com/tutorials/102788-windows-live-messenger-manually-uninstall.html

Thursday, 8 March 2012

How to Remove Entries from the Remote Desktop Connection Computer Box

I have just opened the registry "regedit", and opened Find "Terminal Server Client" checking only the checkbox "keys", which will make your search must faster.

Then I removed all the entries I didn't like from the "Default Key", you will find all of them with the following prefix "MRU#".

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default

Have a non- cluttered Remote Desktop Connection experience!

Tuesday, 28 February 2012

Enable errors display on the production server

They following lines in the web.config are the key to finding errors on the production servers.

<!-- Web.Config Configuration File --><configuration>    <system.web>        <customErrors mode="Off"/>    </system.web></configuration>


Caution:
Don't forget to return the mode into "RemoteOnly" immediately after finishing, that can be a real threat to your application if left behind.

Using SSMS with MS Access

The following is the steps to run a SQL statement against MS Access database using SSMS (SQL Server Management Studio)

1) Enable "Ad Hoc Distributed Queries


EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE


2)Use" OpenDataSource"


Select   * 
FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=\\ServerName\FolderName\DBFileName.mdb')...[TableName] AS T


Unfortunately, finally I got:  :'(


OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Cannot open database ''.  It may not be a database that your application recognizes, or the file may be corrupt.".
Msg 7303, Level 16, State 1, Line 2
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


http://connect.microsoft.com/SQLServer/feedback/details/284113/import-excel-data-with-openrowset-on-production-server


Looks like the file should not be open by someone else!!!

Sunday, 5 February 2012

Detecting Access version which created the file

Although it might be so trivial as the title implies; however, it took me really hours deceived that this can be achieved through a straight forward method like looking up the file properties dialog or finding it somewhere on opening this file in the access application.

The outcome for this research was the following windows VB Script for opening an Access file and displaying the original Access version utilized based on a property called FileFormat.


AccessFieVersionDetector.vbs
--------------------------------

' Initialization
ScriptName = "** Access File Version Detector **"
MsgBox "Please select the Access file...", 0, ScriptName

' Input Access file path
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.InitialDir = "c:\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
    MsgBox "Script Error: Please select a file!", 0, ScriptName
    Wscript.Quit
Else
    MsgBox "You selected the file: " & ObjFSO.FileName, 0, ScriptName
End If

' Open Access file specified
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase(ObjFSO.FileName)
CurrentFileFormat = objAccess.CurrentProject.FileFormat

' Display the equivalent Access version utilized to create this file
Select Case CurrentFileFormat
    Case 2
MsgBox "It is Microsoft Access 2", 0, ScriptName
    Case 7
MsgBox "It is Microsoft Access 95", 0, ScriptName
    Case 8
MsgBox "It is Microsoft Access 97" , 0, ScriptName
    Case 9
MsgBox "It is Microsoft Access 2000", 0, ScriptName
    Case 10
MsgBox "It is Microsoft Access 2003", 0, ScriptName
    Case 11
MsgBox "It is Microsoft Access 2007", 0, ScriptName
    Case 12
MsgBox "It is Microsoft Access 2010", 0, ScriptName
    Case 13
MsgBox "Not yet! ;)" + Chr(13) & Chr(10) + "It is Unknown file type!", 0, ScriptName
Case Else
MsgBox "It is unknown file type!"
End Select

Monday, 30 January 2012

SSRS ReportViewer loads endlessly

I would like to share this article, since it really took me more than an hour trying to troubleshoot this issue, going into the backend stored procedure and the data source and setting static parameters till I finally searched online and got into this very comprehensive post which saved my day.

I had just to include the parameters passing between an "IsPostBack" check!!!

MSDN Blogs > Brian Hartman's Report Viewer Blog > Reports Never Stop Loading With VS 2010

Thursday, 26 January 2012

SSRS Local parameters

I have just completed the SSRS course and I got a so nice tip to let the SSRS manage my parameters rather than doing it on the web page and linking them to my data source. It is apparent now that I am using rdlc in the local processing mode.

After serveral trials, it truned out that: "In local processing mode, the ReportViewer control does not provide a parameter input area that you can use to pass values used during data processing. ", http://msdn.microsoft.com/en-us/library/ms345248.aspx

Unfortunately!

Tuesday, 17 January 2012

New day has come!

A very good tip by experience:

Don't try over and over again on a problem when you are tired, just switch over to another task for an adequate time to have your full concentration then return to the initial issue fresh. When you get back and notice how fast the solution blinked in your mind after an organized thinking, you would value how much time you would have wasted if you didn't cut off your trials short for a fresh revissit.

This situation usually happens to me late after a long working day, but a fresh start in the morning usually comes with the solution mich faster!!!

Have a nice day!

Thursday, 12 January 2012

First Post!

This is actually more like a trial test than anything else. Although my profession involves managing websites, applications and portals to be accessible through the Internet to everyone, it is my first time to decide to have a real blog for myself. Nevertheless, I made several trials before but they were only for the sake trying things out from a technical perspective.