Let's make the world a better place using digital technologies!

Category: Windows

Forward X over ssh

This assumes you use:
1. Putty as ssh client
2. Xming as X server on Windows XP

First you should save a session in Putty that connects to the given server. Now, from a command prompt, execute:
Xming :0 -multiwindow -clipboard
to start the Xming server. And,
plink -X -load RsrvSession xterm
to start the X-based remote connection using Putty session stored as RsrvSession.
If you need all the fonts, then install the Xming-fonts package on Windows. That is all to it.

Continue Reading

Installing Ubuntu from a USB

Taken from ubuntuforums , thanks to vegetarianshrimp.

Windows UNetbootin

  1. Insert your USB flash drive (1GB should be enough, although less may work too, I just haven’t tested it with less)
  2. Go to http://unetbootin.sourceforge.net/
  3. Click on Download (for Windows)
  4. Install the .exe
  5. Open Unetbootin.
  6. In the UNetbootin window, there will be a drop-down menu “==Select Distribution==”
    Select Ubuntu
  7. There will also be one called “==Select Version==”
    Select 9.04_Live for the latest version of Ubuntu: 9.04 Intrepid Ibex, or 8.04_Live for 8.04 Hardy Heron LTS (Long Term Support)
  8. In the bottom left corner of the window, there will be another drop down menu. It will either say “Hard Disk” or “USB Drive”. You want it to say USB Drive
  9. Click OK
  10. Wait for everything to finish. While you are waiting, DO NOT CLOSE THE UNETBOOTIN WINDOW OR UNPLUG YOUR USB DRIVE
  11. On the same ordifferent computer, plug in your USB Drive, and restart. Right at the beginning of the boot, press F12 (may be different) repeatedly, select USB Drive with the arrown keys and spacebar, and Ubuntu will boot from USB drive.

Note: If you encounter an error from SYSLINUX on bootup saying “Error: Could not find kernel image”, try formatting the USB drive with FAT16 (or FAT) instead of FAT32.

Continue Reading

Clipboard not working in Windows XP

What will you do, if all of a sudden, without any apparent reason, the clipboard stops working? There is not much except to reboot, eh? Stop. The reason could be a malfunctioning application that is not letting go of the clipboard. Try searching for this GetOpenClipboardWindow utility. It will inform you of the application holding the clipboard lock. Quitting that application should solve this problem without a reboot.

Continue Reading

Shutdown/Reboot Windows Remotely from Linux

To shutdown:

To reboot:
net rpc SHUTDOWN -r -f -I 192.168.XX.XX -U USERNAME%PASSWORD

Works perfectly!

Continue Reading

Mounting a linux folder in windows as a network drive using Samba

This procedure is based on this excellent tutorial on Ubuntu forums by stormbringer.

  1. First you need to make sure that samba is installed. If not, use the following to install it.
    apt-get install samba
    This assumes you are logged in as root.
  2. Now we need to edit the samba configuration file:
    emacs /etc/samba/smb.conf
    In the [global] section, make sure you have the following:
    netbios name = HOSTNAME
    Here HOSTNAME should be your linux host name.
    In the following line, you should give the workgroup of your windows computer:
    workgroup = WORKGROUP
    And enable the wins support:
    wins support = yes
    Now create a share called mylinuxshare, e.g., using the following section in smb.conf file:
    path = /path/to/linux/sharefolder
    browseable = yes
    read only = no
    guest ok = no
    create mask = 0644
    directory mask = 0755
    force user = USERNAME

    where USERNAME must fulfill the following conditions:

    • It is registered on both windows and linux machines.
    • It has same password on both windows and linux machines.
    • It has the desired access to the shared linux folder (/path/to/linux/sharefolder).

    Now you should save this file and start samba by:
    /etc/init.d/samba start

  3. The username specified in smb.conf must now be registered and enabled with samba. For this:
    smbpasswd -L -a USERNAME
    smbpasswd -L -e USERNAME

    This sets up the Linux side of the share.
  4. On windows do the following:
    • In the TCP/IP Settings of the active LAN connection, go to advanced tab and in WINS, add the ip address of the linux box.
    • Select “Use NetBIOS over TCP/IP”
    • Reboot Windows
  5. In the “Run” textbox, enter \\ip.address.of.linux.box\MyLinuxShare, and you should see the files shared by the linux machine. You can map it as a network drive in windows as well.
Continue Reading

Adding a Windows Share in Linux using Samba

Update your /etc/fstab file in a way similar to:

# /etc/fstab: static file system information.
# proc /proc proc defaults 0 0
# /dev/sda1
/dev/sda1 / ext3 defaults,errors=remount-ro,usrquota,grpquota 0 1
# /dev/sda5
/dev/sda5 none swap 0 0
#/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
//$ /home/user1/share1 cifs auto,iocharset=utf8,uid=linuxuserid,gid=users,credentials=/somefolder/credentialfile,file_mode=0775,dir_mode=0775 0 0
//$ /home/user1/share2 cifs auto,iocharset=utf8,uid=linuxuserid,gid=users,credentials=/somefolder/credentialfile,file_mode=0775,dir_mode=0775 0 0

where credentialfile should either provide windows username/password through some script or in text, like, e.g.,:

After sharing the given drive/folder on windows, and creating the respective folders in /home/user1, issue the following command to mount these new shares at above-mentioned locations in linux:
mount -a
Now you should have the windows shares mounted in linux as 755 (or other settings of your choice).

Continue Reading

Using newmat11 for Matrix Calculations

If you need a good C++ matrix library for scientific computations, then newmat11 could be your choice. Written by Robert B. Davies, it is a complete matrix library, providing all matrix arithmetic, transpose, inverse, SVD, etc.

You have to compile the library into either a static lib or a dll library. I compiled it with Visual Studio 2003 as a static library and then used some of its functions in a sample project.

To use it as a static library, you need to add the newmat11.lib file to the Visual Studio project and then include the newmat header files in your project.

If you want, you can download this Visual Studio 2003 solution as a starting point. This project links to the static library which can be found in newmat11/Debug folder. There is also a release version, in the Release folder.

Continue Reading
Continue Reading

Console Calculator for Windows

It is the best calculator I have seen for windows. There are expressions that are a bit complex for standard windows calculator and too simple for a tool like Matlab. Console calculator fills this niche very nicely. Get it here.

Thank you Scott Cogan!

Continue Reading

Using subst to map folders to drive letters

I have been using “Map Network Drive” feature of Windows XP to map folders on my local drives to drive letters. It is sometimes required in order to provide consistent folder paths for projects developed by a team. The downside of this approach is that the mapped drives are not available when you are not connected to a network, even though your mapped drives point only to your own local hard-disks.

To avoid this problem, you may use subst command as follows:
F:\>subst P: C:\XYZ
which substitutes folder XYZ as drive P
To remove the substitution, simply use:
F:\>subst P: /d

In order to make the substitutions permanent, you will have to execute this command on system start-up. To this end, a handy utility psubst by Alexander A. Telyatnikov can be used. It has exactly the same syntax as subst but the changes are retained permanently even after system reboot.

Continue Reading