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!

Thursday, May 31, 2012

To look at later to help with using MonoDevelop to make Mac apps:

Transitioning from Xcode 3 to Xcode 4 - Xamarin:

Introduction to Interface Builder v4.0

Although Interface Builder is now integrated into Xcode, itโ€™s still largely the same, with the exception of how Outlets and Actions are now created and wired up. Specifically, it gives you the ability to create an Outlet or an Action and wire it up to a control all in one step.

 If you believe what you're told, though the above link is for MonoTouch, MonoMac is similar.

Labels: , , ,


posted by ruffin at 5/31/2012 11:56:00 AM
Wednesday, May 30, 2012

database - Find SQLite Column Names in Empty Table - Stack Overflow:
sqlite> .header on
sqlite> .mode column

Labels: ,


posted by ruffin at 5/30/2012 11:59:00 PM

Note that nothing said here should be taken as anything other than the ramblings of a madman.

From the apparently fairly seminal doc, Applications Programming in Smalltalk-80(TM): How to use Model-View-Controller (MVC) by Steve Burbeck, Ph.D.:

In the MVC paradigm the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object, each specialized for its task. The view manages the graphical and/or textual output to the portion of the bitmapped display that is allocated to its application. The controller interprets the mouse and keyboard inputs from the user, commanding the model and/or the view to change as appropriate. Finally, the model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller). [emph mine]

I think that does it.  MVC means you've got a View (what the viewer sees), the Controller (controlling what happens to a user's input) and a Model (what encapsulates the data itself).  I'm going to try to go with that.

It's like 3-tier, but with two one-way roads going from your UI to your data management tier, one for what your app is showing the user, and another one-way road designed for what to do with your user's responses to what they see in the view.

That would make Fowler's image of MVC make more sense:

local copy of image


As well as his explanation of the "missing" line between View and Controller:

Essential dependencies between model, view, and controller. (I call this essential because in fact the view and controller do link to each other directly, but developers mostly don't use this fact.)

Note that the arrows are pointing the right way. The View does ask the Model for data to display. The Model does not push to the view.

That's the first time I've seen MVC described in a way that makes sense, so I'm latching on like a bit bull, right or not.

Ah, this makes more sense. It's one-way roads from the Model's point of view, but occasionally the Controller might yell at the View to save it a trip to the Model.

Communication Within The MVC Triad
...
The Passive Model

In the simplest case, it is not necessary for a model to make any provision whatever for participation in an MVC triad. A simple WYSIWYG text editor is a good example. The central property of such an editor is that you should always see the text as it would appear on paper. So the view clearly must be informed of each change to the text so that it can update its display. Yet the model (which we will assume is an instance of String) need not take responsibility for communicating the changes to the view because these changes occur only by requests from the user. The controller can assume responsibility for notifying the view of any changes because it interprets the user's requests. It could simply notify the view that something has changed -- the view could then request the current state of the string from its model -- or the controller could specify to the view what has changed. In either case, the string model is a completely passive holder of the string data manipulated by the view and the controller. [more mfn emph]


Though note that this only works on a locked resource in the Model, like the text editor hypothetical here. You can't do passive (well) in practice without very stringent locks, which is what the next section in the doc explains -- you need to have the View listening to the Model for changes, and event handling is born. Say someone else (an object other than its own Controller) changes the string that the text editor is editing -- the View needs to be alerted. And complex listening is born.

And since we can nest Views (a window holds multiple text boxes, eg, and both the Window and each text box has a View and a Controller) and since each needs to listen in on [different?] Models and Controllers in case of change (Controller says button for "Create new text doc" is pressed; wipe the View at the Window level and start over), what we've really got is an exceptionally finely channeled encapsulation for UI design that works well within, for instance, a 3-tiered setup. I think the bottom line is that MVC gets complicated quickly with a complicated UI, but to fully flesh it out causes some slick encapsulation and very easy maintenance. Afaict, IANAL, LMNOP.



In other vents, did I mention I hate the new Blogger interface? Hate it. It's so far from WYSIWYG that a 6 year-old could do better. What's wrong with the beautiful simplicity of the current Edit Html tab that I love, and that used to pop up with BlogThis? Seriously, I have to double check my View (har) every time I freakin post from BlogThis now. I HATE THE NEW BLOGGER INTERFACE. HATE HATE HATE HATE HATE. No kidding.

Labels: , , ,


posted by ruffin at 5/30/2012 10:03:00 AM

Separated Presentation:

Although the domain cannot call the presentation it's often necessary for the domain to notify the presentation if any changes occur. Observer is the usual solution to this problem. The domain fires an event which is observed the by presentation, the presentation then re-reads data from the domain as needed.

A good mental test to use to check you are using Separated Presentation is to imagine a completely different user interface. If you are writing a GUI imagine writing a command line interface for the same application. Ask yourself if anything would be duplicated between the GUI and command line presentation code - if it is then it's a good candidate for moving to the domain. [emph mine]

That's all well and good, but it seems to be reducing MVC (which is what I was reading about before I came to this page) to n-tier design (where n, surprisingly, is currently 2 -- which, when you're talking just GUI, I suppose is fine).

I'm pretty sure MVC is more convoluted than 3-tier design, which is what I usually use, but there I'm still reading.  Until then, this jive makes up a pretty good list of "best practices", especially the part I highlighted.  Being able to quickly remove from or add to your GUI without any change in data logic is the real test of [what I think is better called "encapsulation" -- why Fowler is re-monikering, I don't know] in your app's design.

Excellent, simplest case (give or take) logical refactoring of a non-tiered to properly tiered design follows the description on that page. Nearly required reading, kk?

Labels: , ,


posted by ruffin at 5/30/2012 09:40:00 AM
Friday, May 25, 2012

Former Apple employee claims Steve Jobs would have 'lost his mind' over Siri:
However, author Adam Lashinsky notes that Siri may also reflect a change in the quality of Apple's products.

"People are embarrassed by Siri," Lashinsky quoted a "former insider" as saying. "Steve [Jobs] would have lost his mind over Siri."

posted by ruffin at 5/25/2012 10:50:00 AM
Thursday, May 24, 2012

c# - How to enable assembly bind failure logging (Fusion) in .NET - Stack Overflow:

If you have the Windows SDK installed on your machine, you'll find the "Fusion Log Viewer" under Microsoft SDK\Tools (just type "Fusion" in the start menu on Vista or Windows 7). Launch it, click the Settings button, and select "Log bind failure" or "Log all binds".

If these buttons are disabled, go back to the start menu, right-click the Log Viewer, and select "Run as Administrator".

Still can't say I'm getting Oracle.DataAccess to behave, however.  I hate 32/64 bit debugging.

Labels: ,


posted by ruffin at 5/24/2012 12:32:00 PM

Apple CEO Tim Cook often sits with random employees at lunch:

"In general, Apple has become slightly more open and considerably more corporate," he wrote. "In some cases Cook is taking action that Apple sorely needed and employees badly wanted. It's almost as if he is working his way through a to-do list of long overdue repairs the previous occupant (Jobs) refused to address for no reason other than obstinacy."

Oh well.  It was good while it lasted.

I figure a good Apple television will pump up stock something mad, but after that?  What's left for Apple to Apple-a-tize?  Toasters?  Perhaps I'm missing something, but the TV is the last hurrah, and I don't see Cook keeping the hard line on, "You can have any color, as long as it's Jobsian black."  That's A Bad Thing.

Labels: ,


posted by ruffin at 5/24/2012 09:23:00 AM
Tuesday, May 22, 2012

(image likely belongs to Tom Rix)

I keep forgetting where this lives.

It lives here: https://chrome.google.com/webstore/detail/kkioiolcacgoihiiekambdciinadbpfk

Labels: , ,


posted by ruffin at 5/22/2012 02:55:00 PM
Thursday, May 17, 2012

General Motors un-friending of Facebook ads spells trouble for users | Macworld:

Facebook is closing in on one billion active users (about 14 percent of the worldโ€™s population), but it seems no oneโ€™s really sure if those all those eyeballs convert into value for advertisers.

Because nobody has more than one Facebook account.  Look, my local newspaper requires a Facebook account just to post comments.  I don't post there any more, but have considered a fake account to do so.  I've also got an account for testing apps I've written against Facebook APIs.  There are tons of reasons for folks to create virtual personalities.

Virtual is not real.   They might as well say, "Facebook is closing in on one billion active accounts (about 2,000,000% of the world's bonobo population)."  Just as in/accurate.

posted by ruffin at 5/17/2012 12:28:00 PM
Wednesday, May 16, 2012

Mac-bound Retina displays will cost Apple a $92 premium from suppliers:

The screens DisplaySearch says are available that would be ideal for Apple's next-generation MacBook Pros are a 15.4-inch panel with a resolution of 2,880 by 1,800 pixels, or 220 pixels per inch, and a 13.3-inch screen with a resolution of 2,560 by 1,600 pixels, or 227 pixels per inch. Each would add at least 100 pixels per inch to their respective MacBook Pro models.

As a guy who is constantly trying to smear more code onto his screen, the rumor of a greatly increased resolution on MacBooks is a really exciting development.  I hate having less than 1920x1080 at this point, and the 1280x800 on my old white MacBook sometimes feels like a limiting reagent.  Sure, sure, if I did it all in fullscreen VIm with 9pt ProFont -- but I don't.  I use PhpStorm.  I use MonoDevelop.  I use Eclipse.  And I use Visual Studio 2010 too.  (And in all of which I do use with ProFont 9pt, I should add, trying to cram more on the screen. I'd use smaller term fonts if I could find one that's TTF and compatible).  Lost screen real estate means I have to spend more time scrolling, and that means less time with my fingers on the keys coding.

I can't determine if I buy immediately (my MacBook is two and a half years old, after all! (he said only partially tongue in cheek)) or hope to see something similar in a 13" MacBook Air.  But I do know I enjoy programming on the laptop, free of the desk, and I know that a more optimal resolution means, for me, lots more productive work. I know it's going to be a serious premium to buy the new 'Book, and it's hard to justify when the white MacBook still seems plenty fast enough. But I'm done. I want the monitor.

(My job before last was on a relatively low cost box with an older flat screen, and I was warned that if I brought in my own monitor, it might grow legs and take off to someone's house.  (No, really.  That's what I was told by the support guys.)  So I ended up bringing in an old Dell CRT to get 1600x1200.  With the dual monitor setup, I know I was getting more done, if only because our website had to be optimized for 1024x768, which was even less than the flatscreen could put out.  So code on CRT and view on 1024x.  Try programming on 1280x960 now and let me know what you think.  How did we do it before?)

Labels: ,


posted by ruffin at 5/16/2012 06:57:00 PM
Friday, May 04, 2012

TL:WR
The bottom line is that the Model is an extension of the old Record. Profit.

From my post (though the guy's asking more specifically about Proxies. It's in the answer, I think.) on StackOverflow:

I'm coming from ExtJS 2.2 [sic] to 4, and the Model behavior and terminology threw me for a loop too.

The best quick explanation I can find is from this post in the "Countdown to ExtJS 4" series on Sencha's blog. Turns out a Model acts like it does because it's "really" a Record.

The centerpiece of the data package is Ext.data.Model. A Model represents some type of data in an application - for example an e-commerce app might have models for Users, Products and Orders. At its simplest a Model is just a set of fields and their data. Anyone familiar with Ext JS 3 will have used Ext.data.Record, which was the precursor to Ext.data.Model.

Here's the confusing part: A Model is both a model for the data you're using and a single instance of an object following that model. Let's call its two uses "Model qua model" and "Model qua Record".

This is why its load method requires a unique id (full stop). Model qua Record uses that id to create RESTful URLs for retrieving (and saving, etc) a single Record worth of data. The RESTful URL convention is described here and is linked to in this post on Sencha's blog that talks specifically about Model usage.

Here are a few RESTful URLs formed to that standard to get you familiar with the format, which it appears ExtJS' Model does use:

Operate on a Record with id of 1

GET /people/1 <<< That's what's used to retrieve a single record into Model

return the first record with id of 2

DELETE /people/2

destroy the first record with id of 7

POST /people/7?_method=DELETE

Etc etc.

This is also why Models have their own proxies, so that they can run RESTful operations via that URL modified to follow the conventions described in that link. You might pull 100s of records from one URL, which you'd use as your Store's proxy source, but when you want to save what's in the single Model (again, think "Model qua Record" here), you might perform those Record-specific operations through another URL whose backend messes with one record at a time.


So When Do I use Stores?

To store more than one instance of that Model, you'd slap them into a Store. You add lots of Models quaRecords into Stores and then access those "Models" to pull data out. So if you have a grid you'll naturally want to have all that data locally, without having to re-query the server for each row's display.

From the first post:

Models are typically used with a Store, which is basically a collection of Model instances.

And, of course, the Stores apparently pull info from Model qua Model here to know what they're carrying.

Labels:


posted by ruffin at 5/04/2012 03:34:00 PM

How McDonaldโ€™s Came Back Bigger Than Ever - NYTimes.com:

With their remodeled restaurants, additions to the menu and at least one nontraditional ally โ€” mom bloggers โ€” executives are trying to present a greener, more healthful McDonaldโ€™s. And in some ways the company is indeed changing. For the first time last year, McDonaldโ€™s sold more pounds of chicken than pounds of beef, a seismic shift that would be like Starbucks selling more tea than coffee.

Except that it's all 20 pc McNuggets for $5. Let's not pretend or even imply higher chicken to beef ratios are signs of green change for the best.

Labels: ,


posted by ruffin at 5/04/2012 12:32:00 PM
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

<< 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.