• Server Move

    0

    Sorry for the brief Christmas downtime as my server and domain was being transferred.

  • Hide media files from Android media scanners

    7

    By default Android will scan your phones memory for any audio, video and pictures and add them to the media player/gallery by default. There are many reasons why this could be annoying. First there might be applications that use audio files (say a gps program). If the developer was inexperienced and/or lazy (and lets face it – most mobile developers at the moment are) no steps were taken to hide these files from the media scanner and they will show up in your music player. You might also have pictures/videos that you would not like to show up in the gallery. There exists a simple mechanism in Android to prevent this and it’s very similar to the way the robots.txt file works to control search engine spidering on websites (you can see where Google got the idea :P ).

    Simply create a blank file and call it .nomedia. Whatever directory this file is placed into will indicated to the Android media scanner that any media files inside this directory should not be indexed and left alone.

    You can do this on the phone via Astro (or a similar file manager) or a terminal app (just do ‘touch .nomedia‘ – touch is a unix command that will create the specified file, but not actually populate it with any content).

    You can also do this via your computer:

    Windows - notepad, save as [all file types] .nomedia;
    Linux/Mac et al – Use any file editor, file manager or the ‘touch’ command via the terminal).

    If you are a developer – please be responsible and ensure that this file exists in any asset containing folder for your project :)

    Nokia – Please learn from this example since this was one of the most irritating parts of my whole Nokia experience :(

  • Dynamic variable names in Javascript

    0

    Want to play with a variable who’s name you don’t (yet) know at runtime? So did I. Here’s how:

    var sheep = "dynamicVariableName";
    eval("var " + sheep + " = 'beehh'");
    
    alert(dynamicVariableName);
    

    Result: Shows alert windows with text “beehh”.

    You can also do the same with arrays:

    var sheep= "dynamicVariableName";
    eval("var " + sheep + "= new Array();");
    

    Speed? Eval is VERY fast.

    Security considerations? Think twice before passing user submitted code to eval. Use some form of string escaping if you do.

  • Variable functions in javascript

    0

    So i needed a way to elegantly handle incoming requests and route them to appropriate functions. I had an object comming in with some variables – one specifying the method to execute and the other(s) containing relevant data. I could use a switch statement, but i need to keep the script as small as possible (and i want something more dynamic).

    In PHP i’d use variable functions -

    function sheep() {...}
    
    $cow = "sheep";
    
    $cow() // Executes function sheep()
    

    JS can’t handle that. So i google’d around and found a post that was quite helpful on the subject. After a slight optimisation I’ve come to this:

    function sheep() { alert("behh"); }
    
    var test = "sheep";
    
    window[test](); // Will execute sheep()
    

    And now i can use variable functions in javascript :)

  • Running Starcraft + Brood War on Windows 7

    4

    Right so as promised here’s another how to on running an old classic on windows 7.

    There is a general issue with running the *craft series games on vista+ systems due to the change in the underlying graphics architecture of the systems. This has resulted in the games running in the infamous “low colour” mode (where everything looks like it’s in 16bit – probably because it actually it :P ). This is an annoying bug and one that cannot be easily addressed. Theres a patched driver floating around that someone reverse engineered (annoyingly i cant find the link). I’ve tried it with Starcraft and unfortunately this isn’t (yet) a stable solution (game runs sooooo sloooow) so we have to resort to other means.

    As i mentioned in my update the solution to running the original Starcraft and it’s expansion pack ‘Brood War’ is as obscure as it is elegant. No need for tools, no need for patches no need for virtualisation.

    Note: As always for the best possible experience i would recommend to anyone wanting to run classic games to simply use a virtual machine. These are so easy to setup and they are free. You don’t need VMWare workstation because that’s intended for advanced users (developers etc…). VMWare player, VirtualBox are both free and easy to use solutions. Microsoft’s Virtual PC is also an option. QEMU is pretty much king in the virtualisation world (albite lacking in the nice pretty simple UI so perhaps not for everyone). Boot up a virtual machine, install a copy of windows XP like you would on any other machine and your good to go.

    Ok so that aside lets get Starcraft running on windows 7!

    First you will need to install the game (obviously). You MUST do the following:

    • Install the latest patch (afaik 1.15.1).
    • Go to gamecopy world. Download the NoCD patch for the version of the game your running. This step is crucial. I don’t care if you are against piracy. I don’t care if you spent your hard earned pocket money to buy a legal version of the game. Copy protection technology is ALWAYS an afterthought hack – this is no exception. This game (like all the others i blog about) runs perfect PROVIDED YOU CRACK IT FIRST. The reason is simple. These copy protection technologies use obscure ways to do what they do (because people think this makes it harder to get around them). Typically this is just funny (and sometimes it’s actually degrading in performance). However as soon as something in the underlying architecture of the OS changes (like say going from XP to Vista) your fucked. Your precious copy protection will no longer work the way it’s supposed to and (most of the time) it will be the one single reason why, after following all the steps other people have outlined to get the game running perfectly for them, will fail for you. Crack the game if you actually want to play it - it’s YOUR game. You paid for it. You have that right.

    Once the game is patched and cracked your almost done. 2 more things to do:

    • First (as always) go into the game folder, right click on starcraft.exe and choose properties.
    • Click the compatibility tab and tick EVERY option under settings as well as “run as admin”. Don’t bother with “run in compatibility mode”.

    Now, here’s the obscure bit. Get ready to play the game, minimise the game folder and go to your desktop.

    • Right click on the desktop and select “screen resolution”. You will get your display settings window.
    • Now, without closing the display settings, go back to your Starcraft folder and run the game.

    You will see the starcraft splash screen displayed all correctly and the game will run fast and without issue – at the time of writing i’m about 3 levels away from finishing brood war on a 26″ 1920×1200 display.

    WTF? – Don’t ask. Just exit the game and try starting it without first opening display settings ;)

    IMPORTANT: You will need to open up display settings EVERY single time you want to run the game.

    Also note: If you minimise the game while playing, you will screw up the colour again and you will need to restart it. Also sometimes after playing for a while you might randomly start getting colour issues.
    Save what your doing and restart the game – it’s not a perfect solution (because it’s a hack) but it gets the job done :)

    Have fun guys, and here’s a video for you to enjoy :)

  • Update

    0

    Hey so i know it’s been like 50 billion years since i posted an update, but I’ve been busy. Great news is that i have lots of exciting things lined up to do with this site (as I’ve had an equally large number of things happen in my life over the last few months).

    So, i have a bunch of articles i have lined up. I have a new ‘how to’ on running an old classic on windows 7. This time it’s Starcraft + Brood war )) I know this is one of those games that no one seems to be able to get to run properly (it has to do with the really old rendering framework that is no longer compatible). I can run it. So much so that I’ve nearly finished brood war. (and yes I’m running 64bit) The game runs smooth and i have no problems with colour. The solution is quite literally a hack – one that is as random as it is elegant ;) Stay tuned and i will be updating on how to make more of your lives happy again :)

    Next up there are going to be some site changes. This blog will be moved to a subdomain (i’m hoping that wont screw too much with my google pagerank). The reason for this is that i have more than just blog content I’m going to be pushing out over the next few months. I’ve been very busy the last few months (and hence not really replying to comments). I’ve started a new job for my year in industry, I’ve been playing around with a lot of HTML5 stuff (VERY exciting). There has been javascript, java, scala, QT and objective C. I’m currently in closed beta for my first Android app and I’m in the design documentation stage for my second (I’m hoping this one will be as big as i plan to make it beautiful )) Besides that I’m busy working in some pretty heavy financial software as part of my job, and aside from my two mobile apps I’m also about to start work on one of my dream projects (this will be H.U.G.E) as well as starting work on new project with my friend – which is going to change the online world in mindblowing ways – trust me ;) Somewhere in the middle of all of that I’ve got to redesign the new generation of this site as well as actually finish my uni profile page – which i started back in first year and then stalled – because…well…..uni ;)

    I have some security articles i want to push out – that I’ve had lying around since i was back in high school. I’m hoping some things haven’t changed too much (although the world of computer security ain’t the way it used to be when i was rewriting IM chat traffic with a p3 coppermine in the freezing English winter). Last but not least – there is a possibility of me doing some media. I’m thinking possibly a podcast, but I’m not sure and this is just a wild idea (albeit one that people have been pushing me to do for quite a while). The topic is undecided as is the broadcast language (either English or Russian).

    If you haven’t already now is as good a time to subscribe to this blog as any – i try to post less but more. I don’t have too much time to sit and punch out creative work (as all my creative energy is usually used up on other things), but if i plan to write something i try and make is something that will make the world a better place for whoever stumbles across it :) I will be updating more frequently after the redesign and especially after i start releasing apps. I’m hoping for a regular stream of development updates, tutorials and hacks. Stay tuned :)

Page 1 of 41234»