git branch in bash prompt

2014-03-18 13:20:31 PST

Tags: ,

Adding ‘$(__git_ps1)’ to my .bashrc PS1 bash prompt was the greatest idea/discovery I’ve had in a bit, as now I know exactly what branch any repo I enter is on:

dan@dan-work:~/src/work-project/ (master)$ 

Getting started with my softkinetic DepthSense 325

2014-03-08 20:29:35 PST

Tags: , , ,

So a bit ago I bought a DepthSense 325 camera. I’ve been pretty busy since then but today I finally sat down to get started with it. First thing, it was on my netbook so I had to resetup the software stack and SDK. The SDK is free from softkinetic and works on Linux (which is awesome, and also a big reason I bought this camera) but I think it’s more aimed at Ubuntu 12.04 so there was one or two extra steps to make it go on 13.10.

First, regardless of Ubuntu version, you need to add the DepthSense libraries to the LD_LOAD_PATH and the now recommended way is adding a file to /etc/ld.so.conf.d like this

/etc/ld.so.conf.d/softkinetic.conf

/opt/softkinetic/DepthSenseSDK/lib

Then run ‘sudo ldconfig‘ to regenerate the ld.so cache or what ever. Now you can link agianst the libraries.

Next, at least for Ubuntu 13.10, you need to fake having libudev.so.0. Thankfully libudev.so.1 worked fine so run

sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0

At this point DepthSenseViewer that comes with the SDK should work and you are good to go.

So today’s mission after getting set up was to get some code pulling form the camera and displaying using opencv (because I ultimately want to feed it through ROS filters and as was suggested on a forum post, the best way to hook the DS325 into ROS was through openCV and then the ros opencv bridge). Thankfully I found what I needed on the softkinetic forum in Example Linux/OpenCV Code to display/store DS325 data. The first code needed some slight fixes as detailed in the second (but slightly corrupted formatted) post. With a little poking and proding I had it compiling and working.

g++ ds_show.cxx  -I /opt/softkinetic/DepthSenseSDK/include/ -L /opt/softkinetic/DepthSenseSDK/lib -lDepthSense  -lopencv_core -lopencv_highgui
./a.out

Not actually that much coding today, but a lot of pieces in place.

DepthSeense 325 now being polled by my code and openCV

Go lang Van meetup #1

2014-02-08 22:10:22 PST

Tags: , ,

So some kind folks over at ACL services set up, kicked off and hosted the first Vancouver Go lang meetup on wednesday. It was great. Packed room, about 60 people showed up. One of the talks in particular was of use to me, by Joseph Holsten (who kindly ventured up from Seattle), it was on Go and DevOps and he kindly posted the slide. So thanks to everyone, it was fun and very informative!

Go supports closures. Neat!

2014-01-16 04:57:20 PST

Tags: ,

So Go is a compiled system level language akin-ish to C, except with way more cooler newer features (and a little less memory munging fun I think). I just found that Go totally supports easy first order functions and closures:

package main
 
import (
        "fmt"
)
 
func doTimes(fn func() int, times int) {
        for i:=0;i<times ; i++ {
                fmt.Println(fn())
        }
}
 
func main() {
        x := 0
        inc := func() int {
                x++
                return x
        }
        doTimes(inc, 5)
}
dan@ember:~/Dropbox/src/golang$ go run closure.go 
1
2
3
4
5

So that’s pretty cool! Yeah for the future!

Primes, now with Go

2014-01-15 08:32:55 PST

Tags: , ,

I’ve been getting up to speed on the Go programming language in preparation for my new job next week which uses it. To that end I’ve achieved at least the ability to write a prime number finder in it so far, so I did and added it to my Primes project. I believe that makes 40 languages in total now.

Announcing Simple Location, a WordPress Plugin

2014-01-10 16:17:23 PST

Tags: , ,

So for a new wordpress site I launched I wanted it to track the city and country of posts, preferably automatically via IP. Apparently this was uncommon. There are a plethora of plugins the purport to do geolocation but they do it in a way slightly different from what I wanted. They mostly just track lat/long and then slap down a map on the post. I wanted actual city name and country name. Also a surprising amount of them didn’t do auto detection and needed manual entry every time.

So I dug into WordPress plugin development for the first time and now can present Simple Location, a WordPress plugin. It’s very straight forward. It just adds a city and country field to the post edit page and optionally ties in with IPInfoDB.com for autodetection if you get a free API key. It does what I need. Maybe someone else will find it useful. I’ll also look into submitting it to wordpress.org.

WordPress plugin dev

2014-01-02 06:59:42 PST

Tags: ,

So I’m setting up a new wordpress site and one of the features I want for it is that posts are auto-tagged with the location they are posted from, like the City, County, and then have that simply displayed in the post’s header meta like “… posted from X,Y”. As it turns out this is apparently shocking weird or something because there are tons and tons of plugins for geolocation but none do what I’m looking for. Instead they integrate heavily with maps showing google maps of your location, and only store lat/long, not actual place name (even though most APIs give it out, they just discard it) and they also don’t do auto detection even though again, APIs like google maps API should support it. Instead it’s all manual. Use a google map to drag a marker to your location or use a search field and type in your location name so that then the plugin can discard that and just store lat/long…

So that was pretty disappointing and slows down this project a bit because now for the first time I have to do WordPress Plugin dev. Not that I’m too worried, after 3 years of Drupal dev, this shouldn’t exactly be rocket science, just a lot slower than activating a module that does what I want.

So that’s what I’m up to today. Last week was been wordpress theme hacking, first time I’m properly using a child theme (parent is Customizr, it’s pretty nice and closest to what I was looking for). I was hoping to launch the site nowish but whoops. Gaps in the wordpress plugin ecosystem.

The wordpress plugin dev documentation isn’t bad but it’s not great. WordPress is evolving a lot and some of the Howto’s are pretty shallow with links to more in depth articles that all do things a bit differently. There are straight API docs that seem good, but first I have to grok how things work.

So I’m reading a bunch of tutorials and reading some other plugins code to try and find the fastest way to get what I want done. So far I have an options page that stores the option values, so that’s not bad for an hours work/learning.

Knowledge acquisition in 2013 Q1

2013-03-31 09:19:54 PST

Tags: , , ,

So over the last month I’ve started up learning new tech again. Most of last year I was in and out of coursera classes learning new… “things” (crypto, Saas, model thinking, game theory, Quantum Computing intro theory, Functional programming with Scala…), but now it’s back to new tech, because there is just so much out there and it’s growing near exponentially.

First up is trying to get into Django. I’ve been a Drupal programmer by trade now for two years and wanted to get a better idea of what some of the other web offerings had to offer. Also again it was another chance to work on my Python programming which has never had a chance to be amazing. I ran through their good but somewhat limited intro tutorial. But that didn’t get me far enough along to really sit down and start my own thing, I needed something more. I found many tutorials that looked good but so many were a few versions out of date. After a lot of googleing though I finally seem to have found a good and recent one in Building Ribbit in Django, part of a series of implementing Twitter clones in various frameworks. So I’ve started that.

Django however wasn’t enough, (and by web standards, relatively old) so I’ve also decided to dive into the more cutting edge worlds of Node.js and Backbone.js. And there’s a lot there to learn, and those are practically umbrella names for a whole host of support technologies you need to learn as well, like Underscore.js. Then the internet indicated good practice also points to learning RequireJS and more too. There are even less tutorials here than for Django and out closer to the cutting edge of tech they fall stale and out of date even faster. But I’m slowly getting a handle on the big picture and how to make things work. Lots of Stackoverflow for this learning. Also, if I have time, Backbone Fundamentals soon published by O’Reilly looks full of potential too.

So that’s what’s been filling lots of my spare time recently… well that and Steam for Linux and Starcraft 2… :)

Primes suite updated

2013-01-30 22:54:23 PST

Tags: ,

It’s all Rob’s fault. He got a Kinect and was playing with it and also wanted to bone up on his Python so he ended up trying to write some visual processing code in Python and it was unusably slow, so he had to switch back to C. No problem. But then I wanted to get an idea for just “how much” slower it might have been. So I busted out my terrible tried and true language/math benchmark suite Primes and ran the C and Python parts. Except they both failed.

Primes dates back to about 2004 and has seen very rare updates since then. Seems that some of the languages have changed since then. Who knew. So tonight I sat down, installed as many compilers as I could get my hands on, ran the suite, and started attacking broken things. I fixed the following:

  • Python range() strictness now requires ints and won’t take floats (or they have to match…)
  • gcc (but not g++) now requires linking specified AFTER the source file on the command line (gcc -lm primes.c failes now)
  • fixed open cobol compiler arguments (-O to -x)
  • Changed Objective C syntax: alloc not part of Object, have to manually write it, and now no need to subclass Object. And add stdio.h
  • Removed lua4 support (the auto version detect code (that is bad) was messing up), and really, who now would be running lua4?
  • Updated haskell includes for new 2010 library standard
  • Switched Fortran compiler from g77 to gfortran and tweaked a few type bugs that came from that

And all the updates can be found in the Github repository for primes. I still find it a handy crappy benchmark and a handy Rosetta stone library. Good to keep it vaguely up to date and still running. :)

cl-pack BER encoding fix

2012-11-11 16:23:58 PST

Tags: , , ,

So 3 years ago as I was learning Lisp and looking for things to do I noticed it seemed to lack perl style pack/unpack encoding functions that many other languages shared (like PHP, Ruby, Python) so I wrote cl-pack (github) to fill that void. I released it back at the end of the summer of 2009 and moved on. Then this week on github I got a pull request. It seems cl-pack has found some use by people and a github user Taksatou had noticed a bug in the BER encoding and fixed it! So awesome, and thank you! The fix is merged and cl-pack continues to fill a small gap in the Lisp ecosystem :)

Valid XHTML 1.0!
Valid CSS!
Mindstab.net is proudly powered by WordPress
Entries (RSS) and Comments (RSS).
19 queries. 0.588 seconds.