Wednesday, December 27, 2006

Recovering partition table

I got these links from ilugc forum. These two links are for utilities which help in recovering the parition table of the hard disk which may have got damaged / destroyed for any god forsaken reason. I haven't personally tried this. Shall update once (if and no, i dont want such a situation) I try.

gpart - Guess PC-type hard disk partitions
testdisk - file as well as parition table recovery utility

.

Thursday, December 07, 2006

The Primary parition limitation

I know that we cannot create more than 4 primary partitions. But, why. When technology has grown in leaps and bounds, why this "limitation"? I got the answer to this from ilugc. Any Hard disk drive contains a 448-byte Boot Loader Code (Initial Program Load Code - IPL) followed by a 64-byte partition table. These make up the first 512 bytes of the first track of any HDD. Any OS installation starts from the second track only. Each partition table entry needs 16 byte, thus limitting the total number of partitions to 4.

Monday, December 04, 2006

Synergy between Mac and PC

Can they work together. Can Mac and PC get along well. In Harmony? In Peace? I don't know. But, they sure can share a keyboard and a mouse. "Synergy" achieved this feat. Made my Wintel machine as the server and the MacTel as the client and now, am using a single keyboard and mouse for both the systems. Here's a small write-up on how I got them alive.

First, go to this link and download the corresponding OS related app. Now, since I wanted to use the windows version as the server, I opened "Share this computer's keyboard and mouse (server)'s / Screens & Links" "Configure" button.

In that, I added two screen names in the "Screens" window.
a) Click the "+" button.
b) Add "Joe-Wintel".
c) Here, there is an alias name. If you want, you can give that too. I did'nt.
d) Repeat above 3 steps for "Joe-Mactel" screen name.

Then, in "Links", section, add how the mouse and keyboard is to behave.
a) click the "+" button.
b) My two rules read something like below (Note that the italicized words are configurable)
0 to 100% of the Left of Joe-Wintel goes to 0 to 100% of Joe-Mactel
0 to 100% of the Right of Joe-Mactel goes to 0 to 100% of Joe-Wintel

Click "Start"
Your server is ready.

Now, on to your Mac system.
In the terminal window, go to the synergy app directory. You should see a "synergy.conf" File. Open it.
Modify to something like below.
Point to note. I kept my Mactel to the left of my Wintel. Now, go ahead.



section: screens
# my Windows system
Joe-Wintel
end

section: links
# My Windows is to my (mactel) right
Joe-Wintel:
right = Joe-Wintel
end

section: aliases
# Where you can map aliases. I have added for your reference only. this is not validated.
Joe-Wintel
joe
end


I then went on to create a script to run as client. The command is
sudo ./synergyc --name Joe-Mactel Joe-Wintel &


Now, if you want to run this in the foreground, then use "-f" option. Now, you can create the above as a shell script, and call it from /etc/rc.common file so that the client is up and running the moment the system starts up. ( This way, you can be even more lazy).

And there you have both Mac and Windows living in harmony. The world is returning to peace. Amen.

Wednesday, November 29, 2006

Disabling email notifications in Linux

In Fedora, to disable the "sendmail" service,
service sendmail stop

will suffice. But, sometimes, when you open your shell, or at other times, you may get "you have new mail in /root/***". How to deal with this. For bash, you can do the following steps. To confirm that ur shell is bash:

echo $SHELL
will confirm your shell. If the notifications are alive, then
echo $MAILCHECK
would dump some data. Just type
unset MAILCHECK
After this, the previous command should dump nothing. You are thus freed of your burning mail issue. Amen.

Tuesday, November 21, 2006

restarting bash

There came a situation wherein I had updated the bashrc file and wanted to apply the effects to current shell without restarting it. Then I ended on the "source" command. On Mac, I had to type
source /etc/bashrc
while in linux its
source .bashrc
. It ended up applying the configuration to the current shell. Similarly, for applying profile specific datas (more like the autoexec.bat file in mac), I had to modify /etc/profile file for setting up PATH and other enrivonmental variables.

Wednesday, November 15, 2006

rpm query

rpm -q --queryformat '%{NAME}: %{FILENAMES} install:=%{DIRNAMES} - %{SUMMARY}\n' git-core-1.4.3.5-1

git-core: /usr/bin/git install:=/usr/bin/ - Core git tools

Friday, November 03, 2006

Bye bye smbfs

From Fedora Core 5, ( I dont know about others as of now), they have stopped supporting "smbfs" and expects the users to replace it with "cifs". Hence, if you need to mount a network driver,
mount -t cifs //server_name/to_be_mounted /mapping/directory 
-o username=myname,workgroup=mydomain
Also, it (mount) doesn't like SMB names. You have to give it IP address or DNS hostname. Happy linking !!!

Thursday, November 02, 2006

File format issue

I was trying to execute a shell script which I moved from windows. I repeatedly got the following error
: bad interpreter: No such file or directory

Although I had set the proper shell to the script in, I couldnt get it to run. The high point was the same set of commands executed without any hitch when run on commandline. Then, archamedically, the thought of "file format" struck me. I set

set ff=unix
and then tried executing it. Voila, it ran. It saved the day (atleast for now).

Monday, October 30, 2006

Creating static and shared libraries in Linux

Am too bored to write a proper write-up as of now. So, here are the compiler commands to create static and shared libraries in linux (and mac too).

gcc -fPIC -g -c -Wall a.c
gcc -fPIC -g -c -Wall b.c
gcc -shared -Wl,-soname,libmystuff.so.1 -o libmystuff.so.1.0.1 a.o b.o -lc


Here, the bold and italicized stuff are those that you need to change to reflect to your library name and source files. In the above case, I am using two source files a.c, b.c and compiled it as a shared library named mystuff.so

To create a static library,
gcc -fPIC -g -c -Wall a.c
gcc -fPIC -g -c -Wall b.c
ar rc libmylib.a a.o b.o
ranlib libmylib.a

The last ranlib command indexes the symbols in the library archive to speed up compiler symbol lookup.

Sunday, September 17, 2006

RUN command shortcuts in Windows

To Access…. - Run Command

Accessibility Controls - access.cpl

Add Hardware Wizard - hdwwiz.cpl

Add/Remove Programs - appwiz.cpl

Administrative Tools - control admintools

Automatic Updates - wuaucpl.cpl

Bluetooth Transfer Wizard - fsquirt

Calculator - calc

Certificate Manager - certmgr.msc

Character Map - charmap

Check Disk Utility - chkdsk

Clipboard Viewer - clipbrd

Command Prompt - cmd

Component Services - dcomcnfg

Computer Management - compmgmt.msc

Date and Time Properties - timedate.cpl

DDE Shares - ddeshare

Device Manager - devmgmt.msc

Direct X Control Panel (If Installed)* - directx.cpl

Direct X Troubleshooter - dxdiag

Disk Cleanup Utility - cleanmgr

Disk Defragment - dfrg.msc

Disk Management - diskmgmt.msc

Disk Partition Manager - diskpart

Display Properties - control desktop

Display Properties - desk.cpl

Display Properties (w/Appearance Tab Preselected) - control color

Dr. Watson System Troubleshooting Utility - drwtsn32

Driver Verifier Utility - verifier

Event Viewer - eventvwr.msc

File Signature Verification Tool - sigverif

Findfast - findfast.cpl

Folders Properties - control folders

Fonts - control fonts

Fonts Folder - fonts

Free Cell Card Game - freecell

Game Controllers - joy.cpl

Group Policy Editor (XP Prof) - gpedit.msc

Hearts Card Game - mshearts

Iexpress Wizard - iexpress

Indexing Service - ciadv.msc

Internet Properties - inetcpl.cpl

IP Configuration (Display Connection Configuration) - ipconfig /all

IP Configuration (Display DNS Cache Contents) - ipconfig /displaydns

IP Configuration (Delete DNS Cache Contents) - ipconfig /flushdns

IP Configuration (Release All Connections) - ipconfig /release

IP Configuration (Renew All Connections) - ipconfig /renew

IP Configuration (Refreshes DHCP & Re - Registers DNS) - ipconfig /registerdns

IP Configuration (Display DHCP Class ID) - ipconfig /showclassid

IP Configuration (Modifies DHCP Class ID) - ipconfig /setclassid

Java Control Panel (If Installed) - jpicpl32.cpl

Java Control Panel (If Installed) - javaws

Keyboard Properties - control keyboard

Local Security Settings - secpol.msc

Local Users and Groups - lusrmgr.msc

Logs You Out Of Windows - logoff

Microsoft Chat - winchat

Minesweeper Game - winmine

Mouse Properties - control mouse

Mouse Properties - main.cpl

Network Connections - control netconnections

Network Connections - ncpa.cpl

Network Setup Wizard - netsetup.cpl

Notepad - notepad

Nview Desktop Manager (If Installed) - nvtuicpl.cpl

Object Packager - packager

ODBC Data Source Administrator - odbccp32.cpl

On Screen Keyboard - osk

Opens AC3 Filter (If Installed) - ac3filter.cpl

Password Properties - password.cpl

Performance Monitor - perfmon.msc

Performance Monitor - perfmon

Phone and Modem Options - telephon.cpl

Power Configuration - powercfg.cpl

Printers and Faxes - control printers

Printers Folder - printers

Private Character Editor - eudcedit

Quicktime (If Installed) - QuickTime.cpl

Regional Settings - intl.cpl

Registry Editor - regedit

Registry Editor - regedit32

Remote Desktop - mstsc

Removable Storage - ntmsmgr.msc

Removable Storage Operator Requests - ntmsoprq.msc

Resultant Set of Policy (XP Prof) - rsop.msc

Scanners and Cameras - sticpl.cpl

Scheduled Tasks - control schedtasks

Security Center - wscui.cpl

Services - services.msc

Shared Folders - fsmgmt.msc

Shuts Down Windows - shutdown

Sounds and Audio - mmsys.cpl

Spider Solitare Card Game - spider

SQL Client Configuration - cliconfg

System Configuration Editor - sysedit

System Configuration Utility - msconfig

System File Checker Utility (Scan Immediately) - sfc /scannow

System File Checker Utility (Scan Once At Next Boot) - sfc /scanonce

System File Checker Utility (Scan On Every Boot) - sfc /scanboot

System File Checker Utility (Return to Default Setting) - sfc /revert

System File Checker Utility (Purge File Cache) - sfc /purgecache

System File Checker Utility (Set Cache Size to size x) - sfc /cachesize=x

System Properties - sysdm.cpl

Task Manager - taskmgr

Telnet Client - telnet

User Account Management - nusrmgr.cpl

Utility Manager - utilman

Windows Firewall - firewall.cpl

Windows Magnifier - magnify

Windows Management Infrastructure - wmimgmt.msc

Windows System Security Tool - syskey

Windows Update Launches - wupdmgr

Windows XP Tour Wizard - tourstart

Wordpad - write



wheewwwww.........

Monday, June 12, 2006

Process background and foreground

To run a process in the background, we normally use
$ command &
What if we accidentally start a process in the foreground instead of starting it in the background? No problem. Just do a
CTRL+Z
and the process will jump to the background. Note that pressing a
CTRL+Z
will move the process to the background and suspend it. In order for it to keep executing, you need to do a
CTRL+Z
and then type
bg
to keep it running the background. Now, you can type
jobs
to see the list of processes running the background. To bring a particular job to the foreground, type
fg 

MrProper

I was cleaning up an old version of the kernel and I came across this command
 make mrproper 

Curiosity got the better of me, and I went ahead googling and fell on a forum thread discussing the origin of the “mrproper”. After “analysis", it was found and confirmed that mrproper stands for “Meister Proper” (German) or Mr. Clean , a cleaning liquid product.

Hmmmm……

Creating a patch in Linux

diff -C 4 orig_file.c new_file.c >myfile.patch 

Here the “C 4″ specifies to add a 4 line context to understand where the patch fits for the user. To apply the patch, copy the file to the directory where the patch needs to be applied and execute the following command. Here, the p0 specifies to take the filename only and not the entire path which will be specified in the patch file


patch -p0 < myfile.patch

Recursive Download

For downloading only a particular type of files (say, *.pdf) form a http link, i used the following commands in sequence First, I downloaded the page containing the links to all the pdf files (ok, point to note here; I was not able to download recursively because of the robots.txt restriction)


wget http://my.requiredsite.com/page1/download/

This created a index.html file in the current directory for me with relative links to all pdf files. Then,
wget -r -nd -np -l4 -A "*.swf" -F -i ./index.html --base=
http://my.requiredsite.com/page1/download/
to download only the pdf files from the site.

Tuesday, May 09, 2006

Install / Upgrade Option in Mac Installer

Issue :


In Mac, while installing (using the Mac Installer) the first time, the "install" option will occur. But, from the next time onwards, even after removing the bundle and installing it again using the MAC installer, always "upgrade" option is displayed instead of "Install".


Reason :


MAC keeps a track of all the installed bundles in the OS under " /Library/Receipts " directory.

When we are installing the first time, Mac keeps track of the installation by updating the details under " /Library/Receipts " directory. Hence the "install" option will appear.

From the next time, although we delete the drivers from the corresponding directories, the "Install" option changes to "Upgrade".

Deleting the corresponding install entry in " /Library/Receipts " cleans up any trace of previous installation. Hence, the "install" option will appear in the installer.

It is recommended not to generally mishandle files in the " /Library/Receipts " directory.

A good link regarding this --> here

Thursday, February 16, 2006

Command line compilation in XCode


I was browsing through the XCode 2.1 help for compiling multiple targets in one shot when I fell upon xcodebuild. Its a command-line utility for compiling xcode projects. It can be considered like a Makefile for the XCode environment. You should be knowing there are two types of default configurations present in XCode; the Debug mode and the Release mode. To compile all the targets in a project for a specific configuration, go to the project directory which contains the .xcodeproj and give the following command at the command prompt


xcodebuild -alltargets -configuration Release
.

You can replace the "Release" with "Debug". If none is given, xcodebuild takes the default configuration from the XCode environment. If you need to compile to a specific target, just add "-target " to the above command.
You can also clean a particular configuration as below

xcodebuild -alltargets clean -configuration Release