// Richard Hart / Hates_

Archive
computing

Hackintosh phantom wake from sleep

computing, mac

For some reason since updating Mountain Lion on my hackintosh my computer would mysteriously wake up in the middle of the night. As sleeping and waking had never been 100% I figured that it was just down to a quirk of having a hackintosh. But I did some digging and after some searching and log investigation I found the following entries:


[~]$ syslog | grep -i "Wake"
May 19 00:55:57 <Notice>: Next maintenance wake [Backup Interval]: <date: 0x7fe4899038b0> Sun May 19 01:38:25 2013 BST (approx)
May 19 00:55:57 <Notice>: Requesting maintenance wake [Backup Interval]: <date: 0x7fe4899038b0> Sun May 19 01:38:25 2013 BST (approx)
May 19 00:56:03 <Debug>: Wake reason: ?
May 19 00:56:03 <Debug>: The USB device 4-Port USB 3.0 Hub (Port 3 of Hub at 0x14800000) may have caused a wake by issuing a remote wakeup (3)

Which lead me to believe it was a config issue, and a quick look through the preferences un-earthed the following:

Energy Preferences

Disabling “Wake for ethernet internet access” has solved my problems and there haven’t been any phantom wake from sleeps since.

Read More

It’s my data

computing, spree

Recently I’ve been working on migrating an existing e-commerce site from InstanteStore to Spree and have been having a nightmare of a time trying to get the client’s data out so that I can start the job of importing it all. The trouble is a lot of the information is not exportable, and whatever data is available is only half of what you would expect. It’s starting to make me angry because as far as I’m concerned that data belongs to my client, and to add insult to injury, to get access to certain parts of the data they want to charge extra money to “build an interface” to it.

I can understand on free to use sites like Facebook/Instagram/Tumblr/Whatever-Startup that the price of usage might be my data and that I might not be able to take it and go elsewhere with it, but when you’re paying for a service I expect to have full ownership and access to my information.

Read More

Adding a custom Spree payment Gateway outside a Rails Engine

computing, programming, rails, spree

Adding a new Payment Gateway to Spree through a Rails Engine is pretty straight forward as you can hook in your new gateway after the initial payment gateway array has been created. This is how the spree_gateway gem does it:


initializer "spree.gateway.payment_methods", :after => "spree.register.payment_methods" do |app|
    app.config.spree.payment_methods << Spree::Gateway::AnotherGateway
end

If you want to do the same thing for your own project contained gateway it’s a little different. If you try to just directly edit the payment_methods array in an initializer it will get wiped out when the Spree core engine sets the initial bogus and simple methods. I got around the problem by hooking my gateway in using the after_initialize method. Here I’m hooking in after SpreeGateway:


Spree::Gateway::Engine.config.after_initialize do
  Your::Application.config.spree.payment_methods << Spree::Gateway::YourGateway
end
Read More

Vim – Join lines that end with a ^M (DOS carriage return)

computing, programming

Editing a CSV file which split whenever there was a DOS carriage return (^M). Joining up the lines was as simple as using the command below. To get the ^M char you use CTRL+V CTRL+M (don’t let go of CTRL in-between).


  :g/^M$/normal J
Read More

Small teams and interruptions

computing, work

It’s hard for non-programmers to understand just how bad interruptions are when it comes to being a productive coder. While most jobs suffer from the same problems of “getting back into the flow” after being interrupted, programming is especially difficult as normally programmers are trying to hold a number of structures in their head at any one time so as to solve whatever problem it is that they are working on.

In most small companies, the development team is might only consist of three or four people and in such a small team with a large backlog to deliver, it’s not normally the teams size that is the main factor in being able to deliver large amounts of work, but all the small interruptions that happen during daily business. Asking a developer that is sitting close by about when a feature will be ready or whether something can be fixed/changed is all too tempting and easy to do. Why IM or email when you can just shout across the room. It only takes a few 10-20 second interruptions to change a productive three to fours hours into just maybe one or two.

Once a company grows these sorts of problems can be smoothed out by having someone act as a barrier to the developers, shielding them from minor questions/requests and letting them continue with their work until free to discuss them. Small companies don’t have the luxury of assigning someone that role so need to find other means to minimising that contact. It’s important that someone sets some ground rules. It could be as simple as there is a set period of time every day that programmers should not be disturbed or communication should be limited to IM and email if possible. Just removing the constant stream of “Is X ready yet?”, “Did you get a chance to look at Y?” or “Would it be possible to do Z?” would mean a huge productivity boost for your programmers and overall deliverables for your company.

Read More