How to Install Windows 7 from PenDrive (USB Flash drive)

Leave a comment

Today i’ve to install winodows 7 in my Dell Vostro 3400. I collect a Windows 7′s DVD but some days ago i lost my optical (DVD) drive. So i was thinking to install Windows 7 from USB key. I have seen many sites/blogs that have “Install windows 7 from USB” but either with incomplete steps or not working guide. Luckyly I found two guides, one in English and another in Bangla language. Both guide works for me but no details was there about the commands they instruct to enter. So I rewrite the procedure with more details here.

Requirements:

  1. USB Key/Flash drive (Pen Drive) – Minimum 4 GB, 8 GB recommended
  2. USB Boot supported Motherboard (BIOS)
  3. Windows 7 installation DVD or installation files.
  4. Working Windows 7 Computer to make the Pen drive bootable (optional)

Procedure:
A. Partitioning and Formatting Pen Drive

  1. Enable “USB Boot” feature in your motherboad’s BIOS (if disabled) and set “USB Key” as the first boot device.
  2. Plug-in your USB flash drive to USB port and move all the contents from USB drive to a safe location on your system. Because all the data in the Pen drive will be erased.
  3. Open Command Prompt with administrator rights. Use any of the below methods to open Command Prompt with admin rights.

    *Type cmd in Start menu search box and hit Ctrl+ Shift+ Enter.

    Or

    *Go to Start menu > All programs > Accessories, right click on Command Prompt and select “Run as administrator”.

  4. Type diskpart in command prompt and hit enter. This will initiate a diskpart prompt as DISKPART>
  5. Type list disk and hit enter. This will show a list of disks connected to the computer as Disk 0, Disk 1. From the size of the disk, one can easily find out which disk is the pendrive.
  6. Now type the following commands one by one and hit enter. Be careful, so that all the commands executed successfully.

     select disk # (type the disk number instead of # found at step-5. In my case it was Disk 1. So i replaced # by 1)
     clean
     create partition primary
     select partition 1
     active
     format fs=ntfs
     assign
     exit
    

    In this case, we first select the specified disk (in my case, it was disk 1) and shifts the focus to it, Removes formatting from the disk, Creates a primary partition on the current disk, Selects the specified partition and gives it focus, make it active partition and format in NTFS format. Since the newly created partition does not receive a drive letter, so we use the assign command to assign a drive letter to the partition.

B. Create a Bootable Pen Drive

  1. Create a folder named “Windows7″ in c:/ drive and copy all the installation files of winodws 7 in it.This step is optional, only to avoid annoying directory path changing in command prompt.
  2. In command prompt, type the following commands ony by one and hit enter.
      cd c:/Windows7/boot/
      bootsect.exe /nt60 X: (X is the drive letter of Pendrive)
    

    If the commands executed succefully, a message will be shown “Bootcode was successfully updated on all targeted volumes.”

C. Create a Bootable Pen Drive of Windows 7
Copy all the windows 7′s installation files to the pen drive. Now you are ready to install Windows 7 from pendrive.

Note: At the time of installing windows 7 from Pen Drive, after copying all the files to the system, it restarts the computer. Don’t forget to remove the Pen Drive at this time or change the boot order. Otherwise, whole installation process sratrs again. I faced this problem.

How to customize CKEditor’s Image dialog Window

Leave a comment

I think you already know about CKEditor. If not, you can get details from their site. I only quoted a portion from their site-

CKEditor is a text editor to be used inside web pages. It’s a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.

It’s a JavaScript application. So if you know how to work with JavaScript, you can do anything with this application. However in most cases you don’t need to touch the core. But i had to modify the core and some configurations to meet my application’s requirement. Though it’s a little change, it tooks a lot of effort for me because of my shortage of JavaScript knowledge. I think you know JavaScript better than me. :)

I had to change mainly two things in CKEditor’s Image Dialog winodow. I’ll now share with you how i did these customizations.

1. Removing unused Tabs/Elements (Link tab and Advanced tab):
Sometimes having too many options confuses the users and they may make miskate. So i had to hide unused tabs from Image dialog window.

To remove those tab, first find the tab names. You can find that from CkEditor’s Image dialog’s source code (at ckeditor/_source/plugins/Image/dialogs/Image.js). I find it’s annoying. Better enable CKEditor’s DevTools plugin and hover over the tab/elements of the dialog window; Elements information will be shown.

Now in the default CKEditor’s configuration file, (in my case it was “/ckeditor/config.js”), add the following code:


CKEDITOR.on( 'dialogDefinition', function( ev )
   {
      // Take the dialog name and its definition from the event data.
      var dialogName = ev.data.name;
      var dialogDefinition = ev.data.definition;
 
      // Check if the definition is from the dialog we're
      // interested in (the 'image' dialog). This dialog name found using DevTools plugin
      if ( dialogName == 'image' )
      {
         // Remove the 'Link' and 'Advanced' tabs from the 'Image' dialog.
         dialogDefinition.removeContents( 'link' );
         dialogDefinition.removeContents( 'advanced' );
 
         // Get a reference to the 'Image Info' tab.
         var infoTab = dialogDefinition.getContents( 'info' );
 
         // Remove unnecessary widgets/elements from the 'Image Info' tab.         
         infoTab.remove( 'txtHSpace');
         infoTab.remove( 'txtVSpace');
      }
   });

Here we are listening to the event when CKEditor is on, obtaining the name and definitions of the dialog window, then eliminating entire tabs or elements within them.

I get this idea from CKEditor’s sample page. Only open the html source code of this page, you will get more idea on customization.

Accessing HTML element from CodeFile/ Code Behind page in ASP.NET

Leave a comment

In ASP.NET all HTML elements are treated as text by default. The Parser simply passes them to the client (e.g. Web browser) without processing. So from CodeFile (e.g khaled-info.aspx.cs) we can’t access them.

To make them accessible from CodeFile we need to make them server control by adding an extra attribute runat= “server” to that element. This tells the web server to process the element at page rendering time. The “id” attribute is need to be added to identify the server control. The “id” reference can be used to manipulate the server control at run time.

For example, consider we have a HTML label tag in khaled-info.aspx file as follows-


<label id="lblName" runat="server"></label>

This label can be accessed from CodeFile “khaled-info.aspx.cs” by using id “lblName” .


protected void Page_Load(object sender, EventArgs e)

{

lblName.Visible = "true";

lblName.InnerText = "I'm Khaled Ben Islam. Let's do something ... ";

}

References:

For more information about ASP.NET control,

1. Read the book “MCTS Exam 70-515: Web Applications Development
with Microsoft .NET Framework 4, Self Paced Training Kit, By Tony Northrup and Mike Snell, Chapter-4: Using Server Controls”. I found this book very helpfull for learning asp.net.

2. OR Visit http://www.w3schools.com/aspnet/aspnet_controls.asp  OR http://www.asp.net

You can also check the discussion on Why runat=”server” at http://stackoverflow.com/questions/304290/asp-net-why-runat-server

Reinstalling Grub-2 bootloader in Ubuntu

Leave a comment

Many times I had to reinstall MS Windows XP on my Dell Vostro 3400 where there was already Ubuntu 10.04 installed. So when I reinstall Windows xp, every time I lost the Grub boot menu; This problem occurred since windows overwrite the Grub boot loader with their shitty boot loader and I was unable to start the ubuntu OS. Today I faced the same problem again; So I wish to archive the procedure of recovering grub menu that i followed.

Using Live CD ( USB Stick) of Ubuntu 9.10 or later

Step-1: I download the image file of Ubuntu 10.04 (having .iso file extension) and make a bootable USB stick using “Universal USB Installer” software (No need to burn CD/DVD, just a USB stick with 700 MB or Higher free space).

Step-2: Boot ubuntu from USB stick.

Step-3: Open terminal and enter command
sudo fdisk -l .

A list of partition table entries will be shown. In my case, the following entries displayed-


sudo fdisk -l
.
.
.
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   102398309    51199123+   7  HPFS/NTFS/exFAT
/dev/sda2       102399998   625121279   261360641    f  W95 Ext'd (LBA)
/dev/sda5       245762433   389126429    71681998+   7  HPFS/NTFS/exFAT
/dev/sda6       389126493   512007614    61440561    7  HPFS/NTFS/exFAT
/dev/sda7       512007678   625121279    56556801    7  HPFS/NTFS/exFAT
/dev/sda8       162400256   245762047    41680896    7  HPFS/NTFS/exFAT
/dev/sda9       102400000   160991231    29295616   83  Linux
/dev/sda10      160993280   162383871      695296   82  Linux swap / Solaris

Partition table entries are not in disk order

The above output shows where Ubuntu OS actuallly installed. Line No. 12 indicates my ubuntu partition at sda9. It may vary in others computer.

Step-4: Now run the following command in terminal-


sudo   -i
mount /dev/sda9 /mnt    # Here sda9 is my ubuntu partition.
grub-install --root-directory=/mnt/ /dev/sda
sudo update-grub

Everything is done. After rebooting my laptop, I got my grub loader back.

Reference: http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7

Patching DYMO-UM in NS-2

1 Comment

From many days I was trying many times to patch DYMO-UM (An implementation of DYMO Routing Protocol by University of Maricos) in NS-2.34 in Ubuntu 10.04 . I follow the instructions that they provide to install at their web-site. I tried to patch before and after installation of ns-allinone-2.34. But I failed each time with different errors.

Luckily I able to do it finally. I follow the following procedure-

Step-1: Extract the ns-allinone-2.34 in home directory.
Step-2: Download dymoum-0.3.tgz and dymoum_ns-2.34_v0.3.patch from http://masimum.dif.um.es/?Software:DYMOUM
Step-3: Extract “dymoum-0.3.tgz” in ns-2.34 directory and make a symbolic link (symlink) there-


cd ns-allinone-2.34/ns-2.34/
tar zxvf dymoum-0.3.tgz
ln -s ./dymoum-0.3 ./dymoum

Step-4: Edit “dymoum_ns-2.34_v0.3.patch”.  In gedit (a Text editor in Ubuntu), go to line no 58, delete the word Makefile.

Before deletion-


+# DYMO_UM
+$(NS):    $(DYMO_UM_DIR)/$(DYMO_UM_LIB) $(OBJ) common/tclAppInit.o Makefile
+    $(LINK) $(LDFLAGS) $(LDOUT)$@ \
+          common/tclAppInit.o $(OBJ) $(LIB)

After deletion-


+# DYMO_UM
+$(NS):    $(DYMO_UM_DIR)/$(DYMO_UM_LIB) $(OBJ) common/tclAppInit.o
+    $(LINK) $(LDFLAGS) $(LDOUT)$@ \
+          common/tclAppInit.o $(OBJ) $(LIB)

Step-5: Now patch ns-2 with modified “dymoum_ns-2.34_v0.3.patch”. Use the following command-

patch -p1 < dymoum/dymoum_ns-2.34_v0.3.patch

Step-6: Now install ns-allinone-2.34. See my previous post for installation of ns-allinone-2.34 in ubuntu-10.04.1.

To test the installation, there are some example files in dymoum/ns/test.

KeePass 2.14 in Ubuntu 10.04 : A Powerful Password Manager in Ubuntu

Leave a comment

Just now I’m successfully run KeePass 2.14 (a windows Password Manager) in Ubuntu 10.04. From many days I’m Using this software in Windows OS for storing password. It is very useful but it has no Linux version at this time. Although there is a password Manager named KeePassX which is similar to KeePass but cannot use or import the database of  KeePass. At the website of KeePass software, they said to run the portable version using mono.

Here is the procedure which I have followed to run keepass using mono in Ubuntu-

Step-1: Download the portable version of KeePass from Sourceforge.net and unzip in my home directory.

http://downloads.sourceforge.net/keepass/KeePass-2.14.zip

Step-2: Mono 2.6.7 is required to run Keepass-2.14 but in Ubuntu 10.04,  mono 2.4 is default and there is no ready package from mono-project for Ubuntu 10.04. So I can install it in two way, either by Compiling source or from 3rd party source. I chose badgerports repo as 3rd party source.

http://badgerports.org/ has the complete instruction for installing mono-2.6.3.

Step-3: After installing mono, in terminal i moved to the home directory where i unzip portable KeePass and run KeePass.exe using mono.


cd  /home/khaled/KeePass-2.14
mono KeePass.exe

References:

1. http://mono-project.com/DistroPackages/Ubuntu

2. http://keepass.info/help/v2/setup.html#mono

UM-OLSR Simulation Error: Segmentation Fault

11 Comments

From many days I was trying to simulate UM-OLSR routing Protocol in ns-2.34. It works fine for 3, 5, 10, 20 and 50 wireless sensor nodes. But When i was trying to set it for 100 nodes, it shows “Segmentation Fault” error and simulation terminate. To resolve this issue i search a lot in internet but could not find any solution of this.

Luckily I find that Imran khan ( a researcher of  computer network in France), also faced this problem and solve this. He advised me to change the default maximum number of nodes from 64 to my need which is located in OLSR_pkt.h.


/// Maximum number of addresses advertised on a message.
#define OLSR_MAX_ADDRS        90

In that file I change this value from 70, 80, and 90 and each time i recompile ns-2.34 using make clean and make. For 90, it works for me but it takes about 4 hours to complete the simulation for 100 nodes where for AODV simulation it takes only few seconds for the same simulation scenario.

Change the WordPress blog address: No need to register another blog at wordpress.com

Leave a comment

From many days I was thinking to change the address of my blog (khaled063011.wordpress.com). But I thought that there is no way to change this address without creating a new blog wordpress.com. This idea was wrong and I able to change my blog address to khaledcse06.worepress.com without modifying my blog.

It’s a simple process.

step-1: First Logon into the blog and go to the dashboard. From the left panel, select “My Blogs”.

Step-2: I Move my mouse over the address of the blog I wish to rename. I see that a change blog address option appears. Note that you will only see this option for blogs that you own.

Step-3: Click the change blog address option for the blog that I wish to rename.

Step-4: I enter the new name for the blog in the first two import fields. Verify that this new name is what i want it to be.

Step-5: Once I have completed the form, click continue, a prompt with a summary of the changes i requested appears. I Review this page and continue to change my address.

Once I’ve completed all of the steps above, My blog gets a rocking brand new WordPress.com address khaledcse06.wordpress.com.

For more information-

http://en.support.wordpress.com/changing-blog-address/

To change the user name-

http://en.support.wordpress.com/change-your-username/

Simulating TORA routing protocol in NS-2.34 on Ubuntu 10.04

4 Comments

After a lot of try I able to simulate TORA protocol in NS-2.34. Though TORA has built-in support in NS-2.34 but I wasn’t able to simulate any simulation scenario using TORA protocol. When I was try to simulate a scenario it generates a huge error but that simulation script works fine for others protocol.

Error with TORA protocol at the time of my simulation-


khaled@khaled-laptop:~$ ns tora-nn3.tcl

num_nodes is set 3
INITIALIZE THE LIST xListHead

(_o17 cmd line 1)
invoked from within
"_o17 cmd port-dmux _o28"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o17" line 2)
(SplitObject unknown line 2)
invoked from within
"$agent port-dmux $dmux_"
(procedure "_o14" line 11)
(Node/MobileNode add-target-rtagent line 11)
invoked from within
"$self add-target-rtagent $agent $port"
(procedure "_o14" line 28)
(Node/MobileNode add-target line 28)
invoked from within
"$self add-target $agent $port"
(procedure "_o14" line 15)
(Node attach line 15)
invoked from within
"$node attach $ragent [Node set rtagent_port_]"
(procedure "_o3" line 82)
(Simulator create-wireless-node line 82)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns_ node"
("for" body line 2)
invoked from within
"for {set i 0} {$i &lt; $opt(nn)} {incr i} {
set node_($i) [$ns_ node]
}"
(file "aodv-nn-3.tcl" line 84)

Solution:
Step-1: To resolve the issue, i had to implement PORT-DEMUX in command function of “tora.cc” file.

Modified Command function-


int
toraAgent::command(int argc, const char*const* argv)
{
	if(argc == 2) {
		Tcl& tcl = Tcl::instance();

		if(strncasecmp(argv[1], "id", 2) == 0) {
			tcl.resultf("%d", index);
			return TCL_OK;
		}
	}
	else if(argc == 3) {

		if(strcmp(argv[1], "log-target") == 0 || strcmp(argv[1], "tracetarget") == 0 ) {
			logtarget = (Trace*) TclObject::lookup(argv[2]);
			if(logtarget == 0)
				return TCL_ERROR;
			return TCL_OK;
		}
		else if(strcmp(argv[1], "drop-target") == 0) {
		        int stat = rqueue.command(argc,argv);
			if (stat != TCL_OK) return stat;
                	return Agent::command(argc, argv);
		}
		else if(strcmp(argv[1], "if-queue") == 0) {
			ifqueue = (PriQueue*) TclObject::lookup(argv[2]);
			if(ifqueue == 0)
				return TCL_ERROR;
			return TCL_OK;
		}
		else if(strcmp(argv[1], "imep-agent") == 0) {
			imepagent = (imepAgent*) TclObject::lookup(argv[2]);
			if(imepagent == 0)
				return TCL_ERROR;
			imepagent->imepRegister((rtAgent*) this);
			return TCL_OK;
		}  /*** Extra code to implement port demux ***/
		else if (strcmp(argv[1], "port-dmux") == 0) {
    			dmux_ = (PortClassifier *)TclObject::lookup(argv[2]);
			if (dmux_ == 0) {
				fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1], argv[2]);
				return TCL_ERROR;
			}
			return TCL_OK;
    		}
	}
	return Agent::command(argc, argv);
}

Also edit tora.h file, add the header classifier/classifier-port.h at the first portion and protected: PortClassifier *dmux_; at the end of this file to add the support for port demuxing.

First portion of tora.h file for my case looks like-


#include <tora/tora_dest.h>
#include <classifier/classifier-port.h>

LIST_HEAD(td_head, TORADest);

End portion of tora.h file for my case looks like-


	void		logNextHopChange(TORADest *td);
	void		logNbDeletedLastDN(TORADest *td);
	void		logToraDest(TORADest *td);
	void		logToraNeighbor(TORANeighbor *tn);
	
protected:
	/* for passing packets up to agents */
	PortClassifier *dmux_;
};

#endif /* __tora_h__ */

Step-2: Now simulation script for TORA protocol works fine but the simulation enters into a eternal infinite loop. To avoid this eternal loop, modify imep.cc file.

Fix the line (504 no line in gedit) in ns-2.34/imep/imep.cc which reads

rexmitTimer.start(rexat - CURRENT_TIME);</code>

If rexat – CURRENT_TIME is 0, then the same function is called immediately without increasing the simulation time, creating an eternal loop. I would have replaced the line with the following lines:


if (rexat-CURRENT_TIME<0.000001) // Preventing eternal loop.
rexmitTimer.start(0.000001);
else
rexmitTimer.start(rexat - CURRENT_TIME);

Or download the modified tora.cc and tora.h file and replace the content of original files of tora with the downloaded file’s content if you face any problem to do the above modifications.

Step-3: Recompile the ns-2.34 with make command. Its better to run “make clean”  command before running “make” command so that all the edited file take the effect.


khaled@khaled-laptop:~$ cd /home/khaled/ns-allinone-2.34/ns-2.34
khaled@khaled-laptop:~$ make clean
khaled@khaled-laptop:~$ make

Now Everything is Ready. You can run simulation script for TORA routing protocol.

References:

1. http://mailman.isi.edu/pipermail/ns-developers/2006-March/002250.html

2. http://erl1.wordpress.com/2010/08/10/running-tora-in-ns-2-34-on-ubuntu-10-04/

3. http://www.linuxquestions.org/questions/linux-software-2/tora-simulation-does-not-come-to-an-end-in-ns2-34-a-795189/#post4061628

4. http://www.gidforums.com/t-19724.html

5. http://wpage.unina.it/marcello.caleffi/ns2/tora.html

NS-2 simulation Error: “can’t read ‘node_(10)’: no such element in array”

2 Comments

Last day when I was trying to execute a simulation scenario (a tcl script) in NS-2 which contains an auto generated connection pattern file which is generated by CMU’s connection pattern generator (cbrgen.tcl) which is built-in in ns-2.3x, i got the following error-


can't read "node_(10)": no such element in array
while executing
"$ns_ attach-agent $node_(10) $null_(6)"
(file "~/simulation-code/connections/cbrgen-10" line 100)

In the main simulation scenario (tcl file) i specified 10 nodes (node 0 to 9) and I also specify to generate connection pattern for 10 nodes as the parameter at the time of connection generation as-


ns cbrgen.tcl -type cbr -nn 10 -seed 1 -mc 8 -rate 4 > cbrgen-10

But when I face this error, i open the generated connection pattern file (cbrgen-10) and found that it generate 11 nodes (node 0 to 10). When i manually change the node number in that file it works fine. But it’s annoying.

Solution:

If connection pattern for 10 nodes needed then specify for 9 nodes in parameter of cbrgen.tcl file at the time of generation as follows-


ns cbrgen.tcl -type cbr <strong>-nn 9</strong> -seed 1 -mc 8 -rate 4 > cbrgen-10

It will generate 10 nodes (node 0 to 9).

Older Entries

Follow

Get every new post delivered to your Inbox.