shorne in japan

blog archive about resume

Setting up USB-Blaster in Linux

30 Jul 2014

Today I got my DE0-Nano FPGA development board. The first thing I wanted to do was get the linux connectivity setup; so I plugged it in. The device was recognized as character devide by linux right away.

Next, I checked Altera to see if anything special was needed for getting USB-Blaster setup in linux. They recommend some udev example rules to make the device file world writable, I guess that is ok. I dropped the udev rules into /etc/udev/rules.d/51-usbblaster.rules and unplugged then replugged the device but nothing happened.

I havent setup udev rules for a while, so right away I wasn’t able to spot the problem. I was able to test the rules using udevadm as below.

    udevadm test /bus/usb/devices/3-1

It complained that BUS and SYSFS matchers were not valid. They were removed in 2011 according to the udev changelog.

Using udevadm we are also able to see the proper attributes that we should be matching. Below is what I have come up with to properly setup USB-Blaster in linux. I am using Fedora 18.

    udevadm info -a --path=/sys/bus/usb/devices/3-1

My USB-Blaster udev Rules

    # USB-Blaster
    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="0666", SYMLINK="usbblaster%n"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6002", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6003", MODE="0666"
    # # USB-Blaster II
    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6010", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6810", MODE="0666"

Note, since my device is a 6001 I setup a symlink which will make it easily accessable at /dev/usbblaster1.

Hopefully this will be helpful to other people.

Move to github pages

10 Jul 2014

This is my first post to my new blog using Jekyll.

Lets see how it goes, I want to:

  • Notes on technology I am using (Verilog, Javascript, Rails, C)
  • Links to code
  • Blogs
  • Maybe import my old blog here


22 Feb 2009

Yesterday, Sachi and I were going to a concert for the Yomiuri Orchestra in Ikebukuro, a town on the west side of Tokyo. We received free tickets from Sachi's father, who works for Yomiuri. The nice thing about watching the symphony is that the music is really relaxing and sometimes we get to fall asleep. I guess its ok because most of the people there also sleep. Maybe its a Japanese tradition.

After the concert we left Ikebukuro for shinjuku to do some shopping. First we went to I-Setan. There we bought some really nice bread; German style muesli rolls, pretzel rolls and some anpan.

We also saw some of that really expensive fruit you always hear about. Now, I have seen melons priced at $80 before but this time I saw strawberries.

Japanese strawberries for the sick

The price says 12600Yen, which is about 135USD today. You could also buy one for about $20 if you don't want to splurge.

Anyway, after that we took our bread and went looking for an Indian restaurant because we felt like eating curry. We walked and walked in the north direction and didn't find anything until we got up to Shinokubo; the Tokyo Korea town. By that time we decided we were pretty much hungry for anything and decided to have some Korean BBQ.

The food turned out to be pretty good until I decided to order some Maccori. The lady asked me if I wanted sweet or dry, I chose dry. Next think I know she brings out a one liter bottle and starts to open it. Within about 30 minutes I am done with the bottle and speaking Chinese and having a good time with the owner of the restaurant who is from Taiwan. I give them my business card to staple onto the roof, pay the bill and leave.

By the time I got home I realized we left the bread in the Korean restaurant. I hope they ate it for us.

Using Acegi with Hibernate

13 Feb 2009

A while back I started working on a web application with, at the time, all new java technologies. Once the web application needed an authentication framework I turned to acegi (now part of Spring Security API). Acegi security provides much of the authentication features a developer requires in a web application including: remember me, failed login handling, public content access and so on. Other technologies I used where Struts2, Spring and Hibernate.

Since I was using hibernate and spring daos I thought it best that I store my user names and passwords in the database via the same mechanism. That is, I needed to use Acegi for authentication and Hibernate and Spring for managing the user detail persistence layer. After searching a few forums it turned out that many people wanted to do the same, but no one was providing a solution. Proceeding with a brief brainstorm session and research into the acegi API I came up with my own UserDetailsService implementation backed by hibernate and spring. Its simple but it provides me with what I need and I hope it will be a helpful reference for others as well.

Source Code

The code used for the implementation is packaged as auth.jar with class and source files for your reference. Please do with it as you like (BSD license). The contents of the archive are described below:


Together these small classes provide the groundwork for our authentication layer. Next, the hard part is dealing with all of the Acegi spring configuration.


Acegi is loaded via two spring application context xml files. This first one is pretty basic, first it initialises my hibernate authentication implementation. Next it initialises the authentication provider.

<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="autodetect">
  <!-- Load the hibernate model for authentication -->
  <bean id="sessionFactory" 
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
    <property name="mappingResources">
  <!-- The hibernate backed implementation for UserDetailService -->
  <bean  id="userDetailProvider"
    class="net.shornepla.auth.UserDetailProvider" >
    <property name="sessionFactory" ref="sessionFactory" />
  <!-- Just use MD5 password hashing -->
  <bean id="passwordEncoder"
    class="org.acegisecurity.providers.encoding.Md5PasswordEncoder" />
  <!-- Tie together with the DaoAuthenticationProvider -->
  <bean id="daoAuthenticationProvider"
    class="org.acegisecurity.providers.dao.DaoAuthenticationProvider" >
    <property name="userDetailsService">
       <ref local="userDetailProvider"/>
    <property name="passwordEncoder">
      <ref local="passwordEncoder"/>


The second application context config is applicationContext-acegi-security.xml. This is mostly copied directly out of the acegi example and simplified as much as possible.

The main beans here are:

  • authenticationManager - uses the above defined daoAuthenticationProvider
  • filterInvocationInterceptor - specifies which roles have access to what
  • authenticationProcessingFilter - specifies which pages are used for authentication

All together, these resources will probably not work for you as they require a web application to be deployed. However, the pieces I provide should make integration into your application as simple as possible. If there are any issues or suggestions please let me know.


29 Dec 2008

It looks like google gmail now supports Japanese decome (デコメ) or decorated mails. These are small charset extensions added by Japanese mobile companies to allow cell phone users to exchange emotional icons in their email.

Example with a peace sign


Decome is specific to japan so most computers will not support this natively. To implement this It seems google have a public image repository which is referenced to display the pictures. This should prove useful for 3rd party mash-up applications as well.

Code example

<img src=""
     style="margin: 0pt 0.2ex; vertical-align: middle;">

Pretty nice stuff.