dimanche 2 mai 2010

iPad review, 3 days in

So after being very skeptical of the iPad (and hating the name) after playing with one for 45 minutes in the store I realized its actually not that bad and potentially useful for some things, so I bought one to try it out further. 3 days in here are my thoughts:

It's good for:
* Watching Netflix and ABC shows on something thats easy to carry around the house
* Watching my stock values go down, the Bloomberg app is great
* Watching interviews with Lena Meyer-Landrut (and otherwise wasting time) on YouTube
* Being a portable RDP thin client for a Windows machine (using the Wyse app)
* Reading magazines like Vogue France using the Zinio app (which sucks on an ebook reader)
* Reading letter/A4 size pdf files (like the ones from O'Reilly books) using Good Reader (which also sucks on an ebook reader)
* Watching movies on an airplane
* Looking at naughty images in the photo viewer (preferably not on an airplane)
* Holding a charge for more than 6 hours (looking at my phone thats charging right now, no not the Blackberry, the other one.)
* Having something decently sized thats connected to the 'net that I can carry around the house, while moving my laptop from one room to the other is not exactly hard, it's not nearly as convenient and just picking up the iPad.
* Feeding my being-connected-to-the-internet addiction
* Browsing /b/ (yay for browsers that run completely sandboxed)
* Having a password protection option that will wipe the device after 10 failed attempts at unlocking it

It's ok-ish for:
* Ordering pizza from papajohns.com
* Facebook
* Carrying around a $500 map of the Berlin public transit system
* Trading stocks online
* Selling my possessions on eBay
* Sending sweet online birthday cards
* Creating mind maps with MindNode
* email (the mail client is nothing to write home about)

It sucks for:
* Reading actual books that you read from cover to cover. It's too heavy and the back-lit screen hurts your eyes (ebook readers are waaaayyyyy better for this, and mine is about 1/2 the weight)
* Taking notes during a meeting (unless you want to type them on the keyboard), since its a capacitive screen without digitizer pen support you have to do it with your finger and it comes out even worse than you would expect. (my ebook reader and tablet pc are great for this kind of note taking however)
* Not being able to get a refund on sucky apps (like you can with the Android app store)
* No flash support = no online porn (what am i supposed to do now after sending sweet online birtday cards? Unless you know a site that uses a not-yet-standard html5 format...)
* No silverlight support either for that matter
* Developers who don't use MacOS, there is no way to develop for this thing (or the iPod) on a Windows or Linux machine - heck even on MacOS you are forced to use crappy XCode to do the development.
* You have to upgrade your iTunes to the latest version which takes 45 minutes and plug the device into the computer before you can use it - it doesn't do anything whatsoever when you plug it in this time other than let it go past the screen that says you have to plug it into iTunes.
* Charging, it wont charge off of a PC's usb port because it needs a ton of power, so you have to plug it into the wall and even then it takes like 4 hours to charge fully.

All in all I'd say so far that it's worth the $500 I paid for mine, but I sure as heck would not pay the extra for the 3g model or even the higher capacity, not for my needs anyway.
It does fill a couple areas that other devices do technically cover, but not in as convenient a format, the real test will be to see how much I'm still using it in a month.

samedi 25 juillet 2009

S60 stuf

So since Qt for the Symbian S60 platform is well on its way I figured I should set aside my Blackberry and use my Nokia N85 as my main phone for a while. Here are some of my thoughts about the experience so far:

E-mail - Well... it's not a Blackberry thats for sure. It's "ok". Maybe good for people who don't have a Blackberry lol.

Calendar/to-do - The calendar and to-do list are integrated into one application which at first I didn't like, but having used it for a few days now I think it's nice. I use these feature a lot, so I was glad to see that it could keep up with the Blackberry versions.

Web Browser - Overall the web browser is pretty nice, navigating full web pages is slightly easier than on my Blackberry 8220 because it kind of jumps to the form elements in the page. I have encountered an occasional site that didn't work to well, but overall it's pretty good.

Skyfire - Skyfire is a 3rd party browser for S60 which supports a wider range of websites and content types (like flash). I downloaded it because Hulu.com worked with it, however hulu.com seems to have started blocking Skyfire for whatever reason. Oh well at least it's still useful for watching, umm, other flash stuff on my phone.

Gravity - Very good Twitter/identica application that does pretty much exactly what you would expect such an app to do (and does it better than some desktop apps).

SpbTV - OMG this was so worth the $15, something like 100 TV channels from around the world streamed to your phone (a lot of it is news and the like, don't expect to watch CSI on your local station on here) in two different quality levels. I highly recommend checking this application out, they have a trial version on the Handango website.

Google Maps - I like that this has free traffic info, unlike the Nokia maps program but it's not as useful for actual driving usage as the Nokia maps program.

Nokia Maps - Good for walking, and OK for driving, but totally not a replacement for a "real" GPS system for driving. I wouldn't even consider using this instead of my Magellan GPS if I were driving someplace unfamiliar. Something that would make this app really cool though would be if they would partner with Dash Navigation and upload traffic data from your car so that traffic info is available for every street.

Nokia Map Loader and Maps Updater - The desktop programs to update the map software and to install new maps are totally different applications, these really should be one. Also the Map Loader is horribly ugly and has flashing text :-/

YouTube - The YouTube app for S60 is great. It does exactly what I would expect it to do.

PhoneLocator - Neat little app that runs in the background and uploads your GPS position to a server which then plots this info on googlemaps. Some people could find some major privacy concerns with this, but it could be useful if your phone is lost because you can see where it's going.

mShell - An on-board programming environment and compiler. Pretty neat, however with on-board Python now it would be silly to learn the "m" programming language even if it is pretty C-like

Python - I love the geek factor of having a Python shell on my phone! I actually took the time to tap out a small test program to pop up some menus and such directly on the phone. Seriously though, being able to write little apps in Python is a big plus for the Symbian platform. (of course you would normally write them on your computer then push them out to the device, not tap the whole thing out using multitap).

Ovi Store - I have bought a few things from here, and it could be cool but it's almost impossible to navigate. For instance under the "Audio & Video" category, the sub categories are "Music", "Podcasts", and "Video". If you select Video you get about 100 pages of video clips which are not categorized any further, making it very very difficult to find something interesting. I have also had trouble with the actual buying stuff process, more than once when I tried to purchase something I got an error message saying they were having trouble with their payment service please try again later. The one really big complaint that I have, though, is the lack of integration. Right now you have the Ovi Store and the Music Store and you can't download maps/voices for the GPS application through either. I assume Nokia intends to start integrating all this stuff into one place, but it's not there yet.

Music Store - I found several things I wanted to purchase here from major artists, but during the checkout process I was supposed to click a button to confirm purchase after entering my credit card details, but the button wasn't there and there was no obvious way to complete the transaction. Thinking it may have been a one-time bug I quit the app and re-started and tried again, same thing... that was kind of frustrating. Also having to sign up for a separate Music Store account after just signing up for an Ovi Store account was a bit annoying (why can't they use the same login at least?)

Handago InHand - Easier to navigate than the Ovi Store, but not much in the way of content. The Handango website has a lot more stuff for my phone.

Podcasts - The built-in podcast app is pretty good, it does both video and audio podcasts in several formats. It does not, however, play ogg files and yet the "podcast directory" on the device still lists podcasts which use ogg.

Typing - The thing I miss the most from my Blackberry is the SureType keyboard, this T9 stuff just doesn't cut it for typing anything longer than a couple sentences, where on my Blackberry I could easily type several paragraph emails.

Facebook - or lack there of, WTF? There is no Facebook app for S60v3. On my Blackbery the Facebook app would automatically add people to my contact list, update their photos, update their contact info, put their birthdays into my calendar, etc. It was great! I really miss this... this plus the typing thing makes me think about upgrading to a Nokia N97.

Consistency - Blackberry applications are very good at being consistent from one app to the next, Symbian apps not so much.

Overall - Some good stuff, and some stuff that still needs a lot of work. Maybe Symbian v5 addresses some of the issues *shrug*. I can say that this version is a heck of a lot better than Symbian version 2 was!

jeudi 26 février 2009

Installing WAMP

I needed to install Apache, PHP, and MySQL on Vista for a project I am working on. I downloaded XAMPP which I had used several years ago for this purpose and it worked great... well that was on XP I ended up spending a couple days trying to get its Apache installation to work on Vista and never did get it actually working (and a Google search showed that I was not alone).

Then I remembered that BitNami had a WAMP installer. I downloaded it and for some reason the installer took a couple mintes to start which worried me. Once it started, though, the installation was really straight forward and most importantly it worked right out of the box without having to do anything else! :-)

lundi 21 janvier 2008

Starbucks discontinuing organic milk

Starbucks has announced that they will be discontinuing organic milk; of course some people are up-in-arms over it, but what does it mean for the customers and the company as a whole?

  • While organic milk is being discontinued, Starbucks has completed the process of ensuring all of the "normal" milk is rBST free, which I think is what most people are worried about anyway.

  • During my six or so years at Starbucks (at 7 different stores in 2 states), I personally made no more than 3 beverages using the certified organic milk (thats about 0.0001% of the total beverages I made during that time by my estimates).

  • The organic milk that Starbucks offered was asepticaly packaged (or as they call it here in Germany "H-Milk") which means it was ultra-super-insanely Pasturized then packaged into a sterile container so that it can sit on the shelf for a year, unrefridgerated (until you open it, then it lasts about a week in the fridge). This process makes milk that tastes, well, not as good.

  • One estimate I have read states that between 50-70% of the "normal" milk Starbucks uses is organic, it's just not certified as such (although this is probably impossible to actually prove).


There was possibly a bit of a chicken-and-egg problem in that the organic milk that Starbucks used tasted gross, so no one ordered it, which meant there was no demand for it, which meant there was no reason to move to non-asepticaly packaged organic milk which is WAY more expensive. And the cost of organic milk and low anticipated demand is why they chose to use asepticaly packaged milk in the first place.

Some people have asserted that Starbucks should go to using only organic milk then, and that rBST-free is not enough. It is my opinion, though, that most of these critics don't go to Starbucks anyway - it's usually the anti-Starbucks-no-matter-what-they-do crowd that says such things. For the people that do visit Starbucks, going all organic would probably mean (this is an educated guess here) a 10-20% price increase. Considering the state of the US economy at the moment I don't think anyone wants that.

Some argue that ${localCoffeeShop} can offer all organic milk, so Starbucks should be able to also. This kind of agility is what makes local coffee shops succeed (and even thrive) even when there is a Starbucks right next door; it's very difficult for a company to be both large and agile. Starbucks can be agile in some respects but in general its fairly slow to make changes - especially ones that impact such a core component of their business.

Additionally, many Starbucks simply do not have access to a reliable source of large quantities of fresh organic milk - a normal sized Starbucks can go through something like 100 gallons (380 liters) of milk a day. When you put 200 of them into one city the amount of milk required adds up really fast... In an ideal world, all Starbucks would use a local source of organic milk, but I do not at all believe the needed supply for this is available... it took, what, 5 years just to get all of the dairies Starbucks uses to commit to being rBST-free.

Ultimately, though, considering that Starbucks is currently entering a phase of getting rid of some of the least ordered products to trim the line-up a bit (Almond syrup and Creme Light beverages are going away too), organic milk, in its current form, is an obvious choice for this sort of cut.

If you really want and/or need organic milk, the soy milk that Starbucks uses (if I remember correctly) is certified organic. And if you can't and/or won't drink soy, then chances are there is a small coffee shop in your town that offers fresh organic milk, which is way better than the aseptic stuff anyway.

samedi 19 janvier 2008

Private implementation slots

Disclaimer: this article descrbes techiques that are not part of the public Qt API, using them may result in non-portable or version specific code. The example below was tested with version 4.3.3 on 64bit Linux.

Ok so, now that we have the disclaimer out of the way... If you are a Qt developer you are probably familiar with the concept of private implementation, or "pimpl" classes. If not, well, I won't get into that here, but if you look it up on Google or Wikipedia you should get the idea fairly easily.

Now, say you have a private class and you want it to have slots . One way is to add a slot to your public class then have it call the method you want in the private class, but this means you have to add a method to public API which means you break binary compatibility. Another is to have your private class extend QObject, but this adds overhead. Another way is to use the Q_PRIVATE_SLOT macro, which I will explain here.

First lets look at how to set up the private class.

file: slotTest_p.h

#ifndef SLOTTEST_P_H_
#define SLOTTEST_P_H_

#include "slotTest.h"

class slotTestPrivate
{
Q_DECLARE_PUBLIC(slotTest)
public:
slotTestPrivate(slotTest * qq) : q_ptr(qq) {}
private:
void bob() { qWarning("bob!"); }
slotTest * q_ptr;
};

#endif

The Q_DECLARE_PUBLIC(slotTest) macro definition is:

#define Q_DECLARE_PUBLIC(Class) \
inline Class* q_func() { return static_cast(q_ptr); } \
inline const Class* q_func() const { return static_cast(q_ptr); } \
friend class Class;

The main purpose of this is to define a q_func() method to make sure we can accesses it with the correct const-ness and ensure its cast to the correct type. In practice, when implementing methods of the private class you should virtually never use q_func() or q_ptr directly; instead you should place the Q_Q(Class) macro, which is defined as: #define Q_Q(Class) Class * const q = q_func(), at the beginning of the method implementation. From then on in the method you can use the pointer q to refer to the public class. For example:

void myClassPrivate::someMethod() {
Q_Q(myClass);
q->setText("hello world!");
}

Ok, so now we have our private class, lets create the public class.
file: slotTest.h

#ifndef SLOTTEST_H_
#define SLOTTEST_H_

#include <QtCore/QObject>

class slotTestPrivate;
class QTimer;

class slotTest : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(slotTest)
public:
slotTest();
private:
Q_PRIVATE_SLOT(d_func(),void bob())
QTimer * timer;
slotTestPrivate * d_ptr;
};

#endif

It's important that you don't include the actual private file here, otherwise you will get errors like:

slotTest_p.h:8: error: ISO C++ forbids declaration of ‘slotTest’ with no type
slotTest_p.h:8: error: ‘slotTest’ declared as an ‘inline’ field
slotTest_p.h:8: error: expected ‘;’ before ‘*’ token
slotTest_p.h:8: error: expected `;' before ‘inline’
slotTest_p.h:8: error: ISO C++ forbids declaration of ‘slotTest’ with no type
slotTest_p.h:8: error: ‘slotTest’ declared as an ‘inline’ field
slotTest_p.h:8: error: expected ‘;’ before ‘*’ token
slotTest_p.h:8: error: expected `;' before ‘friend’
make: *** [main.o] Error 1

We have to include the Q_OBJECT macro here even though this example class doesn't actually have any signals or slots of it's own because otherwise moc won't even look at it in the first place.

The Q_DECLARE_PRIVATE(Class) macro is just the counterpart to the Q_DECLARE_PUBLIC(Class) macro except it creates a method named d_func() to access the private class. Likewise, there is a Q_D macro for use inside method implementations so you can use d as a pointer to the private class.

The Q_PRIVATE_SLOT macro takes a pointer to your private class, and we will take advantage of the d_func() method to get it. Next is the signature of the private class' method to call. One interesting thing about this macro is that it directly expands to no actual code - it simply a trigger for moc.

We are also creating a QTimer to call this slot repetadly for the example.

Now our implementation:
file: slotTest.cpp

#include <QtCore/QObject>
#include "slotTest.h"
#include "slotTest_p.h"
#include "moc_slotTest.cpp"

slotTest::slotTest() : QObject()
{
d_ptr = new slotTestPrivate(this);
timer = new QTimer(this);
timer->setInterval(1000);
connect(timer,SIGNAL(timeout()),this,SLOT(bob()));
timer->start();
}

The most important thing to notice here is that we have listed the moc-generated moc_slotTest.cpp file as an include, doing this ensures that slotTestPrivate has been defined before the moc file is processed. If you were to not include of this file here, you may get an error like:

/home/kdab/workspace/prtst/slotTest.h:10: undefined reference to `vtable for slotTest'

Here, we just set up our private class, a timer, and connect the timer to call our slot. Notice that even though the method we are calling is inside our private class, we still use this in the connection because the slot is technically a slot of our public class, even though the implementation is in the private class.

Now lets make it runnable:
filename: main.cpp

#include <QtCore/QCoreApplication>
#include "slotTest.h"

int main(int argc,char* argv[])
{
QCoreApplication app(argc,argv);
slotTest bob;
app.exec();
}

And one final very important thing, the project file...

TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += slotTest.h slotTest_p.h
SOURCES += main.cpp slotTest.cpp

It's very important that slotTest.h is listed before slotTest_p.h otherwise you will end up with the following error:

moc_slotTest.cpp: In member function ‘virtual int slotTest::qt_metacall(QMetaObject::Call, int, void**)’:
moc_slotTest.cpp:64: error: invalid use of undefined type ‘struct slotTestPrivate’
slotTest.h:5: error: forward declaration of ‘struct slotTestPrivate’

Once you have it built, you should see "bob!" printed to the screen every second from the bob() method in the private class.

lundi 14 janvier 2008

Multiple inheritance and Q_OBJECT

I found out today, while working on porting a Motif application to Qt, that when you are inheriting from more than one class and not all of them are derived from QObject, you should make sure the first one does inherit QObject if you want to use the Q_OBJECT macro. For instance:

class A : public QObject {};
class B {};

class C : public A, public B
{
Q_OBJECT
};

If you do it the other way, (class C : public B, public A) you will get errors inside the moc_C.cxx file saying that it couldn't find the QMetaObject members of class B (which it doesn't have) because moc only looks at the first base class listed.
There all sorts of other little things like this which you can read about in the Qt moc documentation (for instance, nested classes cannot have signals or slots).

dimanche 13 janvier 2008

Tall is small?

Lets start with one of the most universal questions in coffee, why at Starbucks (and thus many other coffee shops) is the small size called tall?

The answer is actually quite simple - it isn't (at least not at Starbucks where this strange cup size name thing started in the first place). The small size is called short, but a short cup is only 240ml(8oz.) which, in these times of excess, almost no one wants.

When Starkbucks first started serving brewed coffee (actually it was Il Giornale then, which later bought Starbucks and took over the name, but that is another story) the sizes were short, tall, and grande - which makes perfect sense. Thing is, almost no one was ordering the short, in fact more than 50% of sales were of the grande size - which is twice the size of a short, so seeing that people wanted bigger coffee, they added a larger size called Venti*, which means 20 in Italian (it's a 20oz.(591ml) cup.**) and eventually dropped short form the menu.

Starbucks does still carry the short cups, and all hot drinks are available in that size (there is no short cup for cold beverages) mostly because this is a handy size for things like double espressos, kid's hot chocolates, and the like. But with more than 50% of sales still being grande sized, there is little reason to advertise that.

* Starbucks has actually copyrighted this name, which is why at many other coffee shops tall and grande have the same name, but the largest size has a different one. I wont even go into the implications about copyrighting a number - but I guess the card game "Uno" did it to without destroying society.

** Actually only the hot Venti cup is 20oz., the cold version is 24oz.(710ml) which makes the name a bit silly.