Making CSS mud hills

I was recently asked to work on the UI and UX portion of our new product; colors, menu sizes, location, that sort of thing. This is all CSS work. The extent of my work with CSS up to that point was almost exclusively adding a few style tags to adjust the placement of elements on the webpage and such. I’m no stranger to baptism by fire since a lot of the skills I use on the job were thing I learned after being told to do them. *cough* JavaScript *cough* After messing around with it for a bit, I started to get the handle of the level of prescience of the various CSS items and how things overwrote each other and I began to find some of the interesting properties that can by styled in addition to things like media queries that can give some conditional styling.

I was, however, filled with the overwhelming since that I wasn’t doing it the ‘right’ way; That my style-sheets were going to be super sloppy and a complete mess to someone who knows what they are doing. I got that sense that I used to get when coding that I was making it work, but doing it wrong, and I had no idea what the right way was. I have seen some of the horror shows that sloppy coding can bring about, and I have the feeling my work may wind up as a CSS version of that. None-the-less, as always, it’s a new skill that I picked up and can do (if not super well) if there is a need. (Of course, you really really should hire an actual UX person when you are designing this stuff and not rely on programmers to do this. Programmers are not artists and artists are not programmers).

I have a good screenshot of the before and after that I will post shortly.

Who downloads the downloader?

The problem

I recently had a technical issue where I needed to access an application using an Android tablet (don’t ask, just roll with it). My first line of attack was to simply try to use my Fire tablet to access the application. Apparently the fire OS has been determined to not be Android enough to qualify as Android anymore so that was a bust. I don’t really have ready access to any other Android devices, and I wasn’t going to buy one simply to address a small technical problem.

Luckily, I did some dev work on an android app a while ago, so I happen to know that the Android Studio application comes with everything you need to easily run virtual Android devices for debugging purposes. In this particular case, a virtual device is fine, I just need the application to register as talking to an android tablet. After opening my old install of studio (and waiting for it to run through updates), I was in business and set up a virtual device to test with. It only took me a few minutes to realize that the virtual device did not have the Play Store app installed.

Into the quagmire

It seemed like even a virtual device meant for testing should at least be able to connect to the play store for more complex debugging then simply running smoke tests, but Play Store simply was not there. After briefly having an existential crisis over the idea of ‘how do you download the thing that lets you download other things?’, I figured that it should be possible to download the Play Store though a browser on the very off chance that someone managed to delete it from their phone. After playing around with the Play Store webpage through a browser, which the emulator thankfully does have, (and managing to somehow download an application onto my actual phone), I wasn’t really getting anywhere.

I figure that, as with most things in life, I had done something stupid and screwed it up, so I tried searching to see if there was a simple step to get the Play Store on an emulator that I had missed. I quickly realized that, although this seems to be a common problem, the emulator is simply not designed to support using the Play Store. There were various solutions that people posed, like loading the data into the emulator file, but they were all too complex for what I though would be a simple task.

Luckily, one helpful poster on Stack Overflow noted that the most recent versions of Android studio were updated to include having the Play Store on the emulator. I hit up the site for studio and, sure enough, that was in one of there most recent news postings. I noted that there version number associated with this change was higher then the version of studio that I had installed so I went back and checked for any updates. I had the latest version and there were no updates. After reading the news store more closely (reading is fundamental, kids), I saw that the build was not yet a stable build and was part of the beta builds they publish. After monkeying with the setting in studio a bit, I discovered a section for ‘updates’ that specifically noted which types of builds you want to use. Stable did not have the build I needed, and even beta did not have it, so I turned to the every sketchy and crash-prone Dev build.

After going through the song and dance of manually grabbing the zip and extracting it (since the dev branch is meant to run separately from a regular studio build since it is crash prone), I was back in business and set up another virtual device. After several minutes of waiting for the emulation slowed device to boot, I looked around and found… that the Play Store still wasn’t there. After some more searches, I found out that only some of the devices profiles on the emulator come with the play store installed (noted by a helpful icon in a column labeled ‘Play Store’). I looked at the list of profiles and as luck would have it… not a single tablet profile has the Play Store. At the moment it seems to be limited to Android Wear and the Nexus 5 phone profiles.

In the end…

The upshot of this whole experience is that Android Studio will likely soon have a stable build that can create virtual devices with the Play Store, but it’s still under development right now and it seems to be fairly limited in the number of virtual devices it does this for at the moment. This makes my ‘simple’ technical problem a headache, but at least there will be an easy solution available long after I no longer need it.

Bulking Up

The problem

A common problem I’ve run across is that people will have these elaborate spreadsheets in Excel that contain all of their data that they need to run things. Excel is the poor man’s database, but people prefer its interface over the challenge of having to learn some SQL. (Let’s ignore the fact that learning to manipulate Excel can take just as long if not longer then learning some SQL). I’ve spent some time thinking about various ways that I could import spreadsheet data into a DB and show people how easy it is to switch and do basic manipulation to get them interested. Although I have yet to figure out how to import calculations and elaborate cross-spreadsheet connections, I have figure out import a lot of basic Excel data into a SQL server.

If you can get the data into an approximation of a table structure, (e.g get it into a standard set of columns and a bunch of rows) then the data can be saved as a CSV (A standard format to save in in any spreadsheet application I’ve seen) and it can be directly imported into a table on MS SQL using bulk insert. Bulk insert is command that will, among other things, directly import data from a file into a table.

Fixing a problem where the rain gets in

Here’s a test I ran:


create table inputTest
(
ID int,
FName varchar(2000),
LName varchar(2000),
age int
)

BULK INSERT dbo.inputTest
from 'C:\someFileName.csv'
WITH
(
FIELDTERMINATOR =',',
ROWTERMINATOR ='\n'
);

select * from inputTest

Where ‘someFileName.csv’ contains the data:


64,Joe,Blow,23
78,Alica,Aba,35

With the result being:

ID FName LName age
64 Joe Blow 23
78 Alica Aba 35

This is a very simple example but it shows the basic format and how to easily import a bunch of data from a file. The command has a whole host of other features, including the ability to specify an error file to throw bad rows that can’t be parsed into. Seems like the first step in turning a spreadsheet nightmare into something useful.