Friday, January 31, 2014

XML to JSON

Right , so I was going to blog about the fail of a night I had last night. I tried winging the creation of an application, but turns out that it’s really not a smart idea and you become unorganized. Lesson learned!
So instead of informing you about my failures, I’m going to show you my small triumph! Holla! Today work asked me to create a ruby script that fetches RSS feeds from various news sites and create a JSON out of the RSS feeds. Figuring this has a gem out there I googled the situation. All I got in return was a bunch of gems that halfway did what I needed, or made it x10 harder than it needed to be. So I broke it down into individual steps then created the ruby to go along with it.
1.       Get response body from URL *RSSfeed
2.       Change response body from XML to JSON.
3.       Output to JSON file.

require 'net/http'
require 'active_support/all'

s=Net::HTTP.get_response(URI.parse('http://rss.cnn.com/rss/cnn_topstories.rss')).body
response = Hash.from_xml(s).to_json
    file = File.new("feed.JSON", "w")
     file.syswrite(response)
     file.close

That’s all I want , pretty simple and not that complex. Other gems were going to have me build my own template and blah blah blah. Nah , so I looked a bit into activesupport ( used this gem in previous ruby scripts I’ve created) and it helps with the .from_xml . I’ve been searching for a while on how to switch xml to json for the web app I’ve helped create here at work. But dang.. It’s just so short and sweet and it makes me excited. :D

Hope this helps if you need it

-Hannah

Tuesday, January 28, 2014

We are pleased to inform you that you have been accepted at Hogwats School of Witchcraft and Wizardry-

  I have such an inner struggle with this. I grew up with Harry Potter and company, went on the adventures with them , experienced heart break ( I still have problems with the fact JK killed Sirius ) and triumph.

As the days approached my 11th birthday, I started getting nervous and excited for the letter I was sure that I was to receive. My birthday had come and passed and I experienced heart break, much like many other children around the world. But now that I have grown up a bit and actually realized that unfortunately Hogwarts is only a place I can visit in my imagination and Disney World, I got to thinking about the concept of Hogwarts , witchcraft , monsters and magic. To be entirely honest , I have no idea if I could handle it. Let me explain .

Right , so I grew up with the internet.  Literally. The first website was created on the sixth of august in 1991. So the internet is older than me by three weeks.  So there was never a time while I was alive that the internet wasn’t available. By the time I got to elementary school we were learning how to use the world wide web and all of  that jazz. THE POINT , im trying to get to is that I don’t think I would have a clue how the heck to function without technology. My tooth bush is electric for crying out loud!!

Oh , you want to text your friend? No cell phones.

Oh you need to email your family?  Wrong , you’re going to use an owl to communicate.

Although, it would be pretty rad to have the great hall. Such good food and you don’t have to cook.  Honestly, all these kids stating how they want to go to Hogwarts, they’d need therapy after a week. I know I would! 

Monday, January 27, 2014

Do you want to break free from your iOS jail cell?

After seeing all the fancy pictures of what people can do with a jailbroken iPhone gets you thinking " Should I commit to the jailbreak?" "Is it a good idea to jailbreak your phone?". Well here is the low down. By jailbreaking your iPhone, you have the ability to access files that usually would be completely out of reach from you. Your ability to reach these files gives you the opportunity to express your individuality as a iOS user.

Oh , you want a batman symbol instead of your carrier's name? Jailbreak has a tool for that.
Oh, you want different types of icons for your app? Jailbreak has a tool for that.

It can open you up to so many different things that will enhance your iPhone experience. There is a whole community of people that contribute to the tool development for jailbreaking. It's actually honestly pretty cool what you can do with a jailbroken phone.

This question always comes up though... Is jailbreaking legal? 

As of right now , yes , it is legal as long as you don't use it to unlock your phone to different carriers. So , change all the things that you want to change * insert all the things meme* and go crazy. Just stay clear of unlocking different carriers because that's when things become illegal.

Next most common question. Can I brick my phone? 
*To brick - to render unusable making your iPhone become a very expensive paper weight*

I haven't heard of anyone bricking their phone from jailbreaking but I could be wrong. I am pretty sure that you are good to go as long as you back up your phone before you start the transformation. But don't quote me on that because I am not 100% sure.

Overall , it's a great way to express yourself while still having an iPhone. But there are alot of risks that come with it that may not be worth the trouble of actually jailbreaking your phone. So , it is totally up to you!!!

I have been looking into the whole jailbreaking scene ever since seeing this reddit post in r/jailbreak : here

It's just so pretty!! and the add on's are rad. Like the whole flux thing , that's just awesome.

Lemme know if you've jailbroke your phone and if you like it or not.

-Hannah


Friday, January 24, 2014

Technology Diet Status : OVER

Hey guys, sorry it's been so long! I've been ultra-busy, unfortunately not with a new job (they found an internal person). But I honestly just haven't been near a computer other than work. Which is honestly a good idea every once and a while, a technology diet is never a bad thing.

I unplug myself one every couple , when I say couple I mean like 9 months , and I just go out into the real world and do things. I got my hair done , I went hiking , started a new workout regimen with my friend and even started reading a book. *Gasp* It's been decent but I am ready to dive back into the world of technology. I really need to start working on my app. I think I am going to start that tonight before mid-night soccer. 

Also , I am getting ready for a lot of change in my life and having Virgo tendencies it always makes me feel like i am unprepared. Alas, things will work out and change will happen. The latter is inevitable. I will keep you posted on the change that I am going through once everything is confirmed, I am weird and do not wanna jinx it. hehe

I hope everything is well with you! If you stop by let me know and we can talk! 


-Hannah

Monday, January 13, 2014

For-Loop in Objective-C


So , I bought this book yesterday.

And what I plan on doing is once or twice a week blogging about a chapter or two whilst I relearn objective-c.  We basically covered the first* chapter last week with classes , objects and methods. Go us. So let us start on chapter 2.
*First chapter actually about code

----------------------------------------------------------------------------------------------------------------------------

*Recapping the previous chapter*

So last chapter we learned all about Data-types , objects , methods and classes.

Type float
float  floatingVar = 123.21;
Type int
int integerVar = 19;
Type double
double doubleVar = 2.923e+11
Type char
char charVar = ‘h’
Type id
id hannahObject;

*Recap Over*


So this chapter we are going to talk about looping in objective -c

     There are three different types of ways to loop in Objective-c
  • For Loop
  • While Loop
  • Do statement
But We are only covering For loops today.

----------------------------------------------------------------------------------------------------------------------------

Say we wanted to know the sum of all numbers to 150?
    ex. 1+2+3+4......+150

You could individually add all the numbers but that doesn't seem like it would be very efficient. As we are programmers and we are lazy and that's just wayyy tooo much typing.

This is how you would execute the different loops finding the sum of all numbers to 150.

For loop
#import<Fountdation/Foundation.h>

int main ( int argc , char * argv[])
{
  @autoreleasepool{
     int n , sumNumber;
sumNumber = 0;
for (n = 1; n<=150; n = n+1)
sumNumber += n;

NSLog(@”The sum of the numbers is %i” , sumNumber);

   }
return 0;
}
The format of a for loop is

for( init_expression ; loop_condition; loop_expression)
program statements

The three expressions inside of the parentheses are the expressions that control the for loop.

init_expression: used to set up values before the loop begins. (ex. N = 1; )
loop_condition: Used to state the conditions for the loop to execute. (ex. N<= 150;)
loop_expression: This is evaluated after each time the program statements have been executed. (n = n + 1;)

This is a very basic explanation of for loops. For Loops can be very powerful when used correctly. But you must be careful not to fall into the infamous infinite loop. This is when your loop condition is never met and causes the loop to run forever.

Tomorrow I will chat about While loop!

Friday, January 10, 2014

What the Tech : Selfie Olympics

New year , everything is going to be bigger and better right? Bigger ideas , new and better you!

Right well we already have an incredible community of people participating in what is called the "Selfie Olympics". I have NOT the slightest clue on how this started , or why it even started but brace yourself it's about to get wild.

Just a few that made me laugh (See more in my video)  :


Some people are just so much more creative than I am. I can hardly take a regular selfie without looking like grumpy cat let alone do wild things whilst taking a selfie. If this is any indication on how the internet is going to go this year. We are in deep trouble.

55 hours later | Just Hannah

And my hell week is over. I created over 50+ scenarios for my application at work. *war flash backs to finals week during college* Oh my goodness.. tonight I'm going to lay down and watch a movie then go play some soccer Not really anything technical today , just sheer exhaustion and coffee fumes.  A fast paced development cycle is so intense sometimes. But let's be real i'd rather this than slow and boring work,,,

*cheers*