Moving blog!

March 1, 2012

Moving to programMatical.wordpress.com english is important remember. All my old posts are mirrored and I’ll be shutting this ones down…when I get around to it.


Notifier update

February 29, 2012

Git the updated version here

I noticed a problem with the notifier (at least on my machine) after a period of time between updates you’d get something like

<class ‘gi._glib.GError’>
(‘GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.139 was not provided by any .service files’,)
GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.139 was not provided by any .service files
<class ‘gi._glib.GError’>

I suspect because the dbus interface had cleaned up the interface that the program was using and for some reason re-initializing the library doesn’t seem to re-bind everything. I spent some amount of time on trying to fix it still using the wrapper libraries but I decided to just implement this the sane way which was to use python’s awesome subprocess module to simply call the notify-send command line…uh command directly. This has the side effect of removing the gtk dependency which means anyone who is using a desktop/windowing environment that supports libnotify (most of them) can use this now.

Additonally I’d like to ask for anyone using this who made/found nice macros and/or who made/found good update lines to submit them for inclusion. I am personally getting bored of the set I have and would like new ones.

email them to me indiecoredev@gmail.com and I’ll push them to the github macros/updateText when I get enough.


OS that I programmed in third year with a group of friends

February 24, 2012

Check it out

That’s really it, reading some of this code makes me sad but mostly it makes me happy because it’s the first really complicated thing that I ever did. I wish I’d known about Git or even how to decently use SVN back then, would have made this whole process much easier.

I’m also sad that I can’t find the version with my awesome written in ten minutes memory manager, this just has the ten second version.


Staring into the Aybss

February 22, 2012
Battle not with monsters, lest ye become a monster, and if you gaze into the abyss, the abyss gazes also into you.
Friedrich Nietzsche
So I have been playing around with nltk for awhile and want to make a script that auto-tags stuff I write. I did that last weekend but I only tagged nouns and really only a subset of nouns. What I really want to do is have it recognize things that are generally given hashtags and to do that I want to build a bot that eats twitter and shits hashtags, to put it rather uncouthly.
The first step in that direction is to jack into the source as it were and the best way to do that is to use the twitter streaming api I did this with the intention of mining the data I get from it but…it’s mesmerizing. I’ve been staring at the stream for the better part of an hour now.
Updates as they happen.
ps:
Apparently god wants me to retweet a lot of stuff I hope my mom is ok.

Weekend project – Feb 18th

February 20, 2012

Not much of a project this weekend I had to go socialize and clean because our MP is coming over tomorrow. The entire thing is so simple I’m just going to paste the code here

 #!/usr/bin/python
import nltk.tag
from nltk import pos_tag, word_tokenize

def tweetTag(sentence):
	startingSentence = sentence
	sentence = pos_tag(word_tokenize(sentence))
	outputList = []
	for wordToken in sentence:
		if wordToken[1].startswith('N'):
			outputList.append('#'+wordToken[0])
		else:
			outputList.append(wordToken[0])

	return ''.join([word+' ' for word in outputList])

def unsplitNLTK(wordList):
	return ''.join( [ wordTuple[0]+' ' for wordTuple in taggedTest])

def main():
	#test = "you know I was thinking about that app that they made with the tags and shit"
	while True:
		userInput = raw_input("Tag This:")
		if userInput == "q":
			break
		else:
			print tweetTag(userInput)

main()
 

Basically what this does is use nltk (The Natural Language Tool Kit) to tag the input and then checks and nouns and transforms them into hashtags for a service like twitter. The big take-aways for me from this are

1) How to use NLTK

2) Playing around with lists (it’s a lot like LISP)

3) Possibly hooking this up to a GUI, we’ll see if that happens before midnight or not. Reading about GUI stuff right now.


Beerware Group License

February 17, 2012

Original beerware license was written by Poul-Henning Kamp for releasing stuff related to BSD. That’s all well and good but what if you want to extend the same courtesy to others who may contribute to the project while retaining the same spirit? Well here is my solution, Beerware Group License V 1.0

 

/*
 * —————————————————————————-
 * “THE BEER-WARE GROUP LICENSE” (Revision 1):
 * <indicore@gmail.com> wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff.
 * If you do change it add your name to the beer list,  if you meet someone on
 * the list some day, and you think this stuff is worth it, you can buy them a
 * beer in return
 * —————————————————————————-
 */

BEER LIST:

 

and you just add your name to the beer list when you submit a change. It’s easy!


I made a notifier for Linux

February 17, 2012

I made a MSPA notifier for linux that doesn’t rely on mono.

Download here: MSPA Notifier 0.1.2

or get it from the backup here

Update:

Updated it marginally so that it takes the current working directory into account. This’ll make it easier to start with a raw startup script (cd  and then starting). I’m getting a dbus error every once in awhile but there hasn’t been an update since I noticed it so if you are getting it too I’m on the case. I fear it may be an OS level thing though.

Requirements:

python

libnotify which requires gtk

permission to make something executable

Install instructions:

Download the script and unpack it to wherever you please, then give it execute permission

example:

chmod +x MSPA_notifier.py

After this is done if you wish to start it on startup add it to your startup script.

For ubuntu users this is located in either

System > Preferences > Sessions

or

System > Preferences > Startup Applications

other distros should know where they keep the startup manager and/or how to write your own

You can add other update macros to the Macros folder, they don’t HAVE to be pngs, any image format that libnotify supports should be fine.

To get new messages simply add them to the updateLines.txt folder

usage: MSPA_notifier.py [-h] [-u UPDATE] [-d] [-l] [-t]

optional arguments:

 -h, –help            show this help message and exit

 -u UPDATE, –update UPDATE

                       The time between update checks in seconds default: 300

                       (5 min) can’t go below 60 seconds

 -d, –demo            This just pops an update to test the libnotify system

                       is working correctly

 -l, –link            This is to be used to create a quick click icon for

                       going to a saved page see readme

 -t, –timeout         Flag to tell the libnotify bubble to timeout, defaults

                       to never timing out so you don’t miss an UPDATE in

                       your sleep

Usage of the -l

As we all may know some systems (such as Ubuntu) are transitioning away from applets. This is unfortunate because my first instinct was to just make an applet. There isn’t a cross distro way to do this yet so -l is the solution. -l will simply instruct the script to open your saved MSPA game in a new tab in your default browser and then close.

For instance I use xubuntu so I made a launcher applet and told it to launch the script with the -l option on. Until I figure out this dbus magic this is the best way to do it. You don’t NEED a quick launch, you could just go to the site when you see an update but I like it. The icon in the Icons directory is included for use with the applet launcher

—————

It’s release under a modified version of the beer license so feel free to do whatever you want with it, just be sure to add your name to the beer list.

—————

Credit where credit is due:

I got the icon set from this post on the official forums and the MSPA logo is from MSPaintAdventures

If you have problems/suggestions send over an email or tweet me @indiec0re


Probably take some time and design a layout later

February 16, 2012

For now this will have to do.


This is basically just a place to store stuff that I program.

February 16, 2012

I’m working on a Linux updater for MSPA because I’m a huge nerd like that and got annoyed that there isn’t one anywhere as far as I can tell. I’m using the opportunity to learn Python which I’m really enjoying.

 

Anyway hopefully a link to the program will be up within the day or over the weekend depending on how lazy/4chan browsy I get.