Wednesday, November 27, 2013

Map and HTTP Stuffs

I made a QONQR API app thing. First time using iOS map and HTTP APIs.

Here was a few gotcha's I ran into, in reverse order.

Setting the map pins is done with MKAnnotation protocol. A protocol is like, a set of methods that an object has to abide by in order to pose as some certain thing or another, I think. To get the map pins to show up I had to make a Map Pin class as described here.

Monday, November 4, 2013

Sunday, November 3, 2013

floating point comparisons in CoreData fetch requests

I had to use a predicate like this in order to compare a test value to another one in my predicate so that things were working good.

[NSPredicate predicateWithFormat:@"abs(value - %f) < 0.01", test];

Here was the question I asked:

I guess it turns out you can use SQLIte functions like abs() and cetera for more shit. Yay woo. I was led to this because the BETWEEN function doesn't work with floats, but crashes. You get the "unrecognized selector nsnumber" type error.

See also:

Predicate Programming Guide

Getting Stuck

Predicate Format String Syntax

Creating Predicates

Friday, October 18, 2013

CoreData changes

There were some CoreData changes in iOS 7.

I had to add @{ NSSQLitePragmaOptions : @{ @"journal_mode" : @"DELETE" } } to my code to make it work right importing the database from before. The new way adds -shm and -wal files in SQLite DB.

I found this cool CoreData Editor app from Germany but Apple's douchy market limits won't let me buy it.

More interesting stuff

Interesting bit about protocol declarations needing to be made before includes.

Unsolved: when I change the Main View in XCode it bugs out. Lots of other people had this problem too:

- this class is not key value coding-compliant for the key authView

Wednesday, October 16, 2013

Useful lil things lately in IOS

I figured some cool stuff out on Key-Value coding for scalar values that are properties of objects:

Also found Touches ended usefule


Good shit on bitwise operators:

PCI-compliance is important for storing credit cards

NSSortDescriptors are kind of annoying but maybe cool and useful

Unlike LSL, finding something in an array if it's not there doesn't return -1 but instead 214783647

The NSRange is an interesting structure

I encountered weirdness trying to use TableViewCell's highlighted feature, ended up just giving up and painting my own way of doing it. Probably cuz I was doing it wrong but anyway who cares.

I do want to add a search bar in tableview in an upcoming version

I was trying to think of how to make my UIMenuController not be black-on-black... never got to that

Saw Mission Street Grants and thought of applying:

I asked this question on CoreData but got no answers;

Was curious about iOS7/iOS6 deltas in InterfaceBuilder, found this:

Here's how to update your app to a new version, which isn't working for me right now:

Here's how to beta test your app which also isn't working for me right now:

This was an awesome way to customize the colors of a UISegmentedControl

Saw this interesting idea of "passing around an NSManagedObjectContext" in iOS for keeping ViewControllers segmented. I should read this. It explains why not to be accessing the instance of one viewController inside another viewController, which I seem to do alot.

I also need to read up on Throwing Exceptions.

This was an awesome help tomake a segment of a UISegmentedControl deselect itself.

setBackgroundImage:forState:barMetrics: was useful for coloring my UISegmentedControl.

I thought about trying to animate the angle view display but after seeing that there was a CoreAnimation manifesto I kind of gave up, it doesn't seem to want to animate lines, just layers...

Luda gave an excellent explanation of how to add the done button, OK button, cancel button, or whatever on top of your keyboard in your iOS app.

XS-Labs gives an excellent rundown on XCode build settings

I asked this really stupid question on StackOverflow as to why integers don't get auto-cast as floats when getting assigned to floats. -11 lol

Save graphics from app to camera roll

Add custom fonts to iOS app

Audio capture project

Found this cool project and downloaded it for audio capture and shit

NSNotification to work for the accessibility feature where you invert the screen

I couldn't get the NSNotification to work for the accessibility feature where you invert the screen

I asked this question on stackOverflow:

I am not sure if this is an iOS 7 bug or what. But..I cannot get the UIAccessibilityInvertColorsStatusDidChangeNotification to work.

So when I init my nib I do this:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {

[[NSNotificationCenter defaultCenter] addObserver:self





return self;


Later in my code I have the notification:

- (void)inverted {

if(UIAccessibilityIsInvertColorsEnabled()) {

NSLog(@"setting tintcolor to cyan");

self.view.tintColor = [UIColor cyanColor];

[self tintColorDidChange];

} else {

NSLog(@"setting tintcolor to red");

self.view.tintColor = [UIColor redColor];

[self tintColorDidChange];



However when my app is running and I change the Invert Colors mode via tripple-tap on the home button, nothing happens in the app. Don't get a message on console, don't get a change of tintColor, don't get nothin'.

I tested this on iOS 6 and iOS 7. I tried setting my build target for iOS 6.1 instead of 4.3 and that didn't fix it either.

I tried adding -(void)inverted; to my interface and that didn't fix it. I tried adding the colon after inverted but that didn't fix it either, and the docs say that this notification doesn't have an argument anyway.

Obviously I'm doing something wrong. What? Thanks in advance.

Monday, September 30, 2013

Refactoring almost done

I am almost done with moving about 370 lines of code from the viewcontroller into the model. There were a lot of bugs along the way. This took me a couple of weeks to do.

Along the way I found a good article about bitwise operators in Objective C. I asked What is the convenience method to compare two NSNumbers with float values using limited precision? but still haven't gotten a response. I asked this because I learned some very annoying things about floating point imprecision. Many people have had this problem before. Answerers always reference this really long-ass thing about floats. Blah.

I still haven't got my double-tap recognizer on the segmented control in the main view controller, but I did get a couple answers on how to do it potentially.

Anyway that's where we're at, gotta go get some real life shit done...

Saturday, September 28, 2013

Submitting my App again

I've been going through the Apple guide to submitting your app and trying to get it all done. Still need to fix bugs first though.

Infix Expression Calculator

I used stribehou's Infix Expression Calculator for Objective C to add math expression parsing and computation functions to a text field in my app. Woot! It uses the shunting yard algorithm, and I found it by googling about that. This algorithm is like how train yards control trains. So the interwebs aren't a series of tubes... they're a series of trains! Unless you're in London.

Agile Development

I kept seeing "Agile" everywhere so I googled it. Found some interesting links, like Jeff Sutherland's Agile Principles and Values at Microsoft, and of course the Agile Manifesto. Monjurul Habib's Agile software development methodologies and how to apply them seems like a good explanation. Of course just like with Einstein's Relativity, the original thing makes much more sense, and is much more clearly written, than any of the articles about it. Programmers aren't good writers because they approach writing the same way they approach programming. Ironically, approaching human interaction the same way you approach programming is the antithesis of the Agile philosophy :P

Sunday, September 15, 2013

Trying to figure out how to make a touchDownRepeat work on a UISegmentedControl

CocoaNetics talks about how to programatically make a button that has double-tap functionality. But how do you use Interface Builder to do the same thing?

Sunday, September 8, 2013

Sony Camera Developing

Sony has now a way to become a developer for its WiFi cameras' API. But the API seems quite limited at this point: you cannot change the shutter speed, ISO, aperture, white balance, or any such things... just simply take a picture. Oh well, maybe later.

Wednesday, August 28, 2013

AWS for Node.js

Started using this really cool node package that lets you use any AWS services like SimpleDB from right inside Node.js.

How to escape a space in Angular

I asked this question on, because I was having issues getting dot syntax to work with Angular and mongoose. Turns out you can't have a space in there, and have to drop the dot in favor of square braces and quotation marks. Ugh, I hate ["double enclosure"] requirements... dumb!

At first I thought I might have to use $interpolate or $sanitize Angular services along with express's app.set but I was wrong. Angular is still very mysterious to me, Express only slightly less so. Time! sigh

Mongoose Schema Definitions

Here is how to define a schema in Mongoose. And how to make connections. Here is where to login to which is where my DBs are. This was something I was working on as part of the and sith'ari sites that I haven't touched in a couple weeks due to hammering on my patent application :/

Async was needed for Connect-mongo

You have to have async installed for socket-io to work with connect-mongo evidently. I kept running into a bug that led me to this ("Error: Cannot find module 'async'"). For some reason I'd thought it was already in node by default :/

PlayStation Mobile Developer

I registered as a PSM developer during the free trial, woot ;D Here's the SDK docs and dev portal.

Scripting with Mono

Here is a good site talking about how to script with Mono.

Scripting with Mono

Here is a good site talking about how to script with Mono.


I particularly like this wikipedia article that discusses surfaces.

Friday, August 23, 2013

State Machines

Getting really interested in state machines lately.

Trying to find a good tool that can take standardized state machine markup as input and generate a good visual representation.

Antares Universe VIZIO, a development visualization tool for Unity 3D, seems to be a cool plug-in for visualizing state machine stuff, as shown in this YouTube video.

State Machines

Getting really interested in state machines lately.

Trying to find a good tool that can take standardized state machine markup as input and generate a good visual representation.

Antares Universe VIZIO, a development visualization tool for Unity 3D, seems to be a cool plug-in for visualizing state machine stuff, as shown in this YouTube video.

Tuesday, August 20, 2013


Lcfvs pointed me in the direction of yld, a very cool-looking Node.js package. No wonder, it's his own creation. Here's what he says about it:

Contrary to promises, where developers add functions and disorganize their code, yld allows you to execute instructions linearly.

Each yield pauses the process and allows to retrieve a response from another function ... this is comparable to promise.then().

This programming method avoids to pass the variables from scope to scope, to handle the response.

If you have already tried to use JavaScript asynchonously, you have certainly thought about some answers to these issues.

Sounds good to me!

Akka looks cool

I don't know much about Akka but it sure looks cool. Requires Scala though. And this guy says Node.js with Express is way faster. Hmm.


Lcfvs pointed me in the direction of yld, a very cool-looking Node.js package. No wonder, it's his own creation. Here's what he says about it:

Contrary to promises, where developers add functions and disorganize their code, yld allows you to execute instructions linearly.

Each yield pauses the process and allows to retrieve a response from another function ... this is comparable to promise.then().

This programming method avoids to pass the variables from scope to scope, to handle the response.

If you have already tried to use JavaScript asynchonously, you have certainly thought about some answers to these issues.

Sounds good to me!

Monday, August 19, 2013

More on Software Patents

Today I wrote a comment on an ipWatchdog article where I said:

To say software does not alter the physical machine is wrong. Software is stored as a specific orientation of magnetic particles on a disc, or a specific orientation of physical electrons stored within a memory matrix (RAM, SSD). Software sends specific computing instructions to a processor in the form of precise physical patterns of electrons. Just in the same way, the distributor in a car sends electrons to spark plugs in a specific sequence enabling the engine to run, and most cars now use a computer to control much of this. Further any machine is nothing more than information temporarily conveyed in the arrangement of protons, neutron, and electrons within the spatial matrix of the "reality" of the universe, which is arguably itself a giant quantum computer that we ourselves are merely software running on (see MIT theorist Seth Lloyd's paper, "Universe as quantum computer"). The fact that genes are patentable belies the validity of arguments against software patents since gene sequences are merely biological software! And biology is merely software running on the universe itself.

Re Bilski was denied because they tried to tack "on a computer" to their ideas just to make it patentable. Citing a "data source" does not require a computer: an autistic guy who memorized the phone book is a data source, too. Software that relies on specific things about computers like network protocols, markup languages, complex data structures that are clearly defined by the patent, etc. are things that remain patentable. Saying "a piece of software that accomplishes goal X" is not patentable without thoroughly explaining how that goal is accomplished by the software.

Friday, August 16, 2013

How to use SimpleDB with Node.JS

in the main app:

//aws config


AWS.config.update({region: 'us-east-1', apiVersion: '2009-04-15'});

exports.AWS = AWS;

in the views/partials/partial1.jade:

p IC Name: {{character.Attributes["IC Name"]}}

in public/js/controllers.js:

socket.on('send:character', function (data) {

$scope.character = data.character;

in routes/socket.js:

var AWS = require('aws-sdk');

var sendChar = function(socket) {

console.log("send character");

var sdb = new AWS.SimpleDB();

var params = {

'DomainName': 'Avatars',

'ItemName': 'Avatar Name'


sdb.getAttributes(params,function(err, data){

if(err) {

console.log('error in send:character: ',err);

return error;


charData = {'Attributes':{}};




console.log('char data returned: ',charData);

socket.emit('send:character', {

character: charData




module.exports = function (socket) {





Wednesday, August 14, 2013

Starting a new Node.js Jade Angular Express Site on OpenShift :D

So to start a new site I went to btford's angular-socket-io-seed and downloaded the zip. He seems to have changed his package management over to bower, and alternative to npm, though there seems to be disagreement on stackoverflow as to which is better. Whatever. Here is the definitive article on package management that addresses nom, bower, et al. The whole idea is to get the Amazon AWS SDK node package working with it.

I made a new node site on OpenShift, pulled the repo, then deleted everything and copied the angular-socket-io-seed. Then I globally installed bower, and locally installed socket-io and express in my new app. I renamed app.js to server.js to satisfy OpenShift's launcher. Also had to npm install Jade.

Next I had to change in server.js:

self.ipaddress = process.env.OPENSHIFT_NODEJS_IP;

self.port = process.env.OPENSHIFT_NODEJS_PORT || 8080;

This ends up looking like this:

app.set('port', process.env.OPENSHIFT_NODEJS_PORT || 8080);

app.set('address', process.env.OPENSHIFT_NODEJS_IP);

Added app.get('address'), to server.listen.

That worked, except the time isn't showing up. Well it's on a severe delay.

So I nav'd to /public in my project and did:

bower install angular-socket-io

This is to update that since it was 0.0.2 in the project but current is 0.2.0, and I think it was having to download a dependency causing the delay. Nope, the delay was due to the fact rhcloud does not support websockets on the default port! Therefore it falls back on XHR polling just like Heroku does, at least by default. But as of December 2012 they had a preview with websockets working. You have to use port 8000 for http or port 8443 for https for it to work evidently.

So therefore... what I had to do is in my client app.js I had to add this:

config(function ($routeProvider, $locationProvider,

//this as per the angular-socket-io documentation to get it to connect to the port 8000:

socketProvider) {

var mySocket = io.connect('http://myURL:8000');


Because otherwise it will still default to the regular port and go back to nasty XHR polling.

I thought of using a proxy module for node but this worked so hey. It goes to show you. There's usually a non-obvious built-in solution to obvious problems.

ZOMG I had to bower install angular-cookies ... for some reason it's not already there... WTF!?

Then I had to drag the angular-cookies files into the angular main folder... they couldn't be in the separate folders that it makes for your ass. WTF WTF. It was because I wasn't loading scripts in order in my index.jade file.

Now I keep getting the error:

/Users/qwerqwer/Documents/Dev/node projects/sithari/routes/socket.js:45

thisApp.thisStore.get(sid, function(err, gotsession) {


TypeError: Cannot call method 'get' of undefined

Why the heck is it undefined?

Because I needed to npm install Async.

Monday, August 5, 2013

Software Patents: Good Idea?

I read this article on and posted this comment:

Mr. Love's arguments are illogical.

First of all, he tries to assert that small companies don't file patents, only big companies like Apple and Google; then he says that these big companies spent $15 billion in 2011 to buy their patents *from other companies!* To me that sounds like a great reason to file a patent, if you're a small company: so that later on, you can sell it for lots of cash to someone like Apple or Google.

Mr. Love mentions that most software start-ups don't file patents, but he does not provide any supporting evidence as to why, nor does he state how much less likely they are to file these patents than start-ups in other industries. Leonid Kravets reported on that 29.5% of general software start-ups file patents, while 38% of network hosting software start-ups do -- compared to 52% of general hardware start-ups and 65.2% of semi-conductor hardware start-ups ("Do Patents Really Matter To Startups? New Data Reveals Shifting Habits", June 21, 2012). He also showed that start-ups who do file patents are increasingly more likely to file additional patents. However only 15.9% of web start-ups file a patent in the first four years.

It seems pretty obvious that the type of software being developed is the key factor in determining whether or not a start-up will file a patent. These days, many software start-ups rely heavily on open-source software; their company may not even be selling the software itself, just the service of supporting that software or providing particular content via that software. This is particularly true for web companies who are more service-oriented and content-oriented and do not sell software; or for game companies who license gaming engines from other companies and are not innovating new methods of how a video game is made, but rather, are simply providing a new "flavor" of an existing type of game, relying on copyright to protect their game's unique aspects (3D models, music, textures, level design, etc.).

Mr. Love did not interview any start-ups or conduct a survey of start-ups to find out why they are not filing patents. He implies that even if these companies have something patentable, they simply don't think it's worth patenting anyway. However he provides no examples of companies who decided against patenting a patent-worthy software innovation, simply because they thought it wouldn't do them any good. I am certain they would be difficult to find.

If you are a software start-up who has actually developed a completely original piece of software that does something no software has really done before, in a unique way that is truly worthy of being patented, then why should your right and ability to patent that idea you worked so hard to create be taken away from you, just because some jerks decided that because it's written in code as opposed to made out of metal, therefore patents should not apply? Or just because some litigious companies abuse the system (something that should have a separate cure besides just getting rid of software patents)?

Also what is the problem with Apple and Google paying their attorneys a lot? Mr. Love also does not provide any information on what other major tech companies spend on their attorneys, such as General Electric. I highly doubt Apple spends more on attorneys than GE! Also the attorneys that Apple and Google are paying are largely US citizens who put that money back into the economy. Even with this, attorneys still have a hard time finding work in the US due to the fact that our government does not enforce the constitutional right to a fair trial in this country except in criminal proceedings. If you are a small business and get hit with a bogus tax assessment, it will cost more for an attorney to defend yourself against the vampire state than it will to simply pay the tax assessment, due to the fact that you are not afforded a court-appointed attorney.

I also think:

If there is a reason a software patent might not be a good idea, I would say it is the fact that by filing the patent, you must publish your entire idea, which makes it an easy matter for a programmer in China or wherever to copy your idea long before you have the opportunity to file a patent outside the US. And unlike hardware that must be physically imported, and therefore the importation of it can be blocked, software being sold from a website hosted outside the US would be very hard indeed to take action against, even if your patent is approved. All they have to do is change their website's name.

I also wrote:

Sean, imagine you're an inventer. You work a day job 44 hours per week. In your "spare time" you stay up late and slave away on an invention. It's something that's never before been made, which will enhance the lives of the people who use it. You personally recognized the need for the invention, designed it, tested it, made it, built it, wrote documentation and diagrams for it, and now you want to sell it. Now someone is telling you: your invention does not consist of physical items therefore I can copy it exactly and sell it and you have NO RECOURSE. Your patent application gets denied because there are no physical items involved in this thing, it is something that only exists inside a computer environment, or inside of virtual reality, or on a website, etc. How would that make you feel? I would say you had wasted your time inventing something that wasn't a physical object, and that you just got SCREWED.Look: if I invent something that is made out of metal and parts, all I am doing these days is simply designing it in a 3D CAD program and then sending all my digital plans to some company in China (or wherever) who basically just "prints out" the design. How is the printing out of that digital design any different than the display of a digital design on a computer monitor, in which the digital design is converted into a *physical* array of photons that hit your eyes, just like the 3D printer makes a digital design into a *physical* array of atoms that hit your hands? I think the fallacy here is that there is a difference between hardware and software. Yes, some inventions must take a certain form in order to function properly -- RAM must be a certain arrangement of molecules in reality, while a computer game must be a certain arrangement of electrons in RAM, etc. But it is fallacious to say that everything does not exist, at some level, in physical reality. Vlatko Vedral argues coherently in "Decoding Reality" that physical reality itself is essentially a quantum computer, which means that everything is software at a certain level. The problem is patent trolls, and you people want to solve this problem via draconian methods. The real solution would be to revise patent law to better define what aspects of software are patentable, and what aspects are not; and to establish a set of legal criteria for what a patent troll is, then make it a crime to be one.

Sunday, August 4, 2013

Thursday, August 1, 2013

Got Authorization Working Better

This was useful to get auth working better:

Passport looks cool but I don't have it in use yet:

Had to install nom install cookie to do cookie.parse to un-semicolon-list the cookies for proper un-signing.

How to fire an embedded document in another document in MongoDB / Mongoose.js

Here's what I had to do:

socket.on('get:planet', function (data, callback) {

//console.log('get planet heard');




                .exec(function (err, results) {


socket.emit('send:planet', {





Populate pulls the goods from another record and plops it in there.

But now my problem is how to use Angular select ngOptions to deal with this in a form?

Sunday, July 21, 2013

Getting a Patent for my App

So I found some links for getting a patent for my Dialog System:

NOLO is a great, free informational site. Also, be sure to read what the USPTO (United States Patent & Trademark Office) has to say about patents.

Associations may be a good avenue to explore. These organizations will address many of the thoughts, questions and concerns you'll inevitably have as well as many you haven't anticipated yet. See the source box for some relevant links.

Research, research, research – this cannot be stressed enough. Read as much as you can. Here are some book titles that are relevant:

Getting a Patent:

* Patent It Yourself (11th Edition) by David Pressman

* Patents and How to Get One : A Practical Handbook by U.S. Department of Commerce

* How To Make Patent Drawings Yourself: A Patent It Yourself Companion by Jack Lo

* The Inventor's Notebook: A Patent It Yourself Companion by Fred E. Grissom

What to do Next:

* From Patent To Profit: Secrets & Strategies For The Successful Inventor, Third Edition by Bob Dematteis

* How to License Your Million Dollar Idea: Everything You Need To Know To Turn a Simple Idea into a Million Dollar Payday, 2nd Edition by Harvey Reese

* The Inventor's Bible: How to Market and License Your Brilliant Ideas by Ronald Louis Docie

* The Complete Idiot's Guide ® to Cashing in On Your Inventions by Richard Levy

There are plenty of free informational resources out there. Check the source box for links to articles.

Hope that helps! I wish you much success & happiness in all your ventures!

Source(s):… -- NOLO – Patents Resource Center – United States Patent & Trademark Office Home Page… -- USPTO's FAQ about Patents… -- USPTO's How to Get a Patent -- Search Patents

Associations: -- International Federation of Inventors' Associations -- United Inventors Association -- Directory of Local USA & Canada Groups

Articles:… – Patent – How to Get One by Michael Russell… – Invented Something? Get a Patent by Thomas Choo… – How to Select a Patent Attorney by Lisa Parmley… – How to Patent Your Invention by Neil Armand… – Can You Start Selling Your Invention Before Patenting It? by Xavier Pillai

It might not be free for you.. but what you can do is do a search online for free...

Read more here..…

Patents : Do it yourself.…