Tuesday, July 15, 2014

2D Maze generation: Java code using Growing Tree algorithmn

Ported the maze generation Python code found in
http://pcg.wikidot.com/pcg-algorithm:maze to Java as a coding exercise.

""You are in a maze of twisty little passages, all alike."
-Adventure"

You can find the code on Github :

https://github.com/rebooting/Growing



Sunday, July 6, 2014

Updating Rift to use Glyph Launcher on Wine

From July onwards, Rift game will be launched from the Glyph Launcher.

If you are using Wine to run Rift,  the Rift Launcher will attempt to install Glyph and may crash out. The fix is quite simple:

Set Wine to emulate XP. The installer will run successfully. I did not have any luck using Vista as suggested by some.



Add a new shortcut to the GlyphClient.exe found in C:\Program Files\Glyph\GlyphClient.exe to your PlayOnLinux drive and launch it.

It should find Rift and you can go ahead and patch or play it!




Thursday, June 19, 2014

The shy Ion-Delete-Button in Ionic Framework

Took me a while to figure this out. I was trying out Ionic framework for one of my mobile side projects. The learning curve was fairly low if you know a bit of AngularJS-- I got stumped on a simple UI issue however.

I wanted to put a delete button beside the items of my list so my code was like:

<div ng-app="jsApp">
    <div ng-controller="Ctrl1">
        <ion-content>
            <ion-list >
                <ion-item>
                    <ion-delete-button class="ion-minus-circled"></ion-delete-button>Hello, list item!</ion-item>
            </ion-list>
            
        </ion-content>
    </div>
</div>




Hmm.. where's the delete button? Turns out you had to use show-delete="1" directive in the tag.


<div ng-app="jsApp">
    <div ng-controller="Ctrl1">
        <ion-content>
            <ion-list show-delete="1" >
                <ion-item>
                    <ion-delete-button class="ion-minus-circled"></ion-delete-button>Hello, list item!</ion-item>
            </ion-list>
            
        </ion-content>
    </div>
</div>






the source code http://jsfiddle.net/rebooting/5BSNE/

That being said I enjoyed using Ionic Framework a lot, it's a very clean framework.

Wednesday, June 18, 2014

Stop command from being commited to BASH History

I haven't seen this in the older bash environments before so I guess it must be fairly recent. To prevent commands from being committed to history, simply add a space in front of the command. 

Couldn't be more simpler!



Monday, June 16, 2014

Golang: Serving static content using Gorilla

Using the identical directive from ServeMux  "http.Handle("/static/", http.FileServer(http.Dir("./static/")))" for Gorilla to serve static files wasn't working - the directory listing works but clicking on any of the files listed would produce a 404.

There seems to be two ways to configure the mux to serve static content in Gorilla Mux(highlighted in blue)

package main

import (
    "github.com/gorilla/mux"
    "net/http"
)

func main() {
    r := mux.NewRouter()
    r.HandleFunc("/", HomeHandler)

    //This won't work
    //http.Handle("/static/", http.FileServer(http.Dir("./static/")))

    //These will work
    //first alternative
    http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))


    //second alternative
    
    r.PathPrefix("/images/").Handler(http.StripPrefix("/images/",
            http.FileServer(http.Dir("images/"))))
    
    http.Handle("/", r)

    http.ListenAndServe(":3000", nil)
}

func HomeHandler(rw http.ResponseWriter, req *http.Request) {

    rw.Write([]byte("You are at /"))
}







Thursday, June 12, 2014

Misplaced semiconlon and debugging fun in Javascript

This is frustrating and funny at the same time. I've been stuck at this simple condition statement wondering my nulled variable didn't check out true ... for about 5 minutes.

Turns out I totally missed ';' at the end of the if statement, which ended the condition and executed the next block of code anyway.


listview_tasks=null;


...


if(!listview_tasks);
{
    Ti.API.info("why am I here?");

}

Argh.

I blame the tiny font I'm using on my IDE. 

Time for a break me thinks.



Saturday, May 24, 2014

WinAuth and Wine on Ubuntu 14.04

Didn't see much information on WinAuth working via wine so I was surprised to find out how simple it was to get it working in Ubuntu using PlayOnLinux (4.2.2)

These is my setup:

Set up a new drive by clicking configure.


Select New.



Select 32 bits Windows installation.


I'm using the Wine 1.7.15 (32bits).


Call it "Winauth".


Once the step is done, go back to the configuration window and click on "Install Component", select dotnet40 and install.



Once done, open a terminal and copy your Winauth.exe and if you have winauth.xml from your windows directory, copy that too:


$ cp WinAuth.exe  ~/.PlayOnLinux/wineprefix/Winauth/drive_c
$ cp winauth.xml ~/.PlayOnLinux/wineprefix/Winauth/drive_c



Go back to the configuration window, making sure that Winauth drive is selected, click "Make a new shortcut from this virtual drive".




Click Browse.


You'll be able to find Winauth.exe in the window that shows up. Click Open and once done, exit the configuration window. You should have a shortcut on the desktop as well..



Here it is :)