CentOS Yum
Good idea to either use ProtectBase or YumPriorities
Then you can add some additional repos. The EPEL one is particularly attractive (bunch of packages designed to work with the enterprise linux distros like RHEL and CentOS.
The maintainer of Yum is quite against the whole “protection” idea. But really if you mix official enterprise distros with more experimental ones on a production server, I think it’s a good idea.
Gosh, I hope people do not set up yum priorities. There are so many things about priorities that make me cringe all over. It could just be that it reminds me of apt ‘pinning’ and that makes me want to hurl.
Basically you are trading off ease of installation of the experimental packages (as restrictions can cause odd dependancy failures) for better stability of your core OS. That’s a trade I’m willing to make.
Cool way to change permissions just on directories:
folders
find . -type d -exec chmod 0700 {} \;
files
find . -type f -exec chmod 0600 {} \;
Downloading the iOS (iPhone) SDK on Bad Connections
The iPhone SDK is now a whopping 3.5GB. As a developer you will be downloading these multiple times per year, especially if you want betas. It would be nice if Apple was so kind as to provide patches, or torrents (hell this option would be more reliable *and* save them bandwidth).
Anyone on a sub-4M or flaky connection will know the pain of trying to download this again and again, only to have it be corrupted and refuse to load, or stop half-way.
I have tried Safari, Firefox, Chrome, always clicked the download link (to restore the cookie) before resuming my downloads, but was still plagued by this issue.
Enter wget. A program who’s sole existence is to download stuff. Not only does it work really well, it also can resume iPhone SDK downloads! I even voluntarily stopped my last one, with no issues.
But before you can use wget, you must first click the download link from your browser (you can cancel immediately) and export your cookies to save the auth code. It’s very easy – just use Firefox and the Cookie Exporter plugin to save your cookies.txt file to the same directly you will be doing your download from.
Then, the line you need is this:
wget --server-response --continue --no-check-certificate --load-cookies=cookies.txt https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg
That line does everything. It will continue the download if you have a partially downloaded file, it will load your ADC auth code from the cookie, and will ignore the self-signed certificate issue.
But you will need to update the link to whatever version you are trying to get. Just right-click copy from the ADC. wget will follow the redirect fine.
I will be downloading all my iOS SDK’s this way from now on…
When you thought the DB was UTF-8 but it wasn’t
This post is NOT about converting a DB from latin1 to UTF-8 (as many people had to do when upgrading their blogs, etc to support UTF-8).
This is about fixing a database where everything was setup intending to use UTF-8 (so your charset, and collation was set to the appropriate UTF-8 values), but you wrote a bunch of UTF-8 data using a latin1 charset connection into your database, so your database basically has latin1-encoded utf-8 data (when it should have just plain old utf-8 data). This can be a bit confusing – so just imagine the data was base64 encoded. It’s still the utf-8 data you put there, but you have to decode it first (in this case, not a base64 decode, but by using a latin1-charset MySQL connection).
Evidence of the above problem is easy to check: if your PHP application is rendering the data correctly, but phpMyAdmin is not (and other tools like MySQL Workbench), then chances are you have this problem.
Because PHP understands UTF-8, and is reading and writing the UTF-8 bytes correctly – but over a default latin1 connection – what happens is that the data being read and written is actually correct. But MySQL is storing it strangely inbetween. It’s almost like PHP is decrypting the data, storing it in MySQL and decrypting it back again.
This is a bad setup. You’ve told MySQL to expect utf-8 data, but then you’ve fed it latin1 data (that is actually utf-8 bytes). Very confusing.
This hack however actually works if everyone talks to MySQL on a latin1 connection. E.g. if you hack phpMyAdmin to use a latin1 connection, your data will now render correctly. But this is bad. So fix it – and here’s how:
Your app was meant to call mysql_set_charset(‘utf8′); but because it didn’t, latin1 was used. One way to fix your data, is to apply this same bug to phpMyAdmin itself.
In the mysqli.dbi.lib.php and mysql.dbi.lib.php (two files), in the PMA_DBI_connect function, add the code (thanks to Mike Zhang for the code):
mysql_query("SET SESSION CHARACTER_SET_RESULTS =latin1;",$link);
mysql_query("SET SESSION CHARACTER_SET_CLIENT =latin1;",$link);
before the ‘return $link’ statement.
What you now have is a version of phpMyAdmin with the same bug as your PHP code. If you do a search on your data, it should now display correctly!
But rather than trying to insert this bug into every mysql app and tool you use – it’s best to correct your MySQL data, and then fix your application.
How to fix your old borked data:
- apply the latin1 hack (above) to phpMyAdmin (set the connection to latin1, emulating the PHP app)
- view some unicode data to test (it should render correctly now in phpMyAdmin, whereas before it was not)
- export your entire DB
This will export the data, using the twisted latin1 interpretation (like our buggy web client was) which is actually what we want.
- Remove the latin1 hack in phpMyAdmin.
- View the export in a good text editor like jEdit (make sure the charset is UTF-8), this time the dump should render correctly.
- Import the hack-exported DB like so:
mysql --default-character-set=utf8 -u root database_name < dump.sql
(specify -p if you need to enter a password)
- Now if you look in phpMyAdmin without the latin1 hack, your UTF-8 should now render correctly
- Now that your data is correct, it’s important to update your application. In PHP, call
mysql_set_charset('utf8');after you establish your DB connection (make sure every app that talks to this database sets the charset to utf8).
- Done. Reward yourself with hot coffe or ice cold beer, depending on time of day ~_-
Some mostly unrelated links (as it turns out)
Convert_latin1_to_UTF-8_in_MySQL
mysql ruby1.9 hack (I’m not on Ruby 1.9 yet and did not use this)
RoR unicode hacks (In RoR 3.0 I don’t think this is needed as I have unicode support without it)
Ruby on Rails in Dreamweaver
RubyWeaver an open source extension to Dreamweaver so it understands ERB and RHTML files. Neat.
Facebook’s Super Logoff
Interesting article on using facebook’s ‘Deactivate’ feature whenever you are not online, as a kind of “super logoff”.
I knew someone in Peru who pretty much did this – not as religiously, but certainly quite frequently.
An idea unimplemented is worthless
As I develop my own ideas, and as the recipient of the occasional unsolicited business proposal, I am increasingly convinced that an idea unimplemented, is worthless.
The problem is that ideas are cheap. Anyone can have think up an idea, even dozens in a day. Implementing them however takes dedication and persistence. And money, to hire people whose skills you need beyond your own.
My skills are in programming, and I seem to get a lot of ideas from people who want to build things. They frequently think that once it’s built, it will magically make money, and that I (as the programmer) should be happy to work on a deferred or profits-only basis.
Which brings me back to the point – the idea is worthless. If you think it has potential, then you will need to put your money where your idea is, and build it. Then it is worth something.
If your only contribution to a product was the idea, I would probably value the contribution at 1%. Not 5% or even the 50% that I have been proposed in the past. Now if the creator of the idea contributes funds or effort (and I don’t mean just standing there dictating features), that’s a different story.
Like the Mark character on The Social Network said to the Winklevoss twins’ lawyer: “If they had invented Facebook, well they would have invented Facebook!”. Sure they had a good idea, but they were more focused on their rowing and grades (nothing wrong with that) and didn’t implement it quickly, or as well. In short – who really cares if the ideas were similar? Because the idea itself has little value.
One only needs to look at the dollar valuations to back this assertion up. Facebook, (the implementation) is today worth $25bn, the Winklevoss’ (allegedly: the idea) got $100mil in a settlement. In percentage terms: almost nothing.
In short, if you have a great idea. Then pay up and get it made. Then the world will decide if it’s actually good. But don’t expect people to fall over themselves trying to be part of your idea or expect people to work for free.
I was discussing this theory that ideas are worthless with Rhys on Monday. He linked me to a post on Scott Adams’s blog from this month talking about this very issue. I like Scott’s thoughts, and his summary is probably catchier than mine: “Ideas are worthless. Execution is everything.” :)
So keep dreaming up cool ideas, and if you feel confident, raise the money and make it.
Frame Your Arts
A plug for a mate’s business: If you need to get any art printing / framing done in Brisbane, Australia – then you should check out Frame My Arts. Ian’s printed up a few things for me over the years and I’ve always been impressed :)
Transferring SIM contacts in Android
If you need to transfer contacts in Android, I recommend the free ’Contact2Sim’.
Android’s interesting, it lacks some features that on the iPhone are built in (the iPhone can natively transfer contacts from the SIM card), but unlike Apple, it exposes deep API hooks so someone can write an app to fill the hole. In contrast, Apple only exposes a subset of the device’s capabilities, and often makes you wait before you can access new features (for example, the movie recording and Map widget API’s took a while).
This can be annoying on Android (while you wait for someone to make the app and fill the hole), but then it gives you a few options to choose from, and in the case of this feature, the app lets you transfer contacts *back* to the SIM card which is pretty sweet. I don’t think the iPhone can do that.
Two different approaches, both equally valid I guess.
An aside:
I was talking with my mate Rhys yesterday over some Halo: Reach. He was discussing Windows7 phones and made the interesting observation, that with Windows7 you don’t just decide which OS you want, but you then have to decide between all the different offerings (Android is the same). Contrast that to iPhone and you have to choose between 16GB or 32GB (and maybe, the previous version). Certainly does make the choice easier. Again, there are pro’s and cons…
The Windows Mobile 7 ‘Really?’ ad came up in conversation. Personally I think it’s a cool ad, and I do get their point, but at the same time I can’t help but think they are saying I should use my mobile less. When actually I enjoy using it.
Updated Theme
Today I have updated the theme of OmegaDelta.net.
Almost 9 years after omegadelta.net was registered, for the first time it features a design created by someone else.
I think the design is pretty darn spiffy. The photo is one I took in Tibet, in September.
Why the change? Several reasons. My old page had a bunch of custom javascript link menu’s and I can’t be bothered keeping my javascript or even the links current. The old design had a few bugs that probably needed attention, and again, I’m just too busy to work on it. Not to mention the old design could have probably done with a facelift. The second is I really like the clean style of the new design.
I have however kept the quote of the day footer code. Have not added any new quotes for a while, so if you have any suggestions please leave them as comments.
Facebook’s Application tabs going away
Update: I went to take a screenshot of my tab for this post, and it seems in the last hour the feature has been deprecated. :(
Last year, Facebook removed profile “boxes”. Replacing them were “Application Tabs” – the new way to customise your profile.
Personally I didn’t mind this change, the application tabs are much cleaner. It was a pity that the profile small sidebar boxes were removed, because this was a nice way to customise your profile seen by every visitor (I had a travel map there).
But now, Application Tabs too are going the way of the dodo.
Once this change has been applied, it will no longer be possible to customise your static Facebook profile, other than your list of “Likes”.
No more travel maps. No more lists of XBox achievements, or flair or whatever. Now I understand Facebook likes to keep it clean – but I think it’s nice to be able to customize your static profile one way or another.
This is also quite bad news for Application Developers like myself who have spent time creating rich tabs that users can display (in my case, a travel map).
Facebook claims that the feature was under-used. This may be true, but it still seems odd to remove the last remaining way to customise your static profile.
