Tuesday, July 13, 2010

Auto Draft

Thursday, July 8, 2010

Check Internet Connectivity

How to check is your PC/ Server is connected to the internet.... there are more than one ways to do that - using wininet.dll, calling for DNS resolution, pinging a internet server, calling a web page and checking for response status and as I wanted to be sure that client is able to reach my server so put them all together.

Friday, July 2, 2010

Multithreaded Singleton in C#

Many a times you run into scenario where only one instance of a class should be created in your application. If you need to know more about Singleton pattern, this article "Singleton pattern" provides good reading. There are quite a few ways to implement this (singleton) but after doing some search on the net found this one to be best for my case.

Tuesday, June 29, 2010

Get Unix Time/ POSIX Time in c#

Recently needed to convert the time into Unix format in C#. Since the Unix time format is basically a count of the seconds passed since 1/1/1970 (Unix epoch), this can be easily done using the DateTime object.


int unixTime = (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;


If you are trying to convert some other DateTime value to POSIX time, make sure that it is first converted to UTC.

Error creating Virtual Port in 64bit Vista/ Windows 7 GPSGate

If you getting error 1275 while creating virtual port for GPSGate in Vista/ Windows 7 64 bit, here is the fix from their forums..

If you use 64-bit Vista or Windows 7 please follow those steps.
(If you are unsure, simply install GpsGate normally first, if Virtual ports does not work - follow those steps)

Casting int or string to Enum

Quick note to myself :D

From a string:

MyEnum foo = (MyEnum) Enum.Parse(typeof(MyEnum), yourString);


From an int:

MyEnum foo = (MyEnum) yourInt;

Monday, June 28, 2010

Windows 7 - "New txt file" missing from right click menu

Few days back realized that somehow I managed to loose the "New txt file" option in the context menu 8O . To fix this

1. Download the fix file given below. (Use Right-click – Save as option in your browser to download the file.)

Saturday, June 19, 2010

You cannot debug this SWF because it does not contain ActionScript

Upgrading from Flash CS4 to CS5 ran into great wall of china again 8O .. really man.. I know web is full of posts from people running into this problem then why the hell can't Adobe just make the error message a little less misleading :roll: ... most common reason for this is the code behind is so big that the compiler is running out of memory while compiling the movie.

Font Embedding in Flash CS5

Flash CS5 introduces a new way of emebdding fonts and unfortunately it breaks the older way of embedding fonts :( . The older way of embedding fonts which can be found here , does not work anymore for Flash IDE projects though that will still work for pure AS3 projects. I was using this method only in my project but as soon as I upgraded to flash CS5, text disappeared in my compiled movie. Googling pointed me to these two:

Wednesday, February 10, 2010

Embedding font family in AS3

While trying to embed font in AS3 ran into problem. I was trying to embed MyriadPro font into my AS3 application and got error "exception during transcoding: Font for alias 'MyriadPro' with plain weight and style was not found at: file" and like always Googling provided the solution.

Tuesday, January 19, 2010

How to make sure your emails dont land in SPAM folder

One of the biggest problems with our clients is to ensure that the legitimate emails they send out to their users/ customers do not end up in the SPAM folder. To ensure that as a website administrator you need to follow the bext practices guidelines provided by Yahoo and Google.

http://mail.google.com/support/bin/answer.py?hl=en&answer=81126

http://help.yahoo.com/l/us/yahoo/mail/postmaster/basics/basics-55.html;_ylt=Ahc6x60yB8n8JzvfVztu4QsIJHdG

URL file-access is disabled in the server configuration

One of my PHP app used to send out SMS alerts using HTTP based SMS Gateway. Everything was working fine till last week when the SMS stopped coming. On running a stand alone PHP page using the same function to send SMS as the page in the application, got this error -

"Warning: fopen(): URL file-access is disabled in the server configuration"

PHP 5.3 and MySQL timeouts

On my dev machine, WinXP SP3, I had PHP 5.2 configured with IIS 5.1 and MySQL 5. Recently upgraded to PHP 5.3  and whooops.. most of my applications stop working.. :?  first the ISAPI was discontinued so I had to go the FastCGI way but for some reason I just could not make it work. The browser will just offer me to download/ save the file. As I was in a hurry I thought $#@*& IIS, lets try Apache. Installed and configured Apache with PHP and the phpinfo page works fine but pages with MySQL connection will still not load... after wasting sometime trying to figure out what was wrong, went to the doorstep of all knowing Google.. and found this

Friday, January 1, 2010

Mime Type

Many a times I need to lookup the correct Mime type so for reference purpose, below is a list:

Mime Types By File Extension

Tuesday, November 17, 2009

5005: Unknown error optimizing byte code

Recently while working with a large AIR project i ran into this problem. Every now and then all of a sudden, I will start getting this error while compiling the project :
"5005: Unknown error optimizing byte code"

Now as if MS was not enough with their cryptic messages everytime there was a problem with Windows, Adobe also came up with this gem of concept :x .

Friday, March 20, 2009

Develop in JDK1.5, deploy on 1.4 :-)


You must be wondering why the hell would I want to do that and why not just develop in 1.4? Well, for one, may be you want to use the new features of JDK1.5 but some of the customer for some reason still stuck with JDK1.4 or like in my case, due to some stupidity on our client's part that he bought license to an older version of the application server (yes, it was Websphere) which does not support 1.5 and rest of the stupidity on our part that we just assumed that the application server will be supporting 1.5.



We kept on developing the application and giving demos to the client on our server and when it came to deployment only then we realized that we are in one big soup. And as always Google to the rescue, which helped me find an open source solution Retroweaver  which operates by transforming Java class files compiled by a 1.5 compiler into version 1.4 class files which can then be run on any 1.4 virtual machine.



For more details follow the link. Hope this helps Batting Eyelashes

Wednesday, January 28, 2009

Problem Installing Windows CE 6 Platform Builder SP1

While installing Windows CE 6 Platform Builder, I ran into a problem. When I tried to install the SP1, it gave an error saying that I need to have CS 2005, VS 2005 SP1 and Windows CE6 installed. This seemed kind of funny as I had already all three installed. Googling led me to a thread where someone mentioned that installing Windows CE 6, breaks something in the VS 2005 SP1 and reinstalling SP1 should fix it. Tried that and after an agonizing 30 minutes, when I ran the PB SP1 again, no more error message.

Tuesday, January 13, 2009

Reset MySql root password


Well, it had been quite sometime since I used MySql and then for some demo I had to. But, the problem was that I had forgotten the password and googling for help told me that I am not the only stupid in this universe Embarassed. Well here is the solution to the problem:





  1. Stop your MySql service.




  2. Open and command window.




  3. cd to the MySql bin directory (if the MySql bin is not added to your path).




  4. Now run this command
    mysqld-nt.exe --skip-grant-tables &




  5. Now open another command window and if required again cd to the MySql bin window and run this command
    mysql -u root mysql




  6. In MySQL command line prompt run the following commands:
    UPDATE user SET password=PASSWORD("password1234") WHERE user="root";
    FLUSH PRIVILEGES;




  7. Yippe... the root password is reset to "password1234" and MySQL will now
    know the privileges and you'll be able to login with your new password.





 Of course this set of instruction is for Windows and MySQL 5. For Linux, I guess (am not sure, so please look around in the mysql bin directory for correct file name), the command in step 4 will change to "mysqld_safe --skip-grant-tables &" (based of googled results). Rest I believe should be same. In case someone I missed something or you have instruction for other OS/ mysql versions, let me know, will be happy to update it.



 

Center align site layout using CSS


Recently I began creating 100% CSS layouts, and faced a lot of problems in getting the content to be centered in both IE and FF. After lot of googling, the final working css is :


LiveCycle Form Designer quits on opening a dynamic form


A weird solution to a weird problem. My LiveCycle Designer was working fine and then all of a sudden, it started quitting the moment a dynamic form was opened. The error message was standard application crash one saying



"Adobe LiveCycle Designer ES has encountered a problem and needs to close. We are sorry for the inconvenience."



 Googling led to the Adobe forums and there found this solution - Delete the folder "Designer" residing in your User folder "Appplication Data\Adobe". Usually that should be "C:\Documents and Settings\YOUR USER NAME\Application Data\Adobe". Just delete the folder names "Designer" and when you start the LiveCycle Designer, it will be created again and this time there should be no problem opening a form. Apparently this may also be caused if you have SQL 2008 installed on your system. If thats is the problem in your case, follw this link



http://www.adobe.com/go/kb407823