|
Written by C10ud
|
|
Saturday, 12 April 2008 |
|
For the longest time I have not been a fan of interpreted languages simply because of the speed differences that are often apparent during execution of heavy processing tasks. Python changed my disposition toward interpreted languages with its vast library of modules and ease of use, but speed was still an issue at times. The speed gap can be drastically reduced though by a module I discovered today. Meet Psyco. I know this sounds stupidly simple, but all you have to do is download and install the module and add these two lines at the top of your python source file: import psyco psyco.full() I discovered this while working on a word-search generator/solver for a CS class and it quadrupled the speed of my program :) Check it out at http://psyco.sourceforge.net/ Be first to comment this article | Quote this article on your site | Print |
|
|
Written by C10ud
|
|
Saturday, 22 March 2008 |
Two words. USE PYTHON!!! Its built-in XML parsing modules are teh bomb!! What precipitated this sudden admonition you ask? Well, I noticed that there are very few free Bible programs for Mac these days and I decided to learn Cocoa, Interface Builder, XCode, and Python all at the same time. I decided to use The American Bible Society's new OSIS XML format for scripture. While screwing around with Interface Builder I discovered that it had a handy WebView item in its library so I thought that would make my job super-simple. In no time I was able to grab a chapter from the XML document. With a little more trouble I was able to have the WebView display it. Now I've pretty much spent my entire Saturday trying to make it apply my XSLT to the xml that it is displaying with zero formatting, but to no avail. I spent hours trying to get the Objective-C stuff like objectByApplyingXSLTAtURL and junk to work, but I couldn't get it to work. Finally the ridiculously simple idea occurred to me… why not check out the good ol' python libraries that I have been using to parse this thing… perhaps the creators in their finite wisdom decided to throw in XSLT transformations as well. Well, sure enough that solved my problem in 5 minutes :D Here is the fruit of my days labor :)
chapterhtml = Transform(book.lookup(reference).encode('utf-8'), pathtoxslt)
After this line executes, chapterhtml contains the HTML resulting from the transformation. book.lookup(reference) returns the chapter containing the biblical reference string and so on. You should get the idea ;) Also, make sure you import the method before you use it.
from Ft.Xml.Xslt import Transform Be first to comment this article | Quote this article on your site | Print |
|
Last Updated ( Wednesday, 16 April 2008 )
|
|
|
Written by C10ud
|
|
Sunday, 13 January 2008 |
|
Well, I'm back to school again… less time for all my projects now… It's going to be a crazy semester. As usual, math (this time Calc I) will be my hardest class. My first computer lab was quite interesting in that the teacher got the flu and couldn't make it to class. We all received an e-mail with instructions on what to work on. Very interesting start to the year, no? My Calculus class is also off to an interesting start since about half of my class doesn't have the book yet. The bookstore seems to be sold out and doesn't expect to be restocked till next friday. Comments (1) | Quote this article on your site | Print |
|
|
Written by C10ud
|
|
Thursday, 06 December 2007 |
|
Apple's MacBook line of laptops, as well as some of the later PowerBooks, includes a nice little motion sensor. The idea is that if you were to drop your system then the motion sensor will shut your hard drive off so that your data isn't damaged. Very nice feature in and of itself, but a few geniuses have expanded it a bit beyond its intended use. Be first to comment this article | Quote this article on your site | Print |
|
Last Updated ( Thursday, 06 December 2007 )
|
|
Read more...
|
|
|
Written by C10ud
|
|
Monday, 26 November 2007 |
|
Recently my laptop's power supply cord, which had been frayed for several years, finally fried so on Black Friday I purchased a new MacBook. I have used mac for quite some time, but I have usually had LINUX as my primary OS so this has been a very interesting experience. Unfortunately, most of my programming tools aren't easily available for Mac. Even more unfortunate, my CS class for this semester is using C# of all languages. Xcode and Eclipse work fine for C/C++, but C# is a different animal. The first obvious problem is getting the Mono utilities loaded. The fix for this is rather simple: install MacPorts, run sudo port install mono and watch it build. Finding an editor took me a little longer. I had no success getting MonoDevelop for Mac, and the Xcode C# plugins aren't quite up to par yet. For the moment, the best I can find is SciTE. It is a very nice little editor that works pretty well for C# editing, and it is about the only linux editor I could get to compile. The magic command? sudo port install scite +x11. That took me WAY too long to figure out. I hope that many out there find it useful :) May the source be with you... Be first to comment this article | Quote this article on your site | Print |
|
Last Updated ( Monday, 26 November 2007 )
|
|
|
|
<< Start < Prev 1 2 3 Next > End >>
|
| Results 11 - 20 of 21 |