trainedmonkey

lcdpoled

it turns out that the county of los angeles regulates the use of point-of-sale systems that use barcode scanners. one requirement is that you have a customer-facing display that shows prices as they are scanned.

after investing in a lcd pole display (for about $175), i had to bang together a way for scat to feed data to the display. and thus was born lcdpoled, a very simple daemon that listens for stuff to display.

i need to do some more work to make it as seamless as i would really like, but i think i have done enough to get us through an inspection if and when they stop back in to do that.

siamang: a web-based command-line client for mysql

Siamang Main Screen

because i have many more important things to be doing, i procrastinated by whipping up a little web-based command-line client for mysql. what does that mean? you load the webpage, start typing in sql commands, and it presents the results to you. it is just a weekend hack at this point, and has a lot of rough edges. it does have some cool features, though, like a persistent command-line history using Web Storage.

probably the biggest limitation is because it not maintaining a persistent connection on the backend, you can’t use variables, temporary tables or transactions.

it was really born because i was getting frustrated running queries using the command-line client and having the ASCII table look all wonky because it was too big for my terminal screen. html makes that pretty much a non-issue. it is also tablet-friendly.

Siamang Example Table Result

it was also an excuse to play with a few things i was interested in, like knockout. the whole thing is under 400 lines of code/html right now, but by leveraging bootstrap and knockout, it actually looks pretty polished and functional.

the name comes from a type of gibbon, which seemed to be unused in the software world.

you can find the source on github.

the old samurai

the old samurai is a film that celia produced and i helped out on a little bit. enjoy!

grand central market redux

grand central market

i’m excited to hear that the grand central market is going to see some upgrades. it was almost twelve years ago when i was serving jury duty and stumbled on the grand central market for lunch, which helped the plant the seed for me to move downtown a couple of years later and set the stage for all the awesome things that have happened since.

the market seemed to be having a fairly rough go of it ever since i moved downtown, even before competition like the new ralphs market opened. the hours didn’t really accommodate the new residential influx, and few of the vendors seemed to notice what was happening in the neighborhood around them. i am optimistic that with many of the existing vendors having long-term leases already, they won’t be priced out, and their presence should help keep the market grounded and accessible to the diverse downtown community.

wonton’s gluten-free dog treats

this was adapted from a recipe found online. some ingredients were changed and added, and the amounts were also changed so this makes just one half-sheet baking pan of treats. wonton loves these.

¾ cup bob’s red mill gluten-free all-purpose baking flour*
½ cup rolled oats
¼ cup potato starch
⅛ cup flax seed
¾ cup hot water
⅛ cup natural peanut butter (just peanuts, no added ingredients)

pre-heat the oven to 200°F.

combine dry ingredients. mix hot water and peanut butter. add to dry ingredients and mix into dough.

roll out to ¼" thick, cut into bite-sized treats (or use a bone-shaped cookie cutter). you may need to use more potato starch or flour to prevent sticking.

bake for two hours on parchment paper on baking sheet.

turn off the oven, and let the treats cool and dehydrate more thoroughly in the oven overnight.

* the original recipe called for chickpea (garbanzo bean) flour, but i’ve never tried using it. the gluten-free all-purpose flour contains chickpea flour and some other ingredients, and seems more readily available.

cranking along

a few weeks ago, i got it in my head that the ideal time to switch to using scat, the web-based point-of-sale system that i have allegedly been working on for almost 18 months, would be after the new year. this is despite the fact that it was barely even a rough prototype of some ideas. but i’ve been cranking along on it over the last couple of weeks, and it looks like i might just have something that we can use by my arbitrary deadline.

it’s still just barely a rough prototype of ideas, but i there should be enough there on the surface for us to be able to use it, and needing to fill in the gaps because we are actually using it will probably provide plenty of motivation to make it better.

even in the very rough state it is in, it should alleviate some of the pains of our current system. and save us the $30/month we were paying for not-very-helpful support and slow-to-arrive upgrades (trading that for my time to support the new system, of course).

banker’s round for mysql

for some reason, nobody has ever exposed the different rounding methods via mysql’s built-in ROUND() function, so if you want something different, you need to add it via a stored function. the function below is based on the T-SQL version here.

CREATE FUNCTION ROUND_TO_EVEN(val DECIMAL(32,16), places INT)
RETURNS DECIMAL(32,16)
BEGIN
  RETURN IF(ABS(val - TRUNCATE(val, places)) * POWER(10, places + 1) = 5 
            AND NOT CONVERT(TRUNCATE(ABS(val) * POWER(10, places), 0),
                            UNSIGNED) % 2 = 1,
            TRUNCATE(val, places), ROUND(val, places));
END;

use at your own risk. there may be edge conditions where this fails. but this matches up with the python and postgres based system i was crunching data from, except in cases where that system gets it wrong for some reason.

one thing you might notice is that it does not use any string-handling functions like the other “correct” solution floating around out there.

comments closed

i get tired of dealing with spam on very old entries here, so the comments now automatically close on posts after one week. you know, on the off chance that i ever post anything of interest again.

building an order

Scat screenshot

it feels like i’ve been thinking about this point-of-sale thing long enough that when i find time to sit down and write some code, the pieces actually fall together pretty quickly. today i was able to rough together an order-building interface with a few bells and whistles (literally: it has audible cues).

still a long way to go, but this should be a useful little toy to let us take advantage of a spare computer and barcode scanner to more easily price items from incoming shipments and get them out on the shelves.

one of the things that this screenshot shows is what happens when a scan or search matches multiple different items — it adds a (crudely presented) list of the possible matches, and clicking on any one of them adds that item to the order.

three kinds of people

progress on scat continues to be slow, because i have not found a lot of time to work on it. but every week i have to deal with processing our weekly in-take of products with our current point-of-sale system, i kick myself a little more and get motivated to spend a little more time on it.

the big addition today was a table for people, which is pretty straightforward. our current system divides people up into three types (and stores them in the same table as products, thanks to a normalization scheme i have not carried over into scat), and currently i don’t make any such distinction because sometimes customers can become employees and vendors can be customers and we have few enough of all three that keeping them distinct doesn’t seem worth the extra complexity.