Log in

No account? Create an account
Testing 1,2,3... [entries|archive|friends|userinfo]

[ website | Netrunner Tracker ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Links:| Ruby Home RubyForge RAA comp.lang.ruby Ruby Documentation ]

(no subject) [Jun. 24th, 2016|07:08 am]

Mostly a note to self, this is how you can show your current git branch in Windows Powershell. Just add it to your profile.ps1.

function prompt{
  $p = (Get-Location).path

  git branch | foreach{
    if($_ -match "^\*(.*)"){
     $match = $matches[1] -replace '\s', ''
     $p += " [" + $match + "]"

  $p = $p + ">"
  Write-Host $p -NoNewline
  return " "
linkpost comment

Building libxml2 and libxslt on Windows [Sep. 1st, 2015|06:11 am]
[Tags|, , ]

I had a little trouble building these from source with MSVC so I thought I'd record the issues I faced both so that I can refer back to this post if I forget, and perhaps help others along the way.

For libxml2, download the source and cd to the libxml2-x.x.x\win32 directory. Then run "cscript configure prefix=C:\usr iconv=no". Replace "C:\usr" with wherever you want to install it. Ignore the "iconv=no" bit if you want to try to build with iconv support.

If you get "win32\configure.js(197, 2) Microsoft JScript runtime error: File not found", then hand edit the configure.js file and replace "configure.in" with "configure.ac" and try again.

Then run "nmake /f Makefile.msvc", followed by "nmake /f Makefile.msvc install". That should mostly do it. It does not seem to build or install any sort of xml2-config script, but I found a batch file at https://mail.gnome.org/archives/xml/2012-December/msg00014.html that I copy and pasted into C:\usr\bin. Seems to work.

For libxslt, download the source and cd to the libxslt-x.x.x\win32 directory. Then run "cscript configure prefix=C:\usr lib=C:\usr include=C:\usr\include\libxml2 iconv=no", replacing "C:\usr" with wherever you installed libxml2. Remove the "iconv=no" if you want to try to build with iconv support.

Then run "nmake". If you see "LINK : fatal error LNK1117: syntax error in option 'OPT:NOWIN98'", then hand edit the Makefile and remove that switch, then run "nmake" again. It should build. Then run "nmake install".

That should do it, though I haven't found an xslt-config script yet.
linkpost comment

Azure and client connections [Jun. 18th, 2015|08:52 am]
[Tags|, ]

For anyone out there wondering how to do client side connections with Ruby and Azure, this should get you going. It took me a while to figure this out because the vast majority of the examples online assume you're doing this strictly within a web app and send the token to a reply-url, which is obviously unsuitable for scripting. So, here you go.

require 'rest-client'
require 'json'

token_url = "https://login.windows.net/" + tenant_id + "/oauth2/token"

resp = RestClient.post(
  :grant_type => 'client_credentials',
  :client_id => 'xxxxx',
  :client_secret => 'yyyyy',
  :resource => 'https://management.azure.com'

token = 'Bearer ' + JSON.parse(resp)['access_token']

# Now attach that token to all future requests:

resp = RestClient.get(
:content_type => 'application/json',
:authorization => token

p resp.body
linkpost comment

Hands in the Sea, a game that I designed, is on Kickstarter! [Mar. 1st, 2015|06:09 am]

After about 3 years of development and playtesting, my game "Hands in the Sea" is finally going to be published! Hooray!


It's a 2-player deckbuilding game on the First Punic War, i.e. the first big war between Rome and Carthage. So, not Hannibal, but Hannibal's father, Hamilcar. The mechanics are heavily inspired by a game called A Few Acres of Snow, which in turn was heavily inspired by Dominion.

This will be my first game published in 5 years. Too long, but the amount of time I've put into it (being mostly unemployed during that time) has really allowed me to hone the game.

Anyway, I'm pretty excited about it!
link1 comment|post comment

Getting irb history without readline [May. 17th, 2014|01:46 am]
[Tags|, ]

I built Ruby 2.1.2 from source and got all the desired 3rd party libs installed except readline. A minor nuisance since it mostly only affects irb and history. Except I want irb history so I can use the up arrow key to recall commands.

I tried rb-readline but it was acting weird, with stray characters appearing and general wonkiness that I can't describe. Instead, I installed rawline and modified the irb/completion.rb file so that it requires rawline instead of readline.

Works like a champ.

Update: Also, put "require 'irb/completion'" in your .irbrc file and make sure your HOME env is set. You may need to replace instances of Readline with Rawline in irb/completion.rb.
linkpost comment

Building openssl for Ruby with Visual Studio [May. 11th, 2014|09:02 am]
[Tags|, , ]

Yet another "how to build" post mostly for my own reference, but you may find it useful.

Building the openssl lib for Ruby with Visual Studio is a bit of a pain. First, you'll need to install openssl itself (which you can build from source if you have Perl installed) or use their precompiled stuff. To build openssl itself from source, do this:

  perl Configure VC-WIN32 --prefix=C:\usr\local
  nmake -f ms\nt.mak 
  nmake -f ms\nt.mak install

This assumes a 32-bit build, but you get the idea. Once that's done, you'll need to cd to the ext/openssl directory of wherever your Ruby source code is. Before you begin you will need to hand edit the extconf.rb file and change line 40 from "if $mingw" to "if File::ALT_SEPARATOR". This ensures that the gdi and wsock32 libs are linked properly.

This was reported at https://bugs.ruby-lang.org/issues/9817

With that done, run "ruby extconf.rb --with-openssl-dir=c:/usr/local", or wherever you installed openssl. Once that's complete you have to pause again and hand edit the generated Makefile because it's missing a declaration for $(top_srcdir). Look near the bottom and you'll see this line:

  ossl.o: $(top_srcdir)/thread_native.h $(top_srcdir)/thread_$(THREAD_MODEL).h

Change that line to this:

  ossl.o: ../../thread_native.h ../../thread_$(THREAD_MODEL).h

This was reported and inexplicably rejected at https://bugs.ruby-lang.org/issues/9824

EDIT: In Ruby 2.2 I just added "top_srcdir = ../.." to the top of the Makefile.

Then run "nmake" followed by "nmake install". Once that's done you can test it out by firing up irb and typing 'require "openssl"' to ensure you don't get an error.

That's it!
linkpost comment

The End of RubyForge [Feb. 27th, 2014|09:48 am]

If you haven't heard, RubyForge will be closing down for good on May 15th this year. This is truly the end of an era.

RubyForge began on July 22, 2003. You can see the original announcement here. The kind folks at InfoEther (namely Rich Kilmer and Tom Copeland) had given a nascent Ruby community a place to host projects, not just list them as the old RAA had done.

Based on the GForge code (mostly popularized by SourceForge), it didn't take long for it to catch on in the Ruby community. Not only did it provide hosting, but you could do bug tracking, manage mailing lists, post news announcements, set your own tasks and integrate your version control with it. There were also general areas where you could post code snippets, and you could even see some download statisics. It was fantastic, and soon we had a real competitor for Perl's CPAN.

Some of the most well known libraries in the Ruby community would be started (or soon migrated) there, including rubygems and rake. My own libraries, including the win32utils libraries, would also be hosted there. All hosted there since 2003.

Alas, all good things come to an end. There were several reasons for this, but first and foremost was the rise of git and github. Many people felt RubyForge had become too old school - many of its features often went unused - and they preferred the github.com interface. On top of that it's somewhat difficult to maintain. Being a PHP app meant Ruby programmers couldn't really help with any enhancements or fixes and, although other folks chipped in where they could, that left mostly just Tom to handle issues.

And so, RubyForge will close down this year, having hosted over 9,600 projects with over 100,000 registered users. But more than that, I believe that RubyForge was responsible for helping to popularize a relatively young language and for bringing together Ruby programmers together in the spirit of cooperation. It was, in my opinion, the first "social programming" site for Rubyists around the world.
link1 comment|post comment

Building zlib with Visual Studio [Feb. 27th, 2014|09:17 am]

This is one of those posts I'm making for future reference because I always forget.

If you've built Ruby with Visual Studio (instead of using the mingw32 stuff), you'll need to build zlib from source. You could use the pr-zlib library, but it's slower and you'll need to install it in a non-conventional manner. Anyway, under the zlib-x.y.z/contrib/vstudio directory, look for the subdirectory that matches your version of Visual Studio, e.g. "vc10". You'll see a solution file (.sln) file there. Open that solution in Visual Studio.

You should see several projects in that solution. Remove them all except "zlibvc", as it's the only one you'll need. Before you build it, you'll need to remove the ZLIB_WINAPI preprocessor definition (under Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor, on Visual Studio 10 anyway). Once that's done, build your solution. It will generate some files in zlib-x.y.z/contrib/vstudio/vc10/x86/zlibdlldebug. Look for the .dll and .lib files, and put them someplace sane, like c:/usr/lib. I also copy all the .h files to c:/usr/include. You may also need to copy the .dll file to the c:/ruby/bin directory.

Once those files are in place, cd back to your Ruby source directory under ruby-x.y.x/ext/zlib, and run "ruby extconf.rb --with-zlib-dir=c:/usr; nmake; nmake install", modifying the dir to wherever you put the files. One caveat here is that the zlib folks seem to like to tinker with the zlib output file names. You can either edit the extconf.rb file to make sure it picks them up, or just rename the .dll and .lib files to "zlib.dll" and "zlib.lib", respectively before trying to build it.

Once that's done fire up irb and do "require 'zlib'" to make sure it works.
linkpost comment

The Joys of Unemployment [Mar. 15th, 2013|05:50 am]
As I approach nearly 18 months of unemployment (save for 1 6-week gig in the middle there), I guess I should write a blog entry. What the hell have I been doing in that time?

After I quit my job in Boulder, I went on a 6-week road trip around the country. Starting in Colorado, I headed east through Kansas, Missouri, down to Tennessee and Alabama, over to Georgia, up the eastern states to Virginia, back west through Ohio, up to Michigan, over to Wisconsin (via the UP), then west through Minnesota, South Dakota, Wyoming and finally back to Colorado.

You can see the whole trip here.

Then I took a long hiatus. I job searched a little, but I never really found anything I liked. My main goal was to find something that did NOT involve Rails, which proved quite difficult. I did have one promising opportunity at Spiceworks, but instead of offering me a job they offered me a 3-month contract. I finished it in 6 weeks (well, I think I did, I got almost no feedback), then they asked me to work on....Rails, exactly what I told them I didn't want to do.

In the meantime I've been developing my next board game called "Hands in the Sea". It's based on a Martin Wallace design, though very different in some ways. Here's the BGG entry. My sister took my photoshopped map and did some professional touch ups. I think it looks good. I've had some interest from publishers, but no one has officially picked it up.

Anyway, it's probably time to finally visit the unemployment office. ;)
linkpost comment

Installing apxs on Windows 7 [Aug. 6th, 2012|01:42 pm]
This is one of those postings I make for future reference where I explain how to install apxs on Windows.

First, assuming you have ActiveState Perl installed, run "ppm install MinGW".

Second, grab the apxs source here and unzip and untar it somewhere. Then cd to the apxs directory where you just unzipped it.

Then run "perl Configure.pl --with-apache2=C:/PROGRA~2/APACHE~1/Apache2.2 --with-apacheprog=httpd.exe".

It choked when I tried to use the long path name, and it also wasn't smart enough to search for httpd.exe instead of Apache.exe, even though the Configure.pl script seems to make some effort to do so, but something's wrong with it.

Anyway, that worked for me.

Lastly, make sure your $APACHE/bin directory is in your $PATH.
linkpost comment

[ viewing | most recent entries ]
[ go | earlier ]