Me
  • Archives

  • Categories

  • This post is somewhat more delayed than expected, I’ve been having a lot of fun getting my teeth into a project at work. I’ve also been exploring the ST2 package structure.

    I’m very happy. Sublime has inspired a cool little Javascript project which will make my admin control panels better (it’s a javascript implimentation of Goto anywhere) and the multiple-select option has turned out to be more powerful than I imagined.

    Multiple select
    Quite often I’ll have to replace a versions of a word within just one line. Normally this will come after I copy and paste some stuff and just need to tweak the arguments. In Textmate I’d highlight the new line, hit Cmd + F, enter the search term in the box, tab into the next box, enter the replace term into the box, hold down Alt and click replace, hit Cmd + W and the find box vanishes. I do recall there being a “faster” way to do it but it never worked for me and I could thus never remember it.

    In Sublime I select the word I will be replacing, hit Cmd + D a few times until it his selected all the occourances of that word I want, now I just type the replacement. When done I hit escape to leave multi-select mode. Bang, done. No mouse needed and no dialog boxes popping up either. I’d like to point out that Textmate’s search and replace is very nicely done, better even than the search and replace of Sublime. Sublime wins simply because it offers something different that beats search and replace. I’m very impressed.

    My packages
    In my travel from TM over to ST2 I’ve found a few minor snippets and commands missing. The snippets were very easy to convert as you can use the .tmbundle folder and just throw it in the ST2 packages folder. The commands were a little harder but I’ve made a start. I have 4 packages and my own set of preferences on github.

    Extra Python
    Extra HTML
    Extra SQL
    Math commands (currently just the one)
    My preferences

    I’ve been working out which of the packages to keep and which to bin. I should be blogging about them soonish.





    I spend a lot of time programming. I mean a lot of time. For the past 6 or so years I’ve used one application and one application only: Textmate. I have tried a great many other editors over the years, nothing has come close to toppling Textmate from it’s place as my goto program for editing anything plain-text.

    So it was with quite a bit of surprise I found myself liking Sublime Text. Sublime does itself a huge favour in allowing me to copy + paste my Textmate bunbles and colour scheme. Some of the key combos are different (Goto symbol is now Cmd + R rather than Cmd + T) but these can be changed in the settings. The settings themselves are daunting to say the least, there are a lot of them. It took at least an hour to go through them all and get them just the way I wanted them but I’d expect nothing less if I were moving to Textmate.

    The only thing I don’t like is the default window placement, it’s always dead centre. Given how often I close down projects this isn’t going to be an issue very often but it’s still an annoyance.

    Sublime and Textmate share a lot of crucial features such as good documentation, goto symbol and fast file switching/finding. Both have powerful find & replace with regexs and so on. Both have so many features you have to know they exist to find them.

    So what makes Sublime potentially better?

    Lots of preferences/settings
    As in, about 5 times as many as Textmate has. I’ve only needed to change 15 or so but here’s the cool part. I can further change them on a per-project basis too. This means if one project requires I use tabs and another spaces it’ll do it for me!

    Access command (Cmd + Shift + P)
    Textmate allows me to access any symbol (such as a function) and any file with a key combo. Sublime takes it a step further and allows me to acces snippets/commands (Textmate doesn’t let you live-filter them), program functions (such as Close all files) and even variables. It’s a clear improvement over Textmate.

    Preview file before swapping when using fast file switch
    When I fast swap to a file in Textmate, nothing happens until I hit enter and load the file. Sublime loads it behind the window before I push enter, just incase I want to change my mind.

    Easier to install/manage packages (bundles in Textmate)
    Once you’ve installed Sublime package control (which is as easy as copy + paste) you can install further packages very easily. Textmate had something similar to this, it was a little clunky but it got the job done. Then one day it stopped working, I have no idea why and I tried to manually re-update it but to no avail. I now hit Access command, type “install”, hit enter and start typing about what I want to install. It lists all packages matching the fuzzy search and I need only hit enter to install.

    Multi-select
    Textmate did very well with it’s column select and actually has a slightly nicer implimentation than Sublime. Sublime however allows me to select in multiple different places at once and given the way column select has helped me I am sure it will fast become something I can’t code without. My only gripe is that I can hit ‘alt’ and swap between column and normal mode, I have to use the mouse.

    Minimap
    All sublime files have an overview on the right showing you where you are in the file. I’m not sure exactly how useful it’s going to be but I have a hunch it will help me with my larger files.

    Find and replace outlines all matches at once and highlights one at a time
    It does what it says on the tin. If I search for something not in the document it will even tell me how many characters it was able to match before it had to give up!

    Packages
    The number of packages on wbond.net is very impressive. I have no doubt this will grow in time too.

    So far I’ve changed all my project files over to be sublime based (though haven’t deleted the Textmate project file yet) and I have a hunch I will be slapping down the cash for this within a few days. Normally it takes me quite some time to make a purchase like that. If this happens my next post will probably be listing my favourite plugins.





    Well lent has come to an end now and I’m going to resume using Facebook. I’m enjoying the extra time I no longer waste on it. However at the same time I have missed the ease of communication with my friends in other countries or anybody I’ve not got an alternate means of communication with.





    As mentioned I have mostly given up Facebook for lent. I’m sort of halfway through so I figured I’d share an update on how it’s going. The good news is I’ve managed to keep to my aim. I’ve used facebook for all of about 1 minute where I checked to ensure I had not missed some important message or other. I have not started browsing facebook or using facebook chat. I have used messages but only through the medium of my email client basically making them as good/bad as emails.

    I have so far found the biggest temptation to resume using it is when checking I have not missed anything important. It’s very alluring to start browsing through the status updates of my friends, more alluring than I expected. As a result I’ve checked Facebook less frequently for messages than expected.

    I’ve found I do have more time to do things, granted I spend this newfound time playing Starcraft 2, I’m still silver league in 1v1 but have moved all the way up to Diamond in 4v4! I’m also programming more, I’ve been working on the replacement for World of Arl, more on that some other time though.

    I’ve missed the communication aspect a lot. There are a few people who I had wanted to contact but not having their phone number or email address I was unable to. It’s very interesting to see how all the people I meet I exchange facebook info with yet don’t share my number or email much. Something I plan to change when meeting new people now.






    Due to a recent opportunity at work I am now going to be doing some home working and using my computer in the process. I did some thinking and given how I will be saving some money I had an opportunity to do something. Of course normally this money would fall straight into the “save for a house” fund but I thought of a far more enticing idea. Upgrading my computer from a paltry 4GB of RAM to the full 16GB it can hold. Before my iMac the most RAM I’d ever had in a computer had been the 2GB in my old Macbook Pro.

    It should be noted I had been doing quite well with only the 4, I was certainly not experiencing many problems related to the speed of my computer or the ability to run a dozen or so apps at once. However there were times it struggled, if I was trying to play high def video while run unit tests on my current app of development. It also struggles more than I’d like with Starcraft 2. Any time there are more than about 50 units on screen it starts to lag a bit and then I lose the game and get unhappy. With the RAM, there’s no lag even after several games which is really really nice.

    I am pleased to report the RAM only cost £120. I agree 120 smackers is not a paltry sum of money, however this computer is only two years old. My last Mac lasted me 4 years. I consider this to be an investment into those 2 years, probably more. My computer still holds up quite well against even the latest iMacs, 2.8GHz becomes 3.4GHz, RAM clock speed moves from 1067MHz to 1333MHz. The biggest difference (and only other) difference is the graphics card moving from 512MB to 1GB (with a very nice option to take it to 2GB). I think in the next two years what I now have will tide me over quite well, if not last beyond those two years.

    Next time I hope to be able to share a little more about the new opportunity at work.





    Yesterday I was reading a thread on Reddit about how facebook reads your text messages. It turns out the story may not be accurate but they hardly have a great track record. I got to thinking, should I try giving up facebook? I decided yes and there are several reasons.

    1) I spend a lot of time on it
    I spend a few minutes here, a few minutes there, half an hour here. It can quickly add up to an hour or more a day during weekdays and sometimes more on days off. If I can get a few extra hours a week to do other things then I’m sure I’ll notice it.

    2) Methods of communication
    Facebook for me was initially a way to communicate with people, now it’s that and more. However it’s become akin to twitter did for me, the amount of time used for communication is dropping compared to time… wasted? If I spent 20 minutes on facebook then most of the time much of it would not be used for communication. If people want to send me a message they can email me (and it’s listed on my facebook profile) or if they need to get me there and then, they can call me (not listed on facebook, I like to know who I’ve given my number to).

    3) My data
    It’s something I’ve always been aware of, I am the product and facebook is running because it can sell my data. It’s always made me slightly uncomfortable but not enough to consider giving it up. As you’ll see this giving up may only be temporary so it’s clearly not the main motivating factor. If I find I don’t miss Facebook then I’ll probably almost never return and give them no more of my information.

    4) To see if I can
    As I said for #1, I spend a lot of time on Facebook and it doesn’t feel like a chore either. I am interested to see first if I can manage to give it up and second how it affects my interactions with people. I know where most Salsa events are in my area and I have no doubt people will tell me in classes if there are new events.

    Caveat
    At the end of the day I understand some people will try to send me important information through Facebook; information I don’t want to miss. I’ve thus not deleted my account and have set Facebook to email me when someone sends me a message or friend request. Upon receiving such an email I will log on later that day to reply explaining I am trying to no longer use Facebook and am contactable by email and phone etc.

    I will also be retrieving some of the pictures from it I like and using it to provide profile pictures for any new entries to my address book. I simply won’t be browsing it or using it to communicate except for the above mentioned response to messages. I’ll post again if I fail to stay away or if I decide I really don’t miss Facebook that much.





    I don’t know when they started doing it but recently facebook has put translation links onto the comments in other languages.

    It’s pretty good, before I had to copy + paste into google to do this. The impressive thing is Facebook isn’t doing this for all foreigner’s posts, it only appears on the ones not written in English.





    I’m having trouble writing about dancing, so instead I’m going to post something about Starcraft 2. Insane AIs are tough, they mine faster and don’t give up easily. I was unsure if I would ever be able to beat one in 5 minutes, I couldn’t even defeat the Very Hard AI within 5 minutes. However, I’ve finally managed it as you can see from my profile. I would like to share just how I managed it.

     

    Opening gambit
    The map to select is Agria valley, you want as small a map as possible for this but with some well placed cliffs to make the strategy work. I started by setting all Probes to mine and began production of a Probe. The first Probe to return with minerals is sent to the cliffs by the enemy base nearest the gold minerals. While the Probe is on the way, construct another. When your builder arrives, you should create your first pylon as on the right. While the pylon is building, do not construct any more Probes.

     

    Place the forge
    As the pylon finishes construction you should have approximately 150 minerals, time to place that forge. If all goes well it doesn’t matter where you place it however there’s no disadvantage to placing it like so. I’ve left space for a cannon just above it, if the enemy sends Probes or Zelots against the cannon they’ll have to run around the forge first and only a couple can attack it at a time. While the forge is constructing you should be able to build another two probes, applying a chrono boost will always help here.

     

    Your first Cannon
    Once the forge is up it’s time for the first cannon. It’s going in the spot just above the forge. Cannons take 40 seconds to build so you need to plan ahead when working to our timeframe. You should be able to build another two probes while the cannon is constructing, again, throw on a chrono boost. When the cannon is nearly complete run your Probe into the enemy base, if you do this too early you’ll lose the Probe, do it just right and your Cannon will obliterate their Probes. At this point you shouldn’t be building any more probes, you need everything for the cannons.

     

    Expanding your reach
    Place your next Pylon here and then carefully dodge their probes with yours, if you lose the probe you can still win though doing so within the 5 minute mark will be very tricky if not impossible. While writing this post I have wondered if it would work better to place the first pylon where the forge is and then replace the 2nd pylon with a cannon, getting another cannon up sooner rather than later is good. I suspect however the enemy Probes would destroy the still-building cannon too quickly.

     

    Now add another cannon
    At this stage it’s now time for a 2nd cannon. Make sure it’s within range of your first so it doesn’t get chewed up by any remaining Probes or the Zelots your enemy is building. This cannon will not be in range of the Nexus but it will allow you to place several which are.

     

    If in doubt, add yet more cannons
    While the 2nd cannon is still constructing you should be able to start building a few more cannons. As your 2nd cannon is not functioning yet I suggest trying to build several cannons at once rather than one at a time as soon as you get the minerals. If the enemy does go all in with his probes you’ve got nothing covering your cannons and need to buy time. You can’t buy time if your cannons die off before they’re finished.

     

    Win, like a boss
    As your cannons finish, order them to attack the Nexus. They’ll automatically attack gateways first but we don’t care about them, you want to take down the nexus as fast as possible to force a surrender within the 5 minutes.
     
     
     

    Hopefully this will help you improve your game and demonstrate just how important it is to not get cannon rushed. The replay is located here for your viewing pleasure.





    I was creating a test cases for one of my classes and decided I wanted a to create a blank (but skipped) test case for each and every function in the file. I created the following textmate snippet to do it for me.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    #!/usr/bin/env python
     
    import os
    import re
     
    for f in re.findall(rdef ([a-zA-Z0-9_]*)\(.*?\):, os.environ[TM_SELECTED_TEXT]):
        print(
        @unittest.skip(No test created)
        def test_%s(self):
            pass % f)




    Between salsa, programming and playing computer games I’ve completely forgotten to blog. Okay that’s a lie, I just didn’t have anything noteworthy enough to blog about beyond the sarcastic facebook updates I post. Salsa is going well, I’m making strides in picking up the beat but will need to keep at it for a while (I have been dancing for just two months now). The moves themselves I’m getting quite good at and can pick up new ones swiftly and easily when they are introduced in class; this is certainly good. I now however have a new problem; asking ladies to dance. It’s not the fear of rejection, it’s the fear that they’d feel obliged to say yes or that I wouldn’t be good enough at dancing for them.

    But this new game I am working on, I’ve gotten a lot of the basic data-storage sorted along with admin facilities so I can manage said data. I’ve got some testing scripts in place too and unlike with WoA they will be able to cover database calls too so I can in theory get 100% test coverage! I’m currently working on the battle simulator, unlike WoA this won’t be focused on war and the wars or battles that do take place will be small enough scale that the simulator will work.

    The information about the game I can give out is that it’ll still be turn based but much faster (24 hours is the current plan), much more of it will be automated but much more of it will be focused on diplomacy and interaction with players. Despite being automated the battles will probably have more depth as travel time will play a larger role, at the same time the faster turns will allow for shorter in-game time-jumps so you will have a chance to react to enemy movements.

    It’s still a fair way from completion but it’s really starting to come together.





    « Previous Articles