using namespace kyle; - home

Kyle Kirby
August 14, 2014
So, it's been awhile, yes? Lots of new stuff, nothing to go on about right now, but I do have something to go on about. I recently had to have my iPhone replaced by Apple, so I backed up my device using iTunes. When I had the new device, I restored back to the device. To my unfortunate findings however, my previous apps were not back on the device, nor were they queued for download. Now, I know the app information is stored in the backup from previous experience, but I did not want to download all the apps again manually. I decided to give Apple a call and see if they could help me out. This was the gist of the conversation: Make sure you're signed into the app store on the device. Make sure your Mac is on the latest version of OS X. Make sure your iPhone is on the latest version of OS X. Check your previously purchased items, is that what you were looking for? And then the "genius" told me that when you backup your device, the apps and their data is not backed up with them. A total load of bull. Anyways, he was unable to help me and I informed him of the actuality that iOS backups do contain the app data, and it should restore the apps if you have the apps on your computer (but I did not, even though I had transferred purchases with my backup). So what is a programmer/coder to do? Automate this task, of course. Please find my easy steps below: 1. Copy all apps to a folder 2. Open a terminal and cd to the folder. 3. run this command: ls | sed 's/App - //' > output.txt 4. Save a file with this content in the same folder. Then run the file. Wait for iTunes to show you the app page, and click on "Download". Wait 5 seconds for the next app to show up in iTunes. Hurrah.
Kyle Kirby
December 12, 2012
Today I challenged myself to come up with two vastly different approaches to a problem. The problem being that I needed to conform a string of text to lines of a certian length without breaking words. My first approach was to use arrays and a bunch of logic. The second method was to use regular expressions. I think the regular expression approach is much more delightful. See below. Interesting stuff.
Kyle Kirby
November 29, 2012
As some may notice, my blog is called "using namespace kyle;" which is a language construct of C++. Well, up until now, I didn't actually know very much about C++ and recently I've wanted to correct this gap in knoweldge. I've started learning up on C++ and have found a lot of cool things about it. I find most interesting and fun is how C++ handles memory. From what I've determined, C++ is a front-end to memory managment. When you define a variable, it allocates some memory addresses for that variable and the size is determined by the type of variable. I find that pretty cool and amazing. Keep in mind, I come from scripting languages. Currently, I've been trying to think of ways to break the memory by tricking C++ into doing things (I wouldn't really consider it tricking but I'm not sure of a better use of words). One example I've found is inistalizing a variable then taking the address and pointing it to a pointer of a different underlying type. Having the address of a char be pointed to an int type. You can check out all of my progress on learning C++ through my github page.
Kyle Kirby
July 19, 2012
Hello everyone (or myself). It's been awhile since I last posted. The reason for this is I've been busy. Back at my job Celerity, they moved me over to a Portal Admin position, which drained me. So much so that I quit my job and started looking for new jobs in Milwaukee, WI. I found one. So I've been dealing with moving and I'm startling to settle in. However, this is a blog about programming, not my life. So, what brings me here today? I'm back to working on my PHP simple language, which I have dubbed thee "SimplePHP". Clever, right? Anyways, I've been working on making a language grammar for TextMate so it actually seems like a real language. This code simply generates: Okay, so, maybe the generated code isn't all that simple. But it's all there. All the getters and setters and fun stuff. Of course, this isn't the limit to the scripting language. Check this out: Only 43 lines of code, and most of it isn't logical code. Just defining variables and comments. This is what it produces (prepare to have your mind blown) 185 lines of code. Count them. We just took 41 lines of code and were able to produce more than 4 times that. Talk about time saving, yeah? Well, I'm off for now. For future reference, here is the generator
Kyle Kirby
March 12, 2012
Hello. After posting my previous post, I realized there were a few issues with my code. I found that KO doesn't handle observableArrays with duplicate values very well. It handles them just fine, but when you go and remove the DOM node that was assocoated with it, things get messy. To fix this, I've revised my code.
Kyle Kirby
March 8, 2012
Good Evening. I've recently become very interested in Knockout.js. So much so that I've made my own bindings. These bindings are used to join jQuery UI drag/drop/sortable to knockout. I've seen some implementations, but I wasn't very fond of them. Here is a quick feature list: 1. Binding an observableArray to a UI Sortable 2. Binding an observable to droppable/draggable. 3. Defining what can be dropped on sortable/droppable by using an extension. 4. Binding sortable to a computed property. It's far more extensive than this, but here is the code: http://jsfiddle.net/7SFuR/4/
Kyle Kirby
March 6, 2012
Hello all. Just reporting on a widget that I created. It's an interface to DirecTV's guide. It's super simple. The interface gives you a textfield to search for channels. Once you have found your channel, you hit "enter" and the next three shows display. Super simple, super awesome. Video Download Now
Kyle Kirby
February 9, 2012
Hello everyone (or just hello Kyle, since I don't think anyone else is reading this). Personal project development has been pretty slow lately; I've been pretty busy at work. However, these past two days I have been able to spend some time on my own interests (yay!). I was sitting at my desk at work when I thought to myself how I wish making beautiful code was easier. You have the hassle of writting propery PHPDoc, getter/setters, proper property naming and worrying about the design of all your classes. It takes so much time to do this and to worry wether or not you'll need to go back and modify something later. Then I thought, how cool would it be to have Objective-C's @synthesize on PHP. And having the ability to define parameters in a simple form much like that of C++. After stumbling around in my mind, I wondered how feasable it would be to take an Objective-C/C++ style @interface and convert it to PHP with all PHPDoc, getter/setters, properties, the works. A few hours later, I present to you the pseudo Objective-C code and the resulting PHP code: The code you see is real and was generated by my script. My script is able to understand protected, private, and public method/properties. Static and instance methods/properties. Methods that have referenced arguments, and return references. By default, a property defined will have synthesized methods (getters and setters). The access level of the synthesized methods will be in the same as that of the property. You'll notice things in my psuedo code like "(r+)" or "(r)". This defines what can be done in a public scope. r+ means that get and set will be public regardless of the scope of the property. r means only get will be public, and w means only set will be public. When defining a method, you set it to static using a '+' and instance using '-', just like Objective-C. You define arguments of the method by appending a colin and a list of arguments. eg: + (void) doSomething: (int)someNumber, (array)someArray; When a method has an argument, PHP doesn't automatically type check primatives, only objects. To solve for this, the script will apply type checking to your method. I plan to add a lot more on to this script; things like abstract classes/functions, interface methods, and implements/extends syntax. Once done, I plan to share this script via DonationWare on a website. You can pick your price on it, or if you don't have the money to spare you can use it for free. Until next time!
Kyle Kirby
January 3, 2012
I have a dream; a complex and simplistic one. One that has been solved, but never to the greatest extent of the idea. My dream is to have server-side integrate with client side. This has been solved by many frameworks and custom servers. All of which, or most of, require using Ajax to communicate back to the server. My dream is to eliminate the need of this extra request. Having the server snapshot custom code and render it to the client without having to do any callbacks. An example would be like this: This is just an idea. In writing this, it gave me a few ideas on how to implement it. Using a recording device, and using more specific if/elses with functions. We'll see how this goes.
Kyle Kirby
December 17, 2011
Good evening! I had previously talked about a mysterious other dilemma that I did not have the time to write about. This dilemma really goes into the depts about design ques on frameworking. The question:
How do you associate classes that make up a whole, but define completely different functionality, and are all used in conjunction with each other? How do you abstract this to the best, and when is it considered too much abstraction?
That's a loaded question. Let's break this down some more and see if we can develope an answer (as I don't have one yet). Let's start with the smaller of the questions.
How do you abstract [classes] to the best?
This seems like an incredibily difficult question. How do you know you've actually pulled out all the pieces and made them abstract? How do you know it's not exceedingly abstract? How do you know it's abstract enough for future implementations? Okay, okay. This is super loaded. Lets go and assume you are creating a framework to be prototyped for some basic functionality. I'm going to back track. I'll provide an example; the one that provoked this question to begin with. Imagine, if you will, you are to implement a ratings/reviews API into your website. You want to do a good job, right? You want it to be extremely frameworked and use a standard API for your developers that correlates to another API. Well, ratings/reviews has several different partitions. You have search engine content, content loaded from service server, and you also have a rating's star system that is based on an XML file. These are all different parts of the services API and are all called completely differenly. Not even using the same methods (such as, one in Javascript, one uses XML, another uses static files). Not to mention, each API contains several different rending types. So, how do you split this out, but make it so that it can be used later for other parts of the website that won't be using the same configuration as another part of the website. You'll end up having a lot of classes that don't really work together but are together because they share the same parent. That's about the only relationship. The problem with this is, if another part of website needs to change the implementation, that means they have to write three new classes that extend from the base classes. This seems like God Awful horrible code. How do you overcome this hurdle and allow the classes to be easily extended, changed, modified, and accessible? Yes, you can always just make each property have getter/setter. This also seems like crappy code. Maybe not; but it seems unstandard and unsafe. Inevitably, my solution was to have a helper class that brought everything together. The class allowed you to set properties on the class by defining which rendering you'd be using and the properties for it. Also, you are able to define the renderers options for the type that it was rendering. I found this to be the best in the situation. Back to my original question. I have yet to really answer it; I know. I think the method of abstraction is really all to the eye of the beholder. Everyone thinks completely differently. Some will tell you that you should only abstract as much as the business needs you to. Others will tell you to make each and every property its own class. Where's the fine line? The line is probably at which point have you detoured and are no longer talking about the functionality you were set out to introduce. When you are going into things so off subject, so different that you're just adding code to make it more accessibile. When you reach this point, you need to take a step back and figure out what you really do need. You should never be reinventing anything. Always use what tools you have available. The line is never fine, but horribly fuzzy. You should abstract out to make things easier to expand on in the future. Abstract out to seperate smaller functionalities. For example: