Friday, July 30, 2010

How to load last known good configuration



To get the last known good configuration in Windows 2000/XP as it is booting press and hold your "F8 Key" which should bring up the "Windows Advanced Options Menu", some computers require than instead of press and hold the F8 key, type it continously until you get to the startup menu.
Now all you have to do is use your arrow keys to move to "Last Known Good Configuration" and press your Enter key.

Apache .htaccess file

.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

Default directory page

DirectoryIndex filename.html index.cgi index.pl default.htm


Protect access of .htaccess file


order allow,deny
deny from all


Customized error documents:

ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html


Blocking users by IP

order allow,deny
deny from 123.45.6.7
deny from 012.34.5.
allow from all


Redirects

Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html


Add MIME Types

AddType application/x-shockwave-flash swf


Protec againts hot linking of images and other file types

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]


Preventing Directory Listing

IndexIgnore *
IndexIgnore *.bmp *.gif

Wednesday, July 28, 2010

How to restore archived items


Crete a new folder

In outlook create a new folder where you are going to restore the items from the archived file
  1. Got To Tools
  2. Account Settings
  3. Click on Data Files
  4. Click on New
  5. Select Outlook Personal Folder, then click OK
  6. Specify the physical name of the file and the location

Import the items

Now we will import the items from the archived to the new folder
1.- On the Go menu, click Folder List, and then in the Folder List, click the new folder.
2.- On the File menu, click Import and Export, Click Import from another program or file. Click Next


3.- Click Personal Folder File (.pst). Click Next
4.- In the File to import box, change the default file name in the path from backup.pst to the name of the archive file you're importing from. Click Next



5.- Click the folder to import from. If you want, click Include sub folders or specify the folder you are interesting on. Indicate how you want Outlook to handle duplicate items.



6.- Click Import items into the current folder.
7.- Click Finish.

The items now should be on your new folder.



Thursday, July 22, 2010

Setup Installer For Windows Mobile Applications

SETUP INSTALLER FOR WINDOWS MOBILE APPLICATIONS

The creation of an installer with Visual Studio is simple, requires little coding, and can be done within the existing Visual Studio Solution for your application, this is the path we need to follow:

1. Create a windows mobile application

2. Create a CAB installation file

3. Create a custom action for the installation

4. Create a windows installer setup application

In this tutorial we are going to focus on steps 3 and 4.

I. CREATING A WINDOWS MOBILE APPLICATION

1. On visual studio select: New Project >>Smart Device>>Device Application

2. Add some components to your form

3. Compile the project

II.CREATING A CAB INSTALLATION FILE

Add a new CAB project by right click the solution and select:

Add >> New Project >> Other Project Types >> Setup and Deployment >> Smart Device CAB Project

Right click on the CAB installer project and select: Add >> Project Output


Select your mobile project then from the list select Primary output


Now to add the Programs Folders on the CAB project, on the File System on Target Machine right click it then click on: Add Special Folder>> Programs Folder


Select Programs Folder on the File System tree, then right click on the empty panel at right and select Create New Shortcut


Select Application Folder >> Primary output, then click ok


Now it is time to add a registry key. Click on the Registry Editor button


 
          And add the string value "HKLM\Software\My Company\My App\Version"
          

You need to create the path key by key, and then add the string value on the right panel.


Name it "Version" and then, select it, and enter "1.0" into the Value field on the Properties Window


Build your project and you will have the CAB file by now.


III.CREATING A CUSTOM ACTION

1. On the File menu, point to Add, and then click New Project. Name the new project MyCustomAction.

2. On the Project menu, click Add New Item. In the template list, click Installer Class. Name the new class MyInstallerClass.

3. In the Solution Explorer pane, right-click MyInstallerClass.cs, and then click View Code.

4. In the code window, create a new method called Commit. This method overrides the Commit method of the base Installer class. Use this method to invoke the application manager. The following code example shows the implementation of Commit.


public override void Commit(System.Collections.IDictionary savedState)
{
// Call the Commit method of the base class
base.Commit(savedState);

// Open the registry key containing the path to the Application Manager
Microsoft.Win32.RegistryKey key = null;
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\microsoft\\windows\\currentversion\\app paths\\ceappmgr.exe");

// If the key is not null, then ActiveSync is installed on the user's desktop computer
if (key != null)
{
// Get the path to the Application Manager from the registry value
string appPath = null;
appPath = key.GetValue(null).ToString();

// Get the target directory where the .ini file is installed.
// This is sent from the Setup application
string strIniFilePath = "\"" + Context.Parameters["InstallDirectory"] + "myApp.ini\"";
if (appPath != null)
{
// Now launch the Application Manager
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = appPath;
process.StartInfo.Arguments = strIniFilePath;
process.Start();
}
}
else
{
// No Active Sync - throw a message
}
}


Now you need to add an .ini file

Create a text file in notepad save it as setup.ini and put the next code:




[ceAppManager]
Version = 1.0
Component = SampleApp

[SampleApp]
Description = Sample Application
Uninstall = Pocket App
CabFiles = YourCab.cab




IV. CREATE A WINDOWS INSTALLER SETUP APPLICATION

  1. On the File menu, point to Add, and then click New Project. In the Project Types tree structure, expand the Other Project Types node. In the Templates pane, click Setup Project. Name the project MyAppSetup.
  2. Right-click on the newly created project in Solution Explorer, point to View, and then select File System. The File System window allows you to control where files are installed on the user's computer. For this example, the files are the .cab and .ini files that the Application Manager will use to install the application on the Windows Mobile device.
  3. To add your application's .cab file, right-click on the Application Folder icon, point to Add, and then click Project Output. In the Project list in the Add Project to Output Group window, select MyAppCab, click Built Outputs, and then click OK.
  4. To add the .ini file for your application, right-click Application Folder icon, point to Add, and then click File. Browse to your .ini file, and then click OK.
  5. Right-click the MyAppSetup project icon in Solution Explorer, point to View, and then click Custom Actions. The Custom Actions window allows you to assign custom actions to be executed for different events in the installation.
  6. In the Custom Actions window, right-click the Install icon, and then click Add Custom Action.
  7. In the Select Item in Project window, click on Application Folder, and then click OK. Click the Add Output button. From the Project list in the Add Project to Output Group window, click MyAppCustomAction, click Primary Output, and then click OK twice. For the commit custom action, repeat steps 6 and 7.
  8. In the Custom Actions window, click Primary Output from MyAppCustomAction in the Commit folder area. In the Properties window, enter the following value for the CustomActionData property: /targetdir="[TARGETDIR]\" this passes the directory in which the .cab and .ini files for your application are installed to the custom action.

Compile your project and execute the .exe file created!


Sources:

http://msdn.microsoft.com/en-us/library/bb158529.aspx

http://www.devx.com/wireless/Article/31198/1954

http://www.mobilepractices.com/2008/02/how-to-create-windows-mobile-smart.html

http://www.devx.com/wireless/Article/31198/1954