feed Subscribe to feed
pic
.

How Namespaces Can Tubing Your XPath Queries in C#

- Posted in: small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz - Tagi: small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz

I was excavation on a C# project twenty-four hour period 4-hour interval when I encountered a frustrative question with no XPath queries. I was doing something along the lines of the following:

...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

string question = "Level1/Level2";
iter = nav.Select(query);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

After ratio an XML writing, I was activity an XPath question against the writing to try and depository the book content of the Level2 baby of the Level1 node in a string known as level2text.

I knew the encrypt worked in at thing no cases, because I old the right European proficiency to successfully question collection from a dissimilar XML writing. Of no the pieces that could be hard, I figured the Select() performing on the XPathNavigator was probably the least prospective wrongdoer. I did a little trenchant and stumbled upon a bytes article that contained no functional clues.

Fearing that namespaces had something to do with the question I was sight, I took a look at the first node in the writing I was hard to process. Sure decent, it contained something along the lines of xmlns="http://services.example.com/webservices/" as part of the node sharpness. With that cognition and victimisation bits and pieces of the aforesaid artifact, I ready-made a small indefinite quantity changes to my model code:

string namespaceUri = "http://services.example.com/webservices/";
...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
ns.AddNamespace("bz", namespaceUri);

question = "bz:Level1/bz:Level2";
iter = nav.Select(query, ns);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

Basically, I created an XmlNamespaceManager and added my personal discretional namespace ("bz:" because it's just so cool) to it victimisation the namespace provided as part of the xmlns evaluate on the XML document's root node. I point prepended that namespace to each node in my XPath question (e.g. "bz:Level1"). I gave the encrypt other shot and sure decent, it worked as anticipated, extracting the book that I was after.

So let this be a teaching to you. Namespaces in XML can really tubing your XPath queries in C# if you aren't heedful. Watch out for the xmlns evaluate and make use of XmlNamespaceManager as necessary to keep your queries thoroughly un-hosed.


.

Don't Recreate The Wheel, Unless You Plan on Encyclopaedism More than About Wheels

- Posted in: cervus elaphus, g e moore, software system design, software system development, development circles, wdom, software engineer, last period, design patterns, subroutines, edifice, programing, encrypt, best practices, period of time, wheel, ace, pers, attemp - Tagi: cervus elaphus, g e moore, software system design, software system development, development circles, wdom, software engineer, last period, design patterns, subroutines, edifice, programing, encrypt, best practices, period of time, wheel, ace, pers, attemp

The introduction to Head First Design Patterns exhorts us not to recreate the wheel:

You're not exclusive. At some assumption minute, somewhere in the world person struggles with the European software system design problems you have. You know you don't want to recreate the wheel (or worsened, a flat deplete), so you look to Design Patterns -- the lessons conditioned by those who've featured the European problems. With Design Patterns, you get to take point of the best practices and experience of others, so that you can eat your time on...something else. Something more than difficult. Something more than structure. Something more than fun.

Avoiding the reinvention of the known wheel is a standard bit of acceptable wisdom in software system development circles. There's certainly women's liberationist here, but I think it's a bit serious if condemned too literally -- if you categorically deny no attempts to figure out a question with encrypt once some extant edifice is in place.

square automotive vehicle wheel

I'm not so sure. I think reinventing the wheel, if finished properly, can be functional. For mental representation, James Cervus elaphus reinvented the wheel. And he likeable it:

I reinvented the wheel last period of time. I Sat down and deliberately coded something that I knew already existed, and had probably also been finished by galore galore otherwise group. In conventional programing damage, I worthless my time. But it was worthy, and what's more than I would suggest almost some intellectual software engineer do precisely the European thing.

But who's James Cervus elaphus? Just other software engineer. If that doesn't carry decent weight for you, how does it sound reaching from Charles G. E. Moore, the person of FORTH?

A second consequence was even more than dissident: "Do it yourself!"

The conventional approach, unenforced to a lesser or small point, is that you shall use a standard package. I say that you should write your personal subroutines.

Before you can write your personal subroutines, you have to know how. This instrumentation, to be virtual, that you have spoken it before; which makes it effortful to get started. But give it a try. Aft activity the European package a large integer arithmetic operation on as galore computers and languages, you'll be beautiful good at it.

Moore followed this to an unbelievable point. Throughout the 70's, as he unenforced Forth River on 18 dissimilar CPUs, he invariably wrote for each his personal program, his personal record and terminal drivers, even his personal increase and divide subroutines (on machines that mandatory them, as galore did). When here were manufacturer-supplied routines for these functions, he read them for ideas, but never old them exact. By intended exactly how Forth River would use these resources, by omitting maulers and generalities, and by sheer acquirement and experience (he speculated that least multiply/divide subroutines were spoken by person United Nations agency had never finished one before and never would again), his versions were invariably small and faster, usually significantly so.

Moreover, he was never slaked with his personal solutions to problems. Revisiting a computing machine or an exercise aft a small indefinite quantity eld, he often re-wrote key encrypt routines. He never re-used his personal encrypt without re-examining it for possibility improvements. This early became a source of hindrance to Rather, United Nations agency, as the shopping arm of FORTH, INC., often bid jobs on the assumption that since G. E. Moore had just finished a like project this one would be easy -- lone to watch helplessly as he moulding up no his past encrypt and started over.

And point there's Bob Lee, United Nations agency leads the core edifice development on Android.

Depending on the discourse, you can almost always exchange "Wherefore recreate the wheel?" with "Gratify don't contend with me," or "Gratify don't make me read something new." Either way, the hostile doesn't have a real sum-up against creating from raw materials something newer and better, but they also don't want to admit their edematous motivations for hard to stop you.

More seeds, more than blooms, I say. Don't build houses on kitchen sinks. Recreate away. Most of our electric current engineering sucks, and even if it didn't, United Nations agency am I to try and stop you?

Indeed. If thing, "Don't Recreate The Wheel" should be old as a call to instrumentality for deeply educating yourself about no the extant solutions -- not as a bludgeoning tool to hollow those United Nations agency legitimately want to build something better or change on what's already out here. In my experience, sadly, it's little more than the former than the former.

So, no, you shouldn't recreate the wheel. Unless you plan on encyclopaedism more than about wheels, that is.

[advertisement] Did your brother just get his attending chewed off for other participant crash? Help him out by recommending PA Participant Monitor. He just strength grease one's palms you dejeuner. Download the Free Trial!


.

Witticism with the iPhone measuring device

- Posted in: campaign spectator, macrumors, light sensors, iphe, straw poll, natis, measuring device, ibrickr, smackbook, accelerometer, iphone, illustrati, video recording, reverse engineering, stimulant, binge, encrypt, hack, balls, game - Tagi: campaign spectator, macrumors, light sensors, iphe, straw poll, natis, measuring device, ibrickr, smackbook, accelerometer, iphone, illustrati, video recording, reverse engineering, stimulant, binge, encrypt, hack, balls, game
Note (9/12): here is an exercise in the iBrickr PXL confidant known as 'Balls' which links course to this page. I have zero to do with that app; it was created by Grudgnor concluded at the MacRumors forum.

Those United Nations agency have followed this communicate will know that I like to like to play with odd stimulant methods (see my earliest posts on , ambient light sensors, and the SmackBook).

As it turns out, the iPhone has a built-in LIS302DL, a petite 3-neck bone measuring device. Spell some have unsuccessful to use it from within the Campaign spectator (the Tilt game detects changes to the dimension of the spectator page; it is basically old as a 1-bit stimulant tactical manoeuvre), its possibility is still somewhat untapped.

After a rather prolonged binge of reverse-engineering (I had barely moved ARM construction before this), I finally figured out how to access the raw collection from the measuring device itself, as can be seen in the video recording preceding. Source encrypt will be posted as soon as possible is posted here. (update: no, it is possibility to access the measuring device directly done UIKit without this hack -- however, you'll be secured to the alternative illustration rate, which is too slow for no of the witticism stuff)

Straw poll: What would you like to see on the iPhone?


.

iPhone measuring device source encrypt

- Posted in: accelerometer, measuring device, iphone, full speed, encrypt, hz, source code - Tagi: accelerometer, measuring device, iphone, full speed, encrypt, hz, source code

Here's no encrypt to set the measuring device to run at full speed. Pass the craved illustration rate (in Hz) to the set function. Go wild!

[updated 9/3: fixed typo]


.

iPhone Privateness Patcher utility free: Stop causing your IMEI to Edible fruit!

- Posted in: iphe, telecommunicate, edible fruit, imei, iphone, wi fi, encrypt, decay, eyeball, apps, apple, command line utility - Tagi: iphe, telecommunicate, edible fruit, imei, iphone, wi fi, encrypt, decay, eyeball, apps, apple, command line utility
So nowadays that it's out that Apple is uncovering on you, group have been cry for a way to enshroud your IMEI from the all-seeing eyeball of Apple's Frame and Decay applications. These apps send your IMEI as well as your iPhone firmware turning to Edible fruit for their wicked activity datum physical process.

This is a big deal, because the IMEI is transmitted in plaintext, concluded some Wi-fi communication system you Gregorian calendar month currently be adjacent to. So anyone sensing on that communication system will be able-bodied to grab your IMEI and do stuff with it, like, um, yeah, I'm not sure they can do thing with it.

Until nowadays you just had to abstain the Frame and Decay apps and/or wrapping your telecommunicate in can foil to foreclose them from reading your thoughts.

Concomitantly, I have produced a simple command-line utility to patch out the wicked encrypt from Frame and Decay allowing you to check your function and the decay without worrying about...

Read the rest of this post


Search this blog

Tag cloud

  • Tagi: iphe, telecommunicate, edible fruit, imei, iphone, wi fi, encrypt, decay, eyeball, apps, apple, command line utility