======asm Journals====== ==== January 28, 2013==== Todays snow day doesn't mean a break from work. Spend time reading up what an ABI is and how it's used as a low level binary communicator between the program and the hardware. ==== January 30, 2013==== Today Jacob and I spent the better part of our day working on the dynamic AND, OR, and NOT functions. This actually helped me understand how their logical operations work on a fundamental level - learned a lot. ====February 9, 2013==== Various logical gate and derived gate programs are taking shape. My bitbucket repo says it all: [[https://bitbucket.org/asowers/cscs2650s13/src]] ====February 15, 2013==== Finished a 1 -2 decoder and four input multiplexer. ====April 2, 2013==== Quick update. Things are going just swimmingly for comp org, the JK FlipFLop continues to prove ever versatile when implementing counters and serial to parallel registers. Check the bitbucket for code examples. ======hpc2 Journals====== ====January 28, 2013==== Missed the first day due to snow, but I've spent the day contemplating project ideas. I was thinking of using a web server and building an application that fits into another project for another class. This notion of mixing projects into one coherent project seems to be the best path. More to come later. Later on I started researching how to play audio on my Raspberry Pi. This will eventually be worked into the sound project. I found a useful start here [[http://jeffskinnerbox.wordpress.com/2012/11/15/getting-audio-out-working-on-the-raspberry-pi/]] Followed by this post: [[http://blog.scphillips.com/2013/01/sound-configuration-on-raspberry-pi-with-alsa/]] ====February 6, 2013==== After some time to contemplate I've decided that pursing a server monitoring app for IOS will encompass the disciplines of this course while simultaneously including disciplines from others. So far I've been looking at the following resources for a starting point and have designed an app mockup in xcode. [[http://www.libssh.org/]] [[http://stackoverflow.com/questions/412562/execute-a-terminal-command-from-a-cocoa-app]] [[http://x2on.de/2011/02/02/libssh2-for-ios-iphone-and-ipad-example-app-with-ssh-connection/]] ====February 9, 2013==== Exploring other tutorials now. The previous examples use deprecated code I guess, looking into it. ====February 15, 2013==== Found a different tutorial/guide. Exploring possibilities... [[http://www.apeth.com/nonblog/stories/libssh2sftpcocoawrapper.html]] The guide is for this project: [[https://github.com/karelia/libssh2_sftp-Cocoa-wrapper]] ====February 16, 2013==== Found new scripts that'll build libcrypto.a, libcrypt.a, libgpg-error.a, libssh2.a, and libssl.a libraries. After importing them into the sample project I can execute simple server side commands and return the output to a text field. {{:opus:spring2013:asowers:screen_shot_2013-02-16_at_10.32.01_pm.png?300|}} ====February 17, 2013==== It's 2:30 AM. Can't sleep. Thinking about this project so I might as well write about it. I plan for this to be an all encompassing course project. It'll use sockets, threads, an array of static libraries, maybe a few web pages, and other goodies... Looking on the official libssh website for example code. From there I'll attempt implementing things in objective-C [[http://www.libssh2.org/examples/]] This is pretty awesome: [[https://github.com/kstenerud/iOS-Universal-Framework]] Found a new libssh wrapper that may yield more desirable results: [[https://github.com/Lejdborg/NMSSH]] Playing with the new NMSSH wrapper, the syntax is very easy to understand. Here's some sample code: NMSSHSession *session = [NMSSHSession connectToHost:@"69.205.233.207" withUsername:@"andrew"]; [session authenticateByPassword:@"notMyRealPassword"]; if ([session isConnected]) { NSLog(@"Successfully created a new session"); } if ([session isAuthorized]) { NSLog(@"Authentication succeeded!"); NSError *error = nil; NSString *response = [[session channel] execute:@"ls" error:&error]; NSLog(@"Response: %@", response); } This sends the result of an ls to my iPhones's stdout. (maybe stderror?) ====February 18, 2013==== GLOBALS! =D This could get dangerous... ====March 5, 2013==== I was looking at the NMSSH.h header and found out the "error:&error" is meant to return errors from from stderr if there are any, otherwise the *response string we create is the output of stdout. ====March 8, 2013==== Passing objects betweens classes and views is possible through the [[UIApplication SharedApplication] delegate] class. What this does is share the class members through main. Here's an example of passing strings and an NMSSH session. lairRdAppDelegate.h: #import #import @class liarRdInitialViewController; @class lairRdFirstViewController; @class lairRdSecondViewController; @interface lairRdAppDelegate : UIResponder { NSString *data; NSString *data1; NSString *data2; NMSSHSession *globalSession; } @property (strong, nonatomic) UIWindow *window; @property (copy, readwrite) NSString *data; @property (copy, readwrite) NSString *data1; @property (copy, readwrite) NSString *data2; @property (nonatomic, readwrite) NMSSHSession *globalSession; @end this header declares the pointers that will communicate between the classes. lairRdAppDelegate.m @synthesize data, data1, data2, globalSession; The only thing we 'need' to do in our implementation is synthesize these variables. lairRdInitialViewController.h Declares pointers that are accessible within this class/view. lairRdInitialViewController.m synthesize the class pointers. Finally, here's the magic part: lairRdAppDelegate *data = (lairRdAppDelegate *) [[UIApplication sharedApplication] delegate]; data.data = username; This will allocate and initialize the variable within the AppDelegate. We then pass the value within the current class to the main AppDelegate that is shared through the [[UIApplication sharedApplication] delegate] class method. This is fucking awesome and extremely useful for solving a cavalcade of problems. This can be used to pass entire objects and their states across classes. ====March 28, 2013==== I've implemented a thread that takes care of my authentication method. this allows me to do some fancy UIProgress view stuff for the user to see while the system is authenticating the SSH session. - (IBAction)login:(id)sender { spin.hidden = 0; [spin startAnimating]; username = userField.text; password = passwordField.text; ipaddress = ipField.text; [NSThread detachNewThreadSelector:@selector(login) toTarget:self withObject:nil]; } - (void) login { session = [NMSSHSession connectToHost:ipaddress withUsername:username]; [session authenticateByPassword:password]; [self performSelectorOnMainThread:@selector(loginMethod) withObject:nil waitUntilDone:1]; } - (void) loginMethod { if ([session isConnected]) { NSLog(@"Successfully created a new session"); } if ([session isAuthorized]) { [spin stopAnimating]; NSString *auth = @"Authentication Successful"; NSLog(@"Authentication succeeded!"); authButton.hidden = YES; textView.text = auth; [self.view endEditing:YES]; ipField.hidden = 1; userField.hidden = 1; passwordField.hidden = 1; spin.hidden = 1; toolButton.hidden = 0; lairRdAppDelegate *data = (lairRdAppDelegate *) [[UIApplication sharedApplication] delegate]; lairRdAppDelegate *data1 = (lairRdAppDelegate *) [[UIApplication sharedApplication] delegate]; lairRdAppDelegate *data2 = (lairRdAppDelegate *) [[UIApplication sharedApplication] delegate]; lairRdAppDelegate *globalSession = (lairRdAppDelegate *) [[UIApplication sharedApplication] delegate]; data.data = username; data1.data1 = password; data2.data2 = ipaddress; globalSession.globalSession = session; }else { NSString *fail = @"Error: login failed"; textView.text = fail; } } ======sysprog Journals====== ====January 28, 2013==== I've decided to dial back a few steps with my plan to intergrade SDL and Xcode. Running through all the "Lazy Foo" tutorials in debian will be a prerequisite to this path. ==== January 30, 2013==== Continued with lazy foo - looking forward to some projects. ====February 6, 2013==== Updated the Minute shuffle project page. ====February 17, 2013==== The /breakout irc channel should start filling up with conversation in relation to the "breakout" game project. Expect more soon. ====February 26, 2013==== I had an idea for a new notification in Minute shuffle. If the users music que ends an IF will fire a notification object. here's the code: if ([musicPlayer playbackState] == MPMusicPlaybackStateStopped && playbackToken == 1) { UIAlertView* musicNoteClass = [[UIAlertView alloc] initWithTitle:@"Uh oh" message:@"There's no more music" delegate:self cancelButtonTitle:nil otherButtonTitles:@"okay", nil]; [musicNoteClass show]; playbackToken = nil; musicNoteClass.tag = 96; } if ([musicPlayer playbackState] == MPMusicPlaybackStatePlaying) { playbackToken = 1; } The if is within the primary "doStuff" method that fires every second. musicNoteClass is defined in the header and the tag is set at class initialization. This means the tag will reset to one when the user re-enters this view after selecting new music (if they so desire.) The second if is a precaution; music may be called externally(the view/class wouldn't be reset in this case.) ====March 2, 2013==== Big breakthrough in Minute Shuffle today - Actual shuffling! After looking up the API a bit more I figured out it was as simple as sending this message: [musicPlayer setShuffleMode:MPMusicShuffleModeSongs]; This is called in my viewDidLoad method to ensure shuffling. Now I just need to do some design tweaks and I'm ready to resubmit to the App strore. ====March 11, 2013==== 'Nuff said - https://itunes.apple.com/us/app/shuffle-hour/id612427354?ls=1&mt=8 ====March 27, 2013==== Alex and I have found a sweet pong tutorial that we're tearing apart and rebuilding with classes. More to come soon. ====April 6, 2013==== Decent update here. Over the break I had another idea to add to Shuffle Hour/Minute Shuffle - Gesture controls. I've gotten some code together that recognizes when the use swipes left. The asynchronicity is handled by a message sent via the internal notification system. Here's the code: -(void)addGesture { UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)]; [self.view addGestureRecognizer:swipeGesture]; swipeGesture.direction = UISwipeGestureRecognizerDirectionLeft; } -(void)handleSwipeGesture:(UISwipeGestureRecognizer *) sender { if (sender.direction == UISwipeGestureRecognizerDirectionLeft) { NSLog(@"The user has swiped left on the screen"); } } This code is called in once my state checker method recognizes the user has started the game. The idea here is to eventually add functionality so the user swipe into the music selection view. Perhaps I'll think of some other applications as I play with this more. ====April 7, 2013==== This is freaking fantastic: https://github.com/edgecase/ECSlidingViewController I've implemented this into the app and will do some redesign to accommodate the new user experience