Tag Archives: HTML

11Jan/14

First attempt at a mobile app, using PhoneGap Build

jsCalculator v0.02

For years, I have wanted to develop for Android but I haven’t gotten off my butt and done it.  I recently decided to force myself to explore development, using PhoneGap.  Today, I wrote a very basic proof of concept.  I have to admit that it was pretty easy.  I wrote the app using HTML, JS, and CSS, uploaded it to github, and built it on PhoneGap Build.  It is not pretty but it is very functional.

The next step is to build something that looks half marketable. 🙂

Github Link

Demo of the HTML/JS app

Installer Files (iPhone, Android, etc)

10Nov/13

How to convert decimal to unsigned binary in JavaScript

Ok, I do have to admit that this has limited value. I did this mostly as a thought experiment. I wanted to see how easy it would be to script the conversion from decimal to binary and back again, in JavaScript.

 

 

As you can see, the conversion from binary to decimal is much easier than decimal to binary. Before you ask, I do know that toString() can convert decimal to binary, octal, and hexadecimal but that would not have been as fun. 🙂

Live Demo

Edit: I updated BinaryToDecimal(). There was a significant flaw in it. After talking the problem over with Jeremy Streich, I also decided that this could be refactored to be much more simple. I’ll probably wait on writing a revision, though. I want to try hex and octal sometime soon and I’ll revisit this as part of that.

16Jun/13

How to detect a device type, based upon window width

These days, it seems like there are an almost infinite number of device types.  There are phones, tablets, phablets (AKA really big phone), small laptops (like netbooks), big laptops, and desktops.  The key to dealing with these devices is simply responsive design and extensive compatibility testing.  You should not deviate from that!

With that said, let us say that you want to target specific devices for device-specific behavior.  You could use a condition that is based upon user-agent strings but you would need to know all of the potential user-agent strings.  Even if you have the user-agent for Chrome on Android, what if they use the Dolphin Browser on Android?  Well, you can target based upon the screen width.

 

 

This is dependent upon the user having JavaScript turned on. Make sure you keep this in mind.