Suramya’s Blog

Visit suramya.com Who am I?

April 21, 2008

Getting my wireless card working in Debian

Filed under: Computer Tips, Knowledgebase, Linux/Unix Related — Suramya @ 2:03 am

As promised here are the steps that I followed to get my wireless card working on my Comaq Presario V3000 in Debian:

1. Install ndiswrapper

In my case I allready had the ndis wrapper installed. If thats not the case with your system run the following command as root to install it:

apt-get install ndiswrapper-common ndiswrapper-utils ndisgtk

2. Disable the “bcm43xx” driver on your system

Run the following command at a command prompt as root :

echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist

3. Download the Windows driver for your card

My system uses the Broadcom Corporation BCM4310 card and I had to download the Windows driver for it from the Dell site. For some reason the driver I found at the Compaq site refused to work. You can download it from here.

Save this in the /tmp directory cd into the /tmp directory, and unzip the Windows driver package:

cd /tmp
unzip R123456.EXE (or whatever the name of the download is)

4. Install the Windows driver with ndiswrapper

To load the driver you need to run the following command as root:

ndiswrapper -i /tmp/DRIVER/bcmwl5.inf

The you should verify that the driver has been successfully loaded

ndiswrapper -l

The output of this command should look like the following if it is loaded correctly

Installed ndis drivers:
{name of driver} driver present, hardware present

or

{name of driver} : driver installed
device ({Chipset ID}) present

5. Load the ndiswrapper module

You now need to load the ndiswrapper module. Run the following steps at a command prompt as root:

depmod -a
modprobe ndiswrapper

if the above commands don’t give any errors then the drivers have been successfully installed.

6. Configure the wireless card

I have found the ‘netcardconfig’ command the easiest to use when configuring a new card. Run it as root and answer the questions it asks and it will configure the card for you.

7. Set the ndiswrapper module to automatically load at boot

ndiswrapper is not started by default when the system starts up so you must configure your system to load the ndiswrapper module at system startup. To do this, edit /etc/modules file as root to add an entry for ndiswrapper at the end of the file.

vi /etc/modules

Add ‘ndiswrapper’ (without the quotes) to the end of the file in a new line. Save and exit.

Now the module will be loaded when the system next starts up.
—-

A special thanks to JamesGu from the UbuntuForums for figuring out the solution and posting it there.

Hope you find this useful. I certainly did. ;)

Will post about my sound card next.

- Suramya

February 12, 2008

Regular Expressions Cheat Sheet

Filed under: Computer Tips, Knowledgebase — Suramya @ 9:52 pm

The Regular Expressions cheat sheet is designed to be printed on an A4 sheet of paper and live by a designer or developer’s desk, to make life a bit easier.

regular_expressions_cheat_sheet.png
Regular Expressions Cheat Sheet

Check out this post for a description of what is on the cheat sheet.

- Suramya

October 3, 2007

Automatic session logging/monitoring with GNU screen

Filed under: Computer Security, Computer Tips, Security Tutorials — Suramya @ 11:10 pm

Found this good article on how to setup screen on Linux/Unix so that it automatically logs all activity made in the session. Screen is a utility that I use very often on my Linux box. Basically its a program that you start and it attaches to a specific console and if you ever get disconnected you don’t loose your work/position, all you have to do is log back in and reconnect to that screen. You can also connect to a system via ssh/telnet and start a program then disconnect from ssh then move to another location and reconnect to server and join the same session from there. I use it all the time when compiling stuff or downloading large files.

The main issue I had with screen was that it would only keep 20-30 lines in the history so if you wanted to scroll up to read the previous logs you couldn’t. Now this article explains how to set up logging so that you can do that. For the impatient here’s how you do it:

I wanted to automattically launch a screen session when somone logged in so if I happened to be on the server I could monitor them in real time. I also wanted a log of the session in case I wanted to look over it later or if I was not able to monitor the session live.

I ended up adding the following to my .bashrc

# — if $STARTED_SCREEN is set, don’t try it again, to avoid looping
# if screen fails for some reason.
if [[ “$PS1″ && “${STARTED_SCREEN:-No}” = No && “${SSH_TTY:-No}” != No ]]; then
STARTED_SCREEN=1 ; export STARTED_SCREEN
if [ -d $HOME/log/screen-logs ]; then
sleep 1
screen -RR && exit 0
# normally, execution of this rc script ends here…
echo “Screen failed! continuing with normal bash startup”
else
mkdir -p $HOME/log/screen-logs
fi
# [end of auto-screen snippet]

and add the following to your .screenrc

# support color X terminals
termcap xterm ‘XT:AF=E[3%dm:AB=E[4%dm:AX’
terminfo xterm ‘XT:AF=E[3%p1%dm:AB=E[4%p1%dm:AX’
termcapinfo xterm ‘XT:AF=E[3%p1%dm:AB=E[4%p1%dm:AX:hs:ts=E]2;:fs=07:ds=E]2;screen07′
termcap xtermc ‘XT:AF=E[3%dm:AB=E[4%dm:AX’
terminfo xtermc ‘XT:AF=E[3%p1%dm:AB=E[4%p1%dm:AX’
termcapinfo xtermc ‘XT:AF=E[3%p1%dm:AB=E[4%p1%dm:AX:hs:ts=E]2;:fs=07:ds=E]2;screen07′

# detach on hangup
autodetach on
# no startup msg
startup_message off
# always use a login shell
shell -$SHELL

# auto-log
logfile $HOME/log/screen-logs/%Y%m%d-%n.log
deflog on

Keep in mind that this is not a very secure setup. Anyone with any technical knowledge can edit the logs as they are located in the user’s home directory and are editable by them. So don’t rely on it extensively to keep a system secure.

Complete article is available here: Automatic session logging and monitoring with GNU screen for the paranoid.

Thanks,
Suramya

July 6, 2007

Allow passwordless access to a subfolder of a password protected directory

Filed under: Computer Tips, Knowledgebase — Suramya @ 2:22 pm

Hey,
We have a directory on the server thats password protected and we needed to give access to a subdirectory of that folder to everyone (Without having them enter a password). Turns out it is possible to do so using .htaccess

Create a .htaccess file in the subfolder that you want to give full access to with the following content:

AuthType none
Satisfy any

Save and exit. This overrides the password protection of the parent folder and gives anonymous access to the folder.

Thanks to Vinit for the tip.

- Suramya

June 24, 2007

Getting a 404 error in asp.net when the file exists on the server

Filed under: Computer Software, Computer Tips, Knowledgebase — Suramya @ 1:25 pm

Hit this issue recently on a web server that I was setting up on Windows 2003 server using IIS. Now everything was installed correctly and I had copied all the files to the server, then I created a virtual directory for my asp.net application and when I went to http://localhost/Test it would show me the directory listing (Yes I had enabled that so that I could debug). However when I clicked on the service.asmx file it would tell me that the file didn’t exist and I would get a 404 error. Now I knew that the file was there and I could see it in the directory listing but for some reason the IIS refused to show it.

The problem was caused because the server was running the 64 bit version of ASP.NET 2.0 while we were expecting the 32 bit version. Yes, it took me a couple of hours to figure that out. To fix it basically what you have to do is tell IIS that you want to use the 32 bit version for this particular Virtual Directory by changing the Script Map. The steps to change this are:

  • Open the IIS management console.
  • Expand the local computer node, expand Web Sites, and then expand Default Web Server.
  • Right-click the folder for the application, and then click Properties.
  • On the Directory tab, click Configuration.
  • The Application Configuration dialog box appears.
    On the Mappings tab, select an ASP.NET application extension, such as .asmx or .aspx.

    The Executable Path column of the dialog box lists the path to the ASP.NET ISAPI extension used by the application. By default, the ASP.NET ISAPI extension is installed in the following location:

    %system root%\Microsoft.NET\Framework\versionNumber. Browse to the appropriate directory and select the aspnet_isapi.dll file.

  • Click Ok and exit
  • Finally Stop and Start the webserver for the changes to take effect.

Now you should be able to access the files on the server without issues.

BTW, also make sure that the user IIS is running as also has permissions to read files and execute scripts in the directory where you have copied your files.

Hope fully you found this helpful.

Source for the steps to change the mapping: How to: Configure ASP.NET Applications for an ASP.NET Version

Thanks,
Suramya

April 26, 2007

Status update on my computer issues and my workarounds

Filed under: Computer Tips, My Life — Suramya @ 12:44 pm

As I had posted earlier my laptop was having issues after I got the fan fixed on the system. Now it keeps shutting down randomly anywhere from a min to 15 mins after startup. I have given it to a shop for repair and I am supposed to get it back tomorrow. Keeping my fingers crossed that it will get fixed.

My Dad’s laptop is still having the same issues as earlier (Windows install is messed up on it, Cut and paste doesn’t work. Apps refuse to start etc) but I won’t be messing with it till I get my laptop back. Since the issues got really annoying I started remote desktoping into my desktop from the laptop to work and thats been working really well. Unfortunately the XP on the laptop has gotten into such a state in the past two days that I can’t use rdp on it either. So I decided to avoid windows alltogether and booted off a Knoppix Live Linux CD on the laptop and am using rdesktop on it to access the server (My desktop). So far its working great.

I even got sound working on RDP. I can now play music on the desktop and listen to it on the laptop via RDP. Here’s the command I used to get it working:

rdesktop -r sound -z -x l -f -a 16 192.168.15.10

where:

-r sound:[local|off|remote]
Redirects sound generated on the server to the client. “remote” only has any effect when you connect to the console with the -0 option. (Requires Windows XP or newer).

-z
Enable compression of the RDP datastream.

-x
Changes default bandwidth performance behaviour for RDP5. By default only theming is enabled, and all other options are disabled (corresponding to modem (56 Kbps)). Setting experience to b[roadband] enables menu animations and full window dragging. Setting experience to l[an] will also enable the desktop wallpaper. Setting experience to m[odem] disables all (including themes). Experience can also be a hexidecimal number containing the flags.

-f
Enable fullscreen mode. This overrides the window manager and causes the rdesktop window to fully cover the current screen. Fullscreen mode can be toggled at any time using Ctrl-Alt-Enter.

-a
Sets the colour depth for the connection (8, 15, 16 or 24). More than 8 bpp are only supported when connecting to Windows XP (up to 16 bpp) or newer. Note that the colour depth may also be limited by the server configuration.


I also installed EXT2IFS on the server so that I can get access to my ext3 partitions from windows. This program provides Windows NT4.0/2000/XP/2003 with full access to Linux Ext2/Ext3 volumes by allocating drive letters to the volumes. This means all software installed on the system can access the partitions. Its really cool. Haven’t hit any issues with it so far…

So after installing all this stuff I can work without any major issues. But I still want my laptop back.

Well this is all for now. Hopefully I will get my system back soon.

- Suramya

December 29, 2006

Sending an e-mail to users whose password is about to expire

Filed under: Computer Tips, Knowledgebase — Suramya @ 4:15 pm

If you have users that don’t login to a windows system or Outlook Web access and just use POP/IMAP to download emails then you must be used to having these people call in to have their passwords reset when their passwords expire which can be a pain.

The following script sends out an email to Exchange users when their passwords are about to expire so that they can login to change their password and not bother you.

Download the script from here: Sending an e-mail to users whose password is about to expire

Will post the script to do the same on Unix/Linux systems later.

Thanks,
Suramya

PS: I DIDN’T WRITE THE SCRIPT SO IF IT DESTROYS YOUR SYSTEM DON’T BLAME ME.

November 3, 2006

Find out when Windows XP box was rebooted/shutdown

Filed under: Computer Tips — Suramya @ 12:02 pm

The event manager in Windows XP allows you to find out when a system was rebooted or shut down. To run the Event Viewer follow these steps:

1. Click on Start -> Control Panel
2. Double click on the Administrative Tools
3. Click on System in the left pane. Resize the window so you can see the Event column in the right-hand pane.

Once you have the window open look for an entry of 6009 in the Event column. This shows when the PC was shut down or restarted. A start-up will be logged by a number of events, mostly with the code 7035, 7036 and 26, corresponding to various services and checks.

Source: Check a computer’s event history

- Suramya

October 18, 2006

How I broke Windows XP Genuine Advantage test and then fixed it

Filed under: Computer Related, Computer Tips, Techie Stuff — Suramya @ 11:50 pm

A couple of days ago I had a slight problem with my internet connection, basically what was happening was that I couldn’t access google.com and associated sites (Orkut, gmail etc) but I could access everything else with issues so I spoke to a Comcast representative and she told me to run the following command on my Windows XP laptop (I told her I was using XP because I didn’t want to get into an argument with her that the problem was because I was using Linux.):

regsvr32 softpub.dll

I ran the command and it didn’t fix the issue. So I decided to un-register the dll using the following command:

regsvr32 /u softpub.dll

as I wasn’t sure what this dll did and didn’t want to register random stuff on my system. I ran the command and everything was fine for a couple of days, I could browse the net without issues and everything seemed to work.

Then all of a sudden after a couple of days I get an error message stating that my version of windows could not be validated so I must be running a pirated version of XP. The funny part was that I had installed WGA two months ago on the laptop and it had validated the license and the license is valid. So I went to the Windows update site and tried to validate my copy but ActiveX refused to run. It told me to try a manual check where it downloaded the ActiveX and then tried to run it but that also failed… Finally I tried a check using an executable I downloaded but that validated my license as valid. Now I was confused and tried to force a validation test but every time the system would refuse to run ActiveX and the validation would fail.

After beating my head on the issue for a little while I finally remembered the dll that I had unregistered a while ago so I went through my command history and found the command to re-register it and went ahead and registered it. Then I had to reboot the box and when it came back up I was finally able to run the online validation tool which verified my version of windows was valid. After it verified it I had to reboot again and that fixed the issue.

Moral of the story: If you don’t know what a dll does then don’t uninstall it.
Second Moral of the story: Its a good habit to keep a log of all the commands you run, and any changes you make to the system. Having this will save you a lot of time an energy when something gets messed up.

This is all for now, will post more about my experiments with computers and the messes I caused later.

- Suramya

July 3, 2006

How to photograph Fireworks

Filed under: Computer Tips, Interesting Sites, Knowledgebase, Techie Stuff — Suramya @ 11:32 am

As some of you probably know I love taking photos but I have always had trouble capturing fireworks, they just don’t come out nicely for me :(

The following article’s have some awesome tips on how to photograph fireworks so now that I know the secret you can expect some nice pics of fireworks on my site in the near future :)

For Digital Cameras: New York Institute of Photography - Tips on Fireworks Digital Photography

For Regular Cameras: How to Photograph Fireworks

Thanks,
Suramya

Older Posts »

Powered by WordPress