Aug 12, 2012

Recover Grub2 via LiveCD (Fedora16/17)

After installing the windows 8 RTM in my computer, I can't boot into my Fedora 17. I need to fix the grub2.

I use the Fedora LiveCD to fix it. First, boot the liveCD, and then open a terminal and type:
$ sudo fdist -l
Now, remember which device listed is your Linux distribution. For example, my Linux distribution is in /dev/sda3
$ sudo mount /dev/sda3 /mnt
If you have /boot on a separate partition, you need to mount it too. For instance, your /boot partition is /dev/sda2, you need run sudo mount /dev/sda2 /mnt
$ sudo mount --bind /dev /mnt/dev
$ sudo chroot /mnt
# grub2-install /dev/sda
After this command, it will show you the grubs is installed successfully and then you can reboot. The grub2 list comes back now.

When you boot into your original Fedora, open the terminal and type:
$ su -c 'grub2-mkconfig -o /boot/grub2/grub.cfg'
It will update your boot list.

Aug 6, 2012

My First Android App: Microwave Tools


Description

This is an app for calculating the electrical parameters and physical parameters of different kinds of transmission lines in RF frequency. The physical parameters include the characteristic impedance, electrical length, differential impedance, and common mode impedance. The physical parameters include the width and the length of the lines and the thick and the relative permittivity of the substrate, etc.
Now, this app includes the functions for calculating the Microstrip Line, Coupled Microstrip Line, Coplanar Waveguide, Coplanar Waveguide with Ground, Stripline, Coupled Stripline and Coaxial Line.

What's New


Version: 1.0
> Microstrip Line
> Coupled Microstrip Line
> Coplanar Waveguide
> Coplanar Waveguide with Ground
> Stripline
> Coupled Stripline
> Coaxial Line

Screenshots


Download


Jan 31, 2012

How to Configure the Linux before using the fastboot mode of Android

After installing the android sdk, we still need some configuration before using the fastboot mode of the nexus s on Linux.

Firstly, we need the device ID of the android device, here is the nexus s. Connect the nexus s to the computer via USB, then type "lsusb" in the terminal, see figure 1. In the last line, we can see the ID "18d1:XXXX".
Fig. 1
Then, create a file in "/etc/udev/rules.d" named "51-android.rules". Copy "UBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"" into the file. After rebooting, you can use the fastboot mode.

Sep 12, 2011

Aurora Led with Atmega 8

This awesome idea comes from the the led artist: http://www.theledart.com/blog/
I made another version with the atmega 8 MCU and 70 LEDs. It is not so good as the upper one. I just made it for fun. So watch the video first, which is recorded by my SGS phone.



Hardware:
PCB x1
ATmega 8L x1
3528 full color LED x70
SI2301 P-Channel MOSFET x3
9013 NPN BJT x11
20K ADJ resistor x3
button x2
resistors and capacities
Environment:
Microsoft Windows 7
Fedora 15
Vim
AVR Studio 5
Altium Designer 10
SVN
If you want some detail information,  please email to: rookie.dev@gmail.com

Sep 10, 2011

A Bash Script to Create Multiple User Accounts in a Batch

There are a lot of introductions on the Internet about how to create multiple user accounts in a batch with "newusers" command. But in this way, there are some problems about the environment variables. The system will not initialize the ".bashrc" and the ".bash_proflie" files.

Here is anther way to create multiple user accounts with "useradd" command.
#!/bin/bash
password="123456"
for USER in $(cat example_userlist)
do
    useradd -m $USER
    echo -e "${password}\n${password}" | passwd $USER
done
The password of all the users is "123456", it can be changed in the second line.

In this script, the "example_userlist" is a list of user names, the format of this file is like this:
user1
user2
user3
...
Enjoy!