By x3ro on December 19, 2011
Recently I noticed that it was taking ages for iTunes to start playback of any audio file (up to 3 seconds). I found a solution for my problem in the Apple Support Communities: One just has to disable the “Multiple Speakers” feature of iTunes when not streaming to any AirPort speakers, because iTunes seems to try to connect to them every time you start playback.
If you have “Multiple Speakers” enabled, you should see an icon in the lower right corner of the window saying so. This is where you can disable it, too.
Posted in Applications, Mac OS X, Misc | Tagged delay, itunes, multiple speakers, playback |
By x3ro on May 23, 2011
Hey there folks.
This blog has gone from being a mere reference for myself to at least having a small number of visits every day :) But from now on I will be putting my work into a new blog project, Coding Journal, which will cover every coding-related topic we, that is my friends Marian, Peter and I, come in contact with.
I’ll migrate some of the content from this blog to CJ as soon as I figure out how to do it without breaking all the links.
Visit us at Coding Journal :)
Posted in Misc |
By x3ro on May 19, 2011
When working with Cygwin inside VMware, I had the weird problem of not being able to download stuff using wget or cloning repositories with git because I got the following or similar error messages:
Resolving google.de (google.de)... failed: Non-recoverable failure in name resolution.
wget: unable to resolve host address `google.de'
I really don’t know what causes this problem (and if anyone knows, please feel free to leave a comment), but it turns out that it does not occur when you switch your networking mode for NAT to Bridged. At least that worked from me :)
Posted in Linux, Mac OS X | Tagged cygwin, dns, nat, vmware |
By x3ro on May 19, 2011
Currently I am writing a build script for a UNIX application which needs to be built for Windows using the Cygwin environment. I quickly got tired of working inside the default Cygwin window (which doesn’t even have proper copy & paste), so I installed a SSH server to work on the Cygwin environment remotely:
First of all, you need to install the SSH package using the Cygwin installer. If you already installed Cygwin don’t worry, just re-run the installer and you’ll be fine. When you reach the “Select Packages” section, just enter ssh into the search field, open the “Net” section and select the “openssh” package.
Now make sure that your Cygwin shell is started in administrative mode, by right-clicking the Cygwin icon and selecting Run as administrator.
In your shell, run ssh-host-config -y which will create the necessary configuration files for your SSH server.
Set a password for your account (which you will connect to via SSH) by running passwd. If you are unsure which is your username, just run whoami.
Now you can start your server by running cygrunsrv --start sshd
You will need to disable your Windows Firewall, either completely, or for TCP connections to port 22.
Posted in Misc | Tagged cygwin, server, ssh, windows 7 |
By x3ro on May 18, 2011
By default, Rails 3 interprets a dot in a URL as a format specifier. For example, given the route
match "/foo/:search"
and the URL /foo/bar.baz, this would result in the following parameters being passed:
{ :search => "bar", :format => "baz" }
This may not be what you desire, so here is a quick workaround, using segment constraints:
match "/foo/:search", :constraints => { :search => /[^\/]*/ }
The constraint for the :search parameter now matches anything but a slash, which includes the dot, and Rails will no longer interpret it as a format.
Thanks to this guy, who led me in the right direction.
Posted in Web | Tagged rails 3, routes, ruby |
By x3ro on May 2, 2011
Apparently the Chrome development team is becoming as ignorant as the Internet Explorer development team has been for some time now. Seems to run in the family of browser developers or something, I don’t know.
Anyway, as of Chrome v10, they’ve removed the “Right-click -> Open frame in new tab feature”, which I constantly used when developing. Half a dozen bug reports, with the main bug starred 37 times, have been ignored with a “WontFix” and the closing comment from a Chromium developer was just
The bug tracker is not a feedback forum.
What do we learn? I totally agree with this comment, also posted in the bug report:
Once again (as with the “open file” and “http in the address bar issue”), Google makes the mistake with the “we know what you need” attitude. Chrome’s popularity is only as a result of its increased performance and usability. As the latter decreases and the former is mimicked by other browsers, Chrome will quickly go the way of Wave and Buzz.
Microsoft was able to more or less “push the customer around” during IE’s heyday, but only because IE significantly dominated the browser market. In todays open market (where Chrome only occupies a small percentage), disgruntled users will be quick to turn to alternatives, especially as virtually all Chrome users are by definition not afraid to try something new.
Nice try, Google, but maybe one day you’ll learn not to piss off your consumer base. As for me, I’m going to try the latest version of Firefox.
Off to Firefox and Safari I go. Thanks Chrome/Chromium developers.
PS: Just not to confuse anyone. There is an extension to bring the feature back, but my reason to switch to another browser is the ignorance of the developers, for dropping a feature, and not adding it again after lots and lots of complains from the users.
Posted in Applications, Misc | Tagged Chrome, Chromium, Google |
By x3ro on April 28, 2011
You can easily edit your GitHub hosted wikis by cloning them to your local machines ( yes, the GitHub Wikis are also backed by Git ) and using your favorite text editor. Alternatively, GitHub open-sourced their Wiki software named Gollum which you can install as a Ruby Gem:
$ gem install gollum
This however will not install some required Gems for editing, because those seem to be considered development dependencies. To install those dependencies, first install the “bundle” Gem:
$ gem install bundler
Then check where your “Gollum”-Gem lies and install the development dependencies using the “bundler”-Gem:
$ gem which gollum
/Users/lucas/.rvm/gems/ruby-1.9.2-p180/gems/gollum-1.3.0/lib/gollum.rb
$ bundle install /Users/lucas/.rvm/gems/ruby-1.9.2-p180/gems/gollum-1.3.0/
...
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
As you can see I stripped the last part of the path given by gem which, to the Gem’s root directory.
This should leave you with a working installation of Gollum which supports all the features the GitHub.com Wiki supports. Now navigate to your cloned wiki directory and run:
$ gollum
Posted in Git, Linux, Mac OS X | Tagged Gems, GitHub, Gollum, ruby, Wiki |
By x3ro on April 18, 2011
Finally found an easy solution to automatically remove trailing whitespaces when saving a file in Textmate.
Addition: This approach seems to have its downsides though. Every time you save, Textmate will re-render the syntax highlighting of the entire file, and center the viewport on the cursor, which can be annoying sometimes. Guess I really have to switch to Vim or MacVim if TextMate 2 isn’t released real soon :(
Posted in Misc | Tagged textmate, trailing, whitespaces |
By x3ro on April 17, 2011
If you are already using PHP 5.3.x and you’ve just upgraded to Typo 4.3 or greater, Typo3 might start throwing exceptions where previously everything had worked out just fine.
This is because the Typo3 developers chose to take some of the error handling into their own hands and raise exceptions for certain errors. Now these “certain errors” for which exceptions are raised include E_DEPRECATED, and as a bunch of functions have been deprecated in PHP 5.3, well, you know where I’m going with this.
Fortunately, there is a configuration variable which allows to change the default behavior:
$TYPO3_CONF_VARS['SYS']['exceptionalErrors']
The default value (defined in “t3lib/config_default.php”) is
E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING
To disable the deprecation exceptions, just add a ^ E_DEPRECATED like this (the line goes in your localconf.php file):
$TYPO3_CONF_VARS['SYS']['exceptionalErrors'] = E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING ^ E_DEPRECATED;
Thanks to this guy (link in German) for sending me onto the right path.
Posted in PHP, Typo3 |
By x3ro on April 13, 2011
If you google for “Array to Hash” then you will probably see this snippet close to the top of your search results, and it works pretty well too. However, since that snippet was posted, 6 years have passed, and with Ruby 1.9 it is a bit simpler now:
Ruby < 1.9:
a = [1, 2, 3].collect { |v| [v, v*2] } # => [ [1, 2], [2, 4], [3, 6] ]
Hash[*a.flatten] # => {1=>2, 2=>4, 3=>6}
Ruby 1.9:
a = [1, 2, 3].collect { |v| [v, v*2] } # => [ [1, 2], [2, 4], [3, 6] ]
Hash[a] # => {1=>2, 2=>4, 3=>6}
This is because Ruby 1.9 features a new form for Hash[ ]:
Hash[ [ [key, value], ... ] ] → new_hash
More info in the docs.
No wonder Ruby is still my favorite language :)
Posted in Programming | Tagged array, hash, ruby |