IIS Silverlight

How to solve Unhandled Error in Silverlight Application Code: 2104

The Problem: You ftp a Silverlight App to an IIS website, go to the website in a browser, and get the following error:

Message: Unhandled Error in Silverlight Application
Code: 2104
Category: InitializeError
Message: Could not download the Silverlight application. Check web server settings

The Cause: The Silverlight Mime types (.xaml, .xap and .xbap) are not listed in that websites registered mime types, therefore IIS will not send those files to the browser.

The Solution: Open IIS on the server, go to HTTP headers, click on Mime Types, click “Add New” and add the following:

Extension – Mime Type
.xaml – application/xaml+xml
.xap – application/x-silverlight-app
.xbap – application/x-ms-xbap

Hit Apply and your application will load!

Code Snippets

Export image to PDF in Silverlight

After a few hours serching a way to put a image into pdf in silverlight, something worked out, here goes:

Libraries used:
Imports silverPDF
Imports PdfSharp.Pdf
Imports PdfSharp.Drawing
Imports iTextSharp.text
Imports ImageTools
Imports ImageTools.IO.Jpeg
Imports ImageTools.ImageBase
Imports ImageTools.Helpers
Imports ImageTools.ImageExtensions

Code snippet (vb):

        Dim d As New SaveFileDialog()
        d.Filter = "PDF file format|*.pdf"
        ' Save the document...
        If d.ShowDialog() = True Then
            Dim document As New PdfDocument()
            Dim page As PdfPage = document.AddPage()
            Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
            Dim img As ImageTools.ImageBase = Me.canvas1.ToImage()
            Dim mstream As New MemoryStream()
            Dim encoder As New JpegEncoder()
            encoder.Encode(img, mstream)
            mstream.Seek(0, SeekOrigin.Begin)
            Dim pdfImg As XImage = XImage.FromStream(mstream)
            gfx.DrawImage(pdfImg, 0, 0)
            document.Save(d.OpenFile())
        End If

CodeSnippet (C#):

SaveFileDialog d = new SaveFileDialog();
d.Filter = "PDF file format|*.pdf";

// Save the document...
if (d.ShowDialog() == true) {
	PdfDocument document = new PdfDocument();
	PdfPage page = document.AddPage();
	XGraphics gfx = XGraphics.FromPdfPage(page);

	ImageTools.ImageBase img = this.canvas1.ToImage();
	MemoryStream mstream = new MemoryStream();
	JpegEncoder encoder = new JpegEncoder();
	encoder.Encode(img, mstream);
	mstream.Seek(0, SeekOrigin.Begin);
	XImage pdfImg = XImage.FromStream(mstream);
	gfx.DrawImage(pdfImg, 0, 0);

	document.Save(d.OpenFile());

}
CSS Web

The Father Of CSS Talks HTML5, CSS3 (A TCTV Interview)

Source Link: http://techcrunch.com/2010/10/16/html5-css-css3-tctv/

Microsoft Outlook

NK2View: View Outlook .NK2 AutoComplete Information

This feature is known as ‘AutoComplete’ and Outlook automatically build this emails list according to user activity and save it into a file with .NK2 extension.

In some circumstances, you may need to repair or modify the values appeared in the AutoComplete list, or you may want to remove unwanted email addresses and/or to add new email addresses. MS-Outlook doesn’t provide any ability to edit this AutoComplete list, so this is where NK2Edit software can help you.

NK2Edit Features:

  • Easily modify or fix all information stored in the NK2 file, including the display name, the email address, the exchange string, the Drop-Down display name, and the search string.
  • Easily remove unwanted single quote characters from the display name and from the Drop-Down list.
  • Delete unwanted emails, as well as add new emails, by typing them manually, or by choosing them from the address book of Outlook.
  • Copy NK2 records from one NK2 file to another – simply by copy and paste !
  • Build a completely new NK2 file and add the desired emails into it, by typing them manually, by adding them from your address book, or by copying records from another NK2 file.
  • Extract data from corrupted NK2 files that Outlook cannot read anymore (When Outlook AutoComplete stopped working) and even repair them so Outlook will be able to read them again.
  • Export all data stored in the NK2 file into a special Unicode text file in a stucture similar to .ini file of Windows. You can open it any text editor you like, make the changes you need, and then convert it back into NK2 file that Outlook can use.
  • Export the emails information stored inside NK2 file into HTML/Text/csv/xml file.
  • Export the emails information stored inside NK2 file directly into the contacts of Outlook.
  • Copy the selected NK2 records in tab-delimited format and then paste the information into Excel.
  • Change the order of the records in the NK2 file, which also affects the order they appear in the drop-down. You can also sort the list in alphabetical order of the Drop-Down display names.
  • Command-Line Support: Write simple scripts that can add, remove, or modify records inside the NK2 file, without displaying any user interface.
  • NK2Edit is a portable application that can be used from any computer with Windows operating system (Starting from Windows 2000) without need of any installation process, and without making changes in the Registry.
  • NK2 Control Center – Allows you to watch to location and the status of all NK2 files in your organization.

http://www.nirsoft.net/utils/outlook_nk2_edit.html

nk2edit


.NET Microsoft

Register .Net Framework 4.0 in IIS

Check your .Net framework location , usually is

C:\Windows\Microsoft.NET\Framework\v4.0.30319

you can put this in a batch file ( “iisreg_fx4.bat” ):

REM "Changing to the Framework install directory"
cd /d C:\Windows\Microsoft.NET\Framework\v4.0.30319
echo "Stopping IIS"
iisreset /stop
rem regiis
aspnet_regiis -i
echo "Restarting IIS"
iisreset /start
echo "----------------------"
pause
ArcGIS

How to disable Server Security in ArcGIS Server 9.3

arcgisserversecurity1Find the file: arcGisServer/System/Server/server.dat

on ArcGis 10.0 might be in:

C:\Program Files (x86)\ArcGIS\Server10.0\server\system

and change the option to false, restart SOM, on services.

read more »

.NET ASP.Net 2.0 Microsoft

ASP.NET Web Configuration Guidelines

.NET Framework 4

ASP.NET enables you to specify configuration settings that affect all Web applications on a server, that affect only a single application, that affect individual pages, or that affect individual folders in a Web application. You can make configuration settings for features such as compiler options, debugging, user authentication, error-message display, connection strings, and more.

Configuration data is stored in XML files that are named Web.config.

This topic describes the main configuration settings that you can make in the Web.config file. The topic contains the following sections:

read more »

Chrome Google

chrometophone

logo

Google Chrome to Phone Extension is a project consisting of a Chrome Extension, Android App, and supporting AppEngine server that enables users to send links from their Chrome desktop browser to their Android device using Android’s Cloud to Device Messaging service.

Features:

  • Send links to browser
  • Google Maps links launch the Google Maps app.
  • YouTube links launch the YouTube app.
  • Selecting phone numbers in Web pages, launches the dialer with the number pre-populated.
  • Selected text populates the Android clipboard (long-press on text boxes to get paste option).
  • Right click on links and selections.

Update (15th Sep 2010): Chrome to Phone 2.1 is now available on Chrome Extension Gallery and Android Market in multiple countries. If you had a pre-release version installed, please uninstall the old version first (otherwise you will get an error installing the new version).

Note: Android 2.2 required. Chrome to Phone is powered by the Android Cloud to Device Messaging (C2DM) service, which requires Android 2.2 or later. Supports Chrome 6 and above.

http://code.google.com/p/chrometophone/

Security

Worm:W32/Bugbear

Your keyboard has one hour to another to duplicate the accents? This is when you press’ or ~ they come out duplicates? This is a symptom of the virus BugBear, which began to spread over the Internet on September 30.

The BugBear (also called Thanatos) is a virus e-mail with behavior similar to “famous” Klez. That is, when your machine is infected, it begins to send emails from your computer. The big problem is that, like Klez, it “spoofs” the sender, picking a random name from your list of emails. That way, when you receive an email with the virus, possibly the e-mail that is marked as the sender is not the person who is actually sending you the virus. So no point in answering the e-mail saying “your computer is virus.”

The biggest problem is that this virus is a “backdoor”, ie the infected machine as well as send e-mail viruses can be easily accessed by hackers, and your data is completely exposed.

The virus prevents you run an antivirus. If you are unable to open your antivirus, then it may mean that your machine is infected.

Remove viruses from your machine is relatively easy, just delete the files from the virus. The problem is that at the time of infection, the files are created with random names, and therefore we can not know the exact name of the files to be deleted. Anyway, there is the Internet a small utility to remove this virus, which can be downloaded for free at ftp://ftp.f-secure.com/anti-virus/tools/f-bugbr.zip. Just download, unzip with Winzip and run.

If your machine is networked, the virus attempts to spread the network as well. Therefore, if local networks, the entire network must be disconnected before moving antivirus on all machines, because otherwise, you can eliminate the virus from your machine, but if another PC is infected shortly after their PC will be infected again, via the network.

This worm exploits the same bug in Internet Explorer and Outlook that uses the Klez, which means that you do not need to run the attachment (the virus) of a message to your PC being infected. If you install a patch existing security on the Microsoft website at http://www.microsoft.com/windows/ie/downloads/critical/q323759ie/default.asp, your computer will be less vulnerable to viruses from e-mails.
read more »

.NET ASP.Net 2.0

ASP.NET 2.0 – Enter Key – Default Submit Button

One of the most annoying things in developing web pages is handling the “Enter key” for form submission. Enter key has been the favourite way users like to submit forms. Though we provide Buttons to click on, the easiest and intuitive way is that, I can enter some text, make some changes and then hit “Enter” to accomplish my submission.
“Enter” Key is handled in a little tricky way by uplevel browsers like Internet Explorer, when it comes to ASP.NET.

* If there is a single Textbox and single button, then it becomes straight forward, the button is submitted. However, the event code doesnt get executed, though the page postsback.

* If there are two or more, buttons, then it takes up the first button as the default button. However, it still doesnt execute the event handler but just refreshes the page.

You can supress the Enter key event using Javascript. But this would result in other undesirable effects like, any Enter key in the form i.e. within Text Area or basically where large text is entered, would be disabled.

The earlier work around was to associate a javascript function to each Button to verify the that the relevant button is submitted upon Enter key.

ASP.NET 2.0 introduces a wonderful work around for this. By simply specifying the “defaultbutton” property to the ID of the <asp:Button>, whose event you want to fire, your job is done.

The defaultbutton property can be specified at the Form level in the form tag as well as at panel level in the <asp:panel> definition tag. The form level setting is overridden when specified at the panel level, for those controls that are inside the panel.
read more »