Missing SSD During Ubuntu Install

Posted in General with tags , on May 16, 2012 by vjc

I just got an SSD drive, as well as new motherboard, and was having trouble installing Xubuntu onto it. The drive was detected fine when I was booted into an OS, but not during the install process itself.

Turns out that you have to go into the BIOS and change the controller (in my case, the GSATA3 controller, since I plugged the SSD into that) to use AHCI[1], rather than IDE[2].

This happened with my Gigabyte Z68XP-UD3 and OCZ Agility 3 60GB SSD

[1] http://en.wikipedia.org/wiki/Advanced_Host_Controller_Interface
[2] http://en.wikipedia.org/wiki/Parallel_ATA#IDE_and_ATA-1

Setting up Pyramid (Python Framework) in Ubuntu 12.04

Posted in Python, Ubuntu with tags , on May 6, 2012 by vjc

I wanted to play around a bit with Pyramid, a framework for Python, so I went through all the installation instructions and wrote it down for future reference.

sudo apt-get install python
sudo apt-get install python-setuptools
sudo easy_install SQLAlchemy #assuming you want to use this for data persistence
sudo easy_install virtualenv
virtualenv --no-site-packages ~/env #creates an env dir in home dir
cd ~/env
bin/easy_install pyramid
bin/pcreate -s alchemy MyProject #alchemy can be replaced by a pyramid scaffold
cd MyProject
../bin/python setup.py develop
../bin/initialize_TestProject_db development.ini #for SQLAlchemy

I’m glad there’s an option for automatically reloading Python’s dev server when code changes. That’s something I liked about SBT when I played with Scala.

../bin/pserve development.ini --reload

Writing more often

Posted in General on April 13, 2012 by vjc

You know, back in high school, I hated writing essays. Maybe part of it was the BS I felt like I had to write for English essays, or the research that came with writing most other papers. Back then, I also maintained a livejournal for a lot of my other thoughts — it always felt like a good outlet (though not the healthiest on some matters haha). When it comes to this little tech blog, I don’t find myself touching it very often. I think part of the issue is that I already do it in bits and pieces all day — write code, write documentation, find bug, fix bug, document.

So what differentiates an entry here from what I write day to day? The first thing that comes to mind is the audience. This really affects what level of perfectionist I’m going to go for and I think that hinders how often I desire sharing stuff with the world, which of course subsequently means a low frequency in entries. It reminds me of how I used to communicate with people online and how often I would delete/modify what I was going to say before I sent it because I needed it to sound “perfect” — whatever that means. The thing is, life doesn’t really work that way — saying the perfect thing doesn’t always help (as if I even knew what was really the “perfect” thing to say), nor is it necessary. I don’t need to put up a front around people I don’t know. The people I am most myself around are also the people closest to me, whose opinions of me affect me the most  – so if their view of me affects me the most, why am I not doing all the perfectionist stuff around them? Guess that’s how us human beans work.

People make mistakes. We learn, we grow, and sometimes we shudder at the thought of our old selves (like I do when I think of some of the code I used to write). My entries don’t need to be perfect.

I like helping people with programming issues. This blog is one way to help people out who might run into the same issues as I do — and I think that’s going to be the focus. No matter how stupid I might think something is, I should probably just post it anyway because there’s someone out there googling for a fix for the very same issue. I recently noticed that I actually had some retweets and a fav on Twitter for the last article I wrote on fixing Leiningen in Ubuntu: https://twitter.com/#!/asianexpress/status/126473850279051264  – totally random because I didn’t even realize people were finding my stuff via Twitter (or maybe they found via google then retweeted me, who knows). I also noticed I get a small stream of traffic from people googling SBT, which amused me — mostly because of how complicated that darn thing can be (so much so that most of the Bay Area Scala Enthusiasts group voted for a talk on it).

Anyway, all this to say that I’m going to make a more concerted effort to write a little more about issue I run into that will hopefully help someone out!

Switching to vim from Eclipse

Posted in Programming with tags , on February 13, 2012 by vjc

The goal of this entry is to write down helpful links/features that I don’t want to forget about as I transition to vim. I’ve just had enough with Eclipse-based IDEs. I used PDT for a couple of years and then switched to Aptana for the last year. There are a lot of useful features in these IDEs, but I became fed up with the crashes and various incompatibility issues I’ve run into over the years. Ubuntu would randomly freeze because of Eclipse — I had to go to a different tty to kill Eclipse/java.

Vim has been on the to-do list in terms of things to really learn in the last couple of years. I can already use it at a basic level, as I’ve used it for server administration for awhile now, but there was always so much more I wanted to learn. I figure this will make it a lot easier to work with other languages as well, so that I don’t need to switch to all sorts of editors very often, if at all. Before I’d use Aptana for PHP, switch to the Eclipse plugin for Scala, then switch to Counterclockwise (another Eclipse-based plugin) for Clojure — not that this kind of switching happens very often.

I started off with vimtutor, which was pretty helpful in picking up some new basic commands I didn’t know about. It also helped me nail down various concepts about keystrokes I never really realized — things like deleting N words, deleting until the end of the line, how it’s really you give it an action and then you tell the action what it should do, or how much it should do.

Of course, one of the natural starting steps is to customize your .vimrc file — there are a lot of people out there posting their own. One of the first sites I ended up was: http://spf13.com/post/ultimate-vim-config – kind of overwhelming at first. I didn’t want to just blindly throw all these plugins and settings without playing around with them, so I’ve slowly added settings/plugins over time as I’ve been learning about what they do and realizing what exactly I need.

So far, these are the things I would want some sort of help with — which I’ll update as I find plugins that fit:

  1. Opening files within a project (commandT - https://wincent.com/products/command-t – fuzzy search is great)
  2. Project explorer/listing — I might not need this since I have #1
  3. Autocompletion/Omnicompletion (param hinting)
  4. svn/git diffing/status checking (knowing what files have been changed and what those changes are)
  5. PHP docs (easy to google, but if I can just get the results locally with one or two keystrokes, that would be sweet)

I’m going to check out the plugins used in that ultimate vim config link — seems like there would be some really useful ones

Also found some helpful tips on the web:

http://mwop.net/blog/164-Vim-Productivity-Tips-for-PHP-Developers  — good idea to map an interpreter/linter/tester to some keys, maybe combine this with checksyntax plugin
http://www.vim.org/scripts/script.php?script_id=1431
http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118 — holy smokes this is in-depth, some good tips about how to use vim
http://jonathan.jsphere.com/tagged/taming-vim  — suggests a lot of plugins I’m going to give a try

Fix for Broken Leiningen in Ubuntu 11.10

Posted in Bugs, Clojure with tags , on October 18, 2011 by vjc

I was trying to play around more with Clojure, but for whatever reason, Leiningen (also included in Ubuntu repo) would not run.

Kept getting an error message that ended in:

Could not find the main class: clojure.main.  Program will exit.

I figured it was an issue with Java/Clojure, so I made sure everything was installed properly — I’ve been able to use the REPL just fine the last couple of days. Turns out the issue is with the lein script itself:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642795

So you have to modify CLOJURE_JAR:

CLOJURE_JAR="/usr/share/java/clojure-1.2.jar:/usr/share/java/asm3-all.jar"

That takes care of it (the change is from asm3.jar to asm3-all.jar)

More SBT Issues: Web Plugin

Posted in Scala with tags , on October 18, 2011 by vjc

I was trying to get a Scala/Lift project off the ground with SBT. I was running my favorite command:

sbt update ~jetty-run

which is pretty nice because the tilde (~) allows for triggered execution — run a command when the source changes (in this case, compile and restart jetty). But then it gave me an error message about jetty being an invalid command. So I did some searching and realized that they separated out the webapp plugin needed for jetty — can’t run the fancy ~jetty-run without this plugin.

So I went to install it, and in usual fashion, there are errors everywhere.

I’m not sure if the instructions in that webapp plugin link are wrong or not. They specify version 0.2.7 for the plugin version in the setting:

libraryDependencies <+= sbtVersion(v => “com.github.siasia” %% “xsbt-web-plugin” % (v+”-0.2.7″))

I wasn’t really sure what sbtVersion did specifically, but I could guess that it accepts a function that maps an argument “v” to be concatenated to the plugin version number and that sbtVersion probably supplies the SBT version to “v” (surprise surprise). Last time I ran into issues, I just did some link exploration to find out which repository was for what. When you run into errors via “sbt update”, it tells you all the URLs it attempted to find your dependency. Ex:

[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.9.1/0.11.0-RC0-0.2.7/xsbt-web-plugin_2.9.1-0.11.0-RC0-0.2.7.pom
[warn] — artifact com.github.siasia#xsbt-web-plugin_2.9.1;0.11.0-RC0-0.2.7!xsbt-web-plugin_2.9.1.jar:
[warn] http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.9.1/0.11.0-RC0-0.2.7/xsbt-web-plugin_2.9.1-0.11.0-RC0-0.2.7.jar

Anyway, the xsbt plugins are located in this public repo, which you can see if you navigate to http://repo1.maven.org/maven2/com/github/siasia/ – and then navigate into http://repo1.maven.org/maven2/com/github/siasia/xsbt-web-plugin_2.9.1/ – problem here, is there’s no mention of a version for SBT 0.11.0-RC0 AND no mention of a 0.2.7 version of the web plugin. Maybe I’m crazy.

I didn’t want to spend more time messing with this, so I made a build.properties file in /<project name here>/project/ to specify the SBT version  – you can see it here: https://github.com/vjc/lift-template/blob/master/project/build.properties

Last note: no more ~jetty-run — it’s now

~container:start

EDIT: apparently they updated the repo and 0.2.7 now exists, rendering this post almost useless, except that you now know where the repo is and you can see what versions they have up.

Graphics Problem After Upgrading to Ubuntu 11.10

Posted in Ubuntu with tags , , on October 14, 2011 by vjc

As usual, I went through driver hell after upgrading. My screen would freeze after grub — so I couldn’t even login!

Luckily, using recovery mode allowed me to fix things. It was the usual suspect: /etc/X11/xorg.conf  (http://xkcd.com/963/)

First I deleted it (well, moved it rather — much safer to back up, one lesson you can learn the hard way with X), restarted, and I was able to login, but the problem was that my second monitor was mirroring the first and my desktop setup was a little wonky. I figured it was a driver issue — as is usual with any Linux upgrade. Sure enough I just needed to rebuild my driver for the fancy new Linux kernel (3.0). I took the easy route and added this repository that was referenced in a couple different blogs ( such as in http://mygeekopinions.blogspot.com/2011/06/how-to-install-nvidia-2750907-driver-in.html):

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current

This replaced my version of nvidia-current (and friends) with a new version built for the 3.0 kernel since new kernels usually end up meaning rebuilding various tools. I wanted to start fresh so I went ahead and ran

sudo nvidia-settings

Once that opened up, went to “X Server Display Configuration” and made sure my two monitors were enabled. Once everything looked right, I pressed “Save to X Configuration File” to make sure a new xorg.conf was generated.

Restarted and finally, it works!

Better Balance Needed Between Theoretical and Practical CS at Yale

Posted in General with tags , , , on October 13, 2011 by vjc

Let me start this off by saying that the computer science faculty at Yale is filled with brilliant professors. Each of them is accomplished in their own right and you can tell how much they know in their respective areas when you talk to them. However, brilliant people do not necessarily make great teachers. Coming out with a Yale CS major means a grounding in C, a lot of theory and little practical knowledge.

I remember going to my first Introduction to Programming (CS112) class my freshman year. After the first couple of classes, I was bored out of my mind in class — though to be fair, I was bored in most of my classes. I tend to be a very practical person — if I don’t see a use for something, I tend to ignore it and focus on what is useful. This isn’t to say I don’t have an open mind and consider the options, but I try to stay pragmatic. The class was focused on using C#. I had learned some C/C++ in high school, and everything seemed like a repeat to me, so I stopped going to class and just did the problem sets and showed up for the midterm and final. Aced that class, but didn’t really learn anything about C# in the process or its practical applications. I loved programming itself, but never the classes because I wasn’t learning anything I felt was useful.

I didn’t fare much better in my next class, Introduction to Computer Science (CS201). The professor was on his way out and the class was incredibly hard — we started with 15 people in the class, and went down to 3 — with people dropping out even around the final — it was bad. We attempted to learn lambda calculus and functional programming via ML, but no one had any idea what they were doing. All I learned was that I hated ML with a passion because I could never make it work the way I wanted to (I was too used to the imperative mindset). And because I wasn’t really taught the practical applications of it, I saw no use for functional programming. It seemed like such a useless undertaking and I had no idea why I was learning lambda calculus (which I didn’t even learn properly until I took Formal Semantics with Paul Hudak in my senior year — 3 years later). Recently, I’ve looked back with regret about my grounding (or lack thereof) in functional programming and really wished I had seen how useful it can be — it’s used a lot more in the real world than I realized or was taught.

Most of what I do now (as a CTO) is self-taught. At the beginning of PaperG, a web start-up, I had to choose between web technologies I wasn’t all that familiar with. At Yale, the only language we used to interact with the web was a little bit of Perl in one class (this has since changed! see http://hackyale.com/). I ended up choosing PHP because Ruby seemed unproven at the time (2007) and Java didn’t seem as good for the web (in retrospect, I was wrong). Plus PHP was used all over the place, such as at Facebook. I went with MySQL because once again, it was proven and in the end went with the popular LAMP stack. I didn’t learn any of this through Yale. The professors did always state that the more theoretical approach is due to their wish to give us a good grounding so that we can learn new concepts faster because of our better understanding of the underlying parts. I don’t disagree with this methodology, I just wish there had been more options after a foundation was set. PHP gets the job done, but I don’t know if it would have been my first choice if I had known more about the web landscape back then.

Almost everything I do now, I learned on my own. This isn’t to say I didn’t learn some important things at Yale. I really learned how to debug programs due to the assignments in a Systems Programming class, as well as the Operating Systems class — but as you can see, I really only learned through the assignments. To be honest, I would have paid more attention in my classes if I had known how they might be useful in the future. For example, I would have really focused and tried to learn languages like ML and Haskell if they hadn’t been presented so academically. I want to know — what can I build with this tools? How can I build faster or more efficiently? This isn’t to say I couldn’t have derived the answers to these questions myself by studying the languages, but I have little motivation to spend time on something I can’t see the value of — so if you just reversed the order and told me why it’s useful and what’s so great about it, then I’d be more interested in learning what makes it this way. There’s just too much information to filter through so I have to be pragmatic about it.

Maybe it’s just my learning style — I need to know the practical before I want to learn the theoretical.

I wish I could go back to those CS classes with the real-world experiences I’ve had since starting a tech company — I would have paid much more attention and learned so much more.

Free EC2 Micro Instance

Posted in General with tags on October 8, 2011 by vjc

Found out you can get a year free with AWS so I decided to set up a server to play around with and perhaps host this blog on there, as well as a personal website — and perhaps some random projects I wanted to work on. We’ll see if an EC2 micro instance can handle it.

Ran into one issue from the outset, which is that AWS locks things down by default, including a firewall that doesn’t let you SSH in:

http://serverfault.com/questions/245916/why-cant-i-ssh-or-ping-my-brand-new-amazon-ec2-instance

But now I’m in and I decided to go with a Ubuntu 11.04 installation…I used an AMI from here: http://cloud-images.ubuntu.com/releases/11.04/release/ (ami-02b10503)

We’ll see what happens! I’m debating whether it’s worth it to put my blog on there, as it seems micro doesn’t handle WordPress very well

I might go with putting a Scala project on Heroku for kicks — it would be nice to not have to deal with any system administration stuff for once. In fact, that sounds very appealing…

Aptana Studio 3 Over PDT for PHP

Posted in PHP, Programming with tags , , , , , on October 7, 2011 by vjc

tl;dr: I highly recommend Aptana Studio 3 over PDT for any PHP development.

I started using Eclipse PDT back in 2007 and it was a decent IDE. There weren’t very good alternatives for PHP back then, at least none that I tried and I had been spoiled by beginning my foray into programming via Visual Studio, which is probably still one of the best IDEs I’ve used to date, except when it’s running slowly (I hated booting that thing up).

However, it had its fair share of quirks, especially when I used to switch between the Windows and Linux versions for development. One issue that always came up was that Code Assist and Autocomplete would randomly not work. They would usually work properly in Windows, but not in Linux (where I did most of my development). And when they would work, they would really slow things down on large projects. Waiting for that autocomplete menu to pop up could take ages and the autocomplete options weren’t very…complete (some sort of pathing/include issues?). PDT just started feeling sluggish as I used it more.

I was fairly excited when PDT would release new versions. First it was 2.0 at the end of 2008 and then 2.1/2.2 half a year later in 2009. But then…they just stopped releasing. Sure there were nightly builds but it seemed like the project was dying. Fast forward to early this year where I started getting very frustrated. There were some PHP files I couldn’t open for some reason, or they would cause some sort of error with PDT. Eventually I figured it out that PDT wasn’t a big fan of when there was no closing PHP tag at the end of a PHP file — now this wasn’t always an issue, it only happened sometimes. Eventually I decided to stop closing the beginning PHP tags in my files to follow the standards as introduced by Zend Framework, which makes a lot of sense because you don’t want random whitespace emitted by some random file to ruin the rest of the program. This caused endless pain because I couldn’t open half my files and if I really wanted to open a file I’d have to use Vim to edit the file, add a closing tag and restart PDT. Obviously not something you want to do often and definitely not something an IDE should be having trouble with.

There was still no mention of an update, the project page hadn’t been updated in years — sure, I could have joined the mailing list and find out what was going on, but I instead opted to see what the state of IDEs were with PHP. Probably would have been nice to look into the source and see if I could fix the issue myself and send in a patch, but it seemed like the project was dead. Although, I looked at it today and it seemed like they finally updated to say 3.0 was completed in June…but still no official release of it (and it’s October!)

Anyway, I took a look around and eventually stumbled upon Aptana (Zend Studio looked nice, but I wasn’t about to pay $$$ unless there was no good alternative). It looked like they were getting ready to release 3.0 soon, which seemed to be a pretty huge update. I decided to try out the 3.0 beta and almost instantly fell in love. Though normally I wouldn’t fall in love with a somewhat buggy beta, it was a dream come true in comparison to PDT because It Just Works. Not only that, autocomplete was so much more complete than anything PDT had ever offered. It was so nice with regards to using Zend Framework as well, because autocomplete is so extremely helpful when you work with a large library that tends to be super verbose (if only PHP could be as expressive as Scala and Haskell…but I digress).

Productivity jumped up quite a bit since the IDE was just faster than PDT and the code assist/completion was superior. It even has a code formatting feature that works decently, which I missed from an older version of PDT. My only gripes were that the deployment feature was somewhat buggy as I discussed in a post last month on speeding up remote development and the find feature Aptana bakes in is not as useful to me as the default Eclipse find.

 

Follow

Get every new post delivered to your Inbox.

Join 133 other followers