-
I made a T shirt
Not sure if Vistaprint give me any readies for this, but what the hell. -
It’s not a bug. It’s a feature.
I like Android development. But you go off the beaten path and, well …
I’ve written some custom ListView objects that get rendered depending on what kind of device is needed for a home automation app I’m working on.
So far so bad.
Now you need to be able to turn that device on or off.
Tricky.
On the phone’s screen there is a button for every item displayed, each showing the correct value.
BUT … inside it reuses the object that has been created. I have attached listeners to the button that mean when you toggle it off or on it sends a message to the underlying device.
It does. But then it sends messages to ALL the devices of the same type, because I’ve attached the listeners to what is basically the same GUI over and over again. So it looks right on the screen, but underneath all that happened was things were set in the right order so they display correctly. Right at the end of the call chain it sets the value back just for fun.
OK - let’s get it to tell me the ID of whichever row was tapped and only allow commands to be sent to that device. Nope. The button has the focus and won’t tell it’s container there was a tap and I’ve tried all the suggestions google could find for me. So the listener doesn’t ever get fired.
I think I’m going to have to short circuit the views and create them by hand, so each is a separate object with its own button etc. defined with its own listeners.
List View is designed to work with thousands of elements of homogenous data that can be tapped on and treated as a unit. But actually, for the case where there’s only a few that might have other things on them, it just doesn’t work.
I’ll have another look on line tomorrow.
By the way - I’d lay money that iOS Table View has similar problems, before people start doing the fanboi thing.
-
Take what the defence gives you - coding
I’ve recently listened to Steven Pressfield’s Turning Pro about 10 times driving up and down the motorways. I can’t recommend it highly enough. One of the things he talks about are the things that get in the way of getting things done, of pursing your art and doing what you have to do when you turn pro.
So, some days you just can’t get your mojo on. The pro doesn’t let this stop the work happening. So you take whatever you can get today and work with it. In sporting terms you’re having a day where you can’t make progress against your opponent. So you take what the defence gives you and push on.
So when you look at what you need to get written today and don’t know how to start do the little things you can do and let the ideas percolate through your head. This is similar to the technique where writers just start writing anything that comes into their heads. When you do this it gets you moving and when you are moving you are not stuck any more.
So take what the defence gives you, take the steps you can take. You can’t do the big stuff all the time. But keep moving, that’s what works.
-
Android and mobile, purity, who cares?
Been doing Android dev full time for a few weeks now. I have to say I’m enjoying it. I also put myself through iOS training and have been doing some of that. Really enjoying that too.
I think I’m fed up with web apps, and all the arsing about you have to do to get things going and stoping useless bastards breaking your site. I can just fire up an IDE, and I’m there with mobile.
Beginning to think that the web will become the cloud (ha ha) sooner or later and most things will generally run as native mobile apps talking to servers (that used to be web servers). This will also take web apps away from the current Jesus-it’s-JavaScript-with-bouncy-shit car crash, the (web) interfaces will become simple again, because most of the time you’ll only go onto a site where a phone screen is too small to do something complicated.
I have to confess that I’m not missing Scottish Ruby either. I’d like to be there, but I’m enjoying writing apps in Objective-C and Java. I like the feel of this. Rails is becoming an over-complicated PITA to install and run. I mean, WTF, we replace JavaScript with something we can’t even debug? Please!
I’ve also discovered that my hatred of Java is really a hatred of J2EE and all that shoot yourself in the head dependency injection crap. For putting GUI components together in a coherent way it’s fine. But this makes sense, as it was originally designed to run set top boxes, and build desk top GUIs with Swing. It was only because it was the new kid in town and the web was new at the same time that it ever got popular, i.e. it was the only place to go for corporates who didn’t want to go the Microsoft route. But it was designed by a committee of computer scientists who’d didn’t understand what real people need, so it was always going to suck as much as the MS stuff. Sigh.
I’m not missing Ruby. I’m not missing BDD. I’m writing simple apps with a much faster turn around. Fuck me. I’m having FUN. Who’d a thunk it? Ruby was fun, it was radical. Rails made the web much easier and quicker. But now? I’m just bored by it, dunno why. I like to get things in the hands of folk who need them. Don’t care about the pedantic stuff. In fact the computer science types have taken over again. Sigh.
If you want to create a ListView adapter that searches on the string arbitrarily I’ve created a gist here, by the way. Enjoy.
-
error: Permission denied sending UDP broadcast packets
Sorry, gentle reader, this one’s a bit technical.
I was reusing some of the code Apple supply for sending UDP packets between servers, but the system I’m working with listens for broadcast packets. I set it up to use the address 255.255.255.255, but got the EACCESS error: Permission denied
I found an example that did work (without using Apple’s CFSocket class) and did a line by line what’s different. You need this to do broadcast
int broadcastEnable=1;
int ret=setsockopt(sd, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
if (ret) {NSLog(@”Error: Could not open set socket to broadcast mode”);close(sd);return;}If you edit this into Apple’s UDP echo project then it will allow broadcast. Give thanks and praise at http://splinter.com.au/sending-a-udp-broadcast-packet-in-c-objective -
LoadError: OpenSSL::SSL requires the jruby-openssl gem
I had to hack the bundler executable to load the jruby-openssl gem before it tried to load bundler. Then it worked.
I think the gem command uses openssl, which is built into the MRI version of Ruby, but has to be included as a gem by JRuby and therefore it happens too late.
-
Laments to the 10 years of Agile →
(Click the link above to see the original article - this is a comment I left there)
The IT project failure rate is a direct result of people ignoring (or plain removing) contingency, usually for political reasons (the Dilbert “pointy haired boss” kind). So a fail is being unable to deliver to a Waterfall-style objectives set at some remove from delivering the projects that were only possible if absolutely nothing went wrong. It goes straight back to Deming’s point about MBO vs MBP – the O’s still have it! If each iteration is an management-forced aspiration rather than based on what is possible (so the chance of “hitting” the story points is even as high as 90%) then you will soon run into trouble (in this example the chance of still being on target after 5 iterations is only around 50%). Of course, in this all to common scenario, everybody gets demotivated too and productivity starts to bomb anyway.
I agree that many people “do agile” rather than “be agile” – they see it as process rather than mind set, and so throw out all sorts of sea anchors around “doing it right”, as in being obsessed with process, rather than (and this is a point made in the quote) “doing the right thing”. As you’ve said yourself, the process-driven, analytical mind set is a much easier place to be than an open Chaordic one, particularly if you learned you craft in a process driven environment, such as an educational institution and just don’t have the models to do things any other way.
I see it as a crisis of models, of education, of plain old fear, not principles. It does seem to be getting worse, though. I think we might need a new Manifesto – somewhat less narrow than the craftsmanship movement because it needs to include people who aren’t coders but want to “do the right thing”. In fact, coding is the last thing in this, but it’s the first that everyone looks at because it’s easier to see.
It’s a great source of frustration and sadness for me that we have all the tools now, we have Deming’s insights, we have agile methods, we have methods for managing uncertainty, blah blah blah – but people still carry on doing the same old stuff assuming the results will be different next time. I think it was Einstein that said that this is a sign of madness.
-
PGError: ERROR: date out of range for timestamp
Note - this assumes you’ve enabled the pgbackup plugin in Heroku - as it does the full database backup for you for free - I suggest you do it right now!
Oh, the fun I just had with this one. One of my clients’ systems started throwing this message over the last week or so.
I’m lazy so I was using sqlite for my development database and Heroku’s Postgres for live.
So, thinks I, time to switch to using Postgres in my development environment, because it must be the database, mustn’t it?
I’d installed it on my Macbook ages ago but hadn’t actually used it with Rails. So I found a couple of blog posts and changed things around. I had already told Postgres to use passwords for validation.
It took me ages to realise I needed to set a password for the postgres Unix user - this was the password I needed to connect to the database. Then I followed these instructions and got my dev database set up.
So - pull stuff down from heroku and then import it to my dev environment.
Right - everything works perfectly - right!
So where is the error?
I googled for it and found a forum posting suggesting that you could have a date stamp that is outside the range of time stamps and the coercion of date stamps is going boom. Did a lot of messing around in the heroku console to no avail, trying to issue commands like analyze table and count things.
Also, the column is a timestamp anyway, so you can’t store nonsense in it in the first place.
So, I put the app into maintenance mode, took another backup, restored that backup over the existing database, and all was well.
This might be a better solution than trying to rescue the database in any event, because all of the statistics will have been reset too.
I was a little bit hampered by heroku not letting you connect to a shared database because I was trying to issue commands using Active Record - but hey - it’s free. I do wish that heroku console was slightly more informative than server error.
-
Rails for Designers
This is a short post to help designers who aren’t familiar with Rails understand their way around it enough to change things and work with developers. It assumes that you know CSS and HTML and aren’t scared of HTML that has embedded code in it.
-
Neil Gaiman: Another bit from an ancient blog →
One of the drawbacks of the World’s Best Porridge Recipe for those purposes is that it’s slightly chewy, which is part of the charm.
Having experimented with porridge recipes for years now, this one sort of came together in a bunch of “what if I tried…”s that actually worked.
You need two…(via neil-gaiman)