I Made a Thing

Posted on 19th July 2011 in Something Daily

I built a Twitter app today! It’s called Quadroopl! It’s a version of your Twitter feed that’s been cut down to size by removing all but one of each of your friends’ tweets, leaving only the most retweeted one. That means that, if you want to see if what your friends are doing is interesting or important, you can use Quadroopl to cut through the spam and get a quick update on the good stuff. You should try it. The code is right here on my github in case you’re that kind of dude/lady.

I was in Ohio with my cousin recently, and, being the geeks that we are, were talking about the people we follow on Twitter. One of the first things he mentioned was that, as a result of following me, he’d picked up a lot of interesting people to follow (because I’m really cool and have cool friends, obviously). He said, though, that he was kind of annoyed by their ‘spam’ – that is, a lot of the people he knew were interesting would often tweet in decidedly uninteresting ways (not naming any names….). He didn’t want to unfollow them, because he did want to be updated on their important doings, but disliked the majority of their tweets, which could be called non sequiturs, to put it politely. I’m guilty of this too, by the way. He said, “wouldn’t it be cool if there was an app that just showed you the tweets that you theoretically care about, while filtering out all the crap? It would probably be pretty easy to make. You should build that.”

So I did.

I put together Quadroopl over the course of the last three days, flying by the seat of my pants as I learned both OAuth and the Twitter API (and, arguably, Javascript and Ajax) at the same time. The logic goes like this: your whole (500 tweet) feed is retrieved, and each tweet in the feed is processed, being put into a session hash of hashes. A tweet is added to the hash if the user who created it doesn’t have a tweet in the hash already; or, if they do, it’s added if it’s been retweeted more times than the one currently in the hash. The result is a new feed that’s made up of the most-retweeted tweet by each user. If a user hasn’t been retweeted recently, they don’t show up on Quadroopl. This method places a lot of importance on retweets; I think it’s an ok solution to the problem of the “top tweet”, but I’d love to look for a way to retrieve the number of replies to a tweet. Another vector for the comparison of tweets could only make the results more relevant, I think.

I’m very happy to have gotten this out so quickly, and I look forward to adding features/revising the logic to make a more enjoyable user experience. Try it out, and please direct any constructive criticism to @emmett9001. Direct all other criticism to your mother. Thanks.

New Homepage Now Exists

Posted on 2nd April 2011 in Something Daily

The idea occurred to me recently that I wanted to have a place online that functioned both as a portal and hub for my other online presences (twitter, tumblr, this) and as a networking tool for me to direct people to via word of mouth so they could get a look at my resume and portfolio. So over approximately the last two weeks, I put in the work to register the domain and buy the hosting, moving this blog to my own host as well as moving the domain name threestegosaurusmoon.com to here. I also just sat down last weekend and decided to design the homepage, which was surprisingly easy in light of the fact that this was really my first experience with CSS. The design part was easy and fun; the process of implementing the design across multiple browsers was not either of those things. Once I had a design worked out nicely in Opera, I tested it in Firefox, Safari, Chrome, and….Inernet Explorer (don’t get me started). Basically, everything was a mess, since I didn’t know from experience what to avoid in the first implementation. But I had a five hour shift last night where I wasn’t doing much of anything, as well as access to a Windows laptop running IE9, so I had a great opportunity to iron out all the stupid horrible display bugs that it imposed upon my design, which worked more or less the same across all the other browsers I tested. Like I said, please don’t get me started on Internet Explorer.

Anyway, the nap I took yesterday before work enabled me to stay up until about 2:30 putting the finishing touches on emmettbutler.com, including the automatic emailing form and custom favicon and 404 pages. I also implemented a tagging system for the gallery of my work using (for the first time) object-oriented PHP, which is actually really awesome. Sometimes, when I don’t use OOP for a little while, I forget how awesome it is. But it is really useful. This is my first website, but I’m actually quite proud of it. And, in light of how easy it was to make (took me about a week without Dreamweaver or anything of the sort), I’m very open right now to the idea of doing freelance web design for people who need it. It’s exciting. So yeah, check out my new website. I like it.

Now I’m going to go buy that Four Loko skateboard deck and maybe some old computers, depending on the price. Bye!

Failed Attempt at a Speed Run

Posted on 31st March 2011 in Something Daily

When I miss a day of blogging, it’s pretty often for one of two reasons. Either I’m working really hard and obsessively on something and I let it carry me into the evening without looking back, only to realize at 1:30 AM that I didn’t write today, or I’m video gaming. Somewhat predictably, yesterday was the latter – I foolishly attempted a speed run of Ocarina of Time in one sitting. This is of course something that I’ve tried before, and, historically, it’s always had the same outcome. I start off so enthusiastic, celebrate when I finish the Deku Tree in ten minutes, get annoyed by the long interval between that and Dodongo’s Cavern, and push doggedly onward until about the point where I get the horse. At that point, about halfway through the forest temple, I get really sick of it and I’m forced to quit. Maybe it’s too long of a game to do in one sitting – I mean I literally tried to do it in one sitting, like I didn’t stand up at all. My legs were starting to go numb, which is bad. The experience of failing at the one-sitting run of OoT yet again just makes me want to eventually do it even more. I think it’ll happen one day, I just need to really have nothing else to do, and be willing to stay up all night. And a treadmill or something. But if I can watch all of the Lord of the Rings movies in a day, I can certainly do this. So that’s why i didn’t write yesterday.

On the topic of my developing website, I today implemented a tagging system for the entries in the gallery of creative work I’m including on the site, which the user can use to filter the list by any of a set of chosen criteria. I’m learning PHP very well during this process, and it also occurred to me that it could be a very viable option for me to do freelance web design jobs for extra money. So I’m going to start getting my name out there, which will be made a lot easier once I have a site to show for myself. Coming soon – probably within the next week or two. Not probably, definitely.

PHP Howto: scrape an RSS feed

Posted on 29th March 2011 in Tutorials

Since I’m building my own homepage, I recently learned how to scrape an RSS feed in order to dynamically create content for a website. The idea is that I would have separate feeds from my twitter, tumblr, and this blog all in one place. The tumblr and twitter feeds are offered by those companies in the form of API calls, so using those two is very straightforward in both cases. When self-hosting a wordpress blog, though, as I do, there is no readymade option for a feed that one can just call and have ready to go. So I had to make my own.

An RSS feed is essentially just an XML markup document that browsers interpret and show you in some type of feed form. What I wanted to do with this document (which wordpress produces for me) is essentially the same as what the browser does with it when you click an RSS link – it parses the tags in the XML document and applies predefined visual styles to make the information accessible to humans.

PHP can perform this process quite simply, via the simplexml_load_file function, which provides a simple framework for parsing XML documents.


$feedUrl = 'http://emmettbutler.com/threestegosaurusmoon/?feed=rss2';
$ret = array();

// retrieve search results
if($xml = simplexml_load_file($feedUrl)) { //load xml file using simplexml
$result["item"] = $xml->xpath("/rss/channel/item"); //divide feed into array elements

foreach($result as $key => $attribute) {
$i=0;
foreach($attribute as $element) {
if($i < 3){
$ret[$i]['title'] = (string)$element->title; //assign the desired elements to array entries
$ret[$i]['timestamp'] = (string)$element->pubDate;
$ret[$i]['summary'] = (string)$element->description;
$ret[$i]['link'] = (string)$element->guid;
$i++;
}
}
}
}

After the initial call, this code examines each unit of the divided document and assigns the contents of certain tags to elements of the $ret array. For example, there is a line in each item of the feed that is denoted by the pubDate tag, which contains the date that a certain post was published. The line $ret[$i]['timestamp'] = (string)$element->pubDate; finds those tags and assigns their contents to the $ret array. Once this loop is complete, you’ll have an array full of all the pertinent data for your feed. You can loop through the array and print each element between the appropriate tags, style with a bit of CSS, and you have yourself a homemade and very professional-looking RSS feed widget on your website.

comments: 0 » tags: , , , , , , , ,

Starting to Build a Message Board

Posted on 6th March 2011 in Something Daily

It just occurred to me that life is too short to not write about whatever you want on your blog.

I’ve been teaching myself MySQL, PHP, HTML, and CSS over the last handful of days, originally starting with the W3Schools tutorial. That very quickly grew into the seed of an idea for an introductory project which, when it’s complete, should give me a command of the skills I need to have for the hackathon in April. So the idea is that I’m going to put together a message board, with 4chan as a template/inspiration. I want to have nice looking page layouts (not looking for anything horribly fancy, as I’ve never really used CSS in my life), as well as the functionality of viewing/starting/replying to comment threads and attaching images to comments. Eric gave me a subdirectory on his web host, so I’m using that to practice uploading files. It’s going well so far, I’ve figured out how to use a text file to store the information on submitter name, image, and comment content, and to display them in something vaguely resembling a thread format. The next step is to learn how to do that with MySQL databases instead of text files. That shouldn’t be too much of an issue (at least I hope not).

One other thing – this morning I downloaded Odd Future’s demo tape from their website and it’s some of the most evil rap I’ve ever heard, and the rhymes are so good. Also, Tyler the Creator just celebrated his 20th birthday today, and Earl Sweatshirt is 16. Check out OFWGKTA (this video is not safe for work or small children or anyone who doesn’t especially like profanity).

I Almost Hit an Elderly Man with my Skateboard Today

Posted on 5th March 2011 in Something Daily

I had a somewhat rare day today, in that I was incredibly active for the majority of it. There were three times today when I sat down and started to work, and then for one reason or another, ended up not doing that at all, and instead going out to play in the wonderful weather we had today. At first it was because I realized that it was way too nice out not to go skateboarding, so I headed to Stuyvesant Town again, where I managed to land 3 180s in total – something that I’ve never been able to do before now. I’m definitely getting the hang of it. I also came very close to hitting an old man with my skateboard, and it ended up getting stuck under his little old-man shopping cart thing that old people always seem to have with them on the streets. But I went to go pick it up and I had to go right up in front of him, and as I was getting it he glared at me and said something along the lines of “thats not so smart….I saw a skateboarder get hit by a cab yesterday – the cabs don’t stop….that’s not so smart.” I was embarrassed so I pretty much just said “I’m sorry, I’ll be careful” and kind of skated off…I went home after that. He was a grumpy man.

So I got back and Eric’s friend Rachel was still around, and London was recording in my room. It being a great day, my sometimes-talked about plan to make half shirts was brought up again, and Justin, Eric, and I each made our own halfshirt (mine is sleeveless, and I got an anchor ballpoint tattoo from Eric). Dressed in this ridiculous manner, we went to central park to play frisbee, which was awesome, as it was something that I hadn’t gotten to do in months, it being cold and schooly. But it was a great time. This dad brought his son over to play with us (the son was probably about 3) and they had matching red shoes….awesome! I got back from that and pretty much immediately went for a stroll with Sarah, so this is really the first time that I’m getting a chance to sit down and clear my head today. I don’t regret it though, everything about today was pretty much awesome. It’s good to not worry about work every once in a while, even though that’s something I don’t really like to do too much.

I’m going to learn some more about PHP now, and hopefully also get my data structures homework started, because these things usually take a little while. Oh also I just ate a Blue 9 meal in five minutes, and I kind of feel like I’m going to die. Talk to you guys later.

Preparing for Hackathon 2

Posted on 3rd March 2011 in Something Daily

Something exciting is on my mind since Tuesday: the next HackNY hackathon has been announced. I attended my first in October, but I didn’t know enough about anything that was going on there to really participate at all. I spent about five hours coding Spaceratops there, which I was in fact working on back in October. Side note: this is why I want to be done with that project. It’s taking too long. But anyway, the idea with the hackathons is that a bunch of representatives from startups come and demonstrate what their company’s API can do and then they give you a key and tell you to go nuts for the next twenty hours and hack together some sweet app from the tools that everyone’s given you. In October, this really was my first exposure to PHP, HTML (in recent years) and the idea of using API calls to build apps. So I didn’t join a team, I didn’t really meet anyone, and I didn’t build anything. I did make a lot of progress on Spaceratops that night. The experience of hanging out until all hours coding is extremely appealing to me, though (as is the prospect of free snacks, soda, and burritos all night), so I’m doing everything I can to prepare myself for the upcoming event. Whether I go by myself or with a friend, I’m going to introduce myself to some people, join their team, and help build something awesome. It’ll be awesome.

So to that end I’m going through as much of the W3Schools PHP tutorial as I think is necessary, and then I’m going to make something cool on my own. That’s the only way to learn this stuff: by actually building something. It may very well end up being something that uses Google maps or a calendar API – the choice is all mine. I just got PHP and MySQL running on my local server (for about the fourth time) and I’m tutorialing like crazy. Also Eric gave me subdirectory on his website, so I have some actual hosting. This may allow me to make Spaceratops into an applet that would be playable in a browser…that would be super rad. We’ll see.

And guess what I’m doing this weekend!? That’s right, more homework and coding. If I have my way, I’ll also finally finish Chrono Trigger. I’m at the last battle and it’s so nuts. Let’s do this.

Make your SNES all better

Posted on 9th November 2010 in Something Daily

Last night I sat down to play a bit of Super Mario Kart before bed. As usual, it took a few manual flips of the power switch to get the game started correctly; I also had to take the cartridge out a few times and blow on the contacts. Eventually it started working, I picked my character, and as the first race was starting, I knocked the side of my desk with my foot and the screen went black. I started the game again to see what was up, since this was certainly something out of the ordinary, even for my old and partially broken SNES.

My SNES Game Collection

It turns out that with all of my games except Super Mario World, jiggling the cartridge even the slightest bit while the game was running caused an instant freeze – and, in cases where this applied, a total deletion of the save data (this is why I didn’t do the test with Super Metroid…that game is hard). So seeing that this was happening, and realizing that it was pretty unusual, I looked online and discovered that this type of problem can be caused by a dust buildup on the contacts of the cartridge holder inside the console itself. So I folded up a Post-it and slid it between the two rows of contacts while holding the little door open. I could see a lot of blackish dust and dirt collecting on the paper, and sure enough, when I inserted another game and jiggled it around as a test, it was working fine – totally impervious to freezing. So there it is – if you have an SNES (or, I would guess, any older system that uses cartridges) that’s having trouble reading games, try cleaning out the contacts where the cartridge connects to the console. I really didn’t think it would work, but it totally did the trick.

I’m exposing myself to a lot more PHP/Javascript recently, mainly by reading a ton of posts on Stack Overflow, which is a public forum for programmers of any skill level, with every post organized by tags so you can see conversations about subjects of interest. Mostly it’s a Q&A type situation, where one will make a post asking a question they’ve run into, they can be answered by the community. By the way, Stack Overflow has a huge community (it’s a top 500 site, in fact). But I’ve been reading a lot about PHP and Javascript and how they’re used in conjunction with HTML and APIs like Foursquare and WordPress. I’m not building anything yet, just learning. But this totally counts as a project in my mind. Learning is very important.

Also, I’m listening to MF Doom’s Doomsday, which is an essential underground rap album (released two days after my 8th birthday, fun fact). If you don’t know Doom, I really, really recommend his stuff, especially Doomsday and Madvillainy, which he did with Madlib. Doom has some of the most interesting and unfathomable lyrics I’ve ever heard – “I-C-E cold, nice to be old/Y2G steed twice to threefold/He sold scrolls, lo and behold/Know who’s the illest ever like the greatest story told”…what!? I’m not sure if he writes his stuff on Doomsday or freestyles it, but I think it’s awesome either way. Check it out.

I found this on reddit (where else, right?) – it’s a multitool from ancient Rome. Check out the size of the knife!

Eric Sluyter owes me some Dibs

Posted on 4th November 2010 in Something Daily

So around this time last year, my suitemate Eric promised me that if I ever finished Ikaruga, he’d buy me some of these:

For those of you who don’t know, Ikaruga is an arcade-style shooter that was released on Gamecube in 2001, known for its high degree of difficulty and innovative polarity-switching mechanic. People have called it a “bullet hell” game, in that at some points there are so many enemies and projectiles on the screen that it’s extremely difficult to find the safe areas. It’s a cult favorite these days, mainly because of how hard it is to finish. I got it about 2 years ago from a Gamestop (for 40 bucks used, it’s apparently rare), and I’ve been playing it fairly regularly since then trying to get past the especially difficult 4th level. I eventually did that and recently have been working on the fifth.

And I just finished it.

So now I can finally shut up about it on the blog, and to everyone I talk to in person.

So Eric, whenever’s good for you, you know? There’s no rush. Really.

-&-

Here’s another render that I did a few weeks ago with Blender (haha, blender render), this time of one of the iconic blocks that Mario has punched in so many games over the years. A little better with the lighting here.

Mario '?' Block, rendered 10/2/10

I finished my initial foray into PHP today, after learning how it’s used to grab data from MySQL databases, and how it makes HTML really easy. PHP is awesome. Also, I’m going home this weekend! I’ll probably still post, but it’ll be from Pennsylvania! Check it out!

Speaking of Blender, here’s the famous iPad Blend. Yes, it’s what it sounds like.

Vegeta! What does the scouter say about his room number?

Posted on 2nd November 2010 in Something Daily

My room at NYU

It’s over NINE THOUSAAAAAAAND! This is my dorm room door at school. Vegeta’s pretty angry about how high the number is; so much so, in fact, that he smashed his scouter over it.

Paying attention in class is tough when there’s so much you want to learn (ironic, isn’t it?) I spent a good portion of this morning going over a PHP tutorial and learning how it’s used to generate HTML. Having been discouraged from writing HTML in the past by how apparently daunting the process was, the knowledge that PHP can be used to speed up the process is quite encouraging. I learned from the a tutorial on devzone.zend.com the basic syntax, as well as how to use PHP in HTML pages to dynamically generate the dimensions of a table. I think it’s awesome to have the two so well integrated that all it takes to make a bit of content if for your program’s output to be in HTML format – and way less work than it could be!

It’s exciting to learn a new language. I remember being probably 8 or 9 and waking up really early in the morning to sneak to the downstairs desktop computer and page through my dad’s copy of “HTML & XHTML: The Definitive Guide” from O’Reilly. I think I built a website explaining how to do all kinds of different card tricks. It never went live, but it might still be on that home computer. I’ll dig up the source for it if it’s still around and put it up here…it’ll probably be comedy gold. Unfortunately, maybe due to my years with the School of Rock, I pretty much completely forgot how to write HTML and any other basic coding knowledge that I may have amassed; so when I started taking programming classes last year, it was all essentially new to me. The point is, I’m excited to get into making websites again, with much more enthusiasm this time! Hopefully this works out…

I just got within 23 seconds of finishing Ikaruga again. Before, I would feel pretty good about finishing around that area of the game, because it meant I was generally improving. But now, with success within my grasp, every time I make it to the challenge stage and fail is just a slap in the face. I know I’ll get it eventually, but the sting of defeat is a new and unwelcome sensation in my gaming experience. (In Ikaruga at least – in Team Fortress 2 it’s completely the norm, for example).

I listened to CSNY’s Deja Vu this morning – that is a great album. You probably already knew that. But they just have an awesome, classic sound. Check it out.

This is another webcomic that Justin turned me on to a few days ago. It’s called “Axe Cop“: written by a 5-year-old and illustrated by his 29-year-old brother. It’s so ridiculous (some would say…random?), and the fact that it’s written by a five year old may be what makes it funny, but hey….it’s funny. Check it out.

Thanks for reading!