Conkeror: Webjump Helper

0

I’ve finally picked up the Conkeror browser – the keyboard-centric browser that has Emacs like key bindings and is based upon the Firefox html engine – and it’s simply awesome! I hardly ever have to touch the mouse anymore when browsing the web. You should definitely check it out!

I’m not covering the ins and outs of the browser in this post, though. This article is only about Webjumps and an easier way to create them.

By default you need to add a define_webjump for each webjump that you create. Not bad if you only have a couple, but a real pain in the butt if you have hundreds. I solved this issue by defining my webjumps as a dictionary of objects, then passing that dictionary to a function I wrote called makeWebJumps which does what you’d expect – cycle over the dictionary and create each webjump.

Here’s the definition of the function:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * takes a list of objects and turns them into webjumps
 * spec is mandatory and can be a url or a function that returns a url, alt is optional
 */
makeWebJumps = function(listOfObjects) {
  for (var i = 0; i < listOfObjects.length; i++) {
    var myWebJumps = listOfObjects[i];
    for (key in myWebJumps) {
      if (!myWebJumps[key].hasOwnProperty('alt')) {
        define_webjump(key, myWebJumps[key].spec);
      } else {
        define_webjump(key, myWebJumps[key].spec, $alternative = myWebJumps[key].alt);
      }
    }
  }
}

And to see how I populate my dictionaries and use makeWebJumps check out the snippet below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var baseWebJumps = {
  "wowhead":{spec:"http://www.wowhead.com/search?q=%s"},
  "homemail":{spec:"https://mail.google.com/mail/u/1/#inbox"},
  "yts":{spec:"http://yts.re/browse-movie/%s/720p/All/0/latest", alt:"http://yts.re/browse-movie/0/720p/All/0/latest"},
  "feedly":{spec:"https://feedly.com/index.html#my"},
  "localtrans":{spec:"http://192.168.0.102:12345"},
  "localplex":{spec:"http://192.168.0.102:32400/web"},
  "espnf":{spec:"http://games.espn.go.com/ffl/leagueoffice?leagueId=570639&seasonId=2014"},
  "cbsf":{spec:"http://2002scfl.football.cbssports.com/"},
  "cblog":{spec:"http://blog.coderscabal.org/"},
  "myreddit":{spec:"http://www.reddit.com/user/jmaelstrom/"}
}
 
makeWebJumps([baseWebJumps]);

You’ll notice the function actually takes an array of dictionaries. The reason being is that I like to keep my web jumps organized by category – because I’m kinda weird like that. Also notice the dictionary values are actually objects. spec is mandatory while alt is used if the webjump isn’t supplied an argument.

Pretty slick, eh? Well, not overly – but I find it useful anyway!

 

Emacs Configuration Management – Part I

0

I love Emacs – I use it for everything. Local file editing, remote file editing via Tramp, terminals, calendars, email, news groups, rss / atom feeds, reminders, time keeping, todo lists, document generation (from org-mode) – literally just about everything I can.

As you can imagine that amount of usability takes quite a bit of customization. Luckily, the Emacs community has done most of the heavy lifting. All that I have to manage is my own programmatic idiosyncrasies and – the init.el…

It became huge, and messy, and cumbersome. And like any good programmer it made me feel dirty – it needed organized and modularized. But again like any good coder – I didn’t want it to be manual. I wanted drop-in, auto-discover modularity that didn’t require any additional scripting.

Like most things coding (when you don’t know what you are doing) you start out on a quest to discover what’s available in the language of question for you to leverage. And that, to me, is the fun part – the acquisition of knowledge. The problem at hand is just a reason for you to dig deeper and learn – but I digress…

This post – like most of mine – is segmented. Mostly because I’m long-winded when discussing this material. However, I think this one is pretty good and you should come back to read the follow-ups. Why? Because of the snippet to follow and this explanation:

I currently have over 41 csutomization emacs .el files (1 or more for each mode / package) and my init.el file is simply:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; set up path helpers
(setq my-emacs-d "~/.emacs.d/")
(setq my-emacs-elpa (concat my-emacs-d "elpa/"))
(setq my-emacs-conf (concat my-emacs-d "emacs-conf/"))
(setq my-emacs-live (concat my-emacs-d "emacs-live/"))
(setq my-emacs-org (concat my-emacs-d "emacs-org/"))
(setq my-emacs-3p (concat my-emacs-d "third-party/"))
(setq my-site-file "~/site_conf.el")
 
;; load site file if it exists
(if (file-exists-p my-site-file) 
    (progn
      (load my-site-file)
      (find-file my-site-file))
)
 
;; load various configurations
(load (concat my-emacs-conf "configurations_config.el"))
 
;; will load and byte-compile my modular configurations
(my-load-configurations)

I can add a thousand configuration files – and my init.el never will get any larger. The key? My configurations_config.el – which isn’t as crazy as you’d think it would be. I like to think it’s a thing of beauty – but you can weigh in on my next post when we dig into it!

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

Karaf Auto-Feature Generating Gradle Plugin

0

I’ve over the last year or so really started to switch my focus from JEE based architecture more toward OSGi based architecture as the deployment model and service modularity of OSGi fits with my recent service layer designs. That, however, is a topic for another day.

OSGi

Now if you know nothing about OSGi that’s ok. For the purposes of this post just understand that a service jar’s dependencies are not bundled with it like in the world of JEE. The dependencies must already exist in the OSGi runtime and are then shared with whatever other jars need them.

As it is in the world of Java, most jars have tons of external dependencies. That being said, each one of those dependencies (and their transitive dependencies) will need deployed to our OSGi runtime for our service to function properly – or at all. I could have Gradle  list out all the dependencies used by the service and then manually deploy them – but as you can imagine that would be tedious and fraught with errors and omissions. I simply won’t do that (I hate doing anything manually more than once). Suffice it to say that I need an automated means of deploying my services into a OSGi runtime, which is in this case Karaf.

Karaf

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

Karaf has this notion of a feature – which is basically a listing of bundles (and other features) to deploy in order to fulfill some product’s dependencies – which sounds exactly like something I need to do to solve my problem. The issue is that it’s a verbose XML file, and I don’t won’t to have to do a bunch of text manipulation of Gradle’s dependency output in order to generate it. No, what I need is a plugin that interacts with the project build that will automatically do this for me – no muss, no fuss.

I immediately – being a Gradle newb – started scouring the doc’s and API’s of Gradle and determined that I could in fact, using Gradle’s API’s, get a concise list of the resolved runtime dependencies of my project, manipulate them, and generate a proper feature file for deployment into the OSGi runtime that would satisfy my project’s requirements.

This post serves to outline a little of the background of my issue and a proposed solution. The next couple will cover:

  • What is a feature file?
  • Gradle plugin creation
  • The final solution

I would imagine it will take at least two follow-up posts – so stick around, it’s kind of cool ;)

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

Tags: , ,

Emacs Calendar Extension – Information Unity (Part 3)

4

Ok, this post should wrap up the series – finally. Sorry it’s taken me a while, but got caught up in life for a bit…

To summarize what we’ve covered so far, I figured out how to get a iCal file imported into Emacs calendaring system, remove duplicates, and do a little post-processing in order to get it looking the way I wanted.

Up to this point, it’s all been manual calls with eval-region and that just won’t cut it! We need an Emacsian way of both a) Automatically running this code on start up (which the provided functions can already handle, and b) Being able to manually re-execute at any time via Emacsian means.

The running on start up, as I’ve said, is already handled via normal elisp code execution. We really just need to enable that same functionality through manual Emacs interaction.

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

Looking through documentation and many blog posts I discovered how to interact with the Emacs system – and it’s actually pretty simple. You only have to do a couple of things, actually:

  1. defun a standard lisp method.
  2. Include the interactive form (of which there are varying arguments it takes based on the required functionality.
  3. From within this form make calls out to the forms that we already created for importing an iCal

Read more

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

Tags: , , ,

Ugggh – Malware in WordPress?

0

Sorry folks, but apparently one of the images that I had linked out to in a post – if clicked – would direct you to a malware page…

Luckily, Chrome alerted me to it and I’ve taken care of it.

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

I guess I need to be even more careful with my content!

Again, my apologies.

Your ads will be inserted here by

Google Adsense.

Please go to the plugin admin page to set up your ad code.

%d bloggers like this: