Playing ‘pretend store’ with my three-year-old nephew “R” last night.
R: What do you want ?
J: Some fresh figs please.
R: Here are some fig.
J: How much do I owe you ?
R: $10,000,000 !!!!
J: What ? I don’t need that much. I need a bailout.
R: What’s that ?
J: A wheelbarrow full of money.
R: OK. Here it is. Tens of hundreds of million dollars !! What do you want next ?
J: Another bailout.
R: OK. Here it is. Hundred of million dollars ! What do you want now ?
J: I ran out of money again. Another bailout, please..
R: What ! No ! Stop that !
J: OK, then I want a bonus.
R: How much ?
J: $10,000,000
R: Too much ! What’s that for ?
J: I’m too big to fail.
R: Mooooooom ! Uncle Jude’s being silly again !
I was getting the message above on my laptop when I turned it on.
Surprisingly, whacking the bottom 4 times fixed it. Go figure.
In setuptools, the bdist_egg command has an -exclude-source-files option that is missing in the bdist_rpm command.
So what’s the selfish sod to do if he wants to keep from distributing his source in an RPM ?
Including the install script below worked for me.
python setup.py bdist_rpm --install-script=install.sh
where install.sh is
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
#goodbye py source
find $RPM_BUILD_ROOT -name \*.py -exec rm {} \;
sed -i '/\.py$/d' INSTALLED_FILES
At my current job, I had the misfortune of having to deal with some Oracle Pro*C code. Since I’m a -Werror weenie, I was annoyed that this code was spitting out a ‘warning: ’sqlstm’ defined but not used’ warning in all the proc generated source. Here’s how I inhibited the warning.
I added a new pc_common.h file
// If you know a better way to avoid the 'sqlstm' defined but not used warning, I tip my hat to you.
#define AVOID_THE_UNUSED_SQLSTM_WARNING(X) void avoid_the_sqlstm_defined_but_unused_warning_for_ ## X () { sqlstm = sqlstm; }
Then in some sample.pc that’s generating the warning:
#ifndef ORA_PROC
#include "pc_common.h"
AVOID_THE_UNUSED_SQLSTM_WARNING(sample)
#endif
The problem is that the generated proc code includes a static struct named ’sqlstm’, but then the generated code never references this struct. Instead it uses a local sqlstm variable whenever it’s used elsewhere in the generateed code.
The workaround adds a hopefully-unused function to the source that uses the static sqlstm struct. This is enough for the compiler to mark it as being used, even though the function itself is never used.
However, I did have to introduce the argument to the macro to force a unique name for these functions, since the linker will complain about there being multiple functions with the same signature in in different files.
I’ve published my first Haskell project on hackage. Augeas, is a FFI binding for the Augeas API. I wrote it mainly to learn about Haskell’s FFI, and to keep busy while I was between jobs. Also the API was small enough that it was a managable project.
Chapter 17 of Real World Haskell was very helpful during the project, however it didn’t cover file pointers, which were needed for the aug_print method.
The Bzlib2 Binding article in issue 2 of the Monad Reader, showed me how to do the Handle to CFile conversions, but I ran into some problems with their handleToCFile method during testing.
In my aug_print test, I was confused why I could no longer write to the Handle after calling aug_print. Eventually I found out that handleToFD closes the Handle passed to it.
I got around this by calling hDuplicate on the handle, and then calling handleToFD on the duplicate instead.
handleToCFile :: Handle -> String -> IO (Ptr CFile)
handleToCFile h m =
do iomode <- newCString m
-- Duplicate the handle, so the original stays open
-- after the handleToFd call closes the duplicate
dup_h <- hDuplicate h
fd <- handleToFd dup_h
fdopen fd iomode
Also, I made sure to close the Fd as well, which the Bzlib2 Bindings article did not show:
aug_print :: Ptr Augeas -- ^ Augeas pointer
-> Handle -- ^ Already opened file handle
-> ByteString -- ^ PATH
-> IO (AugRet) -- ^ return value
aug_print aug_ptr fptr_out bs_path =
do
useAsCString bs_path $ \path -> do
out <- handleToCFile fptr_out "w"
ret <- c_aug_print aug_ptr out path
fflush out
fclose out
return(ret)
I’ve been using the python-module-for-puppet to make sure my build environment machines have the python modules they need.
The modules been working as advertised, but unfortunately some of machines need to be running older versions of a couple packages, so I forked the project and added support for an optional $version argument so the easy_install command could use “name==version” style commands.
It’s the first time I’ve submitted changes via github, so I hope it did it right.
A bunch of wonky Indiana time zones, were added to pkg-glibc/tzdata over 19 months ago, (along with a number of other time zone changes) but they still haven’t surfaced in the tzsetup-udeb package, as of 1/7/2009.
As a result, if you’re in one of these odd Indiana counties, the tzsetup portion of the installation won’t display your time zone, but you can set it to the correct time zone after the install finishes.
I filled bug 511153 after asking about it on the debian-boot IRC channel on irc.debian.org
I attended the first session of the novalang sessions on Real World Haskell. So far, I haven’t picked up too much, but we’ve only gone through the first two chapters. It looks like a pretty good group, with a lot of smart folks attending.
The group had a mixture of people using both the physical book and the online version, so there was some confusion when someone would refer to something by page number. It might cut down on some confusion if the HTML had anchor links to the pages in the book.
I was surprised by Exercise 1 at the bottom of chapter 2. It had not occurred to me that last would have to return some element from within [a]. If it returned something else, like 42, then the type checker would catch this and make the signature something more specific like [a]->Int instead.
(It would also be nice if the online version included links to the exercises.)
One of my New Year’s Resolutions (from last year actually) is to revive this blog. So after digging up the administrative password for the site, I decided to look into WordPress a little, and here’s what I came up with.