I’m on Google+

If you are still tracking this blog in your RSS reader:




Follow me
on Google+

Eclipse can’t create project from existing source

When creating a new project in eclipse and you select Create project at existing location (from existing source), you might get

Cannot create project content in workspace

all the time.

You can try to solve this by creating the project somewhere else and dragging the content into that new directory.
But what causes this error is that you put your projects’ source(s) in the directory where your workspace is located.

The recommended approach to avoid this error: name your workspaces something like “Projects” and/or “Accounts”. Not a full path name. This way they get created in your eclipse folder and contain only the .metadata directory.
After that, just place your source(s) somewhere else and add/create them like you intended to do in your preferred workspace.

As a summary: a workspace should just be a name (to which eclipse links some configuration information). Not a physical location (path).

3 simple things I love about Propel

When updating almost all my own projects to Propel 1.6.4 over the last weeks, I decided to keep a list of the things that made me happy about Propel in general:

  • primaryString
    What?
    In your database schema, you can mark a column as the string that represents the data in a table. For instance: the name column in a product table.
    Why?
    2 reasons mainly: the fact that the __toString() of your record object will return this (makes your code look nice when you do echo $product instead of echo $product->getName()) and the link to the slugable behavior (automatic generation of URL-nice representations of that string)
  • findOneOrCreate()
    What?
    When you use one of the Query classes, you can end it with ->findOneOrCreate() to get either the record matching your query or a new one.

    Why?
    Most of the time, this is the only difference between a “add new” action and a “edit” action (e.g. when submitting a form to edit product details). Again, cleans up your code.
  • Inheritance
    What?
    Imagine you have categories for your products and a product can have multiple categories, but in the end, these categories just add a description and a value to your product data. Something like product color and product size. You could create separate tables for them or work with one general category table with a “type” column. But you can have the best of both worlds with Single Table Inheritance. And it only gets more beautiful with the other inheritance types.
    Why?
    In the example above, it generates separate Color and Size classes while in the back, the database just has one category table.

This is a quick summary, but I hope it makes clear why Propel is a pleasure to work with.

Mobile market share

Ever wondered how diverse the use of mobile devices/mobile browsers is?
Have a look at this nice post of iCrossing:

http://connect.icrossing.co.uk/mobile-market-share_6301

be sure to compare it to 2010:

http://connect.icrossing.co.uk/mobile-browser-market-share-map_4217

It is clear that Android gained a lot in the US, Japan and parts of Europe over the last year!

EDIT: 2012 data is available too.

User interface decisions: multi-select

Thanks to Filip Forrez for the inspiration for this post.

As developers, we are often presented with UI choices. Some create subtle differences, others larger ones.

One of them is the way we present the possibility to select multiple items from a set (list) of predefined items. Traditionally this is realized by 2 select-lists with the multiple attribute.

In an (advanced) Sencha Ext Js implementation, you get this:
http://dev.sencha.com/deploy/dev/examples/multiselect/multiselect-demo.html

This offers a lot of features and while we as developers see this as the default way to offer this functionality, there are other options too.

In the spirit of mobile development, a list with check-boxes offers the same basic functionality:
http://demo.superdit.com/ext_listview_dataview/

You would also never be able to present the first solution on a small mobile screen. Another option to meet the same basic requirement is the way Google Calendar lets you add multiple invitees to an appointment.

Depending on the features you need, one option may be preferred over the other. Think of features like:

  • Sorting: you may need to offer the possibility to sort the result.
  • Quantity of predefined options: too much data may require a way to search.
  • Linkability: list-items may also need to be clickable and link to detailed information.

In some cases, a more creative approach can really have your site or app pop out.

Replace an Ext JS Element with a HTML string

After trying to do something as simple as replacing an HTML element in the dom with a string (HTML in this case) with Ext JS for about 3 hours without finding a proper answer on Google, I thought someone else might also benefit from my (sub-optimal) solution.

In my case, the string was a HTML fragment returned from an AJAX call. It needed to replace a HTML element already in place in the dom.

Ext.DomHelper.overwrite() works, but only replaces the contents of an existing element, not the element itself (and since the parent of that element contained other elements too, a higher level selection didn’t solve it either).

You would expect Ext.DomHelper.insertHtml(‘beforeBegin’, oldElement, html) and deleting the oldElement afterwards to work, but it generated an error message which (if I’m correct) told that the html string is not linked to the dom already (which is of course not the case).

Since I could not find a proper working solution, I tried to use the Ext.DomHelper.createTemplate() method to create an Ext.Template and to use template.insertBefore() with an empty values array to get it into the dom before removing the old element. This does not look optimal, but at least it works…

Disable SAP GUI sound

If you’ve ever worked with SAP, the chances are you have been “amazed” by its GUI more than once.

Besides a usability experience dating back from the first half of the previous century, the default sounds on every interaction with the GUI can be very anoying (at a minimum).

How to disable it:

  • Fire up the GUI and sign in.
  • On the main toolbar, click the last icon (Adjust local layout – what did you expect).
  • In the dropdown menu, select the second option (Configure New Visual Design… – of course).
  • Select Sound – Off.

Once again, it proved you should really stay away from the alcohol. Looking for something like “Settings” under de main “System” menu… you s*****.

Indexes on multiple columns in MySQL

When optimizing queries, you don’t need to be reminded that indexes play an important role.

Something to remember though: in real-world examples a multi-column index often outperforms multiple indexes.
So it can be worth changing something like:

to

MySQL 5.0 introduced an internal method called “Index Merge” which merges multiple indexes when querying a table (if applicable) but I haven’t seen this being used that often. On the contrarry, MySQL often picks one of the indexes and in these scenario’s it is especcialy usefull to have one multi-column index.

As always: use EXPLAIN to see what can be improved.

Search keyword tagcloud

Ever wondered what the prominent keywords were that your visitors use to reach your site?

Google Analytics will happily show you those. With the amount of visitors per keyword of course (amongst many other metrics).

But what if you wanted to know which separate words were most used throughout all search queries? Create a tagcloud:

  1. Go to the Traffic sources >> Keywords report.
  2. Be sure to select a good amount of visits by stretching the date range to e.g. a year.
  3. Append &limit=50000 at the end of the URL. This is some hack to get all keywords in the export and be sure to append it to the end, not before the hash (#) character or anything.
  4. Click the export button at the top of the report and click CSV.
  5. Open the file in an application that understands the standard CSV-format. I have to open the file in a text-editor and replace all comma’s with semicolon’s before I can open it in Excel.
  6. Copy all keywords (not the numbers behind them or the general data above them).
  7. Visit a tagcloud creation website and paste the data.

You can argue that the number of visitors per keyword is not taken into account but in the end that may not be what you are looking for. In case you want to know which keywords are most often used in different search phrases, this creates a pretty good image.

Below is the result of all searches that reached this website in 2009:


(click on the image to enlarge)

Thanks to Avinash Kaushik for another great post about Analytics Insights.

Take the risk

Want to start your own business and work from home?

Inc.com published a list of 9 examples of people who started a successful business from their home.

One of them is a self employed insurance broker who offers live webcam chat through his website. You do not need to know anything about insurance to imagine this can have a positive effect on customers who do not have time to make an appointment with him.

Enjoy the read!