« Oktober 2007 | Main | Dezember 2007 »

November 2007 Archives

27.11.07

Leopard Tech Talk Summary

My unedited notes from the Leopard Tech Talk at the Hilton Hotel Düsseldorf today.
As I’m not a Cocoa Developer with in-depth knowledge, I just wrote down some interesting points for me to get an impression of all the technologies available in Leopard and Mac OS X in general. For instance, I didn’t note any in-depth code examples, or all the new features of the Xcode tools.

1st Block

(Speaker: Paul Burford)

Resolution Independence

  • remove any resolution-dependend code
  • use Quartz Debug to increase resolution

Spotlight

  • need plug-in for own filetypes
  • automatic menu indexing in leopard
  • Spotlight runs with user-rights

64-Bit

  • 32- and 64-Bit applications coexist
  • Java 1.6 will support 64-Bit (on Intel) as well as Cocoa

Core Animation

  • originally developed for devices like the iPhone
  • not an animation engine
  • adds realism and valuable feedback to the UI
  • setup and forget about it (really easy to add to an existing application)

Time Machine

  • Backing up to a network-harddrive will be back in the future (they found a bug short before releasing Leopard)
  • you’re able to roll back to a previous state (before an OS-Upgrade for instance)
  • tell TM what files (of your application) shouldn’t be backed up
  • .tmp files are never backed up
  • backups are indexed by Spotlight
  • backs up forever until you run out of diskspace
  • so far no compression of backups

Dashboard

  • Widgets now execute in one process

Apple Script

  • Bridges for Python and Ruby

Objective-C 2.0

  • Garbage Collection
    • Build Settings -> Enable Garbage Collection
    • much more readable code
    • less code to maintain …
    • use -finalize instead of -dealloc
    • not available in Tiger

  • Properties

    • shortcut to get getter- and setter methods
    • @property NSString *name; -> creates these methods for you (yeah, really ruby-like ;-) )

Core Animation

(Speaker: Paul Burford)

Architecture

  • based on OpenGL
  • Access to all other graphic libraries (Core IMage, Quicktime, Quartz)

Cocoa Slides

  • Demo app
  • No blocking of UI (runs in a seperate thread)

  • implicit animation

  • you don’t have the app to tell it “do this animation now”
  • really easy to add to an existing app
  • set animation method (optional)
  • set duration

Overview

  • enhance the user experience
  • create meaningful motions that provide live feedback
  • examples: cover flow, moving items to dock, front row…
  • don’t confuse the user
  • don’t add constant motion
  • don’t add meaningless motion
  • only Objective-C (no Java support)
  • lots of layer properties to style your layer
  • layers are really lightweight (because originally designed for devices like iPhones)
  • your mac can handle thousands of layers flawlessly

Implicit Animations

  • superclass CAAnimation

    • CAPropertyAnimation
      • CABasicAnimation
      • CAKeyframeAnimation

    • CATransition
    • CAAnimationGroup

  • Built-in animation for grid views, scroll views, toll bars…

Spotlight & Quicklook

(Speaker: Paul Burford)

Spotlight

  • preview content in searches
  • new syntax
  • Spotlight plug-ins
    • declare set of handled file formats
    • start with spotlight plug-in template in xcode
    • edit info.plist

Early lunch break at 11:45h (the beamer went out of order)

Lunch was really great: A lot of nice Hilton-worthy food! Hm….

Spotlight (continued)

  • Spotlight for Help
  • Works for Cocoa and Carbon Apps

Quick Look

  • Preview vs. Thumbnails
  • Preview really usefull in cover flow view
  • thumbnail: low-res image, static image
  • preview: feihtful representation of your document, richer format (PDF, rtf etc.)
  • how to create previews
    • Preview saved as any native Quick Look type
    • pregenerate (at save time) or
    • create on demand (using a quicklook plug-in)

  • QL-Plugins are quite the same Spotlight-plugins (if you know one, you should be able to code the other)

Leopard Tech Talk

Xcode 3.0 and Interface Builder 3.0

(Speaker: Alberto Araoz)

Xcode 3.0

  • Repositroy-support (subversion etc.)
  • faster
  • code folding
  • code focus
  • improved syntax coloring

…lunch is taking its toll…

Interface Builder 3.0

*zZzzzzzzzzzzzzzzzz*

64-Bit Development in Leopard

(Speaker: Alberto Araoz)

*zZzzzzzzzzzzzzzzz*

Image Processing & Manipulation in Leopard

(Speaker: again Paul Burford)

Image I/O

  • 1 API for all different file formats and operations
  • preservs metadata (EXIF, Tiff etc.)
  • RAW support
  • floating point support
  • Floating POINT HDR Images
  • Thumbnails: 3 choices
    • generic OS thumb picture
    • small preview (rought sketched real content)
    • bigger preview (exact data thumb)
    • everything is stored in 32-bit floating point numbers

ImageKit

  • Components
    • Viewer
    • Edit Panel
    • Browser (pictures, movies, quick looks)
    • Picture Taker (use built-in camera, screenshot)
    • Slideshow
    • Others

  • New Panels for Core Image filters, so you don’t have to built your own for accessing the filters

Core Image

  • New in Leopard:
    • Adjusting RAW Images
    • Core IMage Filters do the work (every step configurable)

Unofficial stuff (said after finishing event)

  • Apple didn’t ship an iPhone SDK, simply because it was not ready
  • The first iPhone software was really ready just in time, with many processes running as root user
  • iPhone SDK next february

22.11.07

The preview feature and more updates on re-coding innoq.com

So now finally another post concerning the “real” work - meaning the progress on re-coding innoq.com.

I’m still working on the part of maintaining all the articles on the site. To be precise I did a lot of thinking about and coding the articles preview-feature, i.e. when you write a new article or edit an existing one, you can see a preview when clicking the appropriate button.

What took a quite huge amount of time was gathering all the possible alternatives on how to implement that particular functionality. Will the preview be displayed on the same page? Will this be done with or without AJAX? Or should the preview open in a new window or in the same window on a new page? Or is a separate page, embedded in an iframe-element, the best way to do it?
I decided to go with the “same-window-new-page”-variant, and here’s why:
The reason for displaying the preview on a separate page was, that I wanted the article to appear in the way it will appear on the actual webpage-frontend. Furthermore I really wanted to use the original stylesheet, and not a faked 2nd version just for the preview. I think that is easier to maintain and more consistent in case the original stylesheet will be altered. And: why not use the original show-method from the articles controller to display an articles preview? (actually I did implement an extra preview-method and -view-template, which are slightly modified copies of the show-stuff)
The reason for the “same-window”-part is that I don’t like new windows: so (even if they open in new tabs) when you do not close them, after a while you’ll have plenty of them and your screen gets cluttered*. And it is the same amount of work to close the window or hit a button or link taking you back to where you came from. Further this is more linear and user-friendly IMHO.

So this is what it looks like when editing an article:

Editing an article. Click to enlarge.

And this is how the preview looks like when you hit “Vorschau” (i.e. preview in german):

Previewing an article. Click to enlarge.

The giant link at the bottom will take you back to the edit-screen with javascript:history.back();.
I should mention that the preview does not save anything to the database. It is generated on-the-fly and so it takes all the fields of the form as parameters. It’s a GET-Request, so these parameters appear in the adressbar in your browser:

Adressbar

I’m not sure if I think that’s too ugly…maybe this deserves some improvement.

Another thing I implemented is a button for buffering (“Zwischenspeichern” in german). So you can save the article without being sent back to the index action. So far this is just an ordinary POST-Request, with reloading the whole page. Maybe it would be sexier to use AJAX, but it’s more difficult to implement and during a save you won’t be editing the article anyway, do you?

So that was my - a bit extensive - update on innoQonRails…comments are always welcome!

*Yes, I now you can give the window a name and each time you hit the button for the preview it will be loaded in that window. I don’t like that, either.

20.11.07

Make TextMate cope with Rails 2.0 filename convention

In Rails 2.0 view templates have an ending like .html.erb, .css.erb or .xml.erb (instead of f.i. .rhtml in Rails 1.2.x). So if you've selected a syntax highlighting in TextMate for - say a .html.erb template, this would apply to all templates with ending .erb (i.e. .css.erb etc.) and that's bad, because you want the .css.erb file to have another syntax highlighting (CSS!).

To fix this, you simply have to do the following:

  1. In the TextMate menu select Bundles -> Bundle Editor -> Edit Languages
  2. Expand the "Ruby On Rails" item
  3. Select "HTML (Rails)"
  4. Replace "fileTypes = ( 'rhtml' );" with "fileTypes = ( 'rhtml', 'html.erb' );"
  5. Redo this for every language you use (i.e. CSS -> css.erb, XML -> xml.erb...) in its corresponding menu
  6. Now you can select a separate highlighting for every .erb extension

(via Google Groups)

18.11.07

Web Inspector in Safari 3

Today I upgraded my Mac OS X Tiger version to 10.4.11. Included in this update is the new version of Apple's web-browser Safari.
One of the most useful new features, when it comes to web development, is definitely the new web inspector!
It is not activated by default, but entering this line to the terminal will enable it:

defaults write com.apple.Safari WebKitDeveloperExtras -bool true

Now you can right click and choose "Inspect Element" to open the web inspector.

But it gets even better: enter the following line to the terminal and you get a complete new menu point "Debug".

defaults write com.apple.Safari IncludeDebugMenu 1

Great!
(After entering these commands in the terminal, you'll have to restart safari to see the changes)

(via Pimp your mac)

10.11.07

Rails 2.0: Release Candidate 1

Rails 2.0 RC1 is here:
http://weblog.rubyonrails.com/2007/11/9/rails-2-0-release-candidate-1

08.11.07

Tschüss deutsch...hello english!

Also, wie ihr vielleicht schon an dem kleinen About-Text erkannt habt, werde ich diesen Blog auf englisch weiterführen, und zwar aus den folgenden 2 Gründen:

  1. Es nervt auf Dauer seinen englischen Quellcode im Deutschen zu dokumentieren. Ich denke, ich bin da auf englisch einfach schneller, da man nicht wieder nach Übersetzungen suchen muss.
    Außerdem ist Englisch die bessere IT-Sprache - meiner Meinung. Einfach knapper und präziser (wer brauch "Bearbeiten", wenn es auch "Edit" gibt ;-) ).
    (Warum habe ich mein OS eigentlich auf deutsch installiert?)

  2. Ich lerne die Sprache auch in Schriftform mal besser. Ich hoffe mir unterlaufen dann nicht allzu große Schnitzer...

Also: tschüss Deutsch...

...hello english!

As you can see I applied a complete new style to this site. I also improved the navigation (in my opinion): you're now able to navigate via the category links on the right. Furthermore all articles in the archives and categories are now sorted by date descending, so that the newest post is on top (which makes more sense than the other way round). And finally there's a short "about text" - about me and this blog.

The only thing I still need is a new title/headline for this blog, as "MyInnoQBlog" is quite boring and has only little connection to the content provided here...
Suggestions appreciated! :-)

07.11.07

Neues Design

Ich habe mal das Design dieser Seite geändert. Und zwar habe ich mich für das Theme Blue Crush entschieden. Ich finde die Farben sind einfach freundlicher, außerdem ist es auch blau gehalten, was nachwievor noch so halbwegs zur innoQ-CI passt. ;-)
Ich hoffe, es gefällt euch!

Des weiteren werde ich das Erscheinungsbild des Blogs noch weiter ändern. So werde ich demnächst mal einen About-Text verfassen, der dann wahrscheinlich in die Sidebar kommt. So weiss man dann auch endlich mal, wer hier schreibt, und worum es geht.
Dann denke ich darüber nach evtl. den Titel und Untertitel des Blogs zu ändern. Und ich ziehe stark in Betracht diesen Blog tatsächlich auf Englisch weiterzuführen, bes. nachdem ich Zustimmung bekommen habe.

Mac OS X Leopard Tech Talk

Ich habe grade die Bestätigung für meine Teilnahme am "Mac OS X Leopard Tech Talk" bekommen. Der findet am 27.11. im Düsseldorfer Hilton Hotel statt. Hehe...

Naja, ich habe zwar weder Leopard installiert (bis jetzt), noch bin ich wirklich ein Mac-Developer (ich habe nur mal mit Image-Units/Core Image rumgespielt), aber uninteressant wird das bestimmt nicht. Da die Teilnahme nichts kostet, dachte ich, nehme ich dieses Event doch mal mit.

Man kann sich immer noch registrieren, und zwar hier: http://developer.apple.com/events/techtalks/europe.html

06.11.07

Artikel zu OpenID

"OpenID promises a lot — just one username and password for life — but can it deliver? Peter Nixey’s the man to tell you. His startup Clickpass is all about bringing OpenID to the masses and he writes about the cost of sign up, fraud and more."

Ein interessanter Artikel zu OpenID im Vitamin-Blog: http://www.thinkvitamin.com/features/webapps/how-will-openid-change-your-site

05.11.07

Rails Sammelsorium

Hier kleinere Rails-Codeschnipsel, die ich in letzter Zeit benutzt habe.

Form-Partial in Rails 2.0

Als ich mir den Scaffold für die einzelnen Artikel erstellt habe, wurde mir kein Form-Partial (_form.html.erb) erstellt, wie ich es aus Rails 1.2.3 kannte (dort hieß die Datei noch _form.rhtml). So stand der Code der Eingabe- und Editierform 2x im Code: einmal in new.html.erb und einmal in edit.html.erb.
Vorher fand' ich das irgendwie besser, da die Form für's Editieren und neu Hinzufügen die gleiche ist, und somit habe ich den alten Zustand wieder hergestellt.

Zuerst musste ich die Datei _form.html.erb erstellen. Dort kam dann der ganze Code der Form rein, bis auf den Button zum abschicken der Form.
Da in Rails 2.0 der form_for tag etwas anders aussieht...

<% form_for(@article) do |f| %>

...und die Abkürzung über die Variable f gegangen wird...

<%= f.text_field :title, :class => "text_field" %>

musste eben diese noch übergeben werden. Dies geschieht mit folgendem Zusatz im render-Aufruf des Partials:

<%= render :partial => "form", :locals => {:f => f} %>

Und so ist dann auch wieder alles ordentlich DRY.

Tabindex

Um einen Tabindex für Eingabefelder festzulegen, gibt es einfach die Option :tabindex

<%= f.text_field :title, :class => "text_field", :tabindex => "1" %>

Focus auf ein bestimmtes Feld setzen

Dazu legt man sich lediglich eine kleine Helper-Funktion z.B. in application_helper.rb an...

def set_focus_to_id(id)
    javascript_tag("$('#{id}').focus()")
end

...und ruft diese - nach dem end-tag der Form - wie folgt auf:

<%= set_focus_to_id "article_title" %>

Das ganze setzt voraus, dass die Prototype/Scriptaculous-Skripte eingebunden sind über

<%= javascript_include_tag :defaults %>

(via Wolfmans Howlings)

validates_presence_of mit habtm korrekt in update-Action

Hat man eine many-to-many Beziehung zwischen zwei Entitäten, wie sie z.B. habe mir Artikel und deren Kategorien...

has_and_belongs_to_many :categories # (in article.rb)
has_and_belongs_to_many :articles # (in category.rb)

...so gab es bei der Update-Aktion im articles-controller das Problem, dass die Zeile

 validates_presence_of :categories # (in article.rb)

keine Wirkung zeigte und Änderungen an den Kategorien (in meinem Fall mit Checkboxen dargestellt) nicht übernommen wurden. So musste noch folgende Zeile in der Aktion update in articles_controller.rb hinzugefügt werden:

@article.categories.clear if !params['article']['category_ids']

In der Form sieht das Ganze wie folgt aus:

<% for category in @categories %>
    <%= check_box_tag "article[category_ids][]", category.id,
    @article.categories.include?(category), :class => "checkbox" %>
    <%= " " + category.long_name %><br/>
 <% count = count + 1 %>
<% end %>

(via diverser Quellen, die ich nicht mehr zusammen bekomme ;-))

(Randnotiz: wenn ich mir so besonders meine letzte Überschrift in diesem Post so durchlese, frage ich mich manchmal, warum man sich es antut Posts auf deutsch zu schreiben!? Da ich grundsätzlich in Englisch programmiere, und mir eigentlich auch englische Code-Kommentare leichter von der Hand gehen, muss ich manchmal echt überlegen, wie ich das, was ich schreiben möchte, jetzt auf deutsch ausdrücke.)

About

DanielHi. I'm Daniel Pietzsch and this is my innoQ-Blog. I'm a 26y old student at FH Bochum and working student at innoQ.
In this blog I mainly write about the progress concerning my diploma thesis which will be an in-house application for innoQ based on Ruby on Rails, but some other (geek) stuff might appear here, too.

daniel [dot] pietzsch [alt-L] innoq [dot] com

I recommend

Categories

Recent Comments

License

Creative Commons License This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.31