Music Player v2

I’ve been thinking about the little music player I made a while back – the idea was a specific RFID tag triggers a specific album or track to play on an mp3 program.

It worked, as a proof-of-concept, but I never built it out into a practical daily-use system.

My new thought is to break it into two pieces – a tag reader component, and a DAC music player. They would both connect to the same local WiFi network and communicate using web APIs.

Breaking it into two components allows each to focus on a specific task – one as strictly a tag reader (and track controls) and one to focus on playing mp3 files to an audio receiver. The tag reader portion can be small, battery-powered, and therefore portable.

The tag reader portion will be a low-power Arduino chip connected over I2C to an RFID board. The Arduino will also need WiFi, perhaps an Adafruit Feather system.

The player portion will be a Raspberry Pi, possibly with a DAC board for higher-quality audio output. It will run a dedicated headless audio solution such as RuneAudio or Volumio. Music will be stored on SD card or possibly HD, depending on size of library. I could also possibly connect it to the music server I have set up on the network as a source.

The Tools I Use

If anyone’s curious, here’s a look at the development tools I use, day-to-day.

I use a Mac, so these are Mac-based, but many are also available for Windows.

MAMP

Free all-in-one webserver package, instantly sets up Apache, MySQL and PHP. Great for developing locally without all the hassle of trying to build a server yourself.

Zend Studio (plugin for Eclipse)

Eclipse, in my opinion, is slow, bloated, and lacking in some basic features like soft text wrap. Why use it as my primary IDE, then? PHP debugging. Zend Studio (which used to be a nice stand-alone IDE, but is now just a plugin for Eclipse) has a set of tools for runtime PHP debugging which in my opinion are essential to PHP devlopment.

TextMate

Although I work on big projects in Zend Studio, when I just want to try something out, I’ll often fire up TextMate. It’s small, quick, and pretty full-featured. Some people I work with prefer BBEdit, which I’ll admit has more features than TextMate, but TextMate feels cleaner and… I dunno, more *modern* to me.

Photoshop

For graphics and occasional mockups.

Navicat

For working with MySQL, I love, love, love Navicat! If you are currently using PHPMyAdmin, ditch it and switch to Navicat. You won’t regret it. I’ve heard a couple people complain that Navicat’s icons look too “Windows-y” – good god people, get over it. They look fine, and it’s certainly a lot better-looking that PHPMyAdmin. If you’re not sure, Navicat Lite is free and does most of what the full version does, try it out!

Omnigraffle

Good for whipping up quick page wireframes and site flow diagrams for requirements documentation. Believe me, that doesn’t sound like much, but it’s important and the clients love the clean diagrams produced with it.

StarTeam

If I had my druthers, we’d probably be using SVN or something more industry-standard, but it’s what we use at work, and someone else maintains the server so I don’t have to, which is reason enough to use it. I have no desire to become a sysadmin. Like Eclipse, the StarTeam client is also Java-based, meaning it’s slow and bloated. Plus Borland dropped Mac support, so it takes some hacking to get it working on the Mac, though once it’s set up it works fine. There might be better packages out there, but StarTeam gets the job done, and that’s all I need out of a source control system.

Parallels with Windows XP
IE Collection

For IE testing. IE Collection is great, lets me run IE6, IE7 & IE8 side-by-side.

Firefox

Although I test in multiple browsers, Firefox has great plugins available that make it my favorite browser for web development. I tried Webkit for a while, but the better plugins for Firefox brought me back.

Firefox plugins:

– Download Statusbar

Better display of download status than the standard window on Firefox.

– Firebug

A super-useful suite of web development tools. Essential!

– Screengrab

Take a screenshot of the entire page, regardless of scrollbars, automatically.

– Web Developer

A handy collection of tools for web development. Essential!

– Zend Studio Toolbar

Hooks into Zend Studio, allowing PHP debugging with the click of a button.

There are other apps I use now and then, but these are the primary ones that I use every day.

jQuery

Started using jQuery yesterday, just starting to get into it, but so far I’m liking it. It’s a Javascript library that has a bunch of predefined functions and structures set up to make it quicker to write stuff. There’s also a UI component to make it easy to do stuff like dialog boxes and such.

Nice to be able to write something quickly and have it work in all browsers.

Here’s my first test, a simple box with a slide animation between 4 boxes of content when you click buttons.

For some reason it has a slight tearing happening during the animation in FireFox on Windows, but looks good on every other browser (even FireFox on Mac). It only does that for the 1/5 of a second during the transition animation, so I guess I can live with it.

I could do the same thing without the animation pretty easily with basic Javascript, but jQuery’s animation makes it look that much slicker. I’m also starting to do some drag and drop tests with jQuery UI which I may use in a project at work.

Pondering extended ASCII

An examination of ASCII chars

A bit of background: the extended ASCII chars 145-148 were meant as control characters. However, Microsoft instead used them for some custom characters, namely “curly” quotes. Apple stuck with the original charset definitions, meaning that curly quotes from Word sometimes still show up as broken on MacOS. Although oddly, the entities for the same char (like “) work – apparently functioning as aliases to the “correct” upper-ASCII characters (like “).

My question is, why doesn’t this same remapping happen with the literal character? Isn’t it worth the sacrifice of some unused control characters to allow the user to see quotes as the copy editor intended them? Why punish the user because someone else used char 147 instead of 8220?

Also, if Microsoft hadn’t used those slots for their own stuff, and left it alone, then we would have those standard ASCII codes for other uses now – non-character delimiters, anyone? How great would it be if you had characters specifically for string delimiters, so you wouldn’t have to always be escaping quotes? I even notice that the original name of char 150 was “Start of guarded area”, 151 was “End of Guarded area”, 152 was “Start of string” and 156 was “String Terminator”. Sigh, for what might have been.

ASCII Num Entity Bad Char JS charCodeAt of Bad Good Char JS charCodeAt of Good
145 ‘ ‘ 145 ‘ 8216
146 ’ ’ 146 ’ 8217
147 “ “ 147 “ 8220
148 ” ” 148 ” 8221

iPhone 3.0 beta

Important to note:

if you are a developer, if you download the beta of iPhoneOS 3.0, if you install it on your phone, you cannot go back to an earlier version of the OS!

This means you’d be stuck with 3.0 beta on your phone until the final 3.0 release comes out sometime this summer.

Also, if you download the 3.0 SDK, you can’t submit anything you develop with it to the app store until after the final 3.0 release this summer.

Important gotchas to keep in mind.

That said, I doubt I’ll be able to resist the temptation to try it out.

Just Bad

$phrase[0] = “You so ugly…”;
$phrase[1] = “Your mama so fat…”;
$phrase[2] = “You so dumb…”;

What is it?

A disarray!

Sorry, bad programmer pun. Couldn’t help it.

Correction

When I said Eclipse was the only IDE I knew that didn’t support soft text wrap, that was a misstatement. There was one other…

I refer to you a post from August 21, 2002:
Why InterDev Sucks

Of course, I’d betcha Microsoft has added soft text wrap to InterDev since then, while in that same time, Eclipse is still bereft of it.

Right now I’m learning a little Objective-C and using XCode, it has an interface loads better than Eclipse. If only Zend made a “Zend Studio for XCode”… but alas, all they make is “Zend Studio for Eclipse”, so I’m stuck with that for PHP development at work.

Eclipse suckage

So I tried the upgrade from the standalone Zend Studio 5.5 to the Zend Studio 6.0 plug-in for Eclipse.

Eclipse is somewhat nice, but, like many open source projects, sadly flawed in some basic functionality.

One feature, in particular, has me livid.

It doesn’t have soft text wrap.

What does this mean?

Well, say you have a long line of code.
In any other IDE, which is to say, GOOD ones, you can turn soft text wrap on, which puts a virtual line feed at the edge of the window. Anyone who has used any text editor, from Word to Xcode, is familiar with this. It means when you are typing, when you hit the edge of the window, the cursor comes back to the beginning of the line, even though you didn’t hit return. When you resize the window, the text re-flows to wrap at the new window size.

However, apparently no one who wrote Eclipse could figure it out, despite the fact that EVERY OTHER FUCKING TEXT EDITOR IN EXISTENCE HAS IT!

It means that for code on a long line, you must constantly use the horizontal scroll bar. Which is extremely annoying to me. It may seem like nitpicking, but when you code for a living like I do, it’s important that the text editor you use for coding is comfortable and efficient and doesn’t waste your time with a lot of extra unnecessary clicking and scrolling.

Some people like scrolling horizontally, the people who wrote Eclipse LOVE IT, but for god’s sake, don’t force everyone to use your preferred settings! Any decent IDE would have a simple checkbox at least, to turn soft text wrap on or off.

So far the only thing I’ve found is a hack someone wrote which *sort of* enables soft text wrap in Eclipse. Except from what I read, it breaks some other things, and is buggy. And hasn’t been updated since it’s first alpha release in 2006.

Sigh.

Just, sigh.

And, GAHHH!

Update:

I just read through the feature request on the Eclipse website, apparently people have been clamoring for soft text wrap for YEARS (starting around 2002), but the developers didn’t build the feature in at the beginning, and now can’t figure out how to add it. So their solution is to just ignore requests for it.

Choice excerpts of user comments from the feature request:

“I can’t personally think of any other text editor that does not support this. ”

“I don’t suppose it could be given priority over other features, as an
embarrassing design omission of a REALLY REALLY basic text editor feature?

I don’t mean to be obnoxious, but it feels to me like “putting doorknobs on the
doors will be hard to fit in because there’s so many doors, and we’re really
busy putting pool tables in the game room, and rotating shelves in the library,
and auto-darkening windows.” (Please take that in the humerous spirit it was
written…)”

“I would say this problem is the most critical in eclipse text editor as I don’t
know ANYONE who does not want that.”

“It’s a pain to see Eclipse missing such basic features.”

“I think it doesn’t sound good for an all-round development tool
like Eclipse to miss a basic function like this one.”

“There is a real demand and lots of people are surprised that Eclipse
does not do such a simple thing.”

“Ok, so despite 78 votes for this bug (which probably makes it one of the top
voted for Eclipse bug, if not the first), this was not scheduled for 3.2, for
3.3 and now not for 3.4…”

My First iPhone App!

Ok, so it’s only a tiny step above “Hello World”, but it’s the first iPhone app I wrote.
Every time you press the “Roll” button, it generates a number between 1 and 20 and shows it to you in a message.

That’s it. The other buttons don’t do anything yet.

But you gotta start somewhere, right? =)

Now I’m tired and it’s time for bed.
But I feel good that I’ve started to make some visible progress, even if it’s only a little bit.

OS X filesystem madness

So most of last week I spent working on a few bugs in the Catalog Builder, a web-based application I wrote with a few other people at Staples.

The particular bug I was working on was seemingly impossible to fix, and it was driving me to the point of madness. I had it fixed on my local machine, but when I would copy that change to the test server, it wouldn’t work.

Thursday I was determined to fix it once and for all. I stayed at work until around 10 or 11pm, but finally went home in failure, near tears of frustration for not being able to fix it.

The next morning, my manager Asha sat next to me while I once again copied my change from my local machine to the test server. It still didn’t work. Then she had me do it one more time, and miraculously, it WORKED!

I chalked it up to exhaustion, figured I must have made a mistake on Thursday night, copied the wrong file up to the server or something.

But today, I thought about it – I had been very careful on Thursday night. There had to be some other reason that my good code seemed bad on the server. My first conjecture was that there was some issue with the directory names.

I did some poking around, and figured it out.

There is something really odd about the way Mac OS X treats symbolic links.

A symbolic link is a “fake” directory or file, that is actually a pointer to a real file. This is useful if you need a certain file or directory to appear to be in several places, while in fact it’s only in one place. This is better than making multiple copies of the file or directory, because if you have to make changes to it, you only have to change it in one place, since symbolic links just point to the original path the file or directory is in.

Which is the important point.

in Unix, a symbolic link is a marker that points to a path. If you “cd” (change directory) to the symbolic link, it goes to the path indicated.

On Mac, an alias is a marker that points to a folder. If you click on the alias, it goes to the folder indicated.

The difference arises if you move the target directory.

The symbolic link points to the path, so it would say the target dir is missing.
the alias points to the folder, so it would still open the folder, even if it were moved.

And the real trouble is that OS X treats a symbolic link BOTH ways. When you create a symbolic link in the command line, it does TWO things. It creates a unix symbolic link, but also creates an alias in the GUI.

In the GUI, the alias will point to the original FOLDER no matter where you move it. In command line or via webserver, it is a symbolic link, and points to the original PATH.

So when I moved the original folder to the trash, then replaced it with a new folder with the same name as the old one, I would go through the GUI to update the files, then through the webserver to view it… but going through the GUI I was updating the files in the trash (new path, old folder), while viewing the files was showing the ones in the original path (old path, new folder)…

It was this inconsistency that drove me to the point of madness on Thursday.