Archive for 2015

    New Chess Site

    I wanted to learn how to create websites using Bootstrap so I've created a chess site at www.gerardcondon.com/chess. This is a static site developed using Middleman. It uses Bootstrap and pgn4web to display chess games and allow the viewer to play through them.

    posted on December 9, 2015developmentchess


    Upgrading to Rails 4.2 on OpenShift

    I updated my Rails test app from 4.1 to 4.2. However when I pushed to OpenShift I got the following error

    You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0. 
    Using bundle exec may solve this. (Gem::LoadError)
    

    I found the answer on Google Groups here. The root cause is that OpenShift is dependent on Rack 1.5.2 and Passenger 4.0.18. The proper fix will have to wait until they update their versions of that software. Until then to fix this error, ssh into the OpenShift app and in the app-root folder run

    gem install rack
    

    posted on June 15, 2015development


    Publishing an application to OpenShift

    I was doing some sample Rails apps recently and was looking for a place to run them. Heroku would have been my first port of call but given the limits on database size for the free account, I looked around to see what else was out there. I ended up on OpenShift. The free account gives 3 gears (or VMs) with 1GB storage on each. This is better for me as I can run a proper database on it without the 10000 row limit. The 1GB storage is also persistent so you can use it to store assets.

    Redhat has an rhc gem which allows you to control your gears from the command line. You can create new apps from here or you can do as I did and create them from the OpenShift web page. They have a large list of pre-configured applications covering languages such as Java, Ruby, Python and frameworks like Node and Rails.

    I selected the Rails 4 application. This forks the Rails 4 example repository from Github. The name you give your application forms the basis for its url i.e. appname-username.rhcloud.com. You can choose a database - the options for Rails are MySql and Postgres. This creates a blank Rails application - to add OpenShift support to an existing application you can follow the steps here.

    After a short wait a screen pops up with the database credentials and instructions on how to clone the application to a local git repository.

    After I clone the repository I typically change the configuration. I want to also store the application code on Github, so I rename the origin repository to openshift.

    git remote rename origin openshift
    

    Then I add a new origin remote using

    git remote add origin git@github.com:gerardcondon/rails-app.git
    

    and I do an initial push to this remote

    git push origin
    

    The current master branch is still tracking openshift/master so now I change this to track origin/master using

    git branch master -u origin/master
    

    Now by default changes are pushed to Github when I run git push. When I want to deploy to OpenShift I have to manually specify it using

    git push openshift
    

    After the push, Openshift will stop the application, perform any db migrations and restart it again. There is also support for adding in your own operations at various stages in the deployment.

    If I want to clone the repository on a new machine then I clone from Github and add an OpenShift remote using

    git remote add openshift ssh://<<openshift repository ssh url>>
    

    The repository's ssh url is available from the application's dashboard on OpenShift.

    posted on June 7, 2015development


    Linx 7 Standby Battery Life Fix

    One issue I had with my Linx 7 was that the battery was draining really quickly in standby mode. I was having to shut down the tablet completely between uses. I found this page on a Linx forum site which recommended upgrading the wifi driver. I installed the driver and now the standby battery life is excellent.

    posted on June 1, 2015development


    Mini Linx 7 Review

    I recently bought a Linx 7 tablet for 70 euro. For the price it's a great little tablet. It comes with a full version of Windows 8 and a year's subscription to Office 365. It's great for Youtube/videos, Twitter and internet browsing. It's cheap enough, compared to a four or five hundred euro iPad, that I can leave the two year old watch his favourite videos on it without worrying too much. Some parts of the hardware are not up to scratch - the camera is terrible and the headphone jack has static noise - but for the price it's fine.

    One of the best features of the tablet compared to iOS is that it comes with a micro-SD card slot. That means that it is really easy to copy over files from my desktop. I recently tried to load up my iPad with photos and vidoes to show the in-laws. Even though the videos were shot on another iOS device, it was a nightmare to get them on the iPad - a convoluted process involving re-encoding and syncing through iTunes. On the Linx, I just copied the original files to the SD card in Windows, plugged the card in into the slot and was able to watch them immediately.

    In fact that original iPad is really only used now as an ereader. I think the usefulness of the applications on iOS has been going down recently compared to other platforms. Quality-wise they're absolutely fine but they're fairly shallow compared to what they could be. The race to the bottom app-store economy and the limitations that iOS puts on inter-app communications severely limits the type of apps being written.

    I play a good bit of chess and the apps on iOS are nowhere near the quality of those on Windows. And apparently also those on Android. However with the Linx I can run any Windows chess app. Even Chessbase runs fine on it, which gives access to a vast library of Chessbase Fritz Trainer videos. I can open pgn files in multiple different applications and copy and paste data between them. I can use source control to version my notes. Also on Windows, developers are able to charge proper rates for their applications, thus ensuring a robust marketplace for software.

    The problem with using Windows applications on the Linx is that the UI is really awkward to use with just your fingers. However to me, this is a small price to pay for being able to use these apps at all on a tablet. Also you can use Bluetooth mice and keyboards with the Linx so at least you have some options.

    Update If you have a Linx tablet then you should upgrade the wifi drivers to fix the battery life.

    posted on May 20, 2015development


    Ruby Command Line Input Using Highline

    I've been using Rakefiles a lot recently to automate tasks. I find it really useful in comparison to shell scripting as I can run the rakefiles under different OSes (OS X and Windows) and have it behave the same in all cases.

    I was building a simple script to automate the generation of pgn files for my chess games. I wanted to be able to enter the details of the games on the command line and then have my script output a pgn file.

    I didn't want to have to go messing about with low level operations such as puts and gets so I searched for something better. I found the Highline gem for this and was really happy with it.

    It allows for a variety of input formats

    • To display a prompt to the user and then store the input in a variable use event = ask("Event Title: ")

    • You can specify default values and the default will be listed as part of the prompt. On the command line simply hit enter to get the default value. timeControl = ask("TimeControl: ") { |q| q.default = "5400+15" }

    • You can create a menu from an array of values using the choose function. result = choose("1-0", "1/2-1/2", "0-1", "*")

    These can be customised and there are a lot more options available such as entering passwords. If you are doing text input in Ruby, I would advise checking it out.

    posted on April 14, 2015developmentchess


Tags

By year

  1. 2019 (16)
  2. 2018 (2)
  3. 2017 (11)
  4. 2016 (3)
  5. 2015 (6)
  6. 2014 (3)
  7. 2013 (11)
  8. 2012 (25)