Adam Monsen

May 23, 2013

protips: Tiny Tiny RSS on Bluehost

Filed under: Default — Tags: — adam @ 12:14 am PDT

The Bluehost hosting account must be configured to use a recent version of PHP. After creating a subdomain, I had to delete the .htaccess file to make sure the latest version of PHP was used.

I used the periodic cron method to update my feeds. I used the “twice daily” common schedule. Here’s my command:

/usr/php/54/usr/bin/php-cli $HOME/public_html/www.example.com/tt-rss/update.php --feeds --quiet

The explicit path is required because tt-rss needs a recent version of php meant for the cli (for example, with register_argc_argv enabled).

Cloudflare might muck up the JavaScript or CSS or slow things down. I disabled it.

April 16, 2013

My Hadoop/MapReduce article in Linux Journal

Filed under: Default — Tags: , , , — adam @ 10:58 pm PDT

I’m proud that LJ accepted my Hadoop/MapReduce article for the April 2013 issue! If you’re new to MapReduce and are interested in learning about same, this article is for you.

 

I’ll also be presenting a talk based on the article at LinuxFest Northwest 2013.

March 6, 2013

Web Framework Flavor of the Month

Filed under: Default — Tags: , , , , — adam @ 11:20 am PDT

I’ve been playing with Meteor a bit lately. It’s a “kitchen sink” system for writing web apps, complete with a database (MongoDB), server-side (Node.js), and client-side stuff. It’s all JavaScript.

It’s pretty fun for little experiments. I can imagine certain kinds of websites it would be good for (web-based chat, HTML5 games, collaborative editors, and one-webpage apps — same stuff I think vanilla Node.js excels at) and some it would not (mobile, CRUD with an RDBMS). I’m wondering if it would/should work well with larger web apps.

I’m afraid of JavaScript, but I think it’s finally time for me to overcome that fear. What better way to do so than to use JavaScript everywhere (database, server, client, APIs)?!

Meteor isn’t the only game around, it’s just the one I’ve looked at.

March 4, 2013

You are NOT a Software Engineer!

Filed under: Default — Tags: , , , , — adam @ 12:37 pm PDT

I enjoyed You are NOT a Software Engineer! by Chris Aitchison. It’s a fun analogy. Writing software certainly does feel more like something roughly planned and growing organically or evolving rather than something perfectly specified and executed. And I think this is OK.

Another thing we coders often forget: we are also authors. We write code for humans (others and our future selves) to read. I want you to be stoked when you read what I write! And coding is writing.

January 9, 2013

Wanted: Simple 2D Game Framework

Filed under: Default — Tags: , , , — adam @ 11:18 am PDT

ab_dI want to write a simple kid’s game. It would show something like “A B _ D”, then speak “What letter is missing?”. If you hit the “c” key, it would say “Congratulations!”. If you hit any other key, “Try again!”.

Anyone have pointers on game-creation frameworks? I’m looking for something cross-platform and very high-level. I want to be able to write and play the game in a few hours max.

These look hopeful: ScratchLÖVE, RacketAlice, Pygame.

I want this crawl version to be as simple as possible. Eventually I might want to add score tracking and animations.

I could also create a web-based game that would work, say, in a web browser on an iPad, but this smells a bit more complex than I’m hoping for right now.

Here are a couple other related links I came across while poking around:

November 26, 2012

List largest MongoDB collections

Filed under: Default — Tags: , — adam @ 2:11 pm PDT

I wanted to know the top five largest collections in my MongoDB database in terms of document count. This JavaScript gets the job done.

// config
var dbname = 'dev_bv';
var measure = 'count'; // or 'size'
var numTopCollections = 5;
 
function updateTopCollections(collection, stats, topCollections) {
    var thisCollectionObj = {
        'name' : collection,
        'count' : stats.count,
        'size' : stats.size
    };
    for(var i = 0; i < topCollections.length; i++){
        if (stats[measure] > topCollections[i][measure]) {
            topCollections.splice(i, 0, thisCollectionObj);
            break;
        }
    }
    if (topCollections.length < numTopCollections) {
        topCollections.push(thisCollectionObj);
    }
    if (topCollections.length > numTopCollections) {
        topCollections.pop();
    }
}
 
db = db.getSiblingDB(dbname);
var collections = db.getCollectionNames();
var topCollections = [];
 
for(var i = 0; i < collections.length; i++){
    if (collections[i].match(/^system/)) {
        continue;
    }
    var stats = eval('db.' + collections[i] + '.stats()');
    updateTopCollections(collections[i], stats, topCollections);
}
 
printjson (topCollections);

Save it to a file, edit variables in the config section, and execute like so:

mongo --quiet topCollections.js

Here’s a gist of same: https://gist.github.com/4150940

August 26, 2012

Wanted: fair curated tweet list

Filed under: Default — Tags: , , — adam @ 2:03 am PDT

I think I like Twitter. I’m getting to like it, anyway. One problem I have with it is what appears to be an overwhelming emphasis on timely and copious posting.

I often miss tweets from my VIPs (friends, family), especially those who post infrequently. I want something that shows me the last few tweets for a list of people I specify.

Twitter’s “lists” feature comes close to this goal, but (like every other Twitter client I’ve seen) it shows every tweet and the most recent first, so infrequent tweeters are still penalized.

What would really unlock this problem for me is if there existed a REST API to pull a few tweets from several users at once. Anyone know if such a thing exists?

I’m also interested to know if there’s an extant client that does what I’m describing. I wouldn’t mind not coding this.

UPDATE (30 minutes later):

I cobbled something together that basically does what I want. I only slightly modified Kevin Liew’s dead-simple jQuery-based example to make my app. I just factored out the user parameter to JQTWEET.loadTweets() and now call it multiple times, once per VIP. Even with a list of 50 VIPs I can run this less than once per hour and still avoid rate limits.

UPDATE (2012-09-27):

Another idea, no coding required: subscribe to the RSS feeds for each VIP in your favorite feed reader.

March 5, 2012

Squelch Doctrine/MongoDB logging in Symfony2

Filed under: Default — Tags: , , , , , — adam @ 7:30 pm PDT

If you use Doctrine+MongoDB in Symfony2, you may have flood of mongodb queries in your dev environment log. Here’s a snippet of code for app/config/config.yml that will squelch them:

doctrine_mongodb:
  document_managers:
    default:
      logging: false

October 5, 2011

Link Checker Wishlist

Filed under: Default — Tags: , , , — adam @ 7:00 am PDT

Link checkers spider through your website and make sure that links work. I want an awesome link checker. Ideally, it would espouse as many of these attributes as possible:

  • easy to learn
  • easy to configure/customize
    • example config: don’t hit URLs on other servers
  • sensible default behaviors
    • example: respects robots.txt and ‘nofollow’ link attributes
  • scriptable / embeddable
    • useful from command line
    • useful from within CI servers like Jenkins
  • recurses (parses HTML, follows links)
    • and smartly avoids checking the same pages twice
  • fast
  • thrifty with memory
  • pluggable
    • example plugin: run jslint on all JavaScript
    • example plugin: validate HTML 5
    • example plugin: validate CSS
    • example plugin: compute accessibility score
    • example plugin: JUnit XML output
    • example plugin: OpenDocument spreadsheet output
    • example plugin: Excel output
    • example plugin: CSV output
    • example plugin: JavaScript engine
    • example plugin: follow hashbang URLs
  • beautiful source code
  • FLOSS

September 19, 2011

offline HTML 5 validation

Filed under: Default — Tags: , , , , , — adam @ 11:05 am PDT

HTML 5 logo

I’m liking Henri Sivonen’s Validator.nu service. I’ve got it running locally, and it works well. I can use it as a web service and validate HTML from within Vim, using quickfix to rapidly resolve errors. My Jenkins CI server uses the same validator via phpunit tests.

Warning: it took me a very long time to get it running locally. Technically easy (just run a build script), but it downloads tons of libraries and files before it can do its job.

Older Posts »

Powered by WordPress