Flex uploads via http/https

I heard that quite a number of people have issues when it comes to uploading file-content from a Flex application to a server. This is especially true if the upload happens as part of a “session”, meaning a user is authenticated and each HTTP request carries a sessionid back to the server. That sessionid is usually transported in form of a cookie.

So why do things break when trying to do uploads from Flex, especially when using Firefox? The explanation is pretty simple: when you select a file for upload (using FileReference.browse() and FileReference.upload() - see here for a discussion about “Working with file upload and download”) and then send that selected file to the server, Firefox uses two different processes. The first one is the one that hosts your Flex (Flash) application and communicates with the server on one channel. The second one is the actual file-upload process that pipes multipart-mime data to the server. And, unfortunately, those two processes do not share cookies. So any sessionid-cookie that was established in the first channel is not being transported to the server in the second channel. This means that the server upload code cannot associate the posted data with an active session and rejects the data, thus failing the upload.

To fix this we need to make sure that we transport all the necessary information with the upload URL allowing the server to associate the uploaded data with an active session.

It has been suggested elsewhere, like here or here to just tackle on the sessionid to the URLs used for the upload. That will work, but moves logic from the server into the client and I don’t like that. What if the sessionid-parameter gets changed on the server? What if a different server application is receiving the upload-data? In both cases you will need to make modifications to the client as well. You have an unnecessary dependency between client and server.

For a recent project we used a different approach: our flex application communicates via remoting calls with the server (we use Flex Data Services in this case). When a user is about to upload a file to the server, the Flex-application will issue a call getUserUploadURL(...). The receiving java-servlet will construct a one-time usable URL that encodes the users sessionid and a secret into the URL. The flex-code will in turn use that URL when the FileReference.upload() is executed. Once the server has received the data-stream for the current upload, the same URL cannot be used for subsequent uploads, instead the flex code has to ask for another url via getUserUploadURL(...).

And on the server side the upload-code makes sure that no cookies are considered, but only the contents of the URL are used to figure out which session the uploaded data belongs to.

Happy birthday girl!

Four years ago little Pia opened her eyes for the first time (not counting the few times that she exercised in the womb). Four years!!! I can’t believe how fast time has gone by since you’re with us. Sometimes it seems to stand still (especially when you’re throwing a fit), but most of the time it just flies!

Happy birthday little big girl!

(showing off some new clothes from the grandparents in Germany - unfortunately the camera did not want to auto-focus this morning and I did not get a chance for a second photo because of the low temperature)

Pumpkin Festival 2007

I’m a pumpkin myself for sitting on those photos for so long. Two weekends ago we went to the Santa Fe horsepark for the annual Pumpkin Festival. The horsepark organizes it every year to raise some money and boy do they make money. They usually have a number of rides for the kids, a stage with live music, a picnic area and lots of food stands. To use the rides, you purchase a number of tickets ($1 a pop) and then hand over 2,3 or 4 of them depending on the ride. We went through 25 tickets in no time and had to go for a refill. But it was all worth it seeing the joy on the kids faces.

I’m trying to use Adobe Share beta again for the photos. You can download a PDF document with all the photos using the little menu in the upper left corner.

Mirror, mirror on the wall

This is a hilarious prank. It’s in German. For those of you who don’t speak German: the pranksters rigged a bathroom using plain glass instead of a mirror, a mirrored copy of the room and identical twins who try to synchronize their movement:

Death special: How does it feel to die? - - New Scientist

After reading this: Death special: How does it feel to die? - New Scientist I think I take a decapitation with my latte. Oh well, what the heck, throw in an “Explosive decompression” as well …

Christina’s CRUSTy creations

I’m used to walk into a bakery and see at least 20 different kinds of breads. I’m appalled by the long isles of breads in the local super-markets: it’s white, soft “stuff” that fills your belly does not tickle your taste-buds in the same way as European bread does. Two blocks away from my apartment in Amsterdam was one of the most famous bakeries: you would enter this place and would be overwhelmed by smells that I’ve found nowhere else (and I’m talking about the good kind of smell). Bread would have a “crust” and by crust I mean something that actually makes a noise when you bite into it.

So, here I am in Santa Fe, New Mexico of all places. We are already blessed with over-average bread supplies. Take “Sage Bakehouse”, “Chocolate Maven” for example, they provide bread-goods that come pretty close to what you would expect from a European bakery. But things got just turned up a notch, when Christina decided to open her own business here in town.

Let’s roll back for a few months/years: I met Christina first when she was on her stationary bike at “Santa Fe Spa” trying to shed some pounds like everybody else in the room. I got introduced to her as yet another European who decided to make Santa Fe her primary place of residence. My (then) personal trainer Michele introduce the two of us, as “Germans who are supposed to hang out together”. Christina lives here with her husband Peter, just a few minutes away from where I live now. They decided to make Santa Fe their permanent residence after they had enough of Los Angeles. During a party I got to chat with her longer and after reminiscing about the old Vaterland, Christina told me that she was the daughter of the famous German actress, singer and writer Hildegard Knef. When I told my mom about it, she got all excited and told me to mention that she listens at least once a week to one of Hildegard’s many records.

Since then, we’ve been bumping into each other over and over again: a party here, a dinner there and during one of the dinners, Christina told me about her passion for baking. When the topic came up, her husband Peter was the one who was raving about Christina’s skills, because he had the pleasure to sample it time and time again over the years. Soon after that I was in that lucky position as well, when a loaf of home-baked bread and some croissants were given to me as a present. At first I could not believe that she had done that stuff herself, but she assured me that everything came out of her kitchen. The croissants were as close to the real thing as they could possibly get. And the bread was just to die for.

After seeing (and tasting) what Christina was capable off, I told her: “You should turn this into a business!”. The same thought had crossed her mind before and I think she just needed some more reaffirmation from others before venturing off and actually implementing it.

Fast forward to now: A few weeks ago Christina got her business license and now operates a business out of her home called “Crust LLC”. On Wednesday last week she was here at my home and brought some more baked goodies (”Chocolate Croissants”!!!!) while we enjoyed a meal of Bavarian Pork Roast, potato dumplings and her home-made red cabbage (”Blaukraut”). On that day she also handed me a brochure with all the stuff she can prepare at her home. You can see the brochure below. Just look at all the stuff she can do - quite amazing:

So, if you are in the Santa Fe area (no shipping yet) and want to treat yourself to some yummy baked goods, I can only highly recommend Christina. Her phone-number and email-address is on the brochure. Tuesday, Friday and Saturday are delivery days. You need to call/email at least 48 hrs in advance to get your items on those days.

Good luck Christina - I know you won’t need it. And then let’s implement that “fresh rolls delivery service every morning” next …. ;-)

Columbus Day 2007

The US has the weirdest holidays (not that other countries have fewer of them). Today was one of them: Columbus Day. You celebrate the day that somebody discovered the American continent, knowing that he wasn’t the first one. Some states observe it, others don’t. Most companies ignore it and official places (like the Post Office) use it to catch up on work that they should have done weeks ago (which translates to no official Mail Service on that day).

Schools also seem to take the opportunity to give kids an extra day off and cause headaches for (working) parents to find alternatives for the day. I took off today and had Pia with me since 8:30am this morning. Initially we had planned to go up to the mountains and take a hike amidst the turning aspens, but the thermometer made us revisit those plans. Nature decided to turn off the heating for last night and this morning. When I went downtown to pick up Pia, my car told me it was 38 degrees Fahrenheit out there. That combined with some strong winds made us decide to skip the trip to higher elevations. Instead Miles, Mason, Heidi, Pia and I took the dogs for a long walk in the neighborhood. On the way back the kids started to collect shiny, sparkling and interesting rocks. Pia had collected so much stuff that she had a hard time carrying all of it.

Back home the kids sat out in front of the house and used brushes to clean their booty:

All that walking and brushing made Pia really tired and she had an almost two-hour nap. When she got up she was rewarded for her long nap with a popsicle out in the front. Funny enough, temperatures had risen to a t-shirt-worthy 70 degrees by 4pm:

The Associated Press: Bush to Veto Child Health Plan

The Associated Press: Bush to Veto Child Health Plan - you got to be kidding me?!?! George, you’re cutting off support for children who can potentially become soldiers in your future wars - did you know that?

Adobe “SHARE beta”: the cat’s out of the bag …

For the past few months I’ve been working on the front-end of the Adobe SHARE (beta) service. “Front-end” here means the Flex-code that makes up the stuff you see in your browser and that connects to the back-end service that does the heavy-lifting. Almost every action in the user-interface sends a message back to the server with instructions on what to do with the user-supplied data.

The service (along with the “Virtual Ubiquity” Buzzword acquisition) was announced at this year’s Adobe MAX conference in Chicago.

“Adobe SHARE beta” is a web-service that allows you to send “documents” to a number of recipients. You can pick whether you want to have those recipients as the only recipients or whether it is allowed to re-share the documents. 1 GB of free storage should be enough to get you going. Besides pushing (email) data to your recipients, you can also upload documents to the service and embed a preview of the document on your own web-site/blog.

Adobe

The Flex-UI allows us to add some distinct value: you can preview a (growing) number of document-formats right in your browser. This allows you to figure out whether it’s worth to download a document.

There were tons of features that were cut from the application before it’s public release and we are planning to (re-)add those before we reach the 1.0-milestone of the service.

Give it a try and let me know what you think.

Three hours of twiddling my thumbs

At precisely 9:15am this morning power to my home was cut. I was still out, dropping off Pia at school and when I returned and tried to open the garage door, it would just stare blankly at me and not cooperate. Initially I thought the battery in the garage-door-opener had died, but when I entered the house through the front door I knew immediately that I had a bigger problem: there’s usually a low-frequency “humm” in my home from all the 24/7 devices and it was eerily quiet in my home after I opened the door. Oh, great - power was out again. I have to admit that I had a lot less problems here in the “La Vida” subdivision compared to the way more frequent outages in Tesuque, but still, it sucks every time it happens.
Called PNM at 10am to report the outage and I’m surprised to hear that I’m the first one who reports an outage for the “La Vida” subdivision. The lady on the phone does not have a clue what’s going on and can’t provide an estimate on when power would be restored. Luckily the iPhone is fully charged and I can read/write emails while the power is out.
I take the car to one of the neighbours homes across the street and find out that they still have power. I drive back to the “Aldea” subdivision where I saw some PNM-trucks on my way home. They claim that I’m on a different circuit and that their work does not have anything to do with my outage.

It takes two more calls into PNM (at 1-hr intervals) to finally get the power restored (at 12:20pm). Three hours!!! What is this? A third-world country? In all those years that I lived in Amsterdam and Munich, I don’t recall having power outages that lasted more than a few mins. Same at my parent’s place in Aichach, which is a tenth of the size of Santa Fe.

The electrical grid in the US scares the sh*t out of me. Every time I visited New York, I was wondering how that city was still operating: it just seems like a giant patchwork that’s held together by duct-tape and super-glue. If I was a terrorist I would have a pretty good idea on how to make things come to a standstill here: just remove one of the duct-tapes …

|