Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Welcome to the Monastery
 
PerlMonks  

Lawliet

by Lawliet (Curate)
on Jun 30, 2008 at 03:37 UTC ( #694676=user: print w/ replies, xml ) Need Help??

.oO(A masculine user image, I know.)

Log thing, sorta

June 29, 2008 - Now

  • 06/29/08 - 0 days old.
  • Aug. '08  - First (and only) borging.
  • 09/10/08 - Lost XP :( (At time of writing it was -6 or so)
  • 09/30/08 - Lawliet evolved into a Friar! Lawliet learned Moderate! Lawliet learned Consider!
  • 11/27/08 - Hermit now. Took a while to get here, though.
  • 01/04/09 - Chaplain status reached!
  • 02/20/09 - Promoted to Deacon ~ (I don't even know what a Deacon is.)
  • 02/22/09 - Vote Fairy refused to give me my 22 votes. Let us hope for the VF's sake this behavior does not continue... :P
  • 04/28/09 - 567th Curate/Saint! I should post more often.
  • 06/29/09 - Happy monkday to me :). 3283 XP and 388 writeups.

Risk

I have begun to play Risk online. Just thought I would let you know~


Adventures with Pidgin

The instant messenger I use to instant message (without digressing too much, why does it go from messenger -> message? Why not messager? Or messenge?) is Pidgin. As of now I only use two protocols; Gfire and Gtalk. (Feel free to ask me for my IM handles.)

The best thing about Pidgin (in my opinion, obviously) is that it allows plugins to be developed in Perl. (The next best things are the alliterations you can create with 'P'.) Unfortunately, the documentation hardly touches on what one can do with it. (Hopefully you can understand all the .xs files :( -- I had a hard time with it for I do not know C.) The way I learned how to do something is by looking at the preexisting Perl Pidgin plugins (see what I mean about the alliterations :P). The ones that helped me were:

The authors (the ones I emailed, anyway -- I forget which ones) had the same trouble I had (lack of documentation). (I complain a lot about the documentation -- sorry about that.) (I also use parentheses a lot.)

I have proudly created a plethora of plugins for Pidgin using Perl. (Not really, I just wanted to use 'plethora' for the 'p'.) I have only created three as of now:

(Those are in order of creation.) The reason that the only one I have released is eng21337 is due to its simplicity. I copied and pasted all the code from Linkstah (see below for information about Linkstah) to a new file, deleted some irrelevant stuff, added a module, and replaced my super-advanced-mega-utlo-search algorithm (you will see if I ever release it) with Acme::LeetSpeak's single function: 'leet()'. (I then took jdporter's suggestion to add the ability to only trigger the leetspeak if it is between <leet></leet> tags.) I do plan to release the others under CUFP, though. (Should I be using Google Code for this stuff?)

The only thing stopping me from releasing Linkstah right now is creating the Preferences box, but first, let me lucubrate a little lore about Linkstah:

It is named Linkstah because Linkifier has already been taken and the suffix 'stah' needs to be used more.

What it does is, when a user of the plugin types one of many shortcuts, it will substitute the shortcut for the, err, longer version.

"What are these shortcuts?"
you say? Good question, but next time raise your hand. A short snippet of the shortcuts are as follows.

# Keys are what the user must type, first element of value is the url +preceding the query, the second element is the url that proceeds the +query my %shortcuts = ( # General 'c:' => ['http://', '.com'], # Expand query to a .com 'n:' => ['http://', '.net'], # ... .net 'o:' => ['http://', '.org'], # ... .org 'cw:' => ['http://www.', '.com'], # www. .com 'nw:' => ['http://www.', '.net'], # www. .net 'ow:' => ['http://www.', '.org'], # www. .org # General search engines 'g:' => ['http://www.google.com/search?q=', ''], # google 'y:' => ['http://search.yahoo.com/search?p=', ''], # yahoo # Comics 'xkcd:'=> ['http://www.ohnorobot.com/index.pl?s=', '&comic=56'], # + xkcd # Wikis 'wp:' => ['http://en.wikipedia.org/wiki/', ''], # wikipedia # Movies/Videos 'imdb:'=> ['http://www.imdb.com/find?s=all&q=', ''], # imdb 'yt:' => ['http://www.youtube.com/results?search_query=', ''], # +youtube 'mc:' => ['http://www.metacafe.com/tags/', ''], # metacafe # Music 'pl:' => ['http://search.playlist.com/tracks/', ''], # playlist # eShopping 'eb:' => ['http://shop.ebay.com/', ''], # ebay 'ama:' => ['http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias% +3Daps&field-keywords=', ''], # amazon # Torrents 'pb:' => ['http://thepiratebay.org/search/', '/0/99/0'], # the pi +rate bay 'bt:' => ['http://btjunkie.org/search?q=', ''], # btjunkie 'dm:' => ['http://www.demonoid.com/files/?query=', ''], # demonoi +d # Dictionaries (and related) 'mwd:' => ['http://www.merriam-webster.com/dictionary/', ''], # m- +w dictionary 'mwt:' => ['http://www.merriam-webster.com/thesaurus/', ''], # m-w + thesaurus 'dict:'=> ['http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Que +ry=', ''], # dict 'urb:' => ['http://www.urbandictionary.com/define.php?term=', ''], + # urban dictionary 'acr:' => ['http://www.acronymfinder.com/', '.html'], # acronym fi +nder );

Hardly a "short snippet", but whatever. As you can see, the keys of the hash are what the user must type, and the values are what replaces the shortcut. (After relaying this information, I really hope someone does not steal this :O.) Example:

I type,

'Hola my best amigo, what pasa?'
(Yo est an experto in Spanish.) They say,
'Yo dawg, me n mah homiez jussed fownd a hilaryous vidya!'
(I stopped being best amigo's with this person after they said that.) The conversation continued and eventually I had to link them to, err, a link. Long story short, I typed [c:link], and we both saw http://link.com. (In retrospect, there was no reason for me to make up that conversation.)

In recapitulation, surround one of the keys with square brackets, and put the desired root url/search query after the key and before the ending bracket.

So, some of the selective studious students may have realized that the previous shortcuts look very similiar to those used on PerlMonks. They are.

Now that the short synopsis has been said, I can present you with the problem. I do not know how to correctly display the preferences with the options to create/edit/delete shortcuts. I feel that without this feature, the plugin will not be as popular (which, as long as I can use it, matters little, but still). What I am looking for is an interface like the Text Replacement plugin but I am too lazy not experienced enough with creating the preferences dialogs and/or requests dialog. (I am also too lazy to learn at the moment.) If you feel as though you would like to contribute to the cause, feel free to /msg me so we can communicate (unless you are one of the few non muggles here at PM, then we can simply apparate to one another). I am more than willing to share credit.

Enough with Linkstah, let me elucidate Definition Search. Actually, I am feeling lazy. Let me just summarize. If a user types something along the lines of 'define:defenestrate' in their window, hits enter, and has this plugin enabled, they will see the definition of defenestrate in their IM window. However, the other party will not be able to see neither the definition query nor the definition (to save space for them and you from embarrassment). I have not released this plugin because, although it correctly returns the part of speech(es), etymolog(y|ies), synonym(s) and definition(s), it does not correctly return the pronunciation. Also, some words make Pidgin segfault when queried. Also, although there is a preference option to limit the number of definitions, I feel there should be a better way. (The way I coded is a bit...weird.) Also, although there are several more preferences (whether or not the user wants to see the word's PoS, etymology, synonyms, etc.), I do not feel comfortable with its ugliness. Feel free to message me about this plugin, too.


I have a feeling I forgot to address something in this expatiation of mine.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2013-05-25 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (519 votes), past polls