Enabling Serial Console on /dev/ttyAM1 in TS-7260


I’m running Debian on SD card for this TS-7260. I decided to switch the serial console to the second port which is /dev/ttyAM1 because I’m going to use the first serial /dev/ttyAM0 for my Wavecom GPRS modem. So, I open the /etc/inittab and just realize that serial console on /dev/ttyAM1 is already there.

Then I grab my RS-232 cable and plug it from my /dev/ttyS0 on my PC to the /dev/ttyAM1 on the TS-ARM board… after waiting for some seconds, my minicom shows the login…

Debian GNU/Linux 3.1 ts7000 ttyAM1

ts7000 login:

So, I type root and press the enter… the console returns, “Login incorrect”… WTF!!

How come the serial console on the second port is useless for root? The solution for this is actually very simple. But it took me some minutes to figure it out… hehehe…

Thank god, i’ve already fixed the ssh, so i can ssh to the board…

$ ssh root@10.1.1.91
$ Password:

The solution is, edit the /etc/securetty file…

$ vi /etc/securetty

And then add the line ttyAM1 under the ttyAM0 in the /etc/securetty file… press escape and type :wq

That’s it. Reboot the board. and now i can login with root on my second serial console. Thanks to the guys in #debian at freenode for pointing me to the right direction. 

Create network interfaces list using Python

While checking my email this morning, I found a python question on python.my mailing list which sound like this:

Date: Wed, 3 Feb 2010 23:48:10 +0800
Message-ID: <52d26d931002030748pd2c6321p1290b1eeee703...@mail.gmail.com>
Subject: showing interfaces
From: Umarzuki Mochlis <umarz...@gmail.com>
To: pythonmy@googlegroups.com

Hi all,

I wonder how I can output network interfaces with python the same
way I can with these commands on linux

sudo ifconfig | cut -d " " -f 1 > ifconfig.txt
sed '/ *#/d; /^ *$/d' < ifconfig.txt

--
Regards,

Umarzuki Mochlis

For those who couldn’t imagine the output of those two lines command in the question, here is the explanation:

  • The first command write to ‘ifconfig.txt’ the name of up interfaces which comes from ifconfig output and remove other unwanted informations.
  • the second line read the ‘ifconfig.txt’ file, remove empty lines and print the list on the screen.

You can read the discussion thread on python.my mailing list: showing interfaces

Answer:
Here is how you can create network interfaces list with python:

import array
import struct
import socket
import fcntl

SIOCGIFCONF = 0x8912  #define SIOCGIFCONF
BYTES = 4096          # Simply define the byte size

# get_iface_list function definition 
# this function will return array of all 'up' interfaces 
def get_iface_list():
    # create the socket object to get the interface list
    sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

    # prepare the struct variable
    names = array.array('B', '\0' * BYTES)

    # the trick is to get the list from ioctl
    bytelen = struct.unpack('iL', fcntl.ioctl(sck.fileno(), SIOCGIFCONF, struct.pack('iL', BYTES, names.buffer_info()[0])))[0]

    # convert it to string
    namestr = names.tostring()

    # return the interfaces as array
    return [namestr[i:i+32].split('\0', 1)[0] for i in range(0, bytelen, 32)]

# now, use the function to get the 'up' interfaces array
ifaces = get_iface_list()

# well, what to do? print it out maybe... 
for iface in ifaces:
 print iface

This code is tested to be working in my ubuntu linux. Since I made SIOCGIFCONF ioctl number (0×8912) hardcoded, it may seems broken on other UNIX like system. However, you may modified the code to be compatible with your system when you understand it. I hope this snippet can help others too. Enjoy coding! 

How to get iOS 4 (iPhone OS) to sync with rhythmbox in ubuntu 10.04 (Lucid)

Well with the release of iOS 4, many Ubuntu users are complaining of incompatibility with between rhythmbox and the new update. Here is a simple way to fix that:
1. Open up synaptic

2. Go to the Repositories (Under Settings)

3. Add this source:

ppa:pmcenery/ppa

(from https://launchpad.net/~pmcenery/+archive/ppa)

4. Click Close and then click the Reload button at the top left

5. After it is done reloading search for:

libimobiledevice1

6. It will give you two results, install both.

7. Now after installing, close synaptic and open up the terminal and type in

sudo apt-get dist-upgrade

8. After the upgrade Ubuntu 10.04 will have iOS 4 support

Source from here

How to create a zip folder in Windows (OS)

To create a zipped, compressed folder

1.Open My Computer.

2.Double-click a drive or folder.

3.On the File menu, point to New and then Folder.

4.Type a name for the new folder, and then press ENTER.

5.Copy files to be compressed to the new folder and right click folder name and select{or send to} Compressed (zipped)

NOTE:

■To open My Computer, click Start, and then click My Computer.

■You can also create a zipped compressed folder by right-clicking the desktop, pointing to New, and then clicking {or send to} Compressed (zipped) Folder.

■You can identify compressed folders by the zipper on the folder icon.

■If you share compressed folders with users on other computer systems, you may want to limit the compressed folder names to eight characters with a .zip file name extension

Hardware Checklist for Windows 2000

Windows 2000 Hardware Diagnostic Procedure.

1.Check compatibility of the computer by going here. Check the hardware compatibility list (HCL). If the hardware is not on the list it is not supported.

2.If the device is on the list, it may be that the hardware is compatible but the customer may have to download the drivers from the manufacturers web site.

3.If the device is in the HCL and still does not function properly try using the Hardware Trouble Shooter in Windows Help:

Click on the Start Button and go to Help. Next click on the “Index” tab and type Hardware Trouble Shooter. A listing of keywords will come up and one should be Hardware Trouble Shooter. Double click on the device that is having problems and then follow the trouble shooting dialogs.

4.Check the device manager for errors. You can get to the device manager by right clicking my computer and then clicking on the “Hardware” tab. Next click on the “Device Manager Button”. This will bring up a listing of all the devices that Windows sees or if it is having problems with devices.

5.To start Windows 2000 using the last known good configuration, click Options, and then click Print to print these instructions. They will not be available after you shut down your computer in step 2.

a.Click Start, and then click Shut Down.

b.Click Restart, and then click OK.

c.When you see the message Please select the operating system to start, press F8.

d.Use the arrow keys to highlight Last Known Good Configuration, and then press ENTER. NUM LOCK must be off before the arrow keys on the numeric keypad will function.

e.Use the arrow keys to highlight an operating system, and then press ENTER.

Notes
■Choosing Last Known Good Configuration provides a way to recover from problems such as a newly added driver that may be incorrect for your hardware. It does not solve problems caused by corrupted or missing drivers or files.

■When you choose Last Known Good Configuration, Windows 2000 restores information in registry key HKLMSystemCurrentControlSet

How to connect your Laptop/PC/Computer to your TV

I’m writing this post on how to connect your PC or computer to a TV because last week I returned from a trip in India and wanted to show all of my pictures and videos to my family from my laptop onto our HDTV, but unfortunately I did not have the correct cords and so after fumbling around for 30 minutes trying to connect my computer to the TV, I had to tell everyone that they would have to wait till the next weekend! Pretty annoying considering the times we live in, it should be quite easy to connect the two together!

So here’s a quick walk-through of all the methods that I know (if you know any more, please comment) to connect a laptop or PC to your TV:

 

1. S-Video – This is probably the most common method out there currently because an S-Video cable is cheap as heck and just about every TV under the sun has a S-Video port. You’ll have to make sure you laptop is equipped with this port. Remember, there are two types of S-Video cables: 4-pin and 7-pin. Most laptops and PC’s are equipped with a 7-pin port, so if your TV only has a 4-pin S-Video port, then this method will not work.

2. VGA – If you have a HDTV, then you will be better off connecting using a VGA cable. It gives much better quality than S-Video and as with S-Video, the cable is very cheap. You usually won’t find a VGA port on regular TV’s though, so this option is if you have an HDTV.

3. DVI – DVI stands for Digital Visual Interface with “digital” being the key word there. The digital signal will give a higher quality picture than either S-Video or VGA. Of course, your computer will need to have a DVI connection and your TV will need to be an HDTV. This cord is definitely not cheap, it ranges anywhere from $40 to $80.

4. HDMI – Using HDMI will give you the best quality by far. No computers that I know of yet have HDMI ports, but you can get a DVI to HDMI cable to connect it to your HDTV. HDMI is compatible with DVI.

5. Scan Converter Box – This is the last method that I could think of and it involves using a scan converter box, which takes a VGA signal and converts it into S-Video or component video.

Here’s a graphic I created with some pictures of the various cables:

Hope this helps someone! If you have any other ideas or suggestions, please feel free to comment!!! Thanks!

How to extract icons from EXE, DLL, OCX, and CPL files

Wish you could extract all of icons stored on your computer? If I were to ask you how many icons you have stored on your computer, would you be able to tell me? Probably not! Nor can I! Actually, most applications store their icons directly in the EXE (executable) file itself, which indirectly hides those icons from you.

I sometimes enjoy changing the icons on my computer for a specific application or maybe for a certain file that I use very often and want to visually differentiate from everything else. You can quickly change the icon on a program, file, document, photo, etc by simply right-clicking on it and going to Properties. Click on Customize and then click Change Icon.

This is great for the most part, but the problem comes in trying to find a suitable icon to replace the current one with. By default, when you change the icon for a folder or program, Windows will bring up a list of icons from SHELL32.DLL, which has a bunch of generic-looking and crappy icons. Now going around and randomly clicking on EXE files or DLL files to find icons is not fun nor efficient.

IconsExtract is a cool freeware application that you can use to automatically find icons that are stored in EXE, DLL, OCX, CPL, and other file types. You’ll be amazed at the actual number of icons stored on your computer after using this program!

The program is a standalone executable and does not require any installation at all, which means you can run it on any computer easily! You can also filter the search by icons or cursors, by icon size, and even by the number of colors.

You have 2 main search options when you start up the program:

1.Select only a single file. For example: C:\WINNT\System32\shell32.dll You can either manually type in the filename into the textbox, or select it from a dialog box by clicking the “Browse Files” button.

2.Select multiple filenames by using wildcard characters (? and *). You can select the folder that you want to scan by clicking the “Browse Folders” button. If you check the “Search Subfolders” check-box, all of the subfolders of the main folder will also be scanned.For example: if you type “c:\*.*” in the filename text-box, and check the “Search Subfolders” option, IconsExtract will search for icons in all folders and files on your C: drive.

After the search is complete, you will find the icons displayed in the main window of the program. You can then save the icons into ICO files by selecting the ones you want to save and then choosing Save Selected Icons from the File menu.

You can also copy a single icon to the clipboard and paste it into another application by pressing the standard CTRL + C key combo. This will copy the icon in the standard dimensions of 16×16 or 32×32. If you want to copy a different size, double click on the icon and select the specific image in the properties window and click Copy Selected Image.

Overall, this is a very cool application for anyone who likes to customize their icons or who wants to take a cool icon from a program as use it as a Fav Icon or something similar. Definitely worth check out! Enjoy!

Howto Restore Ubuntu After Windows Installation Using LiveCD

Windows will overwrite the grub boot loader , So You cannot access Linux partition after Windows Installation.

Tools Required : Ubuntu LiveCD

First you have to boot your system with a ununtu LIVECD
Then Open a terminal ( Applications –> Accessories –> Terminal)

($sudo -i Will give # Prompt then you can avoid sudo in every command)

Now you can start
$ sudo grub this will give you a new prompt

Type the command

> find /boot/grub/stage1 This will give you a output like (hd0,2) in this case it will vary depends on your system

> root(hd0,2) ( use your hd number and there is no space between root and (hd0,2)

now type
> setup (hd0,2)

then
> quit
Now you can restart your system

HowTo Run Squid Proxy Server in Windows XP

It is better to use Linux for this purpose. , You can make an experiment in your windows and switch to Linux.

installing squid on windows

Download squid for windows from :

http://squid.acmeconsulting.it/download/squid-2.6.STABLE18-bin.zip

Full Installation Instructions are in the documentation.

Change the c:\squid\etc\squid.conf from the default :

acl home src 192.168.0.0/255.255.255.0 # (change it for your subnet)

http_access allow home

cache_dir aufs c:/squid/var/cache 1000 16 256

dns_nameservers 208.67.220.220

run the following commands :

mkdir c:\squid\var\cache

c:\squid\sbin\squid -z

Done,
Now your squid is ready.

squid

HowTo Disable Windows 7 Media Player Network Sharing Service (wmpnetwk)

By default, Microsoft has configured Windows 7 to enable and turn on background services when needed. However, some of these background processes are not always in use or required. When they are constantly running, they will consume a large amount of resources and slow down the system’s performance. One of these background processes that many users have highlighted is the wmpnetwk.exe file. The “wmpnetwk.exe” is the key executable for the Windows Media Player Network Sharing Service and it is used to share Windows Media Player libraries (Windows 7 is using Windows Media Player Version 12). Windows Media Player may not be your preferred player and you may not want to have wmpnetwk.exe running to free up some memory, reduce RAM usage and CPU resources. In that case, Windows 7 offers you an alternative to disable and turn it off.

To disable and turn off wmpnetwk.exe, users just need to type “services.msc” in the Windows search box to open Windows 7 Services Microsoft Management Console (MMC) snap-in. MMC allows users to manage and configure Windows services that are running on the computer.

Select “Windows Media Player Network Sharing Service”, right click, and click “Stop” to disable it.

Users can go to the Resource Monitor to check and confirm that wmpnetwk.exe is no longer running. Even though users have successfully disabled wmpnetwk.exe and turned off Windows Media Player Network Sharing Service, this process will be restored every time users restart the computer.

To permanently disable this process, users can go to MMC again, select and right click “Windows Media Player Network Sharing Service”, in the shortcut menu, click “Properties”. Look for “Startup type” item, select “Disabled” so that this process will be permanently disabled even when users restart the computer.