Finding a device IP Address

If you are developing software for an Ethernet (or Wifi) device, you’ll need to access the board for debugging and/or testing purpose. If your board does not have user interface or the serial port is not available, you’ll have to find the IP address (assuming it is using DHCP) before accessing the board thru telnet or ssh. A simple way to do that is to ping the broadcast address and check the arp table. > ping -b 192.168.0.255 WARNING: pinging broadcast address PING 192.168.0.255 (192.168.0.255) 56(84) bytes of data. 64 bytes from 192.168.0.246: icmp_seq=0 ttl=64 time=0.018 ms 64 bytes from 192.168.0.101: icmp_seq=0 ttl=64 time=0.217 ms (DUP!) 64 bytes from 192.168.0.246: icmp_seq=1 ttl=64 time=0.023 ms > arp -i eth0 arp -i eth1 Address                  HWtype  HWaddress           Flags Mask            Iface 192.168.0.103            ether   00:50:FC:00:00:01   C                     eth1 192.168.0.109            ether   00:13:20:01:01:01   C                     eth1 If you cannot find your device, it may be configured to […]

How to check open files for a process

While debugging your program, you may encounter the message “Too many open files”. One way to fix the issue could be to review your code and check open, fopen, socket and pipe calls are matched with close and fclose calls, but with large projects this may be cumbersome. A better way is to list the open files using the proc filesystem. I’ll use VirtualBox program as an example since this is running in our server. First, locate the process ID (PID): pgrep VirtualBox 3901 3950 Then list the file descriptor opened for process 3901 sudo ls -l /proc/3901/fd total 0 lrwx—— 1 root root 64 2010-10-05 14:52 0 -> /dev/pts/1 lrwx—— 1 root root 64 2010-10-05 14:52 1 -> /dev/pts/1 lr-x—— 1 root root 64 2010-10-05 14:52 10 -> pipe:[15825] l-wx—— 1 root root 64 2010-10-05 14:52 11 -> pipe:[15825] lr-x—— 1 root root 64 2010-10-05 14:52 12 -> pipe:[15829] […]

Quick guide to install Samba/CIFS in Linux

You may want to install Samba/CIFS in a Linux host to share files with other Windows computer or to use as a media server with a networked media player. If samba is missing, install it in the host machine (foomachine):

Create a new smb user:

Start / check status / restart samba service:

To make samba service run automatically at startup:

Type \\foomachine\foouser  in Windows Explorer and type the username foouser and the password to access your Linux files. To add other directories to share with samba, edit /etc/samba/smb.conf Resource: http://www.cpqlinux.com/samba.html Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Script to convert Twitter RSS feeds into text

[Update Nov 2012: URLs such as http://twitter.com/statuses/user_timeline/759251.rss do not work anymore, but you can get a Twitter timeline RSS feed by using http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=xxxxx, where xxxxx is the screen name such as cnxsoft] We needed to convert Twitter RSS feeds to UTF-16 text for displaying them into a digital signage (That did not support RSS feed directly).  This digital signage supports regular http download, .e.g every 5 minutes. Here’s the script (called with crontab) we used for CNN News Twitter RSS feed. #!/bin/sh # CNN Twitter wget http://twitter.com/statuses/user_timeline/759251.rss sleep 10 cat 759251.rss | grep title | sed s/\<title\>// | sed s/\<\\/title\>// > cnn.txt rm 759251.rss iconv -f utf-8 -t UCS-2LE cnn.txt > cnn-utf16.txt cp cnn-utf16.txt /var/www/html/livepics/cnn.txt The resulting text file looks like: Twitter / CNN CNN: BREAKING NEWS: Military: Last U.S. brigade combat team leaves Iraq; 56,000 troops remain. Fifty-thousand set to stay past August 31. CNN: NY Gov. David Paterson […]

Installing Android in your PC

In case you want to checkout Android but do not have any devices to do so, you can simply install it in your PC. In this blog entry I’ll show how to install Android in VirtualBox with a computer running Windows XP, but this could be installed in any OS supported by VirtualBox or other virtual machine (e.g. VMWare). If you don’t have it yet,  download VirtualBox for your OS and install it first. The first thing is to download Android-x86 ISO file. While it is downloading you can add a new Virtual Machine to VirtualBox. After you click on the “New” icon, click on Next  and enter your machine name. e.g. Android, and select the Operating System:  Linux and version: Other Linux. Click on next to select the memory size: Click on next to select to create a new hard disk: Then basically select Next for the following steps […]

Where to get video, audio and image samples

If your system is dealing with media files such as video, audio and image you’d better get some samples to make sure your system can play most of them or at least can match (or beat) the competition using the same platform. So I’ve collected some links for just doing that. mplayer test samples: http://samples.mplayerhq.hu/ – Over 42 GB / a few thousand files of diverse audio and video files. Microsoft HD Showcase – http://www.microsoft.com/windows/windowsmedia/musicandvideo/hdvideo/contentshowcase.aspx – A must to test wmv, wma and wma pro decoding capabilities. For testing MKV videos, you’ll most likely need to download some videos using bittorrent or emule. To search for video you can use sites such as http://www.isohunt.to or http://www.verycd.com/. Very CD is actually one of the top website in China in terms of traffic. You can also convert some other videos to MKV using some MKV editors my favorite being mkvtoolnix. For graphics […]