This has moved (a while ago) to WordPress
Not that anyone reads it but this moved to blog.debedb.com.
Fear, Loathing, Uncertainty, Doubt, Laziness, Impatience and Hubris
Not that anyone reads it but this moved to blog.debedb.com.
Posted by debedb at 3:47 AM 0 comments
Posted by debedb at 10:10 AM 0 comments
/*- From comments in tds.h from FreeTDSSybase does an awful job of this stuff, non null ints of size 1 2 and 4 have there own codes but nullable ints are lumped into INTN sheesh! */
Posted by debedb at 12:55 AM 0 comments
Labels: code comment, code rant, freetds, sybase, tds
"Anything that can be done, could be done 'meta'" (© Charles Simonyi) is right up there with "Laziness, impatience and hubris" (© Larry Wall) as pithy description of my development philosophy. Also, unfortunately, there's another one: "Once it's clear how to proceed, why bother to proceed" (or something like that). So, with that in mind...
I wanted a Python client library for GData (thankfully, they released one last week, so this is moot -- good!), so I thought of automagically converting the Java library to Python. I tried Java2Python, but it's based on ANTLR grammar for Java 1.4, and the library, of course, is in Java 5. As I was relearning ANTLR and writing all these actions by hand (the pain!), I took a break and found Java 1.5 parser with AST generation and visitor suport by Julio Gesser (no relation, I presume?) and Sreenivasa Viswanadha, based on JavaCC. Aha! Much easier... But then, of course, Google releases the Python version of the library I needed in the first place, so I don't bother wrapping this project up... Here it is for whoever wants it: http://code.google.com/p/j2p/.Posted by debedb at 6:34 PM 0 comments
Labels: converter, grammar, java, javacc, python, translator, visitor
The py-cover
task is now integrated into the
project tree.
Posted by debedb at 1:09 AM 1 comments
Labels: ant, code coverage, continous integration, pyanttasks, python, testing
My C is quite rusty, so to help me figure out the flow of a program,
I thought I'd do with gdb
what
Tony Loton did with
JPDA. Quickly giving myself a refresher on gdb
,
I thought tracepoints
are the easiest way to go. Except that they are available only for
remote targets, and
gdbserver
on my host platform (Cygwin)ctags
information,
create breakpoints on every function entry, print the arguments and
resume. I haven't bothered to figure out where to use pure MI
vs. CLI commands, and in general I have no clue...
Now, what I think would be interesting is making this an add-on,
using CDT (or,
more generically, via Eclipse Debug
Framework) and GEF... I envision
something like a call graph (with exclusions of course, because it will become
too big), which grows as you step through, displaying arguments. Could be a
quick way to get a picture of how a program works before just reading the
code and keeping stuff in your head...
Posted by debedb at 9:31 AM 3 comments
Labels: c, cdt, debugging, eclipse, gdb, perl, reverse engineering, snippets, tools, visualization
Since Overstream embedding is now fixed, here...
Posted by debedb at 11:38 PM 0 comments
Labels: overstream
I decided it would be good to have a coverage report of our Python code, with nice visualization like Clover. So I took Ron Smith's PyAntTasks, and addedUpdate
This code has been integrated into the main tree.
py-cover
task to them. This will
run coverage for every test, and a cumulative one. In other words, you can
see what code a particular test exercises, and what code all the tests
in your tree exercise.
This also modifies py-test
task to include
packagedtests
attribute - see below.
The newly added py-cover
task runs Ned Batchelder's coverage.py (download it separately), and is specified as follows in
your build.xml
:
<py-cover packagedtests="false" pythonpath="${pythonpath}" reportsDir="${reports}" coverage="${tools}/coverage.py"> <tests dir="."> <include name="**Test.py"> </tests> <src dir="${quickRoot}"> <include name="**/*.py"> <include name="*.py"> </src> </py-cover>
Here, <tests> is a FileSet specifying tests to run, <src;> is a FileSet
specifying source code to cover.
The attributes are:
reportsDir
- where the coverage reports go
packagedtests
- this idiosyncrasy is prompted by our
tree setup. If this attribute is true
it means that
the test files reside in Python packages, false
otherwise.
(In our case, they do not; they are in the tree but are not packages. Note
that the original py-test
task assumed they are in packages,
I ahve changed this too).
coverage
- path to coverage.py
on your system (which you downloaded separately, right?)
P.S. I know about the colorize.py thingie, but I rolled my own (uglier, of course) for this one.
Posted by debedb at 4:22 PM 0 comments
Labels: ant, code coverage, continous integration, continuum, python, tools
Since people ask (in emails, at the short-lived MT version of this blog and on flexcoders@yahoo), here is how I use it. (DISCLAIMER: as I've mentioned, I hacked this from the original when I was just starting with Flex 2, so I gutted some code before I knew what the hell I was doing, but in this state it works for me...)
I use Flex Builder. I have the contents of the zip file right in my Flex Builder project. (NOTE: This was before I read thatflex
should
not be a part of a package name per Adobe's license; change it, willya?)
Then I choose have a simple facade like so:
package com.qbf.flex.ct { // Insert correct imports here, of course... public class Utils { public static function serverCall(method:String, params:Array, handler:Function): void { SERVER_CALL.call(method, params, handler, DisplayObject(Application.application)); } public static const SERVER_CALL:XmlRpcService = new XmlRpcService("http://localhost:8081/", Application.application.url.indexOf("http://") == 0? null : null : // This is explained further below... QbfFakeResponse.SINGLETON); }And from everywhere else in the code I use
Utils.serverCall()
as
follows:
var params:Array = [{value : resdefDataToServer, type: "struct"}, uri, server]; Utils.serverCall("doStuff", params, // This callback will be executed when the server // call returns function(result:Object):void { process(result); });Notice that you only need to specify types for parameters if it's not a string. If all your parameters are string, you can just pass an array of their values to the
serverCall()
--
a little sugar...
Now about this QbfFakeResponse.SINGLETON
business (it's not
necessary, just use null
in its place if you don't
need it). The definition of
SERVER_CALL
checks whether the application URL starts with
http://
-- in my case, it means that it's running "for real". If it is
running in Flex Builder's debugger, the URL will start with file://
,
and so I will use "fake" responses to simulate server calls (this is sometimes
useful for debugging, so that I don't have to run a server). This fake
response class is an implementation of com.qbf.flex.util.xmlrpc.FakeResponse
interface. All you need
to do is implement getResponse()
method and return
whatever you need by checking the method name and parameters provided.
Posted by debedb at 7:01 PM 2 comments
Labels: actionscript, contrib, flex, xmlrpc