Thursday, November 26, 2009

JavaScript - Get yesterday Date

Get the yesterday Date by using Javascript

var today = new Date(); // Get today date.
today.setDate(today.getDate() - 1); // Get yesterday date.
var date = today.getDate(); // Get the numerical date
var year = today.getYear(); // Get the year
var month = today.getMonth()+1; // Get the monthvar yesterdayDate = month+'/'+date+'/'+year;

Thursday, November 19, 2009

Using Hashtable in 2.0 framework

New warning in .net 2.0 framework. The cumbersome, and difficult to remember case-insensitive comparer declaration for the hashtable has been deprecated.
It tells me to use IEqualityComparer instead.

So, this syntax is obsolete:
New Hashtable(New CaseInsensitiveHashCodeProvider, NewCaseInsensitiveComparer)

So, the replacement seems to:
New Hashtable(StringComparer.OrdinalIgnoreCase)

Saturday, October 10, 2009

Placing AJAX UpdateProgress Dynamically

If you're using AJAX UpdateProgress control, you may find it difficuilt to set the best position where you should put it on the page, because user will not see it if he scrolls down (or up) from it. Here is a simple solution which will make your UpdateProgress more user-friendly, because it will set the position on the screen according to user's movement of the mouse. And you will prevent user to click on any button until the postback finishes execution.

here is the code

<script type="text/javascript">
    function SetProgressPosition(e)
      var posx = 0;
      var posy = 0;
       if (!e) var e = window.event;
       if (e.pageX ||  e.pageY)
          posx = e.pageX;
          posy = e.pageY;
    else if (e.clientX || e.clientY)
         posx = e.clientX + document.documentElement.scrollLeft;
         posy = e.clientY + document.documentElement.scrollTop;
    document.getElementById('divProgress').style.left = posx - 8 + "px";
    document.getElementById('divProgress') = posy - 8 + "px";

<body onmousemove="SetProgressPosition(event)">
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100">
   <div class="overlay" id="divProgress">
        Please wait...
      <br />
         <asp:Image GenerateEmptyAlternateText="true" ID="Image1" runat="server" ImageUrl="~/ajax-loader.gif" Style="margin-top: 7px;" />

As you can see, most important part is javascript which is responsible for the movement of the UpdateProgress. That javascript is triggered with the "onmousemove" part of the body tag. In order to set UpdateProgress style, use this styel sheet:
 border: black 1px solid;
 padding: 5px;
 z-index: 100;
 width: 100px;
 position: absolute;
 background-color: #fff;
-moz-opacity: 0.75;
 opacity: 0.75;
 filter: alpha(opacity=75);
 font-family: Tahoma;
 font-size: 11px;
 font-weight: bold;
 text-align: center;

As you can see, there is a part which makes UpdateProgress semi-transparent, which will make it look even better.

And that's all, very simple, but very effective!
 Code in Action

Wednesday, September 23, 2009

How to Change your Office 2007 Product Key:

How to Change your Office 2007 Product Key:
Are you looking to change a Microsoft Office 2007 product license key, serial number or CD key? One common method used to change the product key for 2007 Microsoft Office programs or suites is to uninstall or remove Microsoft Office and then reinstall the program. Another approach is to edit your registry, reset and change the product serial key without uninstalling and reinstalling 2007 Office system suites.

1. Click Start -> Run
2. Type regedit in the box and click OK
3. Navigate to the following path:
HKEY_LOCAL_MACHINE \Software\Microsoft\Office\12.0\Registration
Within Registration, there is subkey that may resemble the following:
4. Under Registration, you might find several subkeys that contain a combination of alphanumeric characters. Each key is specific to a program installed on your computer.Open each subkey to view and identify the Office product version by the ProductName registry entry in the right pane. For example:
ProductName=Microsoft Office Professional Plus 2007
6. Once you have located the subkey that contains the Office product you wish to change the license key for, delete the following registry entries by right clicking on the registry entry in the subkey, click Delete, and select Yes:
7. Close regedit
8. Start Microsoft Word, Excel, Outlook or another Office application. Office 2007 should now prompt you to enter a new 25 character product key
Enter a valid product key, and click OK
9. If prompted to choose your preferred type of Microsoft Office 2007 installation, select Install Now
10. Microsoft Office 2007 should now be updated with your new CD key

Sunday, February 8, 2009

How to get Offline Google Map on your mobile.

Here's a tutorial which will guide you that how to get Google Map Offline on you Java Enabled phone. This works in most of the SE phones which have Java MIDP 2.0. While writing i assume that you are already familiar with Installing games, applications and transferring files to your phone from the PC.

You Need:
A PC with internet connection.
Windows XP/Vista (not tried with others)
USB Chord of your SE phone.

Step 1:
You need the application of Mini-Google-Maps (mgmaps for short)


Choose "Stable (v1.3x)" and platform "Generic"
Click on [jar] as we are going to use SE mobile phones, [jad] file is not required. You will now be asked to save the file. Please save it on your desktop (makes things easier )

Step 2:
Now we need the map "tiles" which comprise the maps used by mgmaps.
To download these, and a custom area map, you need a tool called gMapMaker. (You need MS .NET Framework v2.0 to run gMapMaker)


Step 3:

Now we need to create a map file for a custom area.
Go here and use the tool to create a ".map" file. Save this to your desktop too.


1. Find the area that You want to get a map of.
2. Draw a line around the area that You want mapped, by placing markers around in sequence. A single click places a marker, a click on a marker removes it. It is also possible to drag markers around after they have been placed.
3. Specify zoom levels, map type, and detail level. WARNING: The maximum detail level can freeze Your browser for upto 5 minutes, depending on the complexity of the shape and other factors.
4. Press the "Generate!" button. Wait for the script to generate everything. As a side note, Mozilla Firefox does the processing much much faster than IE does.

Be careful and do not select a huge map size. Also select a modest zoom level. Level 17 is not needed, it will just clog up your memory.

Step 4:

Now open gMapMaker.
You should see something like this (the fields may differ)
In "operating mode" select "MGMaps mode use a .map file"
Click on "Go.." You will now be asked for the .map file which was saved on the desktop. Select it. gMapMaker will now download the tiles of your map. Please be patient, this can take a while.

Step 5:

A folder should be created in "C:/Program Files/gMapMaker"(Windows XP) Or "C:/Desktop" (Windows Vista)

It will contain another folder "MGMapsCache". Copy this to your memory card or phone memory (If it has enough space)

Step 6:

Now install the application "mgmaps.jar" in your mobile phone the usual way. Start the application. Go to menu->settings->map browsing
Mark the fields of "Stored Maps" and "Offline mode"
If your maps are inside the phone memory, Put the storage path as "C:/MGMapsCache", or if your maps are in the memory card put it as "E:/MGMapsCache". Select more->save
Restart the application. Press till it shows "Google Maps"
If it does not show even after pressing repeatedly, go to menu->settings->map types. Here you will find something as "Not Available(Google)" Select it and mark "Google Maps"
The maps should now be seen.

Monday, January 26, 2009

How to debrand Sony Ericsson Z750a from AT&T to SE

How to debrand Sony Ericsson Z750a from AT&T to SE

If you have a sony ericsson Z750a from AT&T the probably you are not utilizing its great feature, like it has inbuilt GPS, which AT&T has disable, i don't know why AT&T has disable it as this is the main feature of this cell phone, and even i am surprised to see that Sony Ericsson also does not promote this feature. They not published it as a feature, they have only mentioned this feature of phone in there manual only, and that too in other feature section.....

Any way if you have the Sony Ericsson Z750a from AT&T, i will guide you the step how to debrand.
I have successfully done this fro my phone and got the GPS working great.
Please follows the step (on your own risk)
1. Download and install A2 Up loader and the USB flash drivers that come with it. Do a google search and you will find this.
2. if you have antivirus installed on you machine then they detect this as threat, this is because this software read the boot sector and other file of your cell phone. so temporarily disable the antivirus.
3. Download and install Sony Ericsson Update Service.
4. Use a text editor to create a file named customize_upgrade.xml
All it needs to contain is below – the generic CDA allows SEUS to recognize the phone and will upgrade. I used the 1206-7735 “Custom USA” CDA.

You can use A2_CDA_File_Generator to create this file, a good and recommended option to avoid any thing wrong. This tool is also available on net free.
5. Power off phone, remove battery and then replace it. Leave the phone powered off.
6. Connect the USB cable to the computer, but not the phone.
7. Execute A2 Uploader and select the File System tool
8. Hold down “C” on your phone and plug it into the computer (A2 uploader prompts you to do this).
After A2 Uploader accesses the file system, you can release “C”. Then browse to tpa\preset\custom directory and copy your new xml file there (drag and drop).

10. Quit the file system, then stop and exit A2 uploader and remove phone from computer cable.
Power on the phone to load the new CDA, then power off again.

11. Start up SEUS and browse for the Z750 phone and follow the instructions. You do not need to remove the battery again, but do need to hold down “C” before plugging phone into computer again. Release “C” when prompted and SEUS will do the rest.
Loading the new software takes about 20 minutes.

12. You have the original SE software with GPS activated in your phone.
13. To use GPS go to Location Service (Which was not present in AT&T version). and use Status Info to find you current position (Longitude, latitude) and use inbuilt google map to navigate.

Please not that this will void the warranty of you phone with AT&T. So do on you own risk though the success rate of debrading in near to 99%. i never fail.
Just be sure that you phone is 100% charged before following the debranding procedure.

By above mention step you can customize you phone according to you region/country with local language and capability.

Happy Programming.............

Saturday, January 10, 2009

New Feature in ASP.NET 3.5

Microsoft released ASP.NET 3.5 on November 19, 2007. Along with it, was released Visual Studio 2008. This evolution from ASP.NET 2.0 to ASP.NET 3.5 is quiet gradual. ASP.NET 3.5 uses the same engine as that of ASP.NET 2.0, with some extra features added on top of it. In this article, we will explore the new features added to ASP.NET 3.5. This article assumes that you have been working on ASP.NET 2.0.

In ASP.NET 2.0, ASP.NET AJAX was used as an extension to it. You had to download the extensions and install it. However in ASP.NET 3.5, ASP.NET AJAX is integrated into the .NET Framework, thereby making the process of building cool user interfaces easier and intuitive.
The integration between webparts and the update panel is much smoother. Another noticeable feature is that you can now add ASP.NET AJAX Control Extenders to the toolbox in VS2008. Even though this is an IDE specific feature, however I feel it deserves a mention over here for developers, who had to add extenders using source view earlier. It is also worth noting that Windows Communication Foundation (WCF) now supports JSON along with other standard protocols like SOAP, RSS and POX.

New Controls
The ListView and DataPager are new controls added along with a new datasource control called the LinqDataSource.
The ListView control is quiet flexible and contains features of the Gridview, Datagrid, Repeater and similar list controls available in ASP.NET 2.0. It provides the ability to insert, delete, page (using Data Pager), sort and edit data. However one feature of the ListView control that stands apart, is that it gives you a great amount of flexibility over the markup generated. So you have a complete control on how the data is to be displayed. You can now render your data without using the

tag. You also get a rich set of templates with the ListView control.
DataPager provides paging support to the ListView control. The best advantage is that you need not have to keep it ‘tied’ with the control on which the paging is being done. You can keep it anywhere on the page.
DataPager gives you a consistent way of paging with the controls that support it. Currently only ListView supports it as it implements the IPageableItemContainer. However support is likely to be added to other List controls as well.

LINQ (Language Integrated Query) adds native data querying capability to C# and VB.NET along with the compiler and Intellisense support. LINQ is a component of .NET 3.5. LINQ defines operators that allow you to code your query in a consistent manner over databases, objects and XML. The ASP.NET LinqDataSource control allows you to use LINQ to filter, order and group data before binding to the List controls.

ASP.NET Merge Tool
ASP.NET 3.5 includes a new merge tool (aspnet_merge.exe). This tool lets you combine and manage assemblies created by aspnet_compiler.exe. This tool was available earlier as an add-on.

New Assemblies
The new assemblies that would be of use to ASP.NET 3.5 developers are as follows:
· System.Core.dll - Includes the implementation for LINQ to Objects
· System.Data.Linq.dll - Includes the implementation for LINQ to SQL
· System.Xml.Linq.dll - Includes the implementation for LINQ to XML
· System.Data.DataSetExtensions.dll - Includes the implementation for LINQ to DataSet
· System.Web.Extensions.dll: Includes the implementation for ASP.NET AJAX (new enhancements added) and new web controls as explained earlier.

Important Points
1. ASP.NET 3.5 provides better support to IIS7. IIS7 and ASP.NET 3.5 modules and handlers support unified configuration.
2. You can have multiple versions of ASP.NET on the same machine.
3. For those who are wondering what happened to ASP.NET 3.0, well there isn’t anything called ASP.NET 3.0.
4. VS 2002 worked with ASP.NET 1.0, VS 2003 worked with ASP.NET 1.1, and VS 2005 worked with ASP.NET 2.0. However VS 2008 supports multi-targeting, i.e it works with ASP.NET 2.0, and ASP.NET 3.5.

Related Posts Plugin for WordPress, Blogger...