libxml default namespace
No CommentsCan’t find your nodes? Neither could we. So it turns out that Xpath doesn’t behave well with default namespaces. This is what Corey and I figured out…hope it helps.
Example XML
<Response xmlns=”http://www.badpopcorn.com/solutions”>
<solutions>
<solution>Don’t got any</solution>
<solutions>
</Response>
Although you can load it into a document, you can’t find any nodes without a little hack (using the word little loosely). Ruby example.
doc = XML:Document.file(’http://badpopcorn.com/file.xml’)
dn = ‘dn: http://www.badpopcorn.com/solutions’
doc.find(’//dn:solutions’,dn).each do |node|
r = node.find(”dn:solution,dn).first.content
Yea, we know how you feel. Way to go Corey.
Posted in Life Stuff
No Comments
WoW to Go
4 CommentsPosted by mobile phone:![]()
I got a new thing to do while carpooling to work.
File info:
Type: image jpg
Size: 202.44 kb
WoW to Go
Posted in MoBlog
4 Comments
Use app:accept, screw the Atom Categories
No CommentsIt’s been a while since I’ve revisited the Atom Publishing Protocol, so I just had to review (briefly) the latest APP Draft (17) since it’s probably going to be the one that becomes an RFC standard. I noticed something that I must have overlooked before: the app:accept element. Without even looking through the past drafts, I have a gut feeling that it’s been in the APP for quite some time; and I have the feeling that I had a misguided pursuit of using Atom Categories as service type descriptions.
On the surface, one may think that the app:accept is just for giving the mime-type of whatever resource one wants to create in an APP Collection: jpeg, gif, some xml. Let’s look at the “application/xml” mime-type. It describes many many XML documents that represent many resources. One may be a shopping cart order, or it may represent a classified ad. And this is why I may have overlooked the accept element before: a generic mime-type is generally too broad for describing the semantic meaning of the Resource represented using said mime-type.
But, one can aptly describe the what “Service” a server will provide as a side effect after one POSTs a new Resource to a collection (for creation) by using the Accept Extensions as described in the APP app:accept section– note that app:accept refers to Accept Header section (14.1) in RFC2616. Examples of such side effects are the creation of other Resources in other Collections by the server.
So, in the app:accept example in the new APP Draft (17), it is implicitly suggested to use the “type” extension to describe, semantically, what a Collection will accept and process server side. Example: `application/atom+xml;type=entry` for normal atom entries. In my services now, I can add some extra domain specific restrictions on POSTed Resources with an app:accept like `application/xml;type=”http://example.com/online_orders/flower_basket_order.dtd”`. But don’t use DTDs, it’s just an example.
Or try `application/xml;type=com.example.some.resource.type`. Note that one has to be careful about quoting (”) values. In the first case, I had the separators (as defined in RFC26162) slash (/) and colon (:) in my URI; where as the second case had no separators. And also note that what one (as a good APP citizen) POSTs Resources, not RPC requests.
So what are Categories good for? I haven’t had much time to reflect on that, so maybe it’s good to use Categories if I had a generic “http://example.com/online_order.dtd” resource type that is used for all types of orders: flower baskets, bicycles, or electronics. Have a Collection for bike orders whose category may be “http://example.com/bikes”, and another for Flowers…
And all this makes sense to me because we want to be Resource Oriented, and mime-types are the preferred route in describing Resources. I say this is good stuff.
Posted in REST, Technology, XML
No Comments
Zurich
1 CommentAh, ok. The weather outside goes between rainy and sunny, but always plenty of clouds.
![]()
Frankfurt, DE
No CommentsPosted by mobile phone:![]()
I’m currently en route to Zurich with a stop over in Frankfurt. I can’t say much except that me brain is fried and my body’s aching from the long travel. Doubly so since I’ve been trying to work on the plane. Now I sleep for the last leg of the journey into Zurich. By the way, I wish t-mobile had a better international data plan.
File info:
Type: image jpg
Size: 138.57 kb
Frankfurt, DE
Posted in MoBlog
No Comments
Beautiful Day
No CommentsPosted by mobile phone:![]()
Lovely, just lovely.
File info:
Type: image jpg
Size: 254.66 kb
Beautiful Day
Posted in MoBlog
No Comments
Galaxy Game
1 CommentPosted by mobile phone:![]()
Los Angeles 2 - Chicago 0
File info:
Type: image jpg
Size: 225.01 kb
Galaxy Game
Work at the Beach
No CommentsPosted by mobile phone:![]()
I don’t think I’ve ever seen the Santa Monica beach so empty. The walk here was a really nice break from work.
File info:
Type: image jpg
Size: 116.02 kb
Work at the Beach
Posted in MoBlog
No Comments
I eyed the iphone up
6 CommentsWill the Iphone be a huge seller. Yes. Is it worth getting now. Nope.
Why will it sell?
It looks nice and it’s Apple. Apple has a devoted following. Some follow so blindly it makes successful suicide bomber recruiters give props. Apple makes great products but the iphone is riding the Apple branding like Turtle rides Vinnie Chase’s fame. People are now convinced that anything Apple releases will be good. I remember reading a TechCrunch article on this. I would give you the link but I don’t enjoy searching the TechCrunch site. Anyway, the article showed a poll where an overwhelming amount of people felt the iphone was the best cell phone. This was crazy then because most peopled polled most likely never held or even seen the product. This is very similar to the Lebron James NBA draft. People were convinced that this kid was going to be the greatest thing since sliced bread without knowing much about him. They just knew that he was on ESPN every hour.
Simply put. It’s too hyped not to sell but that doesn’t mean its going to change the world. Well, not right away.
Why is it not worth buying yet?
Was Lebron James amazing his rookie year? Yes, but he wasn’t the best player in the league. Will the iphone be a good product when it comes out? Yes, but it won’t be the best cell phone available. It is the first version of a product chain that Apple has never released. There will be problems in the first version, probably big problems. I want one but I would rather wait for the second version after real user bugs have been found. Let the sixteen year old kid with sticky fingers text every five minutes for about six months.
Is it over priced?
Depends on how you look at it. Apple somehow convinced a large amount of people to spend three hundred dollars to get a video ipod that they don’t watch that much video on. Think of all your non geeky friends that have a video ipod. I am willing to bet that more then half of them don’t really watch videos on it and probably don’t use up all the disk space. So why do they have it?
It looks nice and other people want/have it. Yea, thats it. Apple made sure that the iphone looked amazing. It’s just like the hot chick your friends all want to hook up with. At first its all about the looks and the reputation you get when you have her. It’s only after a few months you realize her touch screen interface has major drawbacks and you might have been better off waiting a year for her sister to be legal.
Upate (June 26th 6:04 pm)
CrunchGears has some reviews up. My favorite has been Mossberg’s and Pogue’s videos.
Pros I didn’t expect
- You get used typing on it and it becomes easy
- The wifi feature seems amazingly cool
- Internet browsing might actually work on a phone now
Cons
- The battery is sealed inside so if it gets messed up you have to send it back to apple.
- The regular data connection uses AT&T edge which supposedly sucks.
- No Flash or Javascript
The internet feature looks remarkable. I shall write a comment to this blog about it later.
Posted in Apple, Technology
6 Comments
Angels Game 2
No CommentsPosted by mobile phone:![]()
Where’s Moe?
File info:
Type: image jpg
Size: 246.86 kb
Angels Game 2
Posted in MoBlog
No Comments