Tuesday, 4 December 2012

Compare two files using PHP and bash Script :)

Hi Friends,

Need to compare two files and searching for different entries in them. Here is the solution.

Create a new file named cmp.sh and put it in a folder.

uniq temp1 > sort_temp1
sort sort_temp1 > sort1.txt
uniq temp2 > sort_temp2
sort sort_temp2 >> sort1.txt
sort sort1.txt > sort_dup.txt
cat sort_dup.txt | uniq > sort.txt
echo "Elements present in file temp1 not in file temp2"
php index.php 1
echo "Elements present in file temp1 not in file temp2"
php index.php 2

Save it.

Now, we need to create a php file named index.php in same folder.

$handle = @fopen("sort.txt", "r");
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle, 4096);

if($argv[1] == 1)
$handle1 = @fopen("sort_temp1", "r");
if ($handle1) {
$test = 1;
while (!feof($handle1)) {
$buffer1 = fgets($handle1, 4096);
if ($buffer==$buffer1)
$test = 0;
if ($test == 1)
echo $buffer;

if($argv[1] == 2)
$handle2 = @fopen("sort_temp2", "r");
if ($handle2) {
$test = 1;
while (!feof($handle2)) {
$buffer2 = fgets($handle2, 4096);
if ($buffer==$buffer2)
$test = 0;
if ($test == 1)
echo $buffer;


Save the file in same folder. Add your both files need to compare, with the name temp1 and temp2.

Run the cmd.sh script and it will give you the desired result.

Hope it helps.

Aksshay Sharma

Thursday, 22 November 2012

FireFox Troubleshooting | Addon Disappeared | Extension Disabled

Hi Friends,

Last night i was updated my FF to v17 and faced some issues. That addons suddenly disappeared from my list.

So, if you face similar issue you can proceed like this (updating for linux - same goes for windows)

Step 1 - First check your add-on list at about:support if the things are visible there, then just start the firefox into safe mode and try to enable them.

Step 2 - To open firefox in safe mode enter this command in the terminal firefox -safe-mode and it will open firefox in safe mode, and check your extension list. If you are able to do it, then all good else proceed to next step.

Step 3 - Open error console (Ctrl+Shift+J) , and clear all the logs, Now try to open your addon manager.

Step 4 - If the error is caused due to any extension then try to delete it and delete all the files related to extensions, present in your profile (/home/<username>/.mozilla/firefox/<profile-name>/) (extension.ini & extension.sqlite).

Step 5 - Restart the FF. Hope it solves your issue.

Step 6 - If you are still facing the problem, then open about:support , reset your Firefox, the old data will get saved at your desktop.

Step 7 - Now open terminal and enter the command firefox -P and create the new Profile. -P is used to create, delete, rename the firefox profile and start the firefox profile. Copy the content from folder Old Data to New Profile.

Step 8 - Enjoy your Firefox, and do www.mozilla.org/plugincheck/ Plugins check. (recommended by firefox)

Have a nice day.

Aksshay Sharma

Thursday, 15 November 2012

Make bootable USB of Windows 8 using DISKPART command, no 3rd party tool

So you want to make a bootable USB for windows 8, and don't want to use 3rd party tool.

So DISKPART utility is the solution of your problem.

Tools needed :-

1. Windows 8 DVD (Ofcourse, dont ask why :-P)
2. USB Drive (4GB or 8GB)

Steps to follow :-

Step 1 :- Open CMD (command prompt) using administrative privileges.
Step 2 :- Give the command DISKPART.
Step 3 :- Enter LIST DISK command & it will show all the drives present in your PC, hopefully your USB drive, if its working properly.
Step 4 :-Select your SELECT DISK X (Replace X with USB drive number).
Step 5:  Type CLEAN. It will delete all the information present on USB.
Step 6 :-  Enter CREATE PARTITION PRIMARY. For creating primary partition.
Step 7 :-  Enter SELECT PARTITION 1. Selects primary partition created above.
Step 8 :-  Enter FORMAT FS=FAT32 QUICK. Fast format the partition with FAT32 file system. You can skip QUICK, if you have so much of time. :-)
Step 9 :-  Enter ACTIVE. It activates the partition.
Step 10:-  Enter ASSIGN. It will assign drive letter to your USB.
Step 11:-  Enter EXIT. It will make your exit from DISKPART utility.
Step 12:- Insert your Windows 8 DVD in the DVD ROM.

Step 13:-  Now copy the contents, enter XCOPY A: B: /S/E/H/K/C. Replace A with DVD ROM drive letter and B with USB drive letter.
Step 14:-  Type EXIT to  exit from process. Exits copying section.Your USB is done and bootable now.
Step 15:- Go and intall windows 8. :-P

Aksshay Sharma

Tuesday, 13 November 2012

Transfer PDF files from PC to Nokia LUMIA. :-D

Nokia Lumia – Easy, not the easiest :P way to transfer PDF files to your Phone, as there is no option in ZUNE, so its much better ;)
As i was using Nokia Lumia from past few months, and facing difficulties in synchronizing pdf files, I came up with the solution.
Tools required :-
  1. Wifi Connection.
  2. XAMPP (For creating server)
Step 1:- Download and install XAMPP. (Everything is provided there, even how to start it)
Step 2:- Start the XAMPP.
Step 3:- Go to your C:\xampp\htdocs\ and delete all the contents from there.
Step 4:- Create a folder named Nokia-Lumia inside it.
Step 5:- Open cmd & find the IP(a.b.c.d) of your machine.

Step 6:- You are almost done. Copy all the PDF files into the Nokia-Lumia folder (You want to transfer to the phone).
Step 7:- Connect the phone with your wifi connection to the network.
Step 8:- Open Internet Explorer (IE) in your phone.
Step 9:- Go to http://a.b.c.d/Nokia-Lumia/ (in my case it is you will find all your PDF files here, download them with speed of 54 Mbps :-D.
Step 10:- Start reading PDF in your phone.
Step 11:- For uploading, you need PHP script. Message me if required.