Exclusive Benjamin Franklin information, Franklin timeline, and Time Management mini course
EXCLUSIVE Benjamin Franklin Information Interview
by Nightingale Conant
Tuesday, April 26, 2011
InfoQ: Software Engineer best rated Job in 2011
InfoQ: Software Engineer best rated Job in 2011
According to careertrack.com the best rated job in 2011 is Software Engineer, at least in the US. 200 professions across various industries, skill levels, and salaries have been surveyed to calculate the ranking which is determined by taking the work environment, physical demands, outlook, income and stress into account. Computer Systems Analysts ranked at 5th position, software programmers at 27th position.
According to careertrack.com the best rated job in 2011 is Software Engineer, at least in the US. 200 professions across various industries, skill levels, and salaries have been surveyed to calculate the ranking which is determined by taking the work environment, physical demands, outlook, income and stress into account. Computer Systems Analysts ranked at 5th position, software programmers at 27th position.
Monday, April 25, 2011
Online Alarm Clock
Online Alarm Clock
Ingeniously simple web (Flash) tool to make a sound at wake you up at selected time.
Just make sure to keep the browser tab open and speakers turned on...
Once loaded, the online alarm clock will work even if Internet connection goes down.
Saturday, April 23, 2011
Micro ORMs - Simple is Fast
Podcast:
Hanselminutes: The Rise of the Micro-ORM with Sam Saffron and Rob Conery
dapper-dot-net - Simple SQL object mapper for SQL Server - Google Project Hosting
Massive by Rob Conery @ GitHub
Performance of SELECT mapping over 500 iterations (from Dapper's web page)
Method | Duration Static | Dynamic
Hand coded, SqlDataReader | 47ms | -
Dapper | 49ms | 52ms
Massive | - | 52ms
SubSonic | 107ms | 3619ms
NHibernate SQL | 104ms | 118ms
Linq 2 SQL | 181ms (static), 559ms
Entity Framework | 631ms | 859ms
SqlDataReader is "old" technology, a lot of code... but FAST
Linq 2 SQL was "new" 2 years ago, now is "old"
Entity Framework (EF) is "hot new"... by Microsoft
NHibernate is popular open-source...
Massive is total of only 364 lines of code, Done by a single person (ex-Microsoft)
The key "feature" is use of dynamic "ExpandoObjects" from .NET 4.0, instead of "proxy" classes that are typically created by ORM tools for each db table. It is not the same, since without proxy class there is no IntelliSense.
This makes C# closer to Ruby, as author intended.
And since it is dealing with direct SQL queries, performance is very good.
Dapper is developed and used for hugely popular web site Stack Overflow.
The performance is key in this case. StackOveflow was able to become
one of most popular sites on web running on only one server, much later on total 3 servers! 4-10 times faster data access is a big deal in that case.
While ORM's raw speed is important, API syntax and developers productivity is also,
and both LINQ and EF are very convenient to use, making developers productive.
In fact, most of .NET developers use "binding" of UI components to data source,
not even observing data access... and many times sacrificing performance.
I have created and used similar wrappers of SqlDataReaders,
this is a universal need... It would be worthwhile to have a test platform
for measuring and comparing both usability and performance of alternative
data access approaches, including various NoSQL solutions.
Microsoft currently has a huge focus on EF... hope they will tune the speed also,
since 10x slower (if we can trust reports) may be too big performance price for API convenience.
Hanselminutes: The Rise of the Micro-ORM with Sam Saffron and Rob Conery
dapper-dot-net - Simple SQL object mapper for SQL Server - Google Project Hosting
Massive by Rob Conery @ GitHub
Performance of SELECT mapping over 500 iterations (from Dapper's web page)
Method | Duration Static | Dynamic
Hand coded, SqlDataReader | 47ms | -
Dapper | 49ms | 52ms
Massive | - | 52ms
SubSonic | 107ms | 3619ms
NHibernate SQL | 104ms | 118ms
Linq 2 SQL | 181ms (static), 559ms
Entity Framework | 631ms | 859ms
SqlDataReader is "old" technology, a lot of code... but FAST
Linq 2 SQL was "new" 2 years ago, now is "old"
Entity Framework (EF) is "hot new"... by Microsoft
NHibernate is popular open-source...
Massive is total of only 364 lines of code, Done by a single person (ex-Microsoft)
The key "feature" is use of dynamic "ExpandoObjects" from .NET 4.0, instead of "proxy" classes that are typically created by ORM tools for each db table. It is not the same, since without proxy class there is no IntelliSense.
This makes C# closer to Ruby, as author intended.
And since it is dealing with direct SQL queries, performance is very good.
Dapper is developed and used for hugely popular web site Stack Overflow.
The performance is key in this case. StackOveflow was able to become
one of most popular sites on web running on only one server, much later on total 3 servers! 4-10 times faster data access is a big deal in that case.
While ORM's raw speed is important, API syntax and developers productivity is also,
and both LINQ and EF are very convenient to use, making developers productive.
In fact, most of .NET developers use "binding" of UI components to data source,
not even observing data access... and many times sacrificing performance.
I have created and used similar wrappers of SqlDataReaders,
this is a universal need... It would be worthwhile to have a test platform
for measuring and comparing both usability and performance of alternative
data access approaches, including various NoSQL solutions.
Microsoft currently has a huge focus on EF... hope they will tune the speed also,
since 10x slower (if we can trust reports) may be too big performance price for API convenience.
Friday, April 22, 2011
Tracking iPhone - Apple 2.0 by Fortune
Apple 2.0 - Fortune Tech: Technology blogs, news and analysis from Fortune Magazine
The map at right shows, for anyone who cares, where an iPhone has traveled in the Northeast since last June.
The map at right shows, for anyone who cares, where an iPhone has traveled in the Northeast since last June.
Zazzle T-shirts: "Does Leadership Matter?" (Stocks)
Stock on YOUR Watch
Interesting that historically Microsoft stock apparently outperformed Apple!
Fortune Magazine: The problem with Microsoft...
Apparently Microsoft's recent "steady" state of business based mostly on Windows and Office brands is producing a lot of money, but not a lot of investor's enthusiasm...
Zazzle solution: Developers, Developers, Developers, Developers
But developers make bugs... or do they?
Fortune, again: Let's give Steve Ballmer some credit
Forbes: "[Microsoft] forgets we are not 'eyeballs,' we are people. We aren't talking about column inches or gross rating points. We're talking about our reputations and the risks--privacy issues aside--of their inflation and potential devaluation. Even if Facebook could take that valuation and compensate us $15 billion for the use of our reputations, we would have to split that among 58 million other people. That's $258.62 per person. Are your friends and your reputation for sale for $258.62? We thought not. Facebook isn't worth $15 billion, either."
Well, it now seems the criticism was way off base.
Not only did the deal help Microsoft best Google for an ad revenue-sharing agreement with Facebook (i.e., strategic value), but the price seems like a bargain in light of Goldman Sachs agreeing to invest at a $50 billion valuation (i.e., financial value).
Interesting that historically Microsoft stock apparently outperformed Apple!
Fortune Magazine: The problem with Microsoft...
Apparently Microsoft's recent "steady" state of business based mostly on Windows and Office brands is producing a lot of money, but not a lot of investor's enthusiasm...
Zazzle solution: Developers, Developers, Developers, Developers
But developers make bugs... or do they?
"My software never has bugs... it just develops random features!"
Fortune, again: Let's give Steve Ballmer some credit
Forbes: "[Microsoft] forgets we are not 'eyeballs,' we are people. We aren't talking about column inches or gross rating points. We're talking about our reputations and the risks--privacy issues aside--of their inflation and potential devaluation. Even if Facebook could take that valuation and compensate us $15 billion for the use of our reputations, we would have to split that among 58 million other people. That's $258.62 per person. Are your friends and your reputation for sale for $258.62? We thought not. Facebook isn't worth $15 billion, either."
Well, it now seems the criticism was way off base.
Not only did the deal help Microsoft best Google for an ad revenue-sharing agreement with Facebook (i.e., strategic value), but the price seems like a bargain in light of Goldman Sachs agreeing to invest at a $50 billion valuation (i.e., financial value).
Samsung vs Intel in Chip Leadership, SSD vs HDD
Samsung is a fascinating technology company,
steadily increasing its share of market in many areas.
A few years ago "Samsung" was forbidden word in Sony.
Since, Samsung has taken over in TV sales...
Now, tanks to huge increase of ARM-based mobile devices,
Intel's global lead on CPU sales is challenged... by Samsung.
Samsung Challenges Intel For Chip Leadership
It appears as if the chip industry had a much better 2010 than 2009,
as the global semiconductor business is estimated to have gained about $70 billion in sales last year
...
Intel increased its sales expand to $40.4 billion in 2010, which translates to a 25.5% improvement over 2009 and a 13.3% market share. Samsung, however, jumped by 59.1% from $17.5 billion to $27.8 billion last year, according to iSuppli. The industry average was 32.1% in iSuppli's charts and 30.9% in Gartner's result.
In this growth path there are some loses: Samsung's HDD manufacturing is losing money,
despite quite decent products and reasonable prices... So there is more HDD market consolidation expected.
Seagate May Buy Samsung HDD Unit
On the other side, SSD drives, based on Flash memory, are growing as weeds,
and Samsung is again one of the leaders... competing head to head with Intel...
Strangely, Intel has sold its its XScale division that was making ARM based chips years ago... Since it was not as profitable as x86 CPU business... Now, there are no mobile phones with Intel chips, and even Microsoft is porting Windows 8 to ARM based chips...
steadily increasing its share of market in many areas.
A few years ago "Samsung" was forbidden word in Sony.
Since, Samsung has taken over in TV sales...
Now, tanks to huge increase of ARM-based mobile devices,
Intel's global lead on CPU sales is challenged... by Samsung.
Samsung Challenges Intel For Chip Leadership
It appears as if the chip industry had a much better 2010 than 2009,
as the global semiconductor business is estimated to have gained about $70 billion in sales last year
...
Intel increased its sales expand to $40.4 billion in 2010, which translates to a 25.5% improvement over 2009 and a 13.3% market share. Samsung, however, jumped by 59.1% from $17.5 billion to $27.8 billion last year, according to iSuppli. The industry average was 32.1% in iSuppli's charts and 30.9% in Gartner's result.
In this growth path there are some loses: Samsung's HDD manufacturing is losing money,
despite quite decent products and reasonable prices... So there is more HDD market consolidation expected.
Seagate May Buy Samsung HDD Unit
On the other side, SSD drives, based on Flash memory, are growing as weeds,
and Samsung is again one of the leaders... competing head to head with Intel...
Strangely, Intel has sold its its XScale division that was making ARM based chips years ago... Since it was not as profitable as x86 CPU business... Now, there are no mobile phones with Intel chips, and even Microsoft is porting Windows 8 to ARM based chips...
Monday, April 18, 2011
Prescription For Health Care: Apple vs Dell
Clayton Christensen’s Prescription For Health Care | On Point with Tom Ashbrook
In the 1990’s, big-thinking business guru Clayton Christensen was a colossus in the world of business theory. His “Innovator’s Dilemma” and theory of “disruptive innovation” were at the heart of the Internet revolution.
He introduced a new metaphor:
Apple's "system design" vs Dell "assembled components"
to suggest that health care needs a "system design",
rather than "more assembled components".
This metaphor has some potential!
I would suggest more precise and accurate comparisons,
Apple iPod/iPhone vs (Dell) Windows Pocket PC,
and Apple iPad vs Windows tablets.
and even MacBook Air vs Netbook PCs.
The more Apple does "systems design" the more successful products it makes!
Apple is using many common components like other computer companies,
with a twist: Apple controls whole system, including software.
PC/Windows provides universal software, and making many compromises...
"Something for Everybody vs Everything for Somebody"
While Apple's "systems design" does produce generally more usable products,
they usually do come with higher price, not lower,
and society does need to reduce health care expenses.
Is the metaphor lost?
No, just the opposite!
Here is are keys for answer: iPod, iPhone, iPad
Tablet computing was a "holy grail" of computing for a very long time,
and Microsoft was for long time attempting to "squeeze" Windows.
It didn't work!
It required re-thinking and solving specific problem very well.
I still have a Dell Axim x50v, with almost same components as iPod Touch, that was released 3 years (2004) before Apple's product (2007), at almost the same price. Dell has a beautiful VGA screen, 600Mhz ARM processor, any port and protocol one can think of, programmable...
And it didn't sell! What went wrong? No "systems design".
Here one example: when battery gets empty, all installed programs are LOST.
Need to re-install them, all. No kidding, full re-install,
including re-calibrating screen by using provided pen, not fingers.
Apple has prepared "just right" package of technology,
hardware, software, online store, and marketing, that "just works"
Enough to capture 90% of US market at one point,
and prepare for success of iPhone and iPad...
...
Finally, iPad has demonstrated that tablets could be useful,
if they do not try to be general-purpose computers as Windows tablets are attempted for years and failed. While windows tablets are "premium" and expensive products, thus limiting its reach, iPad is a focused, and highly optimized for its purpose:
apps and simple web browsing, instant-on, long battery life.
Even a full year after iPad launch, and with huge sales, there are no comparable product on the market! Most attempts to make similar "generic" products come more expensive than Apple's "systems design" device.
...
Christensen has suggested another useful key-phrase,
need for "health-care" instead of "sick-care" focus.
I guess it would mean "systems design" approach,
Apple-like simplified and integrated, solving a few problems well,
rather than many "good enough"...
What would that look like? A good question...
In the 1990’s, big-thinking business guru Clayton Christensen was a colossus in the world of business theory. His “Innovator’s Dilemma” and theory of “disruptive innovation” were at the heart of the Internet revolution.
He introduced a new metaphor:
Apple's "system design" vs Dell "assembled components"
to suggest that health care needs a "system design",
rather than "more assembled components".
This metaphor has some potential!
I would suggest more precise and accurate comparisons,
Apple iPod/iPhone vs (Dell) Windows Pocket PC,
and Apple iPad vs Windows tablets.
and even MacBook Air vs Netbook PCs.
The more Apple does "systems design" the more successful products it makes!
Apple is using many common components like other computer companies,
with a twist: Apple controls whole system, including software.
PC/Windows provides universal software, and making many compromises...
"Something for Everybody vs Everything for Somebody"
While Apple's "systems design" does produce generally more usable products,
they usually do come with higher price, not lower,
and society does need to reduce health care expenses.
Is the metaphor lost?
No, just the opposite!
Here is are keys for answer: iPod, iPhone, iPad
Tablet computing was a "holy grail" of computing for a very long time,
and Microsoft was for long time attempting to "squeeze" Windows.
It didn't work!
It required re-thinking and solving specific problem very well.
I still have a Dell Axim x50v, with almost same components as iPod Touch, that was released 3 years (2004) before Apple's product (2007), at almost the same price. Dell has a beautiful VGA screen, 600Mhz ARM processor, any port and protocol one can think of, programmable...
And it didn't sell! What went wrong? No "systems design".
Here one example: when battery gets empty, all installed programs are LOST.
Need to re-install them, all. No kidding, full re-install,
including re-calibrating screen by using provided pen, not fingers.
Apple has prepared "just right" package of technology,
hardware, software, online store, and marketing, that "just works"
Enough to capture 90% of US market at one point,
and prepare for success of iPhone and iPad...
...
Finally, iPad has demonstrated that tablets could be useful,
if they do not try to be general-purpose computers as Windows tablets are attempted for years and failed. While windows tablets are "premium" and expensive products, thus limiting its reach, iPad is a focused, and highly optimized for its purpose:
apps and simple web browsing, instant-on, long battery life.
Even a full year after iPad launch, and with huge sales, there are no comparable product on the market! Most attempts to make similar "generic" products come more expensive than Apple's "systems design" device.
...
Christensen has suggested another useful key-phrase,
need for "health-care" instead of "sick-care" focus.
I guess it would mean "systems design" approach,
Apple-like simplified and integrated, solving a few problems well,
rather than many "good enough"...
What would that look like? A good question...
Dynamic Views @ Blogger / Blogspot
All about Dynamic Views for Readers - Blogger Help
This blinks/blog is using Google's blogging tool, Blogger.
Free and general tool, created by same person who was running Twitter,
so far was just "good enough"...
And now, here is some very innovation, "views"
Click the lift on the left, to try it out..
Blogger currently offers five dynamic views for its public blogs.
These views are only accessible if allowed for by the blog author.
Flipcard: available at [blogURL]/view/flipcard
Mosaic: available at [blogURL]/view/mosaic
Sidebar: available at [blogURL]/view/sidebar
Snapshot: available at [blogURL]/view/snapshot
Timeslide: available at [blogURL]/view/timeslide
This blinks/blog is using Google's blogging tool, Blogger.
Free and general tool, created by same person who was running Twitter,
so far was just "good enough"...
And now, here is some very innovation, "views"
Click the lift on the left, to try it out..
Blogger currently offers five dynamic views for its public blogs.
These views are only accessible if allowed for by the blog author.
Flipcard: available at [blogURL]/view/flipcard
Mosaic: available at [blogURL]/view/mosaic
Sidebar: available at [blogURL]/view/sidebar
Snapshot: available at [blogURL]/view/snapshot
Timeslide: available at [blogURL]/view/timeslide
Sunday, April 17, 2011
Technical Debt
Audio: CodeCast Episode 105: Technical Debt with Gary Short and Markus Egger
"Technical dept is like financial dept, but instead of borrowing money you're borrowing time. Taking a shortcut in an architectural or software decision to save time when at a future date you need to come back and fix or enhance that shortcut. The more shortcuts you take postponing required coding, the more technical dept you build up..."
(inventor of Wiki) Ward Cunningham first drew the comparison between technical complexity and debt in a 1992 experience report
Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite... The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation, object-oriented or otherwise.
"Technical dept is like financial dept, but instead of borrowing money you're borrowing time. Taking a shortcut in an architectural or software decision to save time when at a future date you need to come back and fix or enhance that shortcut. The more shortcuts you take postponing required coding, the more technical dept you build up..."
(inventor of Wiki) Ward Cunningham first drew the comparison between technical complexity and debt in a 1992 experience report
Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite... The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation, object-oriented or otherwise.
Taxes drop dramatically...
The Associated Press: Super rich see federal taxes drop dramatically:
"The super rich pay a lot less taxes than they did a couple of decades ago,
and nearly half of U.S. households pay no (federal) income taxes at all.
(most people do pay state, local and sales taxes)
...
The Internal Revenue Service tracks the tax returns with the 400 highest adjusted gross incomes each year. The average income on those returns in 2007, the latest year for IRS data, was nearly $345 million. Their average federal income tax rate was 17 percent, down from 26 percent in 1992
...
The top income tax rate is 35 percent, so how can people who make so much pay so little in taxes?
The nation's tax laws are packed with breaks for people at every income level
...
There are so many breaks that 45 percent of U.S. households will pay no federal income tax for 2010
..."
No surprise national debt is growing...
"The super rich pay a lot less taxes than they did a couple of decades ago,
and nearly half of U.S. households pay no (federal) income taxes at all.
(most people do pay state, local and sales taxes)
...
The Internal Revenue Service tracks the tax returns with the 400 highest adjusted gross incomes each year. The average income on those returns in 2007, the latest year for IRS data, was nearly $345 million. Their average federal income tax rate was 17 percent, down from 26 percent in 1992
...
The top income tax rate is 35 percent, so how can people who make so much pay so little in taxes?
The nation's tax laws are packed with breaks for people at every income level
...
There are so many breaks that 45 percent of U.S. households will pay no federal income tax for 2010
..."
No surprise national debt is growing...
How to disable Hibernate mode on Windows 7
What is hiberfil.sys and How Do I Delete It? - How-To Geek
You’ll need to open an administrator mode command prompt by right-clicking on the command prompt in the start menu, and then choosing Run as Administrator. Once you’re there, type in the following command:
powercfg -h off
Why would you do it?
Because it is not good for SSD drive, and takes a lot of space.
And sleep mode is much faster anyway...
You’ll need to open an administrator mode command prompt by right-clicking on the command prompt in the start menu, and then choosing Run as Administrator. Once you’re there, type in the following command:
powercfg -h off
Why would you do it?
Because it is not good for SSD drive, and takes a lot of space.
And sleep mode is much faster anyway...
US debt / per person
The Chimes | U.S financial crisis worsens : Opinions « Biola University
"With the current national debt fast approaching $14.3 trillion,
this means that each citizen’s share of the debt is almost $46,000 per person.
If we just look at taxpayers, then the figure rises to over $128,000 per person."
"With the current national debt fast approaching $14.3 trillion,
this means that each citizen’s share of the debt is almost $46,000 per person.
If we just look at taxpayers, then the figure rises to over $128,000 per person."
Saturday, April 16, 2011
Microsoft MIX 11 @ channel 9
Keynotes from (Microsoft
Event) MIX11 @ Channel 9
"The Future of the Web" (& Silverlight, & WinPhone...)
by Scott Guthrie and the team...
Event) MIX11 @ Channel 9
"The Future of the Web" (& Silverlight, & WinPhone...)
by Scott Guthrie and the team...
Thursday, April 14, 2011
Converting between JSON and XML
Converting between JSON and XML
Most of structured data on web used to be encoded in XML format,
and most of new data on the web are encoded and expected in JSON format.
Ability to convert reliably from XML to JSON and back would be very helpful.
Challenge with conversion between XML and JSON
is that XML element has two sets of content:
attributes and sub-elements (plus white spaces)
* Attributes would map nicely to JSON object (hash, map), and
* sub-elements map nicely to JSON array,
but not both at the same time.
This is because XML is a hybrid syntax, intended for text markup
rather than for representing data, in particular not object-oriented data.
Same problem exist when mapping objects from OO programming language to XML and back. Direct example is XAML syntax used by .NET (WPF, Silverlight, WF...).
Objects make a verbose and a bit complicated XML...
Here is another useful article about the same topic
Converting Between XML and JSON @ XML.com
Author of JSON.NET library suggest a method where XML attributes
are converted to JSON names that start with '@' character inside of JSON object/hash/map.
For example
<person id="1">
<name>Alan</name>
<url>http://www.google.com</url>
</person>
"person": {
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
}
so far, so good...
while added @ make a bit of semantic difference,
it makes for a more compact final JSON document,
and help distinguish from XML elements as names.
Same example does have more questionable departure from original XML structure
when two elements with same name are converted
to an array of values, rather than array of objects.
<root>
<person id="1">
<name>Alan</name>
<url>http://www.google.com</url>
</person>
<person id="2">
<name>Louis</name>
<url>http://www.yahoo.com</url>
</person>
</root>
suggested conversion to JSON looks like this:
"root": {
"person": [
{
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
},
{
"@id": "2",
"name": "Louis",
"url": "http://www.yahoo.com"
}
]
}
While suggested format may be convenient for usage, it is different than original XML. XML has two elements, and JSON has one "person" object that has array of anonymous objects. More correct 1:1 mapping should look like this, I think:
"root": [
"person": {
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
},
"person": {
"@id": "2",
"name": "Louis",
"url": "http://www.yahoo.com"
}
]
Each XML element <person> becomes one JSON object "person",
and multiple XML elements are stored in JSON array.
Clearly, <name> and <url> are more convenient when stored as names/values in JSON object, but this is not a direct 1:1 mapping to XML.
Good thing about such mapping is that in special cases where sub-elements
do not repeat it is possible to convert back to original XML without loss of info.
On the other side, exact and non-problematic mapping would be:
"root": [
"person": [
"@": { "id": "1" },
"name": "Alan",
"url": "http://www.google.com"
],
"person": [
"@": { "id": "2" },
"name": "Louis",
"url": "http://www.yahoo.com"
]
]
The syntax difference is just in using [ ] instead of { }.
I have stored attributes into an object with name "@", to preserve original names of attributes. Result is that if for example there could be more sub-elements in XML, so JSON formatted this way is able to take any XML.
"person": [
"@": { "id": "1" },
"name": "Alan",
"url": "http://www.google.com",
"url": "http://www.facebook.com"
],
The 'price' is in possibly less optimal performance and complexity of using such JSON objects.
A good XML-JSON converter should be able to detect problem situations and use 1:1 mapping as needed, I think. In fact, I think 1:1 should be default conversion, and "optimized" should be an option.
Here is a few more links related to JSON-XML conversion:
*Online XML / JSON converter
*JSON-java/XML.java by Douglas Crockford
*How to convert XML to JSON in ASP.NET C#
*Converting Between XML and JSON @ XML.com
Most of structured data on web used to be encoded in XML format,
and most of new data on the web are encoded and expected in JSON format.
Ability to convert reliably from XML to JSON and back would be very helpful.
Challenge with conversion between XML and JSON
is that XML element has two sets of content:
attributes and sub-elements (plus white spaces)
* Attributes would map nicely to JSON object (hash, map), and
* sub-elements map nicely to JSON array,
but not both at the same time.
This is because XML is a hybrid syntax, intended for text markup
rather than for representing data, in particular not object-oriented data.
Same problem exist when mapping objects from OO programming language to XML and back. Direct example is XAML syntax used by .NET (WPF, Silverlight, WF...).
Objects make a verbose and a bit complicated XML...
Here is another useful article about the same topic
Converting Between XML and JSON @ XML.com
Author of JSON.NET library suggest a method where XML attributes
are converted to JSON names that start with '@' character inside of JSON object/hash/map.
For example
<person id="1">
<name>Alan</name>
<url>http://www.google.com</url>
</person>
"person": {
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
}
so far, so good...
while added @ make a bit of semantic difference,
it makes for a more compact final JSON document,
and help distinguish from XML elements as names.
Same example does have more questionable departure from original XML structure
when two elements with same name are converted
to an array of values, rather than array of objects.
<root>
<person id="1">
<name>Alan</name>
<url>http://www.google.com</url>
</person>
<person id="2">
<name>Louis</name>
<url>http://www.yahoo.com</url>
</person>
</root>
suggested conversion to JSON looks like this:
"root": {
"person": [
{
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
},
{
"@id": "2",
"name": "Louis",
"url": "http://www.yahoo.com"
}
]
}
While suggested format may be convenient for usage, it is different than original XML. XML has two
"root": [
"person": {
"@id": "1",
"name": "Alan",
"url": "http://www.google.com"
},
"person": {
"@id": "2",
"name": "Louis",
"url": "http://www.yahoo.com"
}
]
Each XML element <person> becomes one JSON object "person",
and multiple XML elements are stored in JSON array.
Clearly, <name> and <url> are more convenient when stored as names/values in JSON object, but this is not a direct 1:1 mapping to XML.
Good thing about such mapping is that in special cases where sub-elements
do not repeat it is possible to convert back to original XML without loss of info.
On the other side, exact and non-problematic mapping would be:
"root": [
"person": [
"@": { "id": "1" },
"name": "Alan",
"url": "http://www.google.com"
],
"person": [
"@": { "id": "2" },
"name": "Louis",
"url": "http://www.yahoo.com"
]
]
The syntax difference is just in using [ ] instead of { }.
I have stored attributes into an object with name "@", to preserve original names of attributes. Result is that if for example there could be more
"person": [
"@": { "id": "1" },
"name": "Alan",
"url": "http://www.google.com",
"url": "http://www.facebook.com"
],
The 'price' is in possibly less optimal performance and complexity of using such JSON objects.
A good XML-JSON converter should be able to detect problem situations and use 1:1 mapping as needed, I think. In fact, I think 1:1 should be default conversion, and "optimized" should be an option.
Here is a few more links related to JSON-XML conversion:
*Online XML / JSON converter
*JSON-java/XML.java by Douglas Crockford
*How to convert XML to JSON in ASP.NET C#
*Converting Between XML and JSON @ XML.com
Wednesday, April 13, 2011
Intel to break Moore's Law to get Atom competing with ARM
Intel to break Moore's Law to get Atom competing with ARM – Cell Phones & Mobile Device Technology News & Updates | Geek.com
"So how is Intel going to make Atom a viable competitor to Arm? They’re taking Atom Oak Trail and will start iteratively upgrading its clockspeeds at nearly unprecedented rates. All told, Intel expects that Atom will be pushed through three processing cycles in the next three years, which is twice the rate of Moore’s Law.
In fact, they are just planning to use latest technology already used, or planned, for more expensive (Core & Xeon) processors...
Is Intel Really Rewriting Moore's Law With Atom? @ pcmag
"So how is Intel going to make Atom a viable competitor to Arm? They’re taking Atom Oak Trail and will start iteratively upgrading its clockspeeds at nearly unprecedented rates. All told, Intel expects that Atom will be pushed through three processing cycles in the next three years, which is twice the rate of Moore’s Law.
In fact, they are just planning to use latest technology already used, or planned, for more expensive (Core & Xeon) processors...
Is Intel Really Rewriting Moore's Law With Atom? @ pcmag
Tuesday, April 12, 2011
Json.NET Performance With Binary Data
Json.NET Performance With Binary Data - James Newton-King
"WCF DataContractJsonSerializer is by far the least efficient. When I looked into why it performed so badly it turns out that the WCF JsonSerializer serializes binary data as a JSON array of integers, one integer representing each byte. It goes without saying that you should never use the WCF JsonSerializer with binary data."
"WCF DataContractJsonSerializer is by far the least efficient. When I looked into why it performed so badly it turns out that the WCF JsonSerializer serializes binary data as a JSON array of integers, one integer representing each byte. It goes without saying that you should never use the WCF JsonSerializer with binary data."
Monday, April 11, 2011
Japan Lifts Atomic Alert to Highest Level, Matching Chernobyl
"Japan raised the severity rating of its nuclear crisis to the highest, matching the 1986 Chernobyl disaster, as increasing radiation prompts the government to widen the evacuation zone and aftershocks rocked the country.
Amazon’s Kindle unit is hiring Android devs
The Kindle doesn’t run on Android — it runs on good, old-fashioned Linux.
Or it might not be related to the Kindle at all. It’s possible that Lab 126 is working on an entirely separate, Android-related project or projects.
Amazon selling Kindle with ads for $114
examples of offers include:
Friday, April 08, 2011
Thursday, April 07, 2011
Martin Jacques: Understanding the rise of China | Video on TED.com
1. "China is not really a nation state... it is a (Chinese) 'civilization' state" (Example: Hong Kong: One country, two systems, same 'civilization')
2. "90% same 'race', the Han"
3. "Chinese state... guardian of Chinese civilization"
+ "Chinese even invented golf."
1. "China is not really a nation state... it is a (Chinese) 'civilization' state" (Example: Hong Kong: One country, two systems, same 'civilization')
2. "90% same 'race', the Han"
3. "Chinese state... guardian of Chinese civilization"
+ "Chinese even invented golf."
Saturday, April 02, 2011
Beograd je svet!
Beograd je svet! (Belgrade is World)
City map of Belgrade, Serbia, apparently has very similar shape to map of the World.
Serbia is evolving to a better future and closer to the World...
City map of Belgrade, Serbia, apparently has very similar shape to map of the World.
Serbia is evolving to a better future and closer to the World...
Subscribe to:
Posts (Atom)