Android 5.0 silent mode missing

The long awaited Android 5.0 update for my Galaxy S5 has finally arrived in an official update. I wasn’t impressed by the battery-sucking change to put a white background on everything, but hey, I’m adaptable, I can live with that.

However after one (1!) day of use I realised that the silent mode has been removed. The sound icon in the notification area used to cycle between sound/vibrate/mute, now it’s just sound/vibrate. The only way to go silent is to switch to vibrate, then go to sound settings and manually take off the vibration intensity. There has probably been some API changes associated with it as well, as many widgets on the Play Store are broken too.

So my question is: who in their right mind would authorise a change to take out a basic feature that’s been in all my mobile phones since my very first one in 2001? If somehow it got into the RC by accident, how many Google testers does it take to identify this as an issue? Of course there are some toggle widgets that’s been updated to work with Android 5.0, but why would I need to monkey-patch a basic feature like that?

UPDATE: Apparently due to public outrage, Android 5.1 will have silent mode back as before, but as the update goes to manufacturers, then mobile providers, it might take a couple of months for the update to be available on your device.

Thankfully Samsung created an update for the Galaxy S5 5.0 branch, which reverted silent mode changes, along with all the priority contact stuff. While the quick fix is quite welcome, this hybrid Android version might introduce some extra incompatibilities to the already fragmented platform.

Share Button
Tagged with: , ,

Assembly number guessing game

The re-write of the x86 Assembly version of NumGuess was long overdue. 15 years ago when I wrote the original code I didn’t think about standardisation or guidelines, just wanted to make it work. As the NumGuess project took off and received numerous contributions, the old assembly code became the weakest link.

A couple of weeks ago I decided to jump back into 16 bit x86 assembly programming to bring it in line with the rest of the project. It was clear from the start that it needed a complete re-write as the whole code was useless. Nibbling away at it in my free time, it is finally complete. Today I give you not just the guideline compliant 286 DOS code, but an improved 386 DOS version that uses 32 bit registers as well, which pushes the total number of NumGuess implementations to 40.

Random number generator

The original had no such thing. As the limit was hard-coded to 100, it simply queried the current time, which was accurate to 100th of a second. With the guideline’s requirement of a dynamic limit, that was no longer feasible, and an RNG was needed that gave believable randomness.

I chose MINSTD, which is a simple Lehmer RNG with a multiplier of 48271, which conveniently fits into a word register, the largest on the 16-bit platform I was aiming for. Unfortunately I still had to do some arithmetic calculations for up to 47 bits, which needed some extra work-arounds and code branching on 286.

The largest number it generates is 2147483646, one less than the maximum positive value of a 32 bit signed integer. This is the current limitation for all numbers in both versions.

The 386 version

The 386 version is just a simple improvement on the 286 one, taking advantage of the 32 bit registers that are available. To avoid using protected mode and keep it simple, it still uses 16-bit segments, but with the simplified calculations the code is about 140 lines shorter.


To compile the code, you’ll need the DOS versions of either TASM or MASM. The easiest way is the Tasm for Windows project on SourceForge, which bundles it with DOSBox. Compile and link with the following commands to generate an executable:

tasm num_286
tlink num_286

If you prefer MASM, you can download it from here, then:

masm num_286.asm
ml num_286.obj

Enjoy the latest addition to the NumGuess family, comments and suggestions are welcome. If you find a bug, please submit an issue on GitHub.

Share Button
Tagged with: , ,

Android Studio vs Eclipse folder structure

With the recent stable release of Android Studio in December, it has replaced Eclipse as the standard Android development environment. All developers are advised to migrate to it, as the ADT Eclipse plugin will not be maintained and updated, and as of now, it is no longer supported.

In this article I’ll have a quick look at the differences in the folder structure of the two IDEs.

Eclipse workspaces and Android Studio projects

Android Studio changes the terminology a bit. In Eclipse, you had workspaces with a number of projects and library projects in them. In Android Studio, this becomes a project with a number of modules and library modules. Apart from the names, they’re pretty much the same thing, but thanks to the mandatory Gradle build system, it tends to be more organised.

Many libraries no longer need to be copied into your workspace. Simply add a reference to the module’s build.gradle file, state the required version, and it will be automatically fetched from the remote repository, compiled and included without having to worry about it. No more hunting for Android support library JARs in the SDK folders, and no more manual Eclipse project opening nightmare. Many third party libraries can be included in the same way with Gradle, which saves a lot of clutter. Your project folder will be neat and clean, and really only contain your own code.

Folder structure

Here’s a list of folders where your code and resources are stored compared to Eclipse:

What is it? Eclipse Android Studio
Android manifest [project] [module]/src/main
Assets [project]/assets [module]/src/main/assets
Java source files [project]/src [module]/src/main/java
Resources [project]/res [module]/src/main/res
Included JARs [project]/libs [module]/libs
Share Button
Tagged with: , , , ,

NumGuess JScript and VBScript

Two more NumGuess versions have been added bumping the total up to 39. This time it’s JScript and VBScript versions with complete Windows Script Host support. They can be run with cscript.exe for console, or wscript.exe for annoying pop up windows.

The VBScript version is almost the same as the VB.NET one, with small modifications of error handling and console input.

The JScript version was a bit more tricky. On the up side, it includes and uses the JavaScript library, which is JScript compatible. On the down side, Microsoft somehow forgot to add input box support for wscript, so it has to be invoked from a VBScript part. This is why the file extension had to be changed to .wsf and the code itself is embedded into XML.

For the record, there were two more work-arounds proposed on the internet for the above issue, none of them worked:

  • The first one involved creating a ScriptControl ActiveX object to run VBScript code directly from JScript via eval. It looked like a fairly clean solution, but it doesn’t work in 64 bit mode, and on my machine it didn’t work in forced 32 bit mode either.
  • The second proposal was to create a hidden Internet Explorer instance, load an empty page and directly call window.prompt(). Unfortunately due to IE security improvements, it crashed with access denied, and I just ended up with an unkillable hidden IE process.

So yes, the JScript version is not ideal, but it works. If wscript support is not needed, the JScript part works fine in a .js file as well.

And as always, we’re always open to new contributions.

Share Button
Tagged with:

End of 2014 report

Another year has gone by and CodeBin blog is celebrating its second birthday today. Yay! I’d also like to wish all my readers a happy and prosperous new year! This is the usual recap of all that’s happened here.

Apart from a few moderately popular posts about LibGDX and Android stuff, the most popular post this year was about upgrading the Eclipse development IDE to the latest version. With this many hits, I think it’s time for developers to think about making it more straight-forward and automatic in the future.

CodeBin also went social in February last year with Facebook and Twitter accounts, and although the follower and like counters are still under the double-digit mark, it was more as an experiment and development excercise than anything else. Anyways, if you feel like social networks is the best way to keep track of my posts, it’s there if you need them. 😉

The NumGuess project has seen some nice pull request with a couple of extra contributors, and it’s already a bigger and nicer project than I would have expected 15 years ago when I wrote the first line of code. Thank you all for your hard work!

The most ambitious project in 2014 was undoubtedly Mangler.js. While it is still not feature complete and lacks up to date documentation, it has helped me shorten some javascript code at work, and anyone is free to try and use it.

That’s about it, let’s see some random analytics stats.


The site’s popularity has seen significant increase, I had about 10 times more visits compared to the year before. Many thanks to all my 31,051 visitors with 47,540 page views.

Most popular posts and pages

Other (7.2%)


OpenPrince (33.2%)
Mangler.js (22.3%)
NumGuess (18.3%)
FakeTileAO (17.9%)
EsoInt (4.8%)


C64 Games (38.9%)
Ostudio (22.4%)
Kill Bill (12.7%)
Ocamel (8.2%)
Oscorch (6.7%)
Otron (3.7%)

Visitor sources

Google search (89.4%)
Direct traffic / unknown (7.3%)
Semalt (0.6%)
Bing (0.3%)
StackOverflow (0.2%)
Yahoo (0.2%)
Other (2.0%)


Chrome (58.9%)
Firefox (28.3%)
Safari (4.8%)
Internet Explorer (4.3%)
Opera (2.1%)
Other (1.6%)


Desktop (95.5%)
Mobile (3.4%)
Tablet (1.1%)
Share Button
Tagged with: ,

NumGuess R Project contribution

R language logoNumGuess program #37 has arrived as an unexpected contribution by Gergely DarĂłczi, this time in the form of an R script.

It’s very nice and clean code, paying great attention to the guideline from the start. The R language is mainly used for statistical computing and graphics, and now for guessing numbers as well. For more information about the language, check out the R-project website.

As always, if you can code in something that’s missing, the project is always open for contributions.

Share Button
Tagged with:

Happy Holidays!

I’d like to take this opportunity to wish all my readers merry Christmas and happy holidays! Due to the popularity of last year’s riddle, I’d refrain from doing another one. If you’re desperate, just look up the old post and leave a comment, it’s not too late to be the first to submit the correct answer.;)

As this blog is getting close to its second birthday, stay tuned as I plunge into the analytics and give you this year’s highlights and most popular posts soon.

Share Button

Ocamel vs Jazz Jackrabbit menu

While browsing the internet for old DOS games, I just came to realise that Jazz Jackrabbit uses the same font in their menus as Ostudio’s award winning Ocamel, i.e. their developers also found 3D Studio’s funny looking built-in font.

Ocamel's main menu vs Jazz Jackrabbit's

Ocamel’s main menu Vs Jazz Jackrabbit’s

Share Button
Tagged with: , ,

Eclipse out of memory error

When using Eclipse for Android development, it can consume a lot of memory. If you’re working with multiple library projects with varying levels of target APIs and/or opening layout editors for different Android versions, sooner or later the java VM running the Eclipse IDE will run out of memory. This results in crashes, or even worse: cryptic, seemingly unrelated error messages and compilation errors.

To increase the memory available for the IDE, open eclipse.ini in your Eclipse folder and look for these lines:


Change them to the following:


This should be sufficient for most development work, at least I haven’t encountered any issues since I’ve made these changes.

Share Button
Tagged with: , ,

NumGuess Haxe and Jasmin

The NumGuess project has received another couple of great contributions by vbence:

  • New fully compliant Haxe version was added as the 36th implementation.
  • Jasmin version was fixed to follow the guidelines perfectly.

Keep up the good work guys, let me know if you have any other language ideas.

Share Button
Tagged with: