Posted: August 14th, 2009 | Filed under: Immigration | Tags: aspc, Immigration | 2 Comments »
Yesterday was huge. One of the checks our immigration officer needs to perform (the most important and decisive) is the skilled employment check. They need to know if I really was employed as I claim during the period of two years right before the application date. To prove that I was given a choice to provide contracts and agreements, pay slips, bank statements, or any other documentation that conforms my paid full-time employment.
Thanks to Pito and Kate we managed to collect in one (!) day just enough evidence to prove that I had skilled paid employment during the period and finalize the check. Thanks guys!
Today I’m getting my military training certificate back from the translations office, filling the form 80 and sending it all over to my case officer. Right after that, the only thing we need to do is to pass our medical examinations in Kiev. Which is tough actually, since Kate is not in her best shape right now. We are delaying the checks for one and a half weeks to let her recover.
Posted: August 12th, 2009 | Filed under: Immigration | Tags: aspc, au, Immigration, visa | No Comments »
This morning I had great news in my mailbox. They finally assigned an officer to my visa application case. After 18 months of waiting we are on the final straight. The officer requested additional documentation that I have to provide within 28 days. After we send everything over to him, the case will be reviewed once again and the final decision is made.
Our next step is a journey to Kiev to pass medical examinations. According to the regulations, we have to pass them at a certified center that will seal the results and send them to the ASPC all by themselves. Security measures.
Now we have mixed feelings… On one hand, we waited so long that we are glad it’s getting somewhere, on the other, we were very close to settling down over here and almost bought and apartment. That could have been an unpleasant surprise. That’s for sure.
Anyway, all is good!
Posted: August 7th, 2009 | Filed under: Personal | Tags: rss | No Comments »
If you aren’t familiar with the “river of news” concept, it’s quite a simple thing. Imagine that you are subscribed to several feeds. Now some feed readers let you read them all in the mix by choosing the folder they all sit in or in some other way. It’s convenient in a way that you don’t need to switch between individual feeds, but it’s also flawed.
When reading the “river” I never pay attention to what feed a particular article comes from. Why would I, right? Wrong. Over time I start to realize that I skip over many articles either because the titles don’t grab my attention, they don’t have pictures or uninteresting in any other way. Which of the feeds I don’t need any more on my list? There’s no other way to tell than get back into the history of read articles and try to find out. I have more than 30 Cocoa blogs on my list, so what do I need to clean up?
The answer to me is to get familiar with each individual blog content and the author. River of news doesn’t help me with this and makes it even worse. Daily, I can see the unread counter rolling up, but subconsciously I know it’s going to be looking for needles again. Bad attitude, spoiled reading.
Posted: August 6th, 2009 | Filed under: Programming | Tags: edge, rails | No Comments »
Can’t help to share my joy. If you did this (see below) prior to current Rails Edge version when your time zone in environment.rb is set to anything but “UTF-8″, you did it wrong.
class Model < ActiveRecord::Base
named_scope ..., :conditions => { :date_time_field => Time.now }
end
Why? Because the Time.now will be taken in your server local time zone (set in environment.rb) and compared against the UTC saved in the database. To do it right, you needed this:
The same was applicable to finders and other stuff taking dates as arguments. Not very nice. I personally wrote patches to fix this in my projects.
Finally, in the latest Rails Edge it was fixed! No more kludge. Taken from the official post:
What time is it!?
Geoff Buesing provided a useful fix for Time, specifically when used in conjunction with ActiveRecord. Now you can save and search ActiveRecord objects using whichever local time zone you like, regardless of what your default time zone is configured for and everything now will just work. You no longer need to be concerned about converting your user’s local time into your default application time or vice versa.
Posted: August 6th, 2009 | Filed under: Programming | Tags: iPhone, objectivec | No Comments »
What if you followed all official (first, second, third) and unofficial tutorials to the letter, but still can’t make your tests run? Well, it’s what it was for me today. Here are two things I couldn’t find anywhere and had to figure myself:
- If you see only one Unit Test Bundle build error, and it’s says “Failed tests for architecture ‘i386′ (GC OFF)” (slight variations depending on your platform and the state of the GC flag), you don’t have any tests in the bundle. Yes, go check that counter in the Compile Sources task of your test target.
- If you added the application as the dependency to the test bundle, wrote the test that uses one of the classes and see the link error like below, you didn’t add any source files being tested to your test bundle for compilation. I know it’s insane to add them one by one, but it’s how they designed it. To make it a bit easier, right-click on the “Groups & Files” header, choose “Target Membership”, make sure your tests bundle is you current target and start checking missing sources.
".objc_class_name_XYZ", references from:
literal-pointer@__OBJC@__cls_refs@XYZ in XYZTests.o
sumbol(s) not found
collect2: Ld returned 1 exit status
Posted: August 6th, 2009 | Filed under: Programming, iPhone | Tags: iPhone, uinavigationcontroller, uitabbarcontroller | No Comments »
On iPhone, there’s the tab bar control that we, developers, can use to switch between several pages. It appears as a black stripe with icons at the bottom of the screen. Probably, the most famous is the tab bar of the Clock application:

It can show up to 5 icons and if there’s not enough space left, the last one is replaced with the “More …” item. When clicked, it shows the nice view with the list of all available options that didn’t fit into the tab bar. UITabBarController delegates the job to the UINavigationController. Now why I tell all this?
By default, the UINavigationController uses that standard blue top bar, but what if I want it to be Black as in the rest of my app?
First, let’s change the style of the “More …” page top bar. It’s all pretty straight forward as you can see. Just get the navigation controller and set the style of its bar:
tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack;
Finally, let’s change the style of the bar on the “More …” / Edit page (that says “Configure” by the way). It appears that you can’t drill down into the object model like above, but have to catch the moment when the editor is about to come out and do the magic. For this to happen, you needthe tab bar delegate (UITabBarControllerDelegate protocol) and use the tabBarController:willBeginCustomizingViewControllers: callback to nail it:
tabBarController.delegate = self;
and later:
- (void)tabBarController:(UITabBarController *)tabBarController
willBeginCustomizingViewControllers:(NSArray *)viewControllers {
UIView *views = [tabBarController.view.subviews objectAtIndex:1];
UINavigationBar *navBar = [[views subviews] objectAtIndex:0];
navBar.barStyle = UIBarStyleBlack;
}
In the above 3-liner, you can see that we do the trick to actually find the navigation bar. It works nicely on iPhone 3.0, but may change in the future, so be careful.
Don’t forget that you can always subclass UITabBarController and hide all this customization logic inside to stay on the clean design side. In my work, I do that and used the tabBarController here to clearly state what model we operate on.
That’s all, folks. Hope it helped someone to save a couple of hours.
Posted: August 2nd, 2009 | Filed under: Programming | Tags: bash, textmate, Tips | No Comments »
There’s a couple of Bash patterns I often use in my scripting that I would love to share. Both of them are immediately useful in your TextMate practice through commands, and that’s what makes the study really fun.
Default Values
Assuming that you want a user to give you the path as the first argument and fall back to something if he didn’t, normally you may have done this:
if [ -z $1 ]
then
MY_PATH=/usr/local
else
MY_PATH=$1
fi
And here’s how you do it geeky Bash-style:
DEFAULT_PATH=/usr/local
MY_PATH=${1:-$DEFAULT_PATH}
Shorter and delivers the message way more transparently, doesn’t it? That minus sign before the $DEFAULT_PATH is critical, so don’t miss it. Which leads us to the next tip.
String Splitting
If you need only some part of the string, you can easily cut it out knowing the start/end indexes or just one of them.
VALUE=abcd
INDEX=2
# Gives 'ab'
LEFT_FROM_INDEX=${VALUE:0:INDEX}
# Gives 'cd'
RIGHT_FROM_INDEX=${VALUE:INDEX}
What about TextMate?
Now that you possess the secret knowledge, you can use it in your TextMate commands. One example scenario mentioned all around is replicating the common pattern where the command operates either on the selection or the current word. Here’s how it would look:
${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
Note the order of the parameters, TM_CURRENT_WORD is the default, not the other way around. If there’s nothing selected, it will come in handy. Now, if you read my previous posts on Ruby / Shell code execution, this should ring a bell. Here’s how the selection-or-line logic would look:
${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
Amazingly simple and ultimately useful!
Posted: August 1st, 2009 | Filed under: Programming | Tags: cgi, ruby | No Comments »
I’m a big fan of Ruby, and still every time I need some simple server-side functionality — you know those go there, take that sort of tasks — I have to revert to good old PHP. It’s obvious that building a full-blown Rails app is an overkill.
This morning I need another tiny little script to parse the HTML page and get some info back in JSON. And all this for a static web-site, so that it can’t be hosted locally. So what do I do? Getting back to roots…
Many web servers let you run CGI scripts, which is nothing else but an ordinary script that is executed by an interpreter of your choice and the results are thrown back as the response. Of course, it’s a bit more complicated that that, but the gist is accurate, and what’s more important is it’s hilariously easy to write.
If you happen to have a site with CGI enabled, you can try it right away. If not, well, check the hosting docs, or your web server configuration to see if there’s anything you can do. Most often, you will find the cgi-bin directory where all magic happens sitting next to public_html or www in your web site location root. Don’t forget that everything you put into cgi-bin has to be executable by the web server. It means that either you need to give it the correct ownership and the owner execution permissions or simply let everyone run it (which is dangerous sometimes, but good enough for a couple of tests).
So, here’s what you can try throwing into /cgi-bin/ruby.cgi:
#!/usr/bin/ruby
puts 'Content-type: text/plain'
puts
puts 'Test Complete'
Now when you run it by entering http://your_site/cgi-bin/ruby.cgi in the address line, you will get the nice and shiny “Test Complete” string.
Note that content type declaration and the empty line after it. Two things are important about these:
- Both lines are mandatory
- You can set any content type you like, not just output things in plain text. It can be JSON, XML, HTML or GIF, PNG, PDF — anything you can think of.
Now why don’t you throw a couple of gems into the mix and build something cool, fast and breathing!
Posted: August 1st, 2009 | Filed under: Programming | Tags: ruby, textmate | 4 Comments »
In one of my previous posts I mentioned how nice it is to execute Ruby code and get the results in comments. This is quite useful when you build documentation or quickly test some ideas.
There’s one other method of doing this which is based on the Textmate’s ability to execute the code line at cursor or the selected piece of text. It’s as easy as it sounds.
- First, enter the piece of Ruby code to execute, having in mind that the result of the last line will be output below:
- Now select all three lines and press ⌃⇧E (Execute line as Ruby). The result will appear on the next line
One neat trick is that you can use printf(…) function to format your output and, in this case, the result of the last line won’t be displayed, but the printed output will.
I find it useful when there’s something to try right inside the document or there’s some formula to solve. It lets me stay where I am and not to open a separate document just for the Ruby snippet.
As a little bonus, I just want to mention that you can run unix commands in the same fashion and get the output right in your document. For example:
- Enter the following line and leave the cursor at the end of it:
- Press ⌃R (Text / Execute Line Inserting Result) to execute it. The result will be placed below.
The list of all nginx processes will be dumped. Sweet, ha.
Posted: July 29th, 2009 | Filed under: Programming | Tags: config, ssh | No Comments »
Many people around me don’t know about the magical ~/.ssh/config file. If you are among of them, just read on and pretend you knew it all the way.
Here’s a simple, yet useful sample that shows just the two most essential features that you can start using today:
Host someplace.com
Port 22222
Host 174.10.20.30
IdentityFile ~/.ssh/id_rsa.office
What do we see here?
- ~/.ssh/config is a plain-text file. Note that it’s file permissions should be “600″ (read/write by owner only), and ~/.ssh directory permissions must be “700″. It is important. If they are too permissive, SSH won’t trust your configuration.
- The file consists of sections that start with the “Host” declaration. Each section corresponds to one host specified either by name or IP address.
- Statements in the sections are indented (traditionally with 3 spaces).
- “Port” statement suggests the port number to use when connecting to the given Host.
- “IdentityFile” statement lets you use a non-default (id_rsa) private key. I see you burst into tears. Yes, you can have many keys for different occasions — personal and team; any number of them.
These are just few options that I find the most useful in my everyday practice, but feel free to explore it deeper.
One important thing I need to mention is that this configuration applies to absolutely all cases when you open the SSH connection by standard means, not just when SSH’ing somewhere directly. You can do SCP to transfer files, access remote repositories with SVN and GIT, deploy your developments with Capistrano and much more.
Have fun!