MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.

As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.

x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Tuesday, June 23, 2015

Got this message at my outlook account Friday, and just noticed it today:

It's time to upgrade to an even better Skype experience on your Windows 8 device. Your current version of Skype is being replaced by an app called Skype for Windows desktop. It has more features to help you stay in touch like screen sharing and group video calling. Also, your chat conversations (from the last 30 days) and all your contacts will appear as normal after upgrading.

Ouch. I thought Win10 was going to be more "Metro" friendly, somehow maintaining backwards compatibility with apps written fro Win8, but this is making me wonder if the migration path goes back through the desktop.

In other fun, whoever came up with the mbox format wasn't on top of their game. It's hard to imagine in the days where SGML and XML are passรฉ that any non-clearly delimited storage format could gain so much practical acceptance. Wow.

Labels: , , , , ,


posted by ruffin at 6/23/2015 08:56:00 AM
Wednesday, September 18, 2013

Get Kingsoft Office Professional 2013 (Win) free | The Cheapskate - CNET News:
al_chirico

@Cool_Daddy For me, I like being able to actually read the data file. The xxxX formated files are XML files. So, If you know XML or HTML, you can just search the file for something you're looking for. This is especially helpful if you're passing a xxxX file to another program. You can just deconstruct the file as input data. Try doing that with an earlier xxx file. Just my 2 cents.

I read through this comment that's essentially in favor of the use of Microsoft's "Office Open XML" file formats and came away with an unexpected take-home.  First, why should we care how hard it is to open a .doc file in a text editor at this point?  We have plenty of excellent, freeware applications that can do that job for us (AbiWord, though seemingly dead, is still one of my favorites).  There's no real practical advantage for having a .doc file in a human readable file format now, is there, minus outliers like, "I just installed my OS and have no internet access and MUST edit the contents of my file in the 'pack-in' text editor!"

But then I shift from the consumer's pov to Microsoft's.  If the long game says that proprietary file formats will be broken and provide no (again, long-term) advantage, why bother with them at all?  Why not just use XML for your file format?  The format's so complex at this point, the degree of obfuscation in XML versions of the files is still tremendous.  You're past the point of something simply reproduced -- heck, even MS's Mac Business Unit had a heck of a time pulling it off, and that was an inside job!  It's the difference between html made by Seamonkey Composer and html made by Word's "Save As HTML".  HTML is supposed to be a nice, human-editable format.  Yet one product is pretty easy to edit by hand, and the other nearly impossible.  (See also AbiWord's Save As HTML for docs; beautiful stuff.)

So why move from bytecode to XML if you're Microsoft?  XML might be a better tool for serializing docs, and puts contracts with governments that demand "free and open" (and therefore, ostensibly, forward compatible and archival) formats back on the table and kill the "open" movement flat.

And there's really no difference to the end user now either, minus those guys who post to CNET and claim to be opening/editing their docs in Notepad.  ;^)

Microsoft moving to XML seems better, but, in the end, holds the status quo.  (C#'s release as an open standard, however, had much different, more beneficial results.  Wonder if that was expected?)

Labels: , , ,


posted by ruffin at 9/18/2013 01:03:00 PM
Friday, June 22, 2012

ASP.NET Web API vs. ASP.NET MVC "APIs" ๏ฟฝ Encosia:

If you want to bring Web APIโ€™s behavior more in line with the output of MVCโ€™s Json() helper, you can remove XML support from your API entirely. Just add this to the Application_Start event and youโ€™ll never see XML again...

Good riddance.  Never have I seen since a bloated, kitchen-sink approach become so unquestionably adopted.  Sure, XML does everything you'd ever need, but the times you need more than JSON (what, I've already mentioned, is little more than a home-rolled string format) really are pretty rare. 

I know I've mentioned it before, but years ago I remember getting a doc from our resident XML expert promoting its benefits, and search and replaced every occurrence of "XML" with "ASCII" before sending it back to him.  The accuracy of the doc really hadn't changed at all, somewhat surprisingly.  He took it as the good natured jabbing I intended (XML couldn't be stopped at that point), but I think, for at least that once ;^D, I was ahead of the game.

It's all zeroes and ones.  XML doesn't necessarily make something human and machine readable at the same time.  It can, but one look at OOXML tells you that this human readability isn't a requirement.

Maybe the lesson is that we underestimated our ability to read like a machine.  They are modeled after us (how can they not be?  We made them up) to some degree, after all.

Labels: , ,


posted by ruffin at 6/22/2012 08:18:00 AM
Thursday, May 03, 2012

The most annoying thing about setting up a WCF is the number of things that seem to work in the local testing server that'll explode in IIS. The local testing server that you can invoke with F5 is very lenient.

But before we get into the complicated stuff, a quick list of System-Provided Bindings from Microsoft:

WSHttpBinding
A secure and interoperable binding that is suitable for non-duplex service contracts.
BasicHttpBinding
A binding that is suitable for communicating with WS-Basic Profile conformant Web services, for example, ASP.NET Web services (ASMX)-based services. This binding uses HTTP as the transport and text/XML as the default message encoding.
WebHttpBinding
A binding used to configure endpoints for WCF Web services that are exposed through HTTP requests instead of SOAP messages.


Fair warning: I've done this three or four times now to make sure things work, but I haven't started from scratch on a new machine to run through the steps as I present them, here. Could be wonky somewhere. YMMV.

So let's start a WCF Service project. You select File >>> New Web Site >>>WCF Service. Save the new project in IIS's root folder.



That'll create a project with the file structure seen below:


Looking in Web.config, you'll see that, by default, this project has two endpoints. One is the MEX endpoint, which is nice, but not really the business end of things. The other is a wsHttpBinding. That's important, because, as we learned above, that expects to be called from a SOAP-compliant client.

If you try hitting F5 off the bat, it'll seemingly work, first going to a URL like this one:
http://localhost:50319/WCFService1/Service.svc

But if you try to view the GetData method, which is one of the two IService methods that Service.cs implemented by default, using a URL like this one:
http://localhost:50319/WCFService1/Service.svc/GetData

... you get no response, just a 400 error.

So it's worth saying that it's odd to have a SOAP client in my line of programming. You'd usually rather send out a very simple AJAX request to a URL from a web page to the WCF and receive some JSON back to parse in Javascript. The take-home is that we need to remove the wsHttpBinding (set up for SOAP) and set up webHttpBinding (ready for REST) instead.

The endpoints that Visual Studio inserts into web.config by default are below:
<endpoint address="" 
binding="wsHttpBinding" contract="IService">
<!--
Upon deployment, the following identity element should be
removed or replaced to reflect the identity under which the
deployed service runs. If removed, WCF will infer an
appropriate identity automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>

Our next step is to change that wsHttpBinding endpoint to one with webHttpBinding. I've also inserted the additional overhead of adding a JsonBehavior. Honestly, not sure what that's doing yet, but I think I want it.
<system.serviceModel>
<!-- serviceHostingEnvironment aspNetCompatibilityEnabled="true" / -->

<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set
the value below to false and remove the
metadata endpoint above before deployment
-->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for
debugging purposes, set the value below to
true. Set to false before deployment to avoid
disclosing exception information
-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>

<services>
<service name="Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding"
behaviorConfiguration="JsonBehavior" contract="IService">

<!-- original:
endpoint address=""
binding="wsHttpBinding" contract="IService" -->

<!--
Upon deployment, the following identity
element should be removed or replaced
to reflect the identity under which the
deployed service runs. If removed, WCF
will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>

(In case I've screwed up, the entire config is here.)

Again, switching from wsHttpBinding to webHttpBinding makes it so that we can use a URL to access the method. With wsHttpBinding, you'd have to have a SOAP client, which involves insane amounts of overhead for most of my applications.

There's more required than that, however. If you've got the same standard setup as I get in VS 2010, you've got two methods in the Service.cs file. One is pretty easy to set up to listen to query strings for its parameters;

[OperationContract]
[WebGet(RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
string GetData(int value);


Now, you should be able to nav to GetData and slap in a param of "?value=1231" and have that number repeat back to you with a URL like this:
http://localhost:50319/WCFService1/Service.svc/GetData?value=10

You'll see "You entered: 10" (with quotes) in the web page.


You can also leave the port off if you followed the instructions and created the dir in IIS' home dir and created the application using Internet Information Server (IIS) Manager. Go to your default web site, find your server's folder, right click, convert to application, and voila:



Unfortunately, the other method in the default project (GetDataUsingDataContract) is more complicated, as if you try to turn it into a GET-able method, your WCF Service will complain about the CompositeType hand-rolled datatype that's also part of the project VS 2010 dreams up for you.

[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);

You can't webget that because CompositeType isn't serializable.

Operation 'GetDataUsingDataContract' in contract 'IService' has a query variable named 'composite' of type 'CompositeType', but type 'CompositeType' is not convertible by 'QueryStringConverter'. Variables for UriTemplate query values must have types that can be converted by 'QueryStringConverter'.


Whoops. I'm not going to go into serializing to JSON right now. All things considered, that's an easy afterthought after this XML config wading.

So perhaps not the best composed, but that's today's lesson.

(A decent walkthrough of a slightly different way to go about this here.)

Labels: , , ,


posted by ruffin at 5/03/2012 03:52:00 PM
Wednesday, December 17, 2008

I was recently at a blog I wanted to add to the the RSS roll, but I couldn't find an RSS or XML link, nor could I immediately figure out what brand o' blog it was, as a number have standard ways of accessing feeds if you massage the URL a bit.

So I figured, what the heck, let's paste the home URL into Google Reader and see what happens.

POOF. Took a while, but it's in the roll. That's how an RSS reader should work.

Labels: , , ,


posted by ruffin at 12/17/2008 08:48:00 AM
Tuesday, May 27, 2008

From Chapter 5. of Processing XML with Java, "Reading XML":

The main point is this: most programs you write are going to read documents written in a specific XML vocabulary. They are not going to be designed to handle absolutely any well-formed document that comes down the pipe. Your programs will make assumptions about the content and structure of those documents, just as they now make assumptions about the content and structure of external objects.


That's really an intelligent way of coming at reading XML, and it's the way I argue is the way it should, in about 75% of real world cases where XML is used, be done. That Harold does it, even tongue in cheek, is far more important than my recommendation, of course. His books on Java are top rate stuff, imo. The bottom line here is that you know darn well what the XML file you want to read is going to look like. Why put in any libraries for parsing it all out that you don't absolutely need? KISS.

Here's some of the code where he's reading out the XML from his specific example.

private static BigInteger readFibonacciXMLRPCResponse(
InputStream in) throws IOException, NumberFormatException,
StringIndexOutOfBoundsException {

StringBuffer sb = new StringBuffer();
Reader reader = new InputStreamReader(in, "UTF-8");
int c;
while ((c = in.read()) != -1) sb.append((char) c);

String document = sb.toString();
String startTag = "";
String endTag = "
";
int start = document.indexOf(startTag) + startTag.length();
int end = document.indexOf(endTag);
String result = document.substring(start, end);
return new BigInteger(result);

}


I think you can see what's going on. Honestly, that's the right way to do it in what is a much more common, real-world situation than one might suspect. Now granted, Harold adds...

Straight text parsing is not the appropriate tool with which to navigate an XML document. The structure and semantics of an XML document is encoded in the documentโ€™s markup, its tags and its attributes; and you need a tool that is designed to recognize and understand this structure as well as reporting any possible errors in this structure. This tool is called an XML parser.


But think of how many times you've seen XML used -- essentially as a text file. There's absolutely no reason to learn all the new APIs necessary to parse XML in these cases. You could just as easily have created your own file format, but then I understand why one might use XML instead. There is structure that would take weeks for a typical programming team to put together in conference. Why not lean on an over-engineered structured for your flat files? If you do step past known, easy to consume formats, then you don't have to re-engineer to use XML APIs.

XML's strength is to compose very large batches of structured data for anonymous consumption, but that doesn't mean that's the way it's most commonly used, nor the only way that XML's structure can be used. Let your approach, both for the file and the parsing, match your needs.

Labels: ,


posted by ruffin at 5/27/2008 12:33:00 AM
Friday, July 27, 2007

The ongoing guy gets What XML Means pretty well:

XMLโ€™s tenth birthday is coming up next spring; hereโ€™s my sound-bite on What It All Means. XML is the first successful instance of a data packaging system that is simultaneously (human) language-independent and (computer) system-independent.


All he's missing is that it's best when the computers and humans who are consuming the XML are anonymous or at least unknown at spec time. It's much, much easier to write up simple text files or dbms schemas, but what happens when someone or something you never anticipated wants to read your data? Without XML (at at least ODBC in the case of databases), you're in trouble.

The independence allows integration with what's unanticipated. Often XML is the wrong choice... with every acronym you add to an application, you're cutting your future available workforce in half as well. If it's simple enough to roll in-house and only in-house will use it in the future, go for it. The only reason Word docs are in XML now, and even then only as an option, is because of places like Massachusetts who say that if the format's not open, they're not using it. It's not because the old, closed Word doc format stunk. Quite the opposite. Openness concedes power, on some level, and unnecessary technologies increase maintenance costs.

This is why our ongoing friends say...

A classic Unix-flavor file containing ordinary lines of ordinary text is the best choice of all, whenever you can get away with it. XMLโ€™s still a decent option, probably the best, for interchanging things that are (at least in part) meant to be read by humans.


Exactly. Human readable + machine readable + a need to operate with anonymous, unpredicted (though not necessarily unpredictable) consumers == time to use XML. XML is ASCII glorified in such a way that an anonymous machine can still create an outline of it.

Labels: ,


posted by ruffin at 7/27/2007 05:37:00 PM

<< Older | Newer >>


Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (?_?), ยข, & ? if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.