Showing posts with label Work. Show all posts
Showing posts with label Work. Show all posts

March 10, 2011

fixed point arithmetic

There is a good introduction in wikipedia, which includes several useful external links at the end of the article. The MATLAB also has quite a few functions dealing with this kind of problems, as well as a thorough introductory article. Besides, the comp.lang.c happen to take one inspiring discussion about it. All these things adding together shall definitely let me understand sufficient knowledge about this field of study.

In addition, there are other resources from TI and article written by Joe Lemieux directly concerning the fixed point C programming.

March 6, 2011

Comparing file diff in Ubuntu

I am still familiar with the highlighted view for differences rather than the "diff" command, which produces the results in a "+/-" form. After a easy google, the Meld turns out be one good alternative solution for this purpose. Here is its web page.

Just one step to do:
$ sudo apt-get install meld

Then, you will find the Meld in Application->Programming directory.


Have fun.

July 5, 2010

Install Click in Ubuntu 10.04

GIT is the best way to acquire the code, so it is necessary to install this software first. Besides, there are several packages needed to patch before the click installs. And it is also tricky for the final step of installation.

**************

# git clone git://git.kernel.org/pub/scm/git/git.git

# apt-get install git-core

# git clone git://read.cs.ucla.edu/git/click

# apt-get install autoconf

# apt-get install libgtk2.0-dev

# apt-get install libtool

To update to the latest version checked in to the public repository, change into your working copy directory DIR and run:

# git pull

To fetch the Click packages:

# git clone git://read.cs.ucla.edu/git/click-packages DIR

Installation of Click:

# cd CLICKDIR
# ./configure --prefix=$HOME --enable-analysis --enable-test
# make install

The –prefix=$HOME configuration switch causes Click to install into your home directory. To run the Click driver and read its manual pages, you'll need to add $HOME/bin and $HOME/man  to your PATH and MANPATH environment variables, respectively. Alternatively, if you have root privilege on your machine, you can install Click in /usr/local, /usr/local/click, or wherever you'd like.

The –enable-analysis and –enable-test configuration switches turn on support for two necessary sub-packages, including trace analysis and regression test elements.

If you get a bus error when running Click on a Solaris or other non-x86 machine, try running your configuration through click-align: “click-align config.click | click”.

Furthermore, make sure your system has the necessary libraries and packages
installed.  On a Debian or Ubuntu system, this will include automake,
autoconf, libtool, libgtk2.0-dev (or libgtk2-dev), and graphviz.  Then:

# cd CLICKDIR/apps/clicky
# autoreconf -i
# ./configure [--prefix=PREFIX] --with-click=CLICKPREFIX
# make install

That's done:)

But on the other hand, there are some warning coming out, although they seem to be all right till now.

FIRST & SECOND appear in the Click Configuration step.

Your Linux kernel header files cause errors when included by a C++ program,
so I won't try to compile the linuxmodule driver.

There are two common reasons for this error:
1. You have not applied the Linux kernel patch that comes with this distribution.  Apply the right patch and try again.  See the INSTALL file for more information.
2. Your Linux configuration enables some functionality that is not yet covered by our patches.  Turn off this functionality and try again, or fix the error and tell us how you did it.  See the config.log file for more detailed information on the error.

==============

WARNING: `makeinfo' is missing on your system.  You should only need it if you modified a `.texi' or `.texinfo' file, or any other file indirectly affecting the aspect of the manual.  The spurious call might also be the consequence of using a buggy `make' (AIX, DU, IRIX).  You might want to install the `Texinfo' package or the `GNU make' package.  Grab either from any GNU archive site.

=============

The THIRD comes out when I build the Click install.

click-elem2man: warning: category 'devices' begins with a lowercase letter (used in UMLSwitch)
click-elem2man: warning: category 'devices' begins with a lowercase letter (used in UMLSwitch)
../missing makeinfo ./click.texi
WARNING: `makeinfo' is missing on your system.  You should only need it if
         you modified a `.texi' or `.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy `make' (AIX,
         DU, IRIX).  You might want to install the `Texinfo' package or
         the `GNU make' package.  Grab either from any GNU archive site.
make[1]: [click.info] Error 1 (ignored)
......
install-info: warning: don't call programs like install-info with an absolute path,
install-info: warning: /usr/sbin/install-info provided by dpkg is deprecated and will go away soon;
install-info: warning: its replacement lives in /usr/bin/.
This is not dpkg install-info anymore, but GNU install-info
See the man page for ginstall-info for command line arguments
install-info: No such file or directory for /root/share/info/click.info
make[1]: [install-info] Error 1 (ignored)

=============

The FINAL one appears when I build the clicky.

xcallbacks.c: In function ‘on_cut1_activate’:
xcallbacks.c:11: warning: unused parameter ‘menuitem’
xcallbacks.c:12: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_copy1_activate’:
xcallbacks.c:19: warning: unused parameter ‘menuitem’
xcallbacks.c:20: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_paste1_activate’:
xcallbacks.c:27: warning: unused parameter ‘menuitem’
xcallbacks.c:28: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_clear1_activate’:
xcallbacks.c:35: warning: unused parameter ‘menuitem’
xcallbacks.c:36: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_properties1_activate’:
xcallbacks.c:43: warning: unused parameter ‘menuitem’
xcallbacks.c:44: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_preferences1_activate’:
xcallbacks.c:51: warning: unused parameter ‘menuitem’
xcallbacks.c:52: warning: unused parameter ‘user_data’
xcallbacks.c: In function ‘on_about1_activate’:
xcallbacks.c:59: warning: unused parameter ‘menuitem’
xcallbacks.c:60: warning: unused parameter ‘user_data’

July 2, 2010

Install RT2870 usb wireless adapter in Ubuntu 10

Step 0 : At terminal, aaa@ubuntu:~$ sudo gedit /etc/modprobe.d/blacklist.conf. Add “blacklist rt2870usb” without quote at the end of the file, then save it.

Step 1 : Download the latest rt2870 driver (here) from Ralink.

Step 2 : Untar the file and save to your home folder, and name it. (eg. the folder name is rt2870)

Step 2.51 : According to the instruction I found in the internet, there should be another three steps done with the dongle: firstly, without plug your wireless usb at this moment, at terminal aaa@ubuntu:~$ type lsusb.

Step 2.52 : Then plug in the wireless usb to the computer, type lsusb again, the wireless usb ID (8 digits) will be found. Write it down.

Step 2.53 : Check it at aaa@ubuntu:~/rt2870/os/linux$, sudo gedit usb_main_dev.c. If the usb device is not included, add the wireless usb ID. Save the file. For example, the additional two lines are:
{USB_DEVICE(0x0B05,0x1761)}, /* Asus */
{USB_DEVICE(0x1761,0x0B05)}, /* Asus */

Step 3 : In Makefile, set the "MODE = STA" in Makefile and chose the TARGET to Linux by set "TARGET = LINUX". Then, change the directory of RT28XX_DIR in line 7 by "aaa@ubuntu:~$ shell pwd". Finally, via the command "aaa@ubuntu:~$ shell uname -r", define the linux kernel source include file path LINUX_SRC modify to meet your need.

Step 4 : At same terminal , sudo gedit config.mk, and change two settings.
# Support Wpa_Supplicant
HAS_WPA_SUPPLICANT=n → y
# Support Native WpaSupplicant for Network Maganger
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n → y

Step 5 : At aaa@ubuntu:~/rt2870$, sudo gedit Makefile, check the folllowing at the top of the file:
RT28xx_MODE = STA
TARGET = LINUX
CHIPSET = 2870
If ok, close the file. If not, change the setting as above.

Step 6: rt2870 2.2.00 version do not support kernel 2.6.31-14-generic, so you have to do a patch. The download link is here, and the patch is via "patch -p1 < rt2870-2.6.31.patch".If you get a message of unable to patch, then download and install Patch_2.5.9-5_amd64.deb.

Step 7 : At aaa@ubuntu:~/rt2870$, do the compilation.
sudo make uninstall
sudo make clean
sudo make
sudo make install

Step 8 : At aaa@ubuntu:~$ sudo modprobe rt2870sta

Step 9 : At aaa@ubuntu”~$ sudo gedit /etc/rc.local, add following two lines prior to exit0.
ifconfig ra0 up
pkill NetworkManager
save it, then at same terminal, sudo gedit /etc/modules, add rt2870sta, then save the file.

Step 10 :At aaa@ubuntu:~$ ifconfig or iwconfig, you will see your wireless is up as ra0 or wlan0.

Step 11 : Now configure networkmanager, use wep instead of wpa-psk or wpa2-psk. Your wireless will be able to connect to the internet. If there's no connection, then do step 12.

Step 12 : Update networkmanager. Go to System – Software Sources – Other software, add the following line
deb http://ppa.launchpad.net/network-manager/trunk/ubuntu karmic main

That's the end.

Install madwifi in UBUNTU 10.04

When I install the madwifi driver from madwifi.org, the problem appears:

In file included from /home/user/madwifi/madwifi-hal-0.10.5.6/ath/../net80211/ieee80211_monitor.h:34,
from /home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:75:
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/../ath/if_athvar.h:107: error: conflicting types for 'irqreturn_t'
include/linux/irqreturn.h:16: note: previous declaration of 'irqreturn_t' was here
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c: In function 'ath_attach':
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:478: error: 'struct net_device' has no member named 'priv'
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:819: error: 'struct net_device' has no member named 'open'
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:820: error: 'struct net_device' has no member named 'stop'
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:821: error: 'struct net_device' has no member named 'hard_start_xmit'
/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.c:822: error: 'struct net_device' has no member named 'tx_timeout'
.....
.....
.....
make[3]: *** [/home/user/madwifi/madwifi-hal-0.10.5.6/ath/if_ath.o] Error 1
make[2]: *** [/home/user/madwifi/madwifi-hal-0.10.5.6/ath] Error 2
make[1]: *** [_module_/home/user/madwifi/madwifi-hal-0.10.5.6] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'
make: *** [modules] Error 2
This is due to the fact that there was a change in the kernel headers. The new kernels replaced the old net_device structure with a new one called net_device_ops. It looks like this change exists since kernel 2.6.29 and up.

There currently is no stable release of the madwifi drivers for the new kernerls. But the madwifi project's latest trunk compiles and works fine (at least for me) and I have not noticed any issues yet. This should work with any Linux distribution with a kernel of 2.6.29 and above. To find out your kernel version run:
$uname -r
Here is how to get and install it:

1. You can either get the latest trunk from the madwifi website at here or use the one that worked for me (click).

2. Download and uncompress the files, cd to the directory containing the file. Then gunzip and untar the files:
tar -xvzf madwifi-trunk-r4099-20090929.tar.gz
3. Cd into the newly created directory and install the drivers. Firstly, make sure you have the kernel headers:
sudo apt-get install build-essential
Then compile and install:
sudo make
sudo make install
4. Add the ath_pci module to the kernel. You need to add a line to the end of the /etc/modules file. The line should read: ath_pci. You can do this with vi of course, but if you don't know the vi editor then it would be much easier to use gedit. So, do:
sudo gedit /etc/modules
Add ath_pci to the end of the file. Here is how my file looks:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp
sbp2
ath_pci
At this point you can reboot and you should have wireless. You could save yourself a reboot by modprobing the kernel with the ath_pci module like this:
sudo modprobe ath_pci
That's done:)

May 12, 2010

Which programming language should I learn first?

digest from www
--------


Depends.

  • To program in an expressive and powerful language: Python
  • To get a website up quickly: PHP
  • To mingle with programmers who call themselves “rockstars”: Ruby.
  • To really learn to program: C.
  • To achieve enlightenment: Scheme.
  • To feel depressed: SQL
  • To drop a chromosome: Microsoft Visual Basic
  • To get a guaranteed, mediocre, but well paying job writing financial applications in a cubicle under fluorescent lights: Java.
  • To do the same thing with certifications and letters after your name: C#
  • To achieve a magical sense of childlike wonder that you have a hard time differentiating from megalomania: Objective C

December 29, 2009

November 30, 2009

Expository papers

这段时间做convex optimization的大作业,发现老师们的一个很棒的做法,实际上是从他们大学时就已经开始了——写expository paper。

Expository writing is a type of writing, the purpose of which is to inform, explain, describe, or define the author's subject to the reader. Expository text is meant to deposit information and is the most frequently used type of writing by students in colleges and universities. A well-written exposition remains focused on its topic and lists events in chronological order. (en.wikipedia)

很多文献,看了过段时间总会忘记,而像这样把原委记录下来,序言、定义、公理、证明、结论,以及参考文献,以后自己查阅起来也比简单的digest要有的放矢的多。经过自己大脑加工处理的知识,记忆应用起来,自然也会更加的得心应手。写的时候需要注意,首先尽量搜集相关主题的论文,或者是顺藤摸瓜逐渐填充;其次,把相同的内容进行归类和比较,最终得出根据自己计算或者是最新文献的结论,做醒目标识;第三,写的时候可以是“框架->定理->推论->例子”这样的逐渐填充,但成稿的时候,一定要把所有的定理以及例子进行统一编号;最后,章节以及定理的前后衔接,一定要符合逻辑顺序。

只是,这样的文章貌似写一篇要花不少时间。给自己定一个要求,一个月一篇。一步一个脚印往下走,也能心里更踏实。

May 10, 2009

Are You Really an Entrepreneur?


(from readwriteweb.com)

1. You're always looking for opportunities. This is almost the definition of an entrepreneur. Every pain point is an opportunity.

2. Are you prepared to work long hours, every day, for an indefinite period of time? Ahem, let's dispel illusions. Put down "The 4-Hour Workweek"; it is a myth that the author spun to sell books (so that he could work 4 hours a week).

3. Good Health. You cannot answer "Yes" to item #2 unless you are blessed with good health and the discipline to maintain it in tough times.

4. Do you have a unique service or product? Most entrepreneurs have a pocketful of ideas, many of them viable. But they suffer from the "kid in a candy store" dilemma, not knowing which to choose. The trick is choosing the one that really is a winner and having the discipline (see item #9) to ignore all the others.

5. Are you willing to make short-term sacrifices for long-term success? There will be long periods of time when everyone around you questions your sanity, and on all normal metrics (hours worked and stress endured vs. material rewards gained), they would be right.

6. Honesty and integrity. You often have to be able to work with people without the protection of legal contracts. It is the essence of moving fast, and you often simply won't be able to afford a lawyer. So, you have to work with people who have honesty and integrity. It is hard to do that unless you have honesty and integrity yourself.

7. You're dreaming miles ahead while focused on what you're doing right now. The entrepreneur is an odd mix: part dreamer, part brutal realist and pragmatist. You should focus first on today and, secondly, on the big picture, and ignore the rest. Today is about the immediate stuff that you have to get done to stay in business, to deliver projects to clients, to collect cash, and so on. The big picture is about looking at what the world might look like 10 years from now and then building towards that. We cannot know what will happen next week, month, or year. The medium term is totally unknown. However, many long-term trends are fairly clear, even though the timetable is unknown.

8. Are you self-confident? You will almost certainly be going against odds that would make most people run away.

9. Discipline. This relates to many of the other traits mentioned in this checklist. You will need discipline to maintain your health (item #2), so that you can work hard (item #3), so that you can focus on the one product or service you have chosen and ignore all temptations (item #4).

10. You're prepared to say, "I don't know, but I'll figure it out." Entrepreneurs have to be generalists. They may know one thing very, very well. But they also have to know enough about almost everything else to occasionally do those things themselves, and have the judgment to eventually hire the right people to do those things.

Days of our lives

Daisypath Anniversary tickers