<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title><![CDATA[./victor.sh]]></title>
  <link href="http://victor.sh/atom.xml" rel="self"/>
  <link href="http://victor.sh/"/>
  <updated>2012-05-19T04:01:28+02:00</updated>
  <id>http://victor.sh/</id>
  <author>
    <name><![CDATA[Victor Jalencas]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
    <entry>
      




<title type="html"><![CDATA[First impressions of RubyMotion]]></title>
<link href="http://victor.sh/blog/2012/05/16/first-impressions-of-rubymotion/"/>
<updated>2012-05-16T17:50:00+02:00</updated>
<id>http://victor.sh/blog/2012/05/16/first-impressions-of-rubymotion</id>

      <content type="html"><![CDATA[<p>A few days ago, former Apple engineer <a href="http://chopine.be/">Laurent Sansonetti</a> released <a href="http://www.rubymotion.com/">RubyMotion</a> to the world. RubyMotion is a <a href="http://www.macruby.org/">MacRuby</a> implementation and toolchain for iOS, with a few key differences that allow for apps developed with it, first, to work; and second, to be allowed on the App Store.</p>

<p>The technical differences between RubyMotion for iOS and MacRuby for the desktop lie principally in the memory management (while MacRuby uses <a href="http://www.memorymanagement.org/glossary/g.html#garbage.collection">Garbage Collection</a>, RubyMotion uses something similar to <a href="http://clang.llvm.org/docs/AutomaticReferenceCounting.html">ARC</a>) and the compilation model (MacRuby is interpreted, though it can be compiled, while RubyMotion is all statically compiled, that is, it generates a monolithic binary that can run on iOS). Apart from that, the syntactical rules are mostly the same, so any knowledge you have about MacRuby will certainly be useful when is time to work with RubyMotion.</p>

<p>I purchased RubyMotion a couple of days after its release, when I had had opportunity to read about it and considered that it might be useful to me. I haven’t had the opportunity to play too much with it yet, but I already have formed a preliminary opinion and I’d thought I’d share my thoughts here, and perhaps see how they change after I play with it a bit more. Specially since RubyMotion is evolving very rapidly, so some considerations need to take into account the moment they occurred: for example, when initially released, the interfaces for iOS apps were expected to be coded purely programmatically, there was no support (other than using <code>ibtool</code> for compiling them manually) at all for using Interface Builder to design them. Nowadays, the <code>Rakefile</code> already takes care of compiling them for you.</p>

<p>I have a background in Ruby, even though I haven’t used it professionally as much as Objective-C. I was also eager to learn how to use Cocoa from Ruby, first with <a href="http://rubycocoa.sourceforge.net/">RubyCocoa</a>, and later with MacRuby. Part of my motivation for doing so was partly to avoid the steep learning curve of Objective-C and Cocoa, and partly to be able to use Ruby&#8217;s natural expressiveness and terseness.</p>

<p>Nowadays I know better. No matter whether you develop in Ruby or in Objective-C, the hardest part is getting intimate with the Cocoa frameworks. There’s no way around it. The way the Cocoa framework is architected, you have two ways to work with it: swim upstream, or go with the current. If you go with the current, easy things are easy and hard things are still hard, but doable. If you pretend to go against the current, you’ll have a hard time just to make the simplest of things.</p>

<p>And so, working effectively with either MacRuby or RubyMotion requires knowing the Cocoa frameworks. Now, this means you either leverage your existing knowledge of them with Objective-C, or you learn on the fly how to use them with Ruby. And my opinion is that the later will be harder, since most of the documentation and examples are created for Objective-C, and the syntax changes Ruby has made to accommodate Objective-C’s method signatures makes it difficult even for (or specially for) experienced rubyists.</p>

<p>So, my guess is that RubyMotion will be more useful to accomplished Cocoa practitioners, which may find Ruby syntax and terseness very accommodating, than to expert rubyists which will find themselves a little disoriented, moreover when the gems they are familiar with are not available in RubyMotion, and they have to learn the new Cocoa ways of getting things done.</p>

<p>I am sure a lot of rails developers will flock to this new platform, since no doubt their customers are demanding mobile clients for their existing apps, and they find themselves at ease within the confines of the higher design standards of Apple. But I’m afraid that, finding themselves in unfamiliar territory, they’ll have to fall back to snippets, recipes and library wrappers (training wheels, if you like) created by the minority among them that already do develop for Objective-C, just as it happened when Ruby on Rails exploded in popularity. And some of them won’t find the effort worth doing in learning the Cocoa frameworks, and thus deeming RubyMotion inadequate for their development needs, when it is more than adequate for most kinds of applications.</p>

<p>My advice? If you have a Mac and are already familiar with both Ruby and the Cocoa Touch framework, and are willing to pony up $150, give it a try. If not, try first with MacRuby before paying for a tool that you won’t use.</p>

<p>Personally, I already have an app in mind which could leverage the expresiveness of Ruby code and simplify what could potentially be lengthy and cumbersome (and error-prone) Objetive-C code. But that is the matter of another post.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2012/05/16/first-impressions-of-rubymotion/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[iPhone 4S]]></title>
<link href="http://victor.sh/blog/2011/10/05/iphone-4s/"/>
<updated>2011-10-05T11:08:00+02:00</updated>
<id>http://victor.sh/blog/2011/10/05/iphone-4s</id>

      <content type="html"><![CDATA[<p>Yesterday, Tim Cook, Apple’s new CEO, announced the last device in the iPhone family, the <a href="http://www.apple.com/iphone">iPhone 4S</a>. It features a new dual core processor, a new GPU, a new camera, and a new antenna design. It will debut with iOS 5, which will be available for existing hardware starting October 12. And it will have an exclusive assistant app, <a href="http://www.apple.com/iphone/features/siri.html">Siri</a>, featuring voice recognition, that is supposedly capable of understanding natural speech and carry on instructions.</p>

<p>The naysayers have been talking about disappointment. But, tell me about other phones that can do this:</p>

<p><video width='848' height='480' preload='none' controls poster=' http://www.apple.com/iphone/features/images/siri_video.jpg'><source src='http://victor.sh/video/apple-iphone4s-tour-siri-us-20111004_848x480.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'/></video>
<small>Copyright © 2011 Apple Inc. All rights reserved. I just transcoded it to make it play in more browsers.</small></p>

<p>Of course, we’ll have to see if the voice recognition is as good as portrayed. And, non being a native English speaker, I’ll sure have problems using it (or, wait until Spanish is supported). But it is a technical feat nonetheless.</p>

<p>Siri <a href="http://techcrunch.com/2011/10/04/the-original-siri-app-gets-pulled-from-the-app-store-servers-killed/">used to be a normal app available in the App Store</a>, which worked on all iPhone devices, not just the 4S. But it relied on external servers to do the processing of the natural language, as opposed to the new Siri feature, which while using Apple’s massive datacenter in North Carolina, needs a lot of RAM on the device itself to work. Apple bought the company and made the technology a feature of the operating system itself.</p>

<p>While I’m very happy with my iPhone 4, I’ll probably upgrade to the 4S, as my wife’s 3G is showing its age, and that way she’ll inherit my current one. And then she’ll be able to enjoy the features of iOS 4 (and 5) on adequate hardware. Also, being a professional iOS developer, it just makes sense to get test hardware, doesn’t it?</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2011/10/05/iphone-4s/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Spotify: You can have my money or Facebook’s. But not both]]></title>
<link href="http://victor.sh/blog/2011/09/27/spotify-you-can-have-my-money-or-facebooks-but-not-both/"/>
<updated>2011-09-27T10:31:00+02:00</updated>
<id>http://victor.sh/blog/2011/09/27/spotify-you-can-have-my-money-or-facebooks-but-not-both</id>

      <content type="html"><![CDATA[<p>There’s a turmoil on the internet regarding Facebook’s lubed (frictionless) sharing and how it means that Facebook will go all Big Brother on you and be aware of each and every movement you make online. And no service exemplifies it better than Spotify, which recently started requiring that you connect your Spotify account with your Facebook one. So, everything that you listen to, everything that you search for (possibly), and every user library that you browse, will be sent to Facebook for later analysis and correlation.</p>

<p>I was already concerned about the attitude of Facebook regarding privacy. But this is taking it too far. This is downright intrusive. And Spotify’s actions are a big bet on their part. I was the one who always played devil’s advocate, advising people to get a paid membership in order to ensure Spotify’s viability in the future. So, it doesn’t surprise me that much that they’re now in bed with Facebook. They need to keep the money flowing from somewhere, and if conversion rates are not that great, well, they’re more or less justified on having done that. Spotify’s free and open users shouldn’t be complaining now, as they’re not paying users, so they get what they pay for.</p>

<p>But, as a premium user, this is really annoying. If Spotify had a bit of sense, (and Facebook policies had allowed for that, I’m sure they do not), they would not have this requirement in place for paid users. That could even improve their conversion rates. But they did not, and now the common sentiment among paid users is that of being betrayed. And that’s never a good feeling to foster in your client base: their support forums are raging with righteous users announcing the cancellation of their subscriptions. When I went to open the Spotify client yesterday, I encountered a popup that could not be dismissed, and that required me to connect to Facebook in order to use Spotify. Fortunately, the Spotify application uses the same permission system as the other apps in Facebook, so I could log in and deny permission to the Spotify app (which had it previously, so now they’re the worse for that). But I suspect frictionless sharing is still enabled, even if the explicit sharing is not.</p>

<p>As it is right now, I am considering accelerating the cancellation of my Facebook account –I barely use it nowadays, but would hate to lose contact with some school friends and relatives, after all it took to bring it back–. If that would mean the disruption of my Spotify service, so be it. That’s 10€ more I will have for iTunes, DVDs or books each month. I want to be the customer, not the product, and will gladly pay for that. But if you want me to pay for the privilege of being the product, you’re dead wrong.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2011/09/27/spotify-you-can-have-my-money-or-facebooks-but-not-both/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[New VMWare Fusion 4]]></title>
<link href="http://victor.sh/blog/2011/09/16/new-vmware-fusion-4/"/>
<updated>2011-09-16T10:15:00+02:00</updated>
<id>http://victor.sh/blog/2011/09/16/new-vmware-fusion-4</id>

      <content type="html"><![CDATA[<p>A couple of days ago VMWare <a href="http://blogs.vmware.com/teamfusion/2011/09/vmware-fusion-4-is-now-available-worldwide.html">released VMWare Fusion 4</a>. What is new: optimized for OS X Lion, enhanced 3d graphics performance, Time Machine-friendly snapshots, an oh yeah! being able to host virtual OS X Lion instances – which was not something they could do something about, rather it was an OS X license limitation.</p>

<p>As opposed to previous releases, there’s no competitive upgrade from previous versions or from Parallels. The price for everyone is going to be $50 (for a limited time, then it’ll go up)</p>

<p>I have used both Fusion and Parallels and, from my POV, Parallels slows down more the performance of the rest of the Mac. If you’re only going to be on the virtual machine it‘s not so important but, if you try for example to develop a web app on the Mac and test it on a virtualized Windows, the development task will be easier if you’re hosting the VM with Fusion rather than on Parallels.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2011/09/16/new-vmware-fusion-4/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Reboot]]></title>
<link href="http://victor.sh/blog/2011/09/15/reboot/"/>
<updated>2011-09-15T07:06:00+02:00</updated>
<id>http://victor.sh/blog/2011/09/15/reboot</id>

      <content type="html"><![CDATA[<p>This blog is being rebooted today. To begin with, after mulling over it for several days, I’ve migrated the setup to an static <a href="http://octopress.org/">Octopress</a> site. Mephisto, while nice, was going nowhere for lack of maintenance. And after discovering that one can easily migrate from Mephisto to a Jekyll-based system like Octopress, it was a done deal.</p>

<p>Octopress also has niceties for hackers, like powerful code embedding options. It’s still a bit difficult to blog from a smartphone, but that is just a matter of time, in my opinion.</p>

<p>So, over the following days, the archives will be markdown-ified and the comments will be enabled. But let’s mark today –a day almost, but not quite, entirely unlike any other in the year- as the day of the reboot.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2011/09/15/reboot/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[A fresh start]]></title>
<link href="http://victor.sh/blog/2010/08/06/a-fresh-start/"/>
<updated>2010-08-06T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2010/08/06/a-fresh-start</id>

      <content type="html"><![CDATA[<p>Effective immediately, this blog is changing name and domain. From now on, the blog formerly known as Syntactic Saccharose will be known as <strong>./victor.sh</strong> and the domain will cease to be carotena.net, being available at http://victor.sh/ instead.</p>

<p>I will let the old domain expire, as I&#8217;m not interested in it anymore, and will set up redirections so that people looking for the old web pages, or sending mail to my old addresses can find me meanwhile. This will cost me in google rank, but I don&#8217;t care particularly since the low posting frequency had made it already low anyway. At least I won&#8217;t be getting spam for a while&#8230; I hope.</p>

<p>I think this new name more accurately reflects my identity and personality, and while it clearly marks me as a geek (as I can&#8217;t pass for a Saint Helena citizen), it also brings the opportunity of starting a fresh stage.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2010/08/06/a-fresh-start/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Leaving Polymita]]></title>
<link href="http://victor.sh/blog/2009/05/25/leaving-polymita/"/>
<updated>2009-05-25T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2009/05/25/leaving-polymita</id>

      <content type="html"><![CDATA[<p>In a week, I&#8217;ll be changing jobs yet again. Except for the first gig, I&#8217;ve been working on progressively earlier stages during the live of a company: I worked for the publishing powerhouse <a href="http://www.planeta.es/">Planeta Group</a>, a big corporation with slow reflexes. Then, in the Barcelona office of <a href="http://www.pivetal.com">Pivetal</a>, a UK company with advanced automation and quality management products (don&#8217;t let their website fool you) for the telco industry. After that, came <a href="http://www.polymita.com">Polymita Technologies</a>, a growth stage startup that sells a unique BPM platform that integrates all the infrastructure for today&#8217;s business applications. And next month, I&#8217;ll be joining an early stage startup. A web startup, in a way of speaking</p>

<p>I&#8217;ve enjoyed my stay at Polymita. I was currently in a support analyst position and, while not having the glamour of R&amp;D or the hectic pace of the operations department (which I&#8217;m not sure I like anyway), it was rewarding all the same because everyday was different, I didn&#8217;t know beforehand what would the cases be like. But lately, with the product being so stable, my mad skillz were going unused (and please excuse my hubris, that&#8217;s how we geeks are). I hadn&#8217;t planned to leave or anything, but I was offered this new position last year and my inner engineer started to see lots of potential directions this tech could go to. Even so, at first I didn&#8217;t clearly see the way the technology could be monetized (that&#8217;s what reading <a href="http://techcrunch.com">TechCrunch</a> will do to you). I didn&#8217;t hear back from this people until some weeks ago, where they presented me some changes that could make the product a hit. While I had figured out that my next job would involve Rails or Cocoa, looks like I&#8217;ll be sticking with Java (for the time being at least) on this new company. Still, the development platform of choice in the new company are MacBook Pro&#8217;s, so there&#8217;s still hope. I could do some internal tool with Cocoa or an iPhone client, who knows?</p>

<p>So, I decided to switch jobs in this crazy economic climate. I&#8217;m abandoning the stability and job security that Polymita provides me and diving head first into the dangerous waters and stressing climate of a true web startup. While some people have commented that I must be mad, some others have complimented me, and I think this is a golden opportunity to learn first-hand all an entrepreneur has to know. If the progression holds, my next job could be on my own company and I would need this knowledge. And anyway, I&#8217;ll get to work on lots of interesting stuff, there might even be some parsing involved (making this site&#8217;s motto relevant once more).</p>

<p>It could also be that this idea flops, but then again, I&#8217;m not overly stressed by this possibility. After a handful of interviews looking for new staff, I realized how difficult it is for companies to find competent engineers. I know that I wouldn&#8217;t be on the dole for too long.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2009/05/25/leaving-polymita/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Resolutions for 2009]]></title>
<link href="http://victor.sh/blog/2009/01/01/resolutions-for-2009/"/>
<updated>2009-01-01T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2009/01/01/resolutions-for-2009</id>

      <content type="html"><![CDATA[<p>I don&#8217;t usually write a list of resolutions, mostly because I don&#8217;t use to formalize this kind of list as such. But I though this year I could give it a try, at least one that can be bloggable. Without further a do, let&#8217;s go for it:</p>

<ul>
<li>Write more on this blog. Currently I&#8217;m posting more to my Spanish blog, <a href="http://principia.info">Principia Programmatica</a></li>
<li>Put an XML-RPC plugin into mephisto to be able to blog on the move from my iPhone. I also want to use my own themes.</li>
<li>Learn a new programming language. I&#8217;m almost decided for Smalltalk, but it could also be Processing or Nu</li>
<li>Practice Objective-C and Cocoa. Perhaps on the iPhone, even.</li>
<li>Also, I want to learn RubyCocoa or MacRuby. Whichever. As for Python, I don&#8217;t think I would be able to fit Python 3.0 in the schedule, I don&#8217;t currently have a use for it.</li>
<li>Finish reading at least 70% of all the books I currently have started but haven&#8217;t finished yet.</li>
<li>Write a Facebook application.</li>
<li>Get a media center for the living room. I&#8217;m saving for an AppleTV, but withouth HDMI on the TV set it&#8217;s a bit silly yet. I haven&#8217;t found a reasonably priced adapter kit yet. Perhaps the Mac Mini slated for Macworld expo next week will do, who knows?</li>
<li>Contribute to some open source project. I have already sent patches here and there, but since I&#8217;m using Mephisto intensively, I&#8217;ll scratch my own itch and write a couple of plugins at least.</li>
<li>Master git, and perhaps buy a subscription to github. I don&#8217;t really need a paid account yet, though</li>
<li>Modernize my home network. I have some scattered old PCs that aren&#8217;t currently being used, and their old hard disks are beginning to catch bit rot. I&#8217;d like to get a new home server, to store all my pictures/movies/mail, and perhaps to develop some of my projects on it.</li>
<li>I want to use all of my skills at work, at least the most enjoyable ones. If that means switching jobs (in this dire economic situation) so be it. I&#8217;m tired of reading people like Paul Graham or Jason Calacanis, but being afraid of leaving my comfortable and safe work place.</li>
</ul>


<p>Ok. That&#8217;s about it, I think. Let&#8217;s review this list in a year or so&#8230;</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2009/01/01/resolutions-for-2009/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[SWLOTD]]></title>
<link href="http://victor.sh/blog/2008/04/09/swlotd/"/>
<updated>2008-04-09T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2008/04/09/swlotd</id>

      <content type="html"><![CDATA[<p>Cut&#8217;n&#8217;fold <a href="http://home.comcast.net/~kymcat3/character001.html">Stormtroopers</a>!</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2008/04/09/swlotd/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Star Wars link of the day]]></title>
<link href="http://victor.sh/blog/2008/04/08/star-wars-link-of-the-day/"/>
<updated>2008-04-08T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2008/04/08/star-wars-link-of-the-day</id>

      <content type="html"><![CDATA[<p>A coworker, Juanma, and I use to send over IM more or less daily an star wars related link. In order to avoid all this effort to be lost, I&#8217;ll post them here as time permits.</p>

<p>Here is the first one:
<a href="http://www.superdeluxe.com/sd/contentDetail.do?id=D81F2344BF5AC7BBDF72CDEA065DF6EC96C87E8B3E62B9C7">Dave Hill: Jedi Master</a></p>
<p><a rel="bookmark" href="http://victor.sh/blog/2008/04/08/star-wars-link-of-the-day/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[About this site]]></title>
<link href="http://victor.sh/blog/2007/10/19/about-this-site/"/>
<updated>2007-10-19T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2007/10/19/about-this-site</id>

      <content type="html"><![CDATA[<h3>Colophon</h3>

<p>This site is powered by <a href="http://mephistoblog.com">Mephisto</a>. The servers are hosted at <a href="http://joyent.com">Joyent</a> (née <a href="http://textdrive.com">TextDrive</a>) and powered by Solaris.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/10/19/about-this-site/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Standby]]></title>
<link href="http://victor.sh/blog/2007/08/25/standby/"/>
<updated>2007-08-25T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2007/08/25/standby</id>

      <content type="html"><![CDATA[<p>As you might know if you visit this blog regularly, I&#8217;m not updating quite often. Part of the reason behind that is my schedule, and part of it is the current hosting situation: this blog is hosted at <a href="http://textdrive.com">Textdrive</a> on one of their shared <a href="http://freebsd.org">FreeBSD</a> servers.</p>

<p>Unfortunately, some time ago the powers that be at Textdrive decided to limit the resource consumption of their shared accounts, and since then, rails applications on Textdrive are often killed due to their excessive memory usage (for values of excessive starting at 48MB). Since the blog is powered by <a href="http://mephistoblog.com">Mephisto</a>, a rails application, it often occurred that I had to abandon editing a new entry, or updating the design.</p>

<p>However, not all is lost. As it turns out, Texdrive is massively migrating their FreeBSD accounts to their shared Accelerators, powerful <a href="http://sun.com">Sun</a> servers running <a href="http://www.opensolaris.org/">OpenSolaris</a>, and with much broad resource limits. According to users who have completed the migration, the new servers fly!</p>

<p>So, this post is mostly to announce that, until my account is moved to the new servers, I&#8217;ll refrain from updating the blog. I hold a Premier account, so I&#8217;ll be in the first lot of customers to move, though I&#8217;ll still have to wait, since the order is alphabetical and my account begins with &#8216;v&#8217;. Please be patient and stay tuned.</p>

<p><strong>Update 18/10/2007:</strong> If you can see this, it means I&#8217;m on the new server</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/08/25/standby/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[A bit of fiddling with F-Script Anywhere...]]></title>
<link href="http://victor.sh/blog/2007/07/01/a-bit-of-fiddling-with-f-script-anywhere/"/>
<updated>2007-07-01T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2007/07/01/a-bit-of-fiddling-with-f-script-anywhere</id>

      <content type="html"><![CDATA[<p>and here you have the results :)</p>

<p><a href="http://www.flickr.com/photos/vich/685694960/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1258/685694960_210c8bd717.jpg" width="462" height="500" alt="My library" /></a></p>

<p>Of course, not all my books are in <a href="http://www.delicious-monster.com/">Delicious Library</a> yet. Specially since Amazon doesn&#8217;t carry most of my books in Spanish. But this is, anyway, a representative sample.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/07/01/a-bit-of-fiddling-with-f-script-anywhere/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Installing RubyCocoa]]></title>
<link href="http://victor.sh/blog/2007/02/21/installing-rubycocoa/"/>
<updated>2007-02-21T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2007/02/21/installing-rubycocoa</id>

      <content type="html"><![CDATA[<p>Since the first exercise on the book - on chapter 2- consists merely on following along the instructions and build a simple application, I&#8217;m gonna start by doing this same exercise with Ruby. To that end, the <a href="http://rubycocoa.sourceforge.net/doc/">RubyCocoa</a> bridge must be installed.</p>

<p>I use the ruby from  <a href="http://www.macports.org/">MacPorts</a> (formerly known as DarwinPorts), so I can&#8217;t use the binary that one can download from RubyCocoa&#8217;s site, since that is for the ruby that comes with Mac OS X Tiger. If that were your case, just download the biinary, but be warned that Apple&#8217;s ruby is buggy.</p>

<p>Installing the bridge is as simple as</p>

<pre><code>sudo port install rb-cocoa
</code></pre>

<p>The system will fetch and install the newest version available from the bridge. If a message like this appeared</p>

<blockquote><p>Error: Target com.apple.activate returned: Image error: /Developer/Documentation/RubyCocoa/build.en.html already exists and does not belong to a registered port.  Unable to activate port rb-cocoa.</p></blockquote>

<p>it means that you already had the package installed for Apple&#8217;s ruby and in trying to install it, it finds some conflicting files (while they are installed in different places, some files do indeed go to the same place, such as documentation and XCode templates). In that case, you will have to use the following command to activate the port:</p>

<pre><code>sudo port -f activate rb-cocoa
</code></pre>

<p>To check that it&#8217;s working, we&#8217;ll invoke the interactive interpreter:</p>

<pre><code>$ irb
irb(main):001:0&gt; require 'osx/cocoa'
=&gt; true
</code></pre>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/02/21/installing-rubycocoa/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[CP, Chapter 2: Random number generator]]></title>
<link href="http://victor.sh/blog/2007/02/21/cp-chapter-2-random-number-generator/"/>
<updated>2007-02-21T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2007/02/21/cp-chapter-2-random-number-generator</id>

      <content type="html"><![CDATA[<p>After telling XCode which name we want to give to the project, it will generate its skeleton. As we can see, an <code>rb_main.rb</code> script has been created, that is called from the entry point (in <code>main.m</code>); and the RubyCocoa framework has been added as well. If we build and launch this project, we can see that it runs normally.</p>

<p><img src="http://principia.info/assets/2007/2/17/CP_2_2_XCode_RbRandomApp.png" alt="Project files" /></p>

<p>If we look closely at the generated code, we&#8217;ll see that <code>main.m</code>, instead of calling <code>NSApplicationMain</code>, is actually calling <code>RbApplicationMain</code> and passing it the script name as an argument.</p>

<p>The script, for its part, looks somewhat more complex:</p>

<pre><code>require 'osx/cocoa'

def rb_main_init
  path = OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation
  rbfiles = Dir.entries(path).select {|x| /\.rb\z/ =~ x}
  rbfiles -= [ File.basename(__FILE__) ]
  rbfiles.each do |path|
    require( File.basename(path) )
  end
end

if $0 == __FILE__ then
  rb_main_init
  OSX.NSApplicationMain(0, nil)
end
</code></pre>

<p>The first thing the script does is require the Cocoa libraries (for Ruby). Then defines a function, <code>rb_main_init</code>, that is called if the script it&#8217;s the same as the one that was passed as a parameter, proceeding then to call the method <code>NSApplicationMain</code>, which loads the NIB files and begins the main Cocoa application loop.</p>

<p>What does this function do? It iterates over the package (the bundle) files, looking for all the ruby scripts within, and <code>require</code> them all, presumably so that they are available before being used from the application.</p>

<p>Having seen this, we can proceed with the application, launching Interface Builder and defining the interface, as explained in the book. Once the main application window is created, we are expected to define a class <code>Foo</code> with an outlet and an action, and then have XCode generate the code for that class. But XCode does not yet generate Ruby code, so the only thing we can obtain from it is Objective-C code. I have done this in order to convert it to Ruby, but you can skip this step and use the following code:</p>

<pre><code>#
#  Foo.rb
#  RbRandomApp
#
#  Created by Victor Jalencas on 18/02/07.
#

require 'osx/cocoa'

class Foo &lt; OSX::NSObject

    ib_outlets :textField

    def generate(sender)
    end

    def seed(sender)
    end

end
</code></pre>

<p>Now we&#8217;re ready to instantiate Foo. If we look at the Connection inspector, we&#8217;ll see that there is an outlet, which is there thanks to the class method we used to declare it, <code>ib_outlets</code> (which is, actually, an alias to <code>attr_writer</code>). However, there isn&#8217;t yet a method for declaring the actions, so that our only course of action is adding them by hand in Interface Builder. I&#8217;ve heard rumors that it will soon exist such a method, though.</p>

<p>Next, we&#8217;ll connect the outlets and actions as normally. Then it&#8217;s just a matter of implementing the methods we had declared:</p>

<pre><code>#
#  Foo.rb
#  RbRandomApp
#
#  Created by Victor Jalencas on 18/02/07.
#

require 'osx/cocoa'

class Foo &lt; OSX::NSObject

    ib_outlets :textField

    def generate(sender)
      generated = (rand(100))+1
      @textField.setIntValue(generated)
    end

    def seed(sender)
      srand(Time.now.to_i)
      @textField.setStringValue "Generator seeded"
    end

end
</code></pre>

<p>If we build and launch the project now, we&#8217;ll see that it works perfectly. Where in the original code we would have called C functions (<code>random</code>, <code>srand</code> and <code>time</code>), I have now used the ruby counterparts.
We&#8217;ll also see that the outlets are used as instance variables, and that there&#8217;s no need to convert ruby strings to <code>NSString</code> (that is one of the few automatic conversions RubyCocoa offers us)</p>

<p>To finish the example, we&#8217;ll add the <code>awakeFromNib</code> method:</p>

<pre><code>def awakeFromNib
  now = OSX::NSCalendarDate.calendarDate
  @textField.setObjectValue now
end
</code></pre>

<p>And with this, the application is finished. We could run the Ruby and the ObjC applications side-by-side and we&#8217;d get the same results, save for the fact that in Ruby, if you don&#8217;t seed the random number generator, it&#8217;s by default seeded with a value that depends on the time and the PID, while the C function <code>random</code> does not and will always repeat the same sequences if it&#8217;s not properly seeded.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/02/21/cp-chapter-2-random-number-generator/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Cocoa Programming exercises]]></title>
<link href="http://victor.sh/blog/2007/02/21/cocoa-programming-exercises/"/>
<updated>2007-02-21T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2007/02/21/cocoa-programming-exercises</id>

      <content type="html"><![CDATA[<p>Since I bought the Mac I&#8217;m trying to learn to program in that environment. I have a couple of books to that effect, but for some reason I can&#8217;t <em>retain</em> (pun intended) the knowledge in my head to effectively develop on the Mac - that is, I&#8217;m constantly referring to the books for every step I need to take. Be it for having to use Interface Builder and its myriad options, or the fact that not using automatic garbage collection scares me (my pointers are certainly rusty), the thing is, I&#8217;m sure that if I exercise regularly - as in a code Kata - in the end I will master it.</p>

<p>That&#8217;s why I&#8217;m starting this new section. I&#8217;m gonna follow the exercises in Aaron Hillegass&#8217; book, <a href="http://www.amazon.com/gp/product/0321213149?ie=UTF8&tag=victorweb-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0321213149">Cocoa(R) Programming for Mac(R) OS X</a><img src="http://www.assoc-amazon.com/e/ir?t=victorweb-20&l=as2&o=1&a=0321213149" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> in public, commenting and expanding them, so that the peer pressure makes me do it regularly. Mi intention is, provided I have the time and skill, to also rewrite the exercises in some other language than Objective-C -but with bindings for Cocoa, of course- such as Ruby or C# and, while doing so, prepare myself for the release of Leopard, where alternative languages will gather more importance.</p>

<p>Even better if, in doing this, some reader can benefit from it. Likely, having the book will be a requisite to follow the posts effectively, but I will try to make them self-contained. Let&#8217;s see how I fare&#8230;</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/02/21/cocoa-programming-exercises/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Current Projects]]></title>
<link href="http://victor.sh/blog/2007/02/14/current-projects/"/>
<updated>2007-02-14T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2007/02/14/current-projects</id>

      <content type="html"><![CDATA[<p>Right now, the current projects include bringing a couple of sites back to life - like this one, now powered by Mephisto, or <a href="http://www.planetarails.es/">Planeta Rails</a>; an aggregator for the Spanish speaking rails community.</p>

<p>Lately, I have been interested in giving <a href="http://microformats.org/">microformats</a> a spin, so I have launched <a href="http://spotspotting.com/">SpotSpotting</a>, a site where TV commercials are reviewed (as if they were movies), and am preparing another site for reviewing and recommending restaurants worldwide.</p>

<p>I hava also started a new section, <a href="http://victor.sh/choclit">Choclit</a>, in which I try to learn Objective-C and Cocoa in public, sprinkiling in some Ruby and C# so as to make it more palatable.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/02/14/current-projects/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Just testing if this will stand its own]]></title>
<link href="http://victor.sh/blog/2007/02/05/just-testing-if-this-will-stand-its-own/"/>
<updated>2007-02-05T00:00:00+01:00</updated>
<id>http://victor.sh/blog/2007/02/05/just-testing-if-this-will-stand-its-own</id>

      <content type="html"><![CDATA[<p>Please pardon the dust&#8230; again. Looks like the resources at TXD are rather tight. Changing themes can bring the samurai&#8217;s wrath upon the processes, <em>if ye catch me meaning</em>.</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2007/02/05/just-testing-if-this-will-stand-its-own/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[This is just a test post]]></title>
<link href="http://victor.sh/blog/2006/09/25/this-is-just-a-test-post/"/>
<updated>2006-09-25T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2006/09/25/this-is-just-a-test-post</id>

      <content type="html"><![CDATA[<p>Lately, rails has been playing tricks on me. The applications would go and disappear under my feet, segfaulting sometimes without even logging a message. That&#8217;s why I&#8217;m posting this, to see if the problem appears now that the TXD folks are having an eye on it.</p>

<ul>
<li>Update: * Umm&#8230; somehow, it&#8217;s good news that no problems occur&#8230; but then, if there really is a problem, it won&#8217;t help that it doesn&#8217;t appear now&#8230;</li>
</ul>


<p>It&#8217;s a bit annoying somehow. I migrated to mephisto because I suspected typo&#8217;s bloat would have something to do with the problems, and now I am missing some features that mephisto doesn&#8217;t yet implement (I don&#8217;t doubt it will, mephisto is very young still). And yet, I won&#8217;t go back, since I&#8217;m interested in hosting multiple sites with a single instance of whichever rails app will do that, and just now, only mephisto does it. If it stays stable for one more day, I&#8217;ll deem the issue –closed– vanished and try this feature (yes, I haven&#8217;t really tried it yet)</p>
<p><a rel="bookmark" href="http://victor.sh/blog/2006/09/25/this-is-just-a-test-post/">&infin; Permalink</a></p>]]></content>
    </entry>
  
    <entry>
      




<title type="html"><![CDATA[Okay, let's try more things]]></title>
<link href="http://victor.sh/blog/2006/09/25/okay-let-s-try-more-things/"/>
<updated>2006-09-25T00:00:00+02:00</updated>
<id>http://victor.sh/blog/2006/09/25/okay-let-s-try-more-things</id>

      <content type="html"><![CDATA[<p>Since I&#8217;m still getting to know mephisto, I thought I&#8217;d try a couple of things out&#8230;</p>

<p>&lt;macro:flickrshow set=&#8221;72057594082061447&#8221; /></p>
<p><a rel="bookmark" href="http://victor.sh/blog/2006/09/25/okay-let-s-try-more-things/">&infin; Permalink</a></p>]]></content>
    </entry>
  
</feed>

