Wednesday, June 1, 2011
Sunday, March 7, 2010
I initially released under GPL because I wasn't really sure where I wanted to go with TxtSushi and I knew it was easier to go from GPL to a more liberal license than to move in the other direction. A recent thread on licensing on haskell cafe convinced me that BSD is the way to go.
Saturday, January 30, 2010
- Initially I installed mono 2.6.1. using the OS X Intel installer which worked without any issues.
- Next I downloaded and unzipped the F# 184.108.40.206 zip file from the F# downloads page. The zip file contains a convenient install-mono.sh script so all you have to do is
chmod +x install-mono.sh && sudo ./install-mono.sh
- I decided to create bash scripts for the compiler and interpreter just for the sake of convenience:
mv FSharp-220.127.116.11 ~/bin/The contents of ~/bin/fsc.bash:
#!/bin/bash mono `dirname $0`/FSharp-18.104.22.168/bin/fsc.exe "$@"... and likewise the contents of ~/fsi.bash:
#!/bin/bash mono `dirname $0`/FSharp-22.214.171.124/bin/fsi.exe "$@"
fsc.bash --resource:SampleForm.resx \ sample.fs sampleform.fs Beginners.fs \ intermediate.fs program.fs mono program.exe
hmm... almost there. It looks like there is a hard-coded "..\..\" that gets inserted in source code path. A minor code change in sample.fs fixes that:
60c60,61 < let dir = System.IO.Path.Combine(appdir, @"..\..\") --- > //let dir = System.IO.Path.Combine(appdir, @"..\..\") > let dir = appdir... now for a second try:
That's better. OK, now let's see about getting an OpenGL example running.
- First I downloaded the TAO Framework (version 2.1.0) which provides .NET bindings to OpenGL and other API's for gaming
- You can install all of the libraries into mono's global registry by:
cd $TAO_HOME/bin for file in *.dll; do sudo gacutil -i $file; donehmm, I get the following error while trying to install FreeType:
Installed Tao.FreeType.dll into the gac (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac) ** (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/gacutil.exe:253): WARNING **: Error parsing \x87\xa0: Error on line 3 char 46: 'libglfw.so"' is not a valid name: '"'I'm going to ignore this for now since it doesn't seem to matter for my simple example code.
open System open Tao.FreeGlut open Tao.OpenGl let init () = // Select clearing color Gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f); // Initialize viewing values Gl.glMatrixMode Gl.GL_PROJECTION; Gl.glLoadIdentity (); Gl.glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0) let display () = // Clear all pixels. Gl.glClear Gl.GL_COLOR_BUFFER_BIT; // Draw white polygon (rectangle) with corners at (0.25, 0.25, 0.0) and // (0.75, 0.75, 0.0). Gl.glColor3f (1.0f, 1.0f, 1.0f); Gl.glBegin Gl.GL_POLYGON; Gl.glVertex3f (0.25f, 0.25f, 0.0f); Gl.glVertex3f (0.75f, 0.25f, 0.0f); Gl.glVertex3f (0.75f, 0.75f, 0.0f); Gl.glVertex3f (0.25f, 0.75f, 0.0f); Gl.glEnd (); // Don't wait! Start processing buffered OpenGL routines. Gl.glFlush () // Declares initial window size, position, and display mode (single buffer and // RGBA). Open window with "Hello" in its title bar. Call initialization // routines. Register callback function to display graphics. Enter main loop // and process events. let main = Glut.glutInit (); Glut.glutInitDisplayMode (Glut.GLUT_SINGLE ||| Glut.GLUT_RGB); Glut.glutInitWindowSize (250, 250); Glut.glutInitWindowPosition (100, 100); ignore (Glut.glutCreateWindow "Hello"); init (); Glut.glutDisplayFunc (new Glut.DisplayCallback(display)); Glut.glutMainLoop () [<STAThread>] do mainNow I just compile and run with:
fsc.bash -I $TAO_HOME/bin -r Tao.OpenGl.dll -r Tao.FreeGlut.dll hello.fs mono hello.exeHey, it works! That wasn't so painful.
MIT License Copyright
Sunday, January 10, 2010
- static site hosting for keithsheppard.name
- blog hosting for blog.keithsheppard.name
After a lot of trial and error I found hurricane electric $1/month static site hosting which has just worked with no problems worth mentioning. As a bonus you transfer your files using scp instead of the lame web-based file managers a lot of the other hosts make you use. HE also throws in a free domain name but I have my domain under dotster and I like keeping the hosting and name registration separate (that costs me an extra $15/year). So for what it's worth, this configuration has worked well for me.
UPDATE: It seems that hurricane electric is no longer advertising $1/month hosting, but no worries I found something better! You can host static content on your domain for free using github (I think something similar is possible with bitbucket). You can find instructions at http://pages.github.com/ and see my example site repo at https://github.com/keithshep/keithshep.github.com (note the CNAME file in my repo).
Wednesday, December 30, 2009
Hiya! I've uploaded TxtSushi 0.5.0 to hackage and there are quite a few changes. I still need to update the documentation on http://keithsheppard.name/txt-sushi which probably won't happen for a week or so (Edit: I have made the updates) but I'll summarize the changes here:
- generalized the JOIN syntax to allow joins on arbitrary expressions (you used to only be able to join on column IDs). This test script demonstrates a join on a simple expression
- added initial support for the "for x in [col1 .. col4] yield expr" syntax. See this test script for an example of how it works.
- parser now works with UNIX, DOS and Mac newlines no matter which OS you're working on
- added integrated help for all SQL functions and operators. Use "tssql -help" to get a list of all functions and operators. Use "tssql -help sum" to get help on the SUM function
- added many new function definitions
- Grouped data syntax generalization: you can now group tables multiple times (via nested selects) and join those grouped tables to other tables (grouped or not). You can even mix grouped and non-grouped columns in the same expression.
- Many bug fixes and code simplifications (still learning how to write good Haskell). Most notably it is now very easy to extend tssql with new SQL functions and operations. Here's an example of what it takes to add a new function.
- added support for bool constants in SQL expressions
- improved error messages
- Declared the "classic join" performance bug a feature :-)
- and most importantly: changed the synopsis to "The SQL link in your *NIX chain"
Have fun and please send me your bug reports!
Sunday, October 4, 2009
I have just uploaded version 0.4.0 of TxtSushi with the following changes:
- General code improvements: fixed any -Wall warnings, improved help messages and SQL parser error messages
- External sort: added an -external-sort option to tssql which tells tssql to sort on disk for JOIN and ORDER BY. This was tested on a 10G CSV file and it worked but it took 10 hours on my macbook! I think that this can be improved.
- Nested select: TxtSushi now allows nested select statements
- Classic joins: added support for older style join syntax. These joins are still unoptimized though so their time complexity is row_count^2 rather than the row_count(log row_count) complexity when using the INNER JOIN syntax
- Transpose utilities: added transposecsv and transposetab utilities which will print a transposed version of the given table
I think TxtSushi fills a unique niche in the *NIX toolchain for tabular data. On one side you have python, perl, sed, awk which are all great for general purpose text processing but it takes a lot of hand rolled code to do table filtering/joining/transformation and it gets even worse if you want to be able to deal correctly with quoted fields. On the other side you have real databases which allow you to do all of these things but which tend to be heavyweight solutions that require data import/export and don't want anything to do with your other *NIX commands. TxtSushi is different because it takes your text tables (or event STDIN) as they are and doesn't want to be anything more than an SQL link in your *NIX tool chain.
The two long term goals that I have for TxtSushi are to improve it to the point where it is generally available on *NIX distro package managers and that it is "owned" and developed by a group instead of just me. These two goals really go together since I may not be able to do all of the work required to mature TxtSushi by myself. I thought about keeping these goals to myself until I could get to the point where the core architecture are solidified and the remaining work would amount to developing and integrating modules into the existing architecture, but I think things are just moving too slowly with me hacking alone. So, if you are interested in hacking TxtSushi with me let me know!
Off the top of my head here are some relatively self-contained contributions that can be made:
- Extensible SQL Functions: This one should be fun. The way I implemented SQL functions isn't very pretty. The function parsers are in SQLParser.hs toward the bottom and the SQL Function execution code is in a big function guard toward the bottom of SQLExecution. I think we should have an SQLFunction type which would bundle up both the parsing and execution for a single SQL function/operator. The real payoff is that we could then have an XMonad-like configuration file that allows users to define their own SQL functions (Eg: if a user wants to define a STD_DEV aggregate function, now they can as long as they know haskell).
- Improve table parsing: the table parsing code was the first thing I wrote and it shows. It should be replaced by something more like what you find in Real World Haskell: Using Parsec which is much more concise and tolerant of any end-of-line encoding
- External sort: The external sort algorithm works but could probably use a more expert Haskell hacker's eye to become efficient (there were a couple of reasons I couldn't just use the external-sort cabal library as-is).
- Efficient classic joins: The classic style WHERE joins should be just as efficient as the INNER JOIN joins. If you're interested in this I have an idea for what I think may be the easiest way to do this. See issue 7
- Support for SQL Case Statement: See issue 8
- Implement window functions like RANK() and ROW_NUMBER(): See issue 11
- Test cases? Bug reports? Some other idea you have? ...
If you're curious, the simplest way to browse the source is here http://patch-tag.com/r/keithshep/txt-sushi.
Wednesday, August 12, 2009
Update 1: The site is back up and running, hosted by izfree.com
Update 2: izfree.com was not working out so I switched to he.net. It's $1 per month for static file hosting. I'll report back after a while on how he.net is going.
I've been serving up my website on the cheap using dynamic DNS and a spare linux box at home. My linux box just died so my main site is down :-(. Luckily my blog is hosted by blogger which is why it's still doing fine.
I don't suppose anyone knows a good way to host a web site for free assuming all the content is just static pages? I need to be able to come with my own domain name too. I think I'm going to have to finally break down and actually spend money on hosting.