Thursday, June 10, 2010

Installing PHP mcrypt extension under Snow Leopard (Mac OS X Version 10.6.3)


Step 1


Enable php in /etc/httpd.conf by uncommenting (remove # at the start of line) the following line


LoadModule php5_module libexec/apache2/libphp5.so


Step 2


a) Download libmcrypt from
http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download

b) Extract the contents to ~/Downloads/libmcrypt-2.5.8

c) In Terminal type the following commands

cd ~/Downloads/libmcrypt-2.5.8/
./configure --disable-posix-threads --enable-static
make
sudo make install


Step 3


a) Download source code of PHP 5.3.0 from
http://us2.php.net/get/php-5.3.0.tar.gz/from/a/mirror

b) Extract the contents to ~/Downloads/php-5.3.0

c) In Terminal type the following commands
cd ~/Downloads/php-5.3.0/ext/mcrypt
phpize
./configure
make
cd modules

sudo cp mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 4


a) Set your default timezone in php.ini located at /etc. Mine is


date.timezone = Asia/Kolkata


b) Enable the mcrypt extension by typing/editing the following in php.ini


extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so


Step 5


Restart apache with the following command in Terminal


sudo apachectl restart


Step 6


1) Test your php installation by creating a test.php file in /Library/WebServer/Documents
with the following contents

<?php
phpinfo();
?>
2) Open a browser and go to http://127.0.0.1/test.php which should
list the version and other details regarding PHP.
You should also see a section with mcrypt details.

Saturday, June 05, 2010

Printing from lpt1 port of legacy DOS application running under Windows XP to a file and converting it to PDF format

Goal
Create PDF files instead of real printing (save some trees) from legacy DOS applications that output to HP's PCL format on lpt1 port

Scenario
  • DOS application prints directly to lpt1 port in HP's PCL format
  • No real printers having PCL capability installed
Procedure for printing to file

  1. Install a PCL capable printer under Windows XP such as HP's LaserJet 6L even though you don't physically have the printer.
  2. Go to Printers and Faxes under Control Panel and select properties of the newly installed printer. Under Ports select FILE: - this will make the printer print to file
  3. Enable sharing on the printer and give it a share name such as HPLJ
  4. Open command prompt and type net use lpt1 \\foobar\hplj (where foobar is your computer's name)
  5. Open command promt, create a test file (for example test.txt) and check if the above is working by giving print test.txt at the promt. A pop-up window will appear asking for file name, give a name such as c:\test.prn and check that the file has been created. If this works, the printing to file is working as expected.

Recap
The above creates a PCL printer that prints to a file and thus it is not necessary to physically have the printer. We redirect all output to lpt1 from the DOS application to this shared printer which then prints it to file.

Procedure for converting the PRN to PDF

Follow the detailed procedure as shown at http://evelands.net/evan/win32gnu09.php but I couldn't get the right-click menu stuff working. So I always use the command pcl2pdf input.prn output.pdf on the command prompt. If you don't want to compile or don't know how to compile you can download the GhostPCL windows binary from http://www.truong.id.au/node/97

Recap
Use Ghostscript and GhostPCL to convert PCL formatted files to PDF. It worked fine even with DOS applications printing complex graphical plots using PCL.

Side Note
If you work exclusively on the DOS OS and don't have networking installed you can downlaod the prindir utility from http://www.simtel.net/product/view/id/49062 to redirect the lpt1 port to a file. I tested with the following command c:\utils\prindir /c - this installs prindir to memory and then redirect lpt1 to file report.prn by c:\utils\prinmod /GET1 /PUT9 /FILE-c:\report.prn (as I put the files under directory utils). Please note that prindir is not a free software, hence I only used it for testing purposes. I don't use it anymore. There are heaps of port capture softwares for DOS but none worked with PCL files as outputed by my legacy DOS application except for prindir. Please note that this procedure will not work with Windows XP or later versions since now the OS doesn't allow direct hardware access to applications. It might work with Windows 95 and Windows 98 but I have not tested it.
How to enable networking in a MS DOS virtual machine running under VMware

Things you need

MS Dos Networking Client:
Download Disk3-1.exe and Disk3-2.exe from ftp://ftp.microsoft.com/bussys/Clients/MSCLIENT and put them each in its own folder. For example, make a folder Disk1 and put Disk3-1.exe in it. Similarly put Disk3-2.exe in a folder called Disk2. Extract the contents by double clicking on each.

Floppy Drive: Copy the extracted files from Disk1 into floppy 1 and Disk2 into floppy 2 (you don't need to copy the Disk3-1.exe and Disk3-2.exe to floppy) . If you don't have a physical floppy drive, no need to despair, just create virtual floppy drives and images using an excellent free software called Virtual Floppy Drive (VFD) for Windows NT platform from http://chitchat.at.infoseek.co.jp/vmware/vfd.html I personally used this to create .flp files which can be used as floppy drive images under VMware. Rest of the instructions will be as per the virtual floppy images Disk1.flp and Disk2.flp

Network Driver:
Download and extract in a floppy or create a virtual floppy image (pcnet.flp) of the AMD PCNet Dos drivers from http://www.amd.com/us-en/assets/content_type/utilities/dos_mslanman.exe

Installation
  1. Boot into MS DOS
  2. Use Disk1.flp as the floppy image and type A:\setup
  3. Follow the prompts for installation and when the Network Adapter List is shown select Advanced Micro Devices AM2100/AM1500T
  4. Select user name, computer name as per your desire
  5. Under Network Configuration delete the default protocol NWLink IPX Compatible Transport and select Microsoft TCP/IP
  6. Select Network Configuration is correct
  7. It will prompt you for the OEM drive disk, at that point select Disk2.flp and continue installation. In the end again the Network Client disk will be asked and you will have to select back Disk1.flp as the floppy image.
  8. After installation remove the floppy images and reboot.
  9. You will get errors regarding NEMM.DOS not found.
  10. Load the pcnet.flp image and copy pcntnd.dos and pcntnd.nif to C:\net (if you installed the networking client in another place, change accordingly).
  11. Change folder to C:\net , open SYSTEM.INI and change netcard=am2100.dos to netcard=pcntnd.dos under section [network drivers]
  12. Open PROTOCOL.INI and change DRIVERNAME=AM2100$ to DRIVERNAME=PCNTND$
  13. Change all occurrences of ms$am2100 to ms$AMD_PCNet and remove ; INTERRUPT=9, ; IOADDRESS=0x300 and ; DMACHANNEL=5 from the originally named [ms$am2100] section in PROTOCOL.INI
  14. You can customise IP and DHCP configuration under section [TCPIP] in PROTOCOL.INI
  15. Reboot and networking should be working
  16. You can map shares using the command net use d: \\computername\sharename

My Setup
VMware Server v2.0.2 running under Ubuntu 8.04.4 LTS
MS DOS v6.22

References

Friday, April 04, 2008

Taare Zameen Par Theme

I have added one more theme to my installer repository http://www.kansara.in/installer.xml
Here is the preview,


As you can see the theme is best when the icons are arranged in 3-lines only, so that the space just above the dock remains free.

If you have any more ideas or suggestions about themes and other stuff, post in the comments section.

Take care,
Incredible India

Thursday, April 03, 2008

Auto configure Vodafone Live for Iphone

Okay, kush and some other person had asked for an app/script that automatically configures vodafone live on the Iphone. I have manged to make it, it can be found on my installer source, http://www.kansara.in/installer.xml.

Instructions to install are same as installing airtel live(click here).

However, I would like to inform you that I do not have a vodafone connection, so I could not test the settings. I have made the app on the basis of the Vodafone live settings i found on the net. I would request someone to install the app and see if it works out(kush, can you give it a try).

These are the settings that the app configures
apn: portalnmms
proxy: 10.10.1.100
port: 9401 (update 14/4/08 - With kush's and Hegde's help I found out that port 8080 does not work for vodafonelive, instead it works with port 9401, so now i have updated the mod to configure port 9401, thanks to Kush and Hegde)

Also, as with Airtel Live, there are two apps for Vodafone Live in the source, one for 1.1.2 and below iphones and the other for 1.1.3 & 1.1.4 iphones. So, Install as per your iphone version.

Take Care,
Incredible India



Tuesday, March 25, 2008

Umaid Bhawan Palace theme

I have also added a theme to my installer repository http://www.kansara.in/installer.xml
Here is the preview,
As you can see the theme is best when the icons are arranged in 3-lines only, so that the space just above the dock remains free.

If you have any more ideas or suggestions about themes and other stuff, post in the comments section.

Take care,
Incredible India

Configure Airtel Live automatically through my installer source, www.kansara.in/installer.xml

After a long hiatus, I post again!!! Also, Please do not use the previous posts as they have all become obsolete and are no longer useful with Iphone firmware versions 1.1.2 and above.

Previously, I have posted ways to manually configure Airtel Live on your Iphones but still I found that those steps were a bit complicated for many people.

So to save all the confusion, I have managed to set up my installer source and it presently has a very small app, 'Airtel Live Edge settings'. This automatically configures Airtel live on your iphone.

Instructions
1. In your installer sources add the source http://www.kansara.in/installer.xml
2. After refreshing sources finish, go to install and you should see the category Incredible India
3. In this you will find two apps, Airtel Live Edge Settings(1.1.2 and below) and Airtel Live Edge Settings(1.1.3 & 1.1.4), install the one according to your iphone firmware.
4. Restart your phone, goto Settings->General->Network->Edge->APN. APN should be airtelfun.com, if it's not manually enter it.
5. You are ready to roll, open safari and open a webpage like www.google.com or live.airtelworld.com

Warning: I have made the app with the best intentions, however if anything goes wrong, I do not take any responsibility.

Also, if you want settings for any other network to be added drop me a comment.

Take Care,
Incredible India

Friday, December 28, 2007

Download mp3 or ringtones directly to your Iphone and sync without using Itunes

Now MNPlight has been released and this is probably amongst the best Iphone applications that has come out till yet.

Goto http://movenplay.gforge.inria.fr/ for installer source and other instructions, do check out the HOWTOS section.

After you have installed it follow the below instructions,

Downloading MP3 Files
1. Switch off the Iphone and then back on, this will enable the MNPlight safari plugin.
2. click the MNP icon, it will launch safari and open the application in it.
3. look for preferences, click it, choose level of expertise greater than 1.
3. go to bottom, there is a section 'Imported links' and below are three small text boxes for Mime-type, Extensions and Description.
4. In the Mime-type, fill in audio/mpeg, in Extensions box, tap in mp3 and in the description box enter any suitable description like mp3 files.
5. press Add, the values will appear below the textboxes, then at the bottom press 'kill safari'
6. Ralaunch safari, goto any mp3 link(Indians with Airtel sims can goto live.airtelworld.com to download mp3 ringtones), as soon as you click the mp3, a green button saying 'download' will appear and clicking it will start the download.


Syncing the files to Ipod database
7. Now that you have downloaded the file, it is saved on the location /var/root/Downloads in the Iphone file system,
8. Now goto to main MNPlight screen and click playlists, in the Import songs section, in the Directory field enter /var/root/Downloads (take care that you enter the first 'D' in 'Downloads' as 'D' and not 'd') and click 'import songs from directory', it will show a screen saying a few things and that the operation was 'Done !'
9. It will put the song in your ipod library and also make a playlist of the latest songs imported, open Ipod, go to playlists and see if the new playlist has been added and listen to the downloaded song.
10. You are done, additionally use the Sendsong program from installer if you want to export the downloaded song as your ringtones.

P.S. I have just provided these steps so that Indian users can download ringtones from the Airtel live website, I absolutely abhor Piracy and am against it. Please do not use the above methods to download mp3s from illegal sources, if you like a song go and buy the original album, this is the only way to show your appreciation to your favorite artists and musicians.

Also I would just love it if apple soon launches the Itunes India store, waiting for it eagerly!!!!

Also do check out this MNPlight app thoroughly as apart from the above things it has a wide range of other features like importing your google calendar to Iphone(though it has a little problems with time-zones right now, am sure they will be soon solved), accessing Iphone filesystem on your computer, sending files between two iphones, listening to online radios and many other things, Simply a truly great app!!! Kudos to the MNPlight team.

Take Care All

Tuesday, December 25, 2007

No Service Curse(NSC) on the Iphone

If you too are one of the unlucky ones like me who got their Iphones from the States and after a few days of normal usage it started displaying 'No Service' aka NSC. If you have tried out all the software solutions like virginizing, downgrading, upgrading and others but are still stuck with NSC, you might want to have a look at this Hackint0sh topic.

I am the guy with the screen name 'nochinta'

PS - Before applying any hardware solutions, try the software solutions at this, this and this page.

Take Care All
Download links for the file required to edit the edge settings [OBSOLETE]

Please Note: This is an old post, now you can configure airtel live automatically by adding my source www.kansara.in/installer.xml to your installer sources, for more info go here [Update: 31/03/2008]

1. Proxy.pac file - here.
Download the file and put in your proxy server settings from instructions given here. If you are already on Airtel Live, no need to edit this file.

2. Preferences.plist.edited file - here. Just Download this file and rename it to preferences.plist and upload to your iphone to the location /private/var/root/Library/Preferences/SystemConfiguration/, no need to make any changes to the file!!!

3. Preferences.plist.original - here. In case you require the original file for some reasons.

Take Care All
A quick tip to make use of the visual voice mail button on the dialer screen

Hey guys,
Now the visual voice mail button right now on our iphones just occupies the dialer space and does nothing. This small tip will help you make use of it. This will enable you to use the voicemail button as a shortcut or a speed dial button to dial a number that you dial very frequently or perhaps you can even use it to call your voice mailbox.

Go to the dialer screen and tap in the following code: *5005*86*YourNumber# (replace YourNumber with the number you want to dial) and press the call button, the rotating disc will appear and voila! Your voicemail button is now activated.

Press the voice mail button and it will begin the call to your favorite number.

Take Care All.