Saturday Mar 12, 2011

This Blog May Be Moving in the Future

I'm adding this entry so that my blog will be migrated to the new platform.

Friday Jan 08, 2010

Netbeans and Git

I've heard some Netbeans users say that it does not work with the Git version control system. They're right that it doesn't come built-in but you can download a separate plugin called nbgit that does support it.

I'm using the nbgit plugin with Netbeans 6.8 and it highlights diffs for me in the UI. However, I am still using the command line for actual git operations and I use GitX to visualize my revisions.

Wednesday Dec 16, 2009

Kenai.com Source Repository Access

With last night's deployment, Kenai.com now supports SSH access to Subversion which should help improve performance. Since we provide different ways to access the three types of hosted source repositories: Git, Mercurial (hg), and Subversion (svn). Which should you choose? Well, the answer is: it depends. Though, if you want one method that will always work, then choose the SSH option. In general, SSH will be the fastest and most secure method. However, SSH requires users to upload a public key to the site which can be problematic if you are unfamiliar with keys. Read on if you want other answers that do not require SSH and also for my recommendations.

First, let's consider a couple common usage scenarios for a generic user that is not a project administrator: read-only access and read-write access. Someone who wants to checkout a project's source code only needs read-only access. In this case, the project's admin needs to give "checkout permission" to generic users. By default, project "observers", meaning a user who has "bookmarked" a project, can checkout code. A project admin can change this setting using the set role permissions screen to make access more or less permissive.

For git, the read-only git URL is recommended. For hg, https URLs will work but unless the project admin has relaxed checkout permissions, it may require password authentication. This means that your password will be stored on the client and so you may want to use ssh URLs to protect your password. For svn, https URLs are available and may be more familiar to users, though svn+ssh URLs often perform better.

For the read-write scenario, a developer needs to commit code changes to a repository. Here a project admin must add that person to the project with a role that has write access such as "software developer". For git, ssh URLs are required. For hg and svn ssh URLs are recommended but https is also available.

Summary of Recommendations:

Repository Type Read-only Checkouts Read-Write Commits
Git git: ssh:
Mercurial ssh: or https: ssh:
Subversion svn+ssh: or https: svn+ssh:

Monday Oct 19, 2009

Ruby Multipart Post/Put Request

I had to modify a client app to perform a multipart PUT request and ran into a few snags that I'd like to share. The first is that there isn't a single common way to do this in Ruby. Ruby has a Net::HTTP API but it operates at a primitive level and so a higher level API would be useful. I like using the RestClient gem, but the mainline version does not support multipart POST/PUT requests yet. There is a @technoweenie fork of the gem that does, however, it is based on an older version. The app I was modifying was not based on this fork which is missing some useful features such as logging. Enter @nickseiger's multipart-post gem which does just what I need. This gem provides some code that works with Net::HTTP and supports both mutlipart POST and PUT requests. However, it also requires working with Net::HTTP directly which isn't as easy to use as RestClient.

One problem I ran into was that Net::HTTP does not automatically detect the use of TLS/SSL and so you must explicitly tell it to use it. I found some other posts like this one. Basically, one needs to set the instance attribute Net::HTTP#use_ssl separately. My version of the code is below. This is part of a larger example on using the Kenai APIs which can be found within the kenaiapis examples repository.

class KenaiClient
  # Code that uses rest-client gem
  @host = "https://kenai.com"
  ...
  module MultipartClient
    require 'net/http/post/multipart'

    def wiki_image_client(project, image_filename)
      @url = URI.parse("#{@host}/api/projects/#{project}/features/wiki/images/#{image_filename}")
      @initial_headers = { "accept" => 'application/json' }
      self
    end

    def put(payload, additional_headers = {})
      req = Net::HTTP::Put::Multipart.new(@url.path, payload, @initial_headers.merge(additional_headers))
      req.basic_auth(@user, @password)
      http = Net::HTTP.new(@url.host, @url.port)
      if @url.port == 443
        http.use_ssl = true
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        unless @warning_printed
          puts "\\nwarning: peer certificate for #{@url.host} won't be verified"
          @warning_printed = true
        end
      end
      res = http.start do |http|
        http.request(req)
      end
      raise "Request failed with response: #{res}" unless Net::HTTPSuccess === res
    end
  end
  include MultipartClient
end

Saturday Sep 12, 2009

Kenai.com SSH Source Repository Access Tip

Projects hosted on Kenai.com can have three different kinds of source code repositories: git, mercurial, and subversion. With git and mercurial, developers often use ssh for access. However, this requires at least one public key to be uploaded to the site. If you are having problems accessing a repository using ssh, you can test to see if your uploaded key is correct by invoking ssh from the command line on the host with the corresponding private key. Substitute your own Kenai.com username in the examples below. My username is edwingo and the following means a successful public key upload:

$ ssh edwingo@kenai.com
Hi, edwingo! You have successfully authenticated, but we do not provide shell access.
Connection to kenai.com closed.

If you receive some other kind of error, such as:

Permission denied (publickey,keyboard-interactive)

please check that your public key has been uploaded correctly to the SSH keys tab of your profile.

This entry was updated on 2009-12-09 to reflect the improved SSH keys tab user interface. (Soon subversion will also be accessible via ssh.)

Tuesday Jul 28, 2009

Connecting to Kenai.com Chatroom Using Adium

Someone recently asked how I connect to a project chatroom on kenai.com using the multi-protocol Adium client on my Mac. First, you need to be a member of the project whose chatroom you want to join. To do that, you can bookmark the page. The remaining instructions are documented on this help page. One final problem is that if you get disconnected from the chatroom, you may need to restart Adium to reconnect. I'm not sure whether the problem is on the client or server side.

Monday Jun 29, 2009

Troubleshooting Kenai.com Ssh SCM

Update: please see this updated post.

See this tweet on debugging kenai.com ssh access to SCM (source code management) problems.

Wednesday Sep 24, 2008

Project Kenai is Public

Two weeks ago, before I left for vacation, Sun launched the new project collaboration site I am working on. You can learn more about Project Kenai and how it differs from similar project hosting sites like sourceforge.net and Google Code in Tim's interview with Nick, the lead developer.

Tuesday Aug 12, 2008

My New Project

I've been working on a new project for the past six months. It's a new web site built using Ruby on Rails that will be going public as a beta real soon now. Ruby on Rails is a webapp framework that's built on top of the Ruby scripting language so I've also been working in Ruby. It's a pretty cool language compared to others I've used. I'll write more once the project has been released to the public.

Thursday Apr 24, 2008

CommunityOne and JavaOne

Yes, it is that time of the year again for 2008: JavaOne and the preceeding CommunityOne. I went to CommunityOne last year and thought it was definitely worth attending and was impressed by the variety of open source projects represented. Unlike its more well-known sibling, CommunityOne is completely free. Last year they had free food, t-shirts, and limited entry into JavaOne exhibits. This year some of the presentations I see are on OpenSolaris, MySQL, Ruby, Python, NetBeans, jMaki, Glassfish, OpenOffice, and even hardware. There's lots more I haven't mentioned too.

This is the second annual CommunityOne and I believe it developed as an expanded version of NetBeans Day which always occurred on the Monday of JavaOne week. It's a great idea because there are lots of open source projects useful for developers that Sun is involved in.

I'm signed up for CommunityOne, but so far I don't have a pass to JavaOne. That's because I no longer work on a project that's directly Java-related. For the last couple months, I've been working on Project Kenai. I'll write more about Kenai later. There is supposed to be a demo at the JavaOne Pavilion. I volunteered to help demo, but I might not be able to get an exhibit pass to get in. We'll see what happens.

Sunday Mar 16, 2008

Provisioning and Deploying to a VMware Fusion Virtual Machine

The project I work on requires me to deploy to an OpenSolaris-based machine. However, the machine is going to be moved to another location which means it could be down for a week, so I thought I would take the time to set up a virtual machine (VM) using VMware Fusion on my Mac. It seemed like a good idea, particularly since I've worked with hypervisors like Fusion in my last project. Unfortunately, the app is quite large so it did not work out too well. I started with SXDE 1/08 and after provisioning it with all the needed software and deploying the apps into glassfish, the VM ended up slowing down and its size ended up approaching 18GB! Hopefully, the next iteration of the app will be consolidating several apps into a smaller number so it might eventually work.

I intend to write more about my experience. For example, I started writing some info on how to get the latest Java Desktop System (JDS) to run in the VNC server that comes pre-installed. See this link. Thanks go to the people in the OpenSolaris forums that helped me figure it out.

Monday Jan 07, 2008

Using Mercurial on Mac OS 10.5 Leopard

The source code management system we are using in my project is Mercurial. To learn more about using Mercurial, see the information in the "UnderstandingMercurial" and "Tutorial" guides in the "Getting Started" section on the main Mercurial page. There is also a more extensive manual available.

If you're using a Mac like I am, go to this page and look for the heading "For OS X 10.5". Download the latest Mercurial zip file, open it, and then run the installer in the new directory. Open a new Terminal window and make sure that "/usr/local/bin" is in your PATH and then verify that Mercurial runs by running "hg --version". Use the documentation mentioned above to become familiar with Mercurial. For other platforms, see other information on the Mercurial site.

When checking in code, it is useful to set your username in a ~/.hgrc file so the command does not complain. Mine is shown below. Other configuration options can also be placed in this file.

# This is a Mercurial configuration file.
[ui]
username = Edwin Goei <edwin.goei@sun.com>

A common setup is to use ssh to access a common repository. If you do not have a ~/.ssh directory, run the following command to create a key pair. Select the default location (~/.ssh/id_rsa) and use an empty passphrase.

% ssh-keygen -t rsa

Send the generated public key located in a file called ~/.ssh/id_rsa.pub or ~/id_dsa.pub to the repository administrator. They will add it to a authorized_keys file on the common repository host to grant you access.

The following shows some example commands that access a common repository.

% hg clone ssh://hgroot@santa.sfbay/hg/vapp
destination directory: vapp
no changes found
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cd vapp
% echo "This is a test" >> README.txt
% hg add README.txt
% hg ci -m "Initial README"
% hg push
pushing to ssh://hgroot@santa.sfbay/hg/vapp
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 2 changesets with 2 changes to 1 files

Thursday Dec 27, 2007

Apple 15" MacBook Pro Laptop For Sale

Sold -- no longer available

Condition: Almost New. Same model currently sells for $2499 + tax from Apple. (You can check for yourself by going to the Apple Store.)

Shipping: local pickup preferred. I live in downtown Mountain View and work in Menlo Park, California.

Price: $1900 cash or check with valid ID. Credit card is $60 extra for transaction fee. Priced to sell so I can enjoy the rest of my break. :-)

Specs

  • 15-inch MacBook Pro Notebook Part number: MA896LL/A
  • Intel Core 2 Duo 2.4GHz, 2GB, 160 GB disk, matte display
  • Newly pre-installed with Mac OS X 10.5 "Leopard"
  • Comes with original box with all accessories, some unopened

Why am I selling it? There is nothing wrong with it. I purchased this in August 2007, before my company gave me with a new MacBook Pro to use instead. I've only used this one for a couple months and then it sat unused. I now have time to sell it because my company shuts down over the holidays. I've erased the hard disk and pre-installed Mac OS 10.5 Leopard on it so it will behave upon power up just like you bought it new from an Apple store with the "Welcome to Leopard" setup video.

I'm a software engineer living in Silicon Valley. This is an excellent development and home computing machine with a very nicely designed user interface. It is an x86-based CPU and so you can also use it to run other operating systems such as Windows, Linux, and Solaris simultaneously using virtualization software like Parallels or VMware Fusion, which is NOT included. I used to use a PC laptop running Windows XP before and I like this machine much better as do other engineers I know who have switched to MacBook Pros as their development machines.

I posted this on eBay originally, but then decided to try craigslist because I prefer a local pickup so I don't have to mail it. The pickup location is negotiable but I live in downtown Mountain View and work in Menlo Park in Silicon Valley. I checked comparable prices and set the price to be low so I could enjoy the rest of my break :-). If you are interested, leave me a comment and I will contact you. Thanks!

Wednesday Dec 26, 2007

Winter Break and Getting a Round Tuit

Sun has a Winter Break this week and so my goal is to complete some tasks that I've been meaning to do.

One of them is selling my MacBook Pro that I bought recently. I've wanted one for a long time but I was unsure when I would get one from work. I got tired of waiting and so I bought my own personal one last August from an Apple Store. Then soon after, the work laptop arrived and so I no longer need my personal one. If you're interested, feel free to leave me a comment and I'll get back to you.

Monday Dec 24, 2007

MacBook Pro Battery Indicator Problems

The battery icon in the menubar of my MacBook Pro was showing a black "X" instead of the time remaining. It looks like it also prevented the battery from being charged correctly. I found this article on how to reset the System Management Controller (SMC) that fixed the problem.

About

edwingo

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today