Multiple Detail Views in Swift

 

See Larry my African grey watch and comment on my video. In this video I demonstrate how to call multiple detail views from a single table. This will give you a menu structure like option for different experiences.

 

Here is the code used in the application:

override func tableView(tableView: UITableView,didSelectRowAtIndexPath indexPath: NSIndexPath) {




        if indexPath.row == 1 {

            self.performSegueWithIdentifier("secondView", sender: self)

        } else {

            self.performSegueWithIdentifier(“others", sender: self)

        }

}

Creating a simple state CRUD REST Service using NodeRed on Bluemix

This is my first article and video in my BlueMix series. BlueMix is an amazing platform where you can get a highly scalable solution up and running very quickly. Because there is so much to BlueMix, I figure I would start off with something simple but useful. A state storage and retrieval service. A simple REST API based on JSON implemented as a NodeRed application on the IBM BlueMix platform. We will be doing the CRU of CRUD (create, read, update, delete), so no delete in this first stab.

The first flow is the “Store State” which is an HTML POST that takes this JSON object:

{
"_id": "eb7c844a07e4ad183df6e7921498c898",
"_rev": "8-47b75155b16372e040ec9803c550b91c",
"key": "BobBalfe","state": "0"
}

Don’t get intimidated by the complexity of that because you actually get most of that information from the get state flow below. But first lets look at the store state flow:
Screen Shot 2016-03-29 at 10.44.19 PM

Now we could just slam that information right into the database but I don’t like doing that without at least one or two checks prior. The switch statement takes care of that, I basically require a “key” property in the JSON in order to continue. Otherwise I take the entire load, with the unique key, and store it. If no key is specified the original load is sent back to the caller with an error:

Screen Shot 2016-03-29 at 10.45.10 PM

Now for the easy part, the “get state” REST call. This takes a very simple load:

{     
     "key" : "some big unique key"
}

Yep, thats it. And if you have an entry in the database you will get an array with a record back, otherwise you will just get an empty array. This is because I am really not doing much in this flow. I pass the load into a function that constructs the search string, pass it on to the Cloudent search node and pass that functions results to the caller – pretty basic.

Screen Shot 2016-03-29 at 10.49.26 PM

Well now you can see me walk through how this flow was constructed with Larry commentating on the side.

Simulate a mouse click using Dojo with Larry

The next video in the Dojo series where I go through animating a mouse click with Dojo. The key functions used are the Dojo query and fx.animateProperty functions. Larry was pretty talkative in this one, he even answered me a couple of times.

Click here for the JSFiddle

Simulate moving a cursor in Dojo with Larry

Larry is definitely settling in on the perch with the green screen. I always have snacks in his bowls and he hasn’t touched them much. I guess he decided to sit by and snack while we record.

Continuing on from the previous video here we implement a moveto function in our simulator.  There is one fix in the code, I removed these two lines as I realized I did not need them:

var l = Math.round(aPos.x);
var t = Math.round(aPos.y);

Check out the jsFiddle here.

 

Simulate typing text using Dojo with Larry

This was a pretty funny video, Larry is definitely becoming more comfortable in front of the camera. He says a lot of new phrases and a couple of swears in this one.

So this is the first part in a three part series where I essentially do the same thing I did in the jQuery series. One difference is I start with the typing text emulator. With the Dojo query API it is very easy because it uses the same CSS3 convention jQuery uses.
Click here for the jsFiddle

 

The new for loop in jQuery 3

Love the fact that the for loops are now iterations in jQuery. The old way of doing loops like this:

var $elements = $(".myclass");
for (var x=0; x< $elements.length; x++){
       $elements[x].toggleClass("shadow);
}

Can now look like this in jQuery 3:

var $elements = $(".myclass");
for (var element of $elements){
       element.toggleClass("shadow);
}

Simulate Typing Text using jQuery with Larry my parrot

This was the first time I recorded Larry at the same time I recorded myself doing a lesson. Let’s just say he didn’t say what I wanted him to say. Too many F-U’s in this one. The good thing is he doesn’t say the word, he actually says the letter F then the letter U. Either way, its pretty cool how easy this was to do and I am sure Larry will be saying a lot more as he gets comfortable in his new setting.

On to coding and the video!

Continue reading “Simulate Typing Text using jQuery with Larry my parrot”