NavBar

Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Thursday, November 10, 2016

Raspberry Pi Project Build #1 - Controlling the Hardware Remotely With Socket.IO

So, I started last week on my raspberry pi project. I had not received my Raspberry Pi yet, so I first started figuring out how might I be able to accomplish having a web app that sends messages to the pi from OUTSIDE my local network. My initial thought was building a front-end in React/React Native with a Ruby on Rails API backend that would control the pi. I quickly realized in some internet research that a RoR backend would not be optimal, mainly because there was already a library in Python for controlling the UnicornHat LED board. So, it was in my best interest to write the pi's software in Python, even though I have no experience in Python. I would still keep the frontend in React & React native.

With that kinda worked out, I next focused on figuring out how I was going to send messages from outside the local network to the pi. The main goal of this project was that I wanted to make a fun, interactive lightboard where friends across the world could send me so pixel art that would pop up in my living room. So much of the raspberry tutorials and info focused on controlled a LED or lights while on the local network or it only interacted through GET requests to well-known APIs like twitter or gmail. I needed to send POST requests to the pi.

I started looking and couldn't find a lot of helpful info that was applicable to my project. I had heard of websockets, but hadn't used them before in any project. I started wondering if possibly that could work for me. Luckily, I found this wonderful video where someone created a server and clients using SocketIO and javascript to turn on an LED on a raspberry pi. It was kinda a mind shift for me to think of the RPi as a client, since, for some reason, I wasn't even imagining having a separate server to handle all of the requests/messages and the Pi AND the mobile/web apps being clients. After I thought a bit about it though, it made a lot of sense. I looked into if there was a python socketIO client library... and there was! So my plan was to follow similarly what I saw in the video and implement the following:

  • Create a simple Express server (javascript) that connects to clients and relays socket messages.
  • Create a javascript client on the server for testing the server.
  • Create a python client and make sure it receives socket messages from the server.
  • Create a react-native app using ExponentJS with a button just to see if it works. Make sure it connects to server and sends messages.
Project diagram showing SocketIO communication flow.

I spent my first day working on this. Surprisingly, this went pretty smoothly even though everything I was doing was basically new to me (especially the figuring out python part). I was able to get the server going locally and relaying messages to a bare bones python client and JS client on the server!

I got the python client connected and receiving messages from server!
I also went ahead and deployed my server to heroku and updated the configuration of the clients. After getting it to work, I created another client using ExponentJS and React Native. Honestly, after setting up 1 client, the process is almost identical in the other clients, minus the differences in the languages, of course.
Using exponentJS XDE, I have a React Native client also working with the server and other client!
I was pleasantly surprised that, at the end of the first build day, I had a server and the raspberry pi and react native clients communicating with each other. I really was expecting to struggle with this for days.

As I still hadn't received my raspberry pi yet, I decided that my next step would be change the client on the server, which was just html and jQuery over to React.

Monday, November 7, 2016

CS50x & a Raspberry Pi Art Project

Since my last blog post, I decided to finally try Harvard's Intro to Computer Science course (CS50) that is available to take for free through EdX. The course consists of 12 weeks of lectures, 9 problem sets and a final independent project.  Watching the lectures and working through the problem sets is a definite time commitment, especially as the coursework progresses it gets much more challenging.

During the past month I've been going through a very stressful period so I've found this course to be a great escape for me. I have thrown myself into the coursework and have been working intensely on getting through all 9 problem sets. I've learned C by solving problems using different sorting algorithms, different types of data structures, allocating memory, recovering 'lost' jpeg images from a data file, implementing a spellchecker and a web server ...all in C. I even wrote PHP for the first time to complete the last few assignments. It was nice to see that the things I'd learned as a Ruby on Rails dev were transferable when I was working in a unfamiliar language like PHP. To me, it made me feel like a real programmer. Though the language's syntax is different, the underlining principles and problem solving strategies are pretty universal. It's just really an adjustment to the syntax of the language. So I was able to jump into a PHP project, without any background in the language and get through the tasks relatively simply.

Last week, I finished all the problem sets, I just started on my final project. For this project, you have complete freedom to choose to write any kind of software that you want. I knew I wanted to do something artistic, interactive and with language(s) outside my comfort zone. I drew inspiration from a few places-- the current exhibit of Jean Tinguely's art at the Stedelijk Museum, an interest in learning about Raspberry Pis (and maker culture), and recent attendance at a React Native meetup.

My original idea was a Tinguely-inspired wall installation with EL wire, leds, motors that were connected to a raspberry pi that could be controlled/interacted remotely by a user with a mobile app. As I researched more about hardware and RPis, I soon felt overwhelmed by the hardware side of it - wiring, circuitry, power supply, soldering.

Since my focus is mainly on the software, I didn't want to get discouraged during my project by the hardware side of things. I want to setup myself for as much success as possible. So, I opted to go simpler for now and purchased a preassembled LED board with a square grid of 64 LEDS. This way, I can focus on the writing the software and getting my feet wet with hardware/RPi. Then, if it is a blast to work with, I can dive deeper into building my own hardware on future projects.

I will be using 2 pieces of hardware for this project, a Raspberry Pi 3 and UnicornHAT:
Raspberry Pi 3 w/ an AMAZING rainbow case
UnicornHAT 64-LED board

I still haven't received the hardware I ordered yet, but I've already started on the software infrastructure that is necessary to get the Raspberry Pi communicating with a remote native app or web browser. I've already gotten the RPi's software communicating with a server and receiving data from a React Native app using websockets. I am going to post much more frequently to detail how the build process is going and document what I'm up to.

This is one of the most intensive projects I've taken on by myself, since I will be writing code in multiple languages that I am not familiar with. It'll be the first time I'll work with hardware, write a native app, work with websockets, code in Python, etc etc. I can't wait to see how it all turns out.

Friday, August 19, 2016

still here, learning and growing.

I've started writing this blog update many times over the past several months but always felt like it was inadequate, too long after the fact of doing something interesting, and I had just missed covering too much stuff over that time and it was too late to share it. So I ended up never publishing anything at all.  

My absence from the blog doesn't equal inactivity. Quite the opposite of that, actually. I'm still at my original & first dev job and coding every Monday through Friday and sometimes on the weekends. I go to tech meetups and even host my own events. Heck, I even co-organized and co-hosted a Stupid Hackathon in Amsterdam.

This year has been weird, stressful, anxious, exciting for both me as a human being and me as a programmer.

Here are the code-related highlights:
  • I've regularly kept up hosting the Coffee & Code meetups I started with another awesome person in January. Every 2-3 weeks we meet up to work on code and generally support each other while drinking a few beers or coffee. It's usually full and regularly attended by a lot of folks. I've actually made some new friends through it...
  • ...And with those friends I made through hosting the coffee & code meetups, we just organized and hosted a stupid hackathon (stupidhackathon.wtf) event. First one ever in the Netherlands? I think so. It was literally a hackathon devoted to developing the most useless and dumb ideas for apps/hardware. We scored some sponsors and hosted nearly 40 participants for an all-day hackathon last Saturday. We had 17 projects presented at the end of the day! Cool stuff. I even worked on a project at the event. We made a lightweight css library for CSS'ing like it's 1996 Geocities again ---> Geolize.css.
  • Also... with those friends from Coffee & Code, we've started our own coding group. We felt our goals and mission no longer matched up with the local railsgirls organization we were previously affliated with. We not only want to get more women excited about coding, but also help them get jobs/internships with companies that are similarly enthusiastic as we are and dedicated to actually hiring them. We will host our coffee & code meetups through our new group & plan to soon host coding workshops and other events.
  • In May, I went to my first RailsConf in the US. As a Ruby/Rails dev, I feel like it was taking a pilgrimage! Utterly amazing. Everyone should try to attend RailsConf at least once... cuz it's fun. and you learn stuff. I applied for and received an opportunity scholarship. I'm really grateful that I was chosen, otherwise there's no way I really could have afforded to go. This is probably the funnest thing I've done as a dev so far. It was my first conference experience. It was awesome to be a scholar and get paired up with a speaker as my guide. I got paired with the amazing Nadia Odunayo. It was really invigorating to go and see/meet some of my Ruby/tech heroes like Sarah Mei & Sandi Metz.  I think RailsConf is probably the highlight of this year as a dev. I even gave a lightning talk - it's my first talk at a conference (don't bother that it was only 5 minutes long)!
  • I finished my 1 year job contract and signed a new, indefinite job contract at my current employer. In the Netherlands, this is what you want if you work a full-time job. It offers a lot of job security (or so I'm told).
  • I've learned some ReactJS through the awesome ReactJS Program by Tyler McGinnis. Highly recommend it - there are really good video explanations in there. I feel like it has helped me understand JS fundamentals better as well as I worked through it. And the intro to ES6 makes me really excited to see the direction that JS is going in. ES6+ is making writing javascript actually kinda pleasant for me. I've actually even built some react components for the production rails project I work on at my job. ;-)
  • I'm working through the FreeCodeCamp curriculum. Slowly. I'm trying to do the individual projects in ReactJS. I'm slow. But I try to work on it when I'm motivated and have the energy.
  • I'm really looking forward to getting more skilled/confident/comfortable with javascript and ReactJS. I really believe that building up my JS skills is a great compliment to what I'm now capable of building in Ruby on Rails and the next logical step for me as a dev. 
  • Next month, I'm attending Euruko with my colleague in Sofia, Bulgaria. Pretty excited to go to another Ruby conference after having such a stellar time at Railsconf. It wiill be even more awesome to share the experience with my colleague.
So, I'm still around... growing as a dev, figuring out interesting/frustrating problems, and trying to contribute to the local coding community positively. I'm still happy that I changed careers and I get to code for a living. 

More than anything, right now I'm trying to find a balance between the constant need to "always be learnin'" with also needing to be a real human being that takes rests and does other interesting things to keep my brain happy and keeps me a dynamic and interesting person and not a grumpy, dry code bot.

Sunday, February 21, 2016

Learning Front End + Coding as Art

I may already 'made it' as a Ruby on Rails developer, but that doesn't mean that I don't have weaknesses in my developer abilities.  I know that doing creative stuff in the front-end is not my strongest area.  Sure, I'm able to work on the haml/slim/html views and coffeescript/jquery in the front-facing portion of the Rails app I work on, but coming up with cool designs and integrating/writing interesting javascript are not things I consider myself good at.   I've also been trying to level up my javascript and learn more ReactJS, but felt that some gaps in my understanding of the fundamentals of javascript have been making it really challenging for me.  I think my approach of reading random bits and pieces about JS from online articles, tutorials, videos has only left me feeling... fragmented.

I feel like I needed more of a path for learning with little challenges and project along the way, so.... I have started the FreeCodeCamp front-end curriculum to push me along/keep me on track.  It might be silly for someone with some experience as a dev to do this curriculum, but I don't think so.  I have been able to fly through the HTML/CSS/Bootstrap parts and started on the first individual project for FCC on Saturday -- a tribute page.

It's kinda silly, but I'm really love + proud of the page I made.  It's so silly, really, but I actually keep going to look at it again, to see the responsive design as I change the size of the browser window from big to small, and think about the quotes I included from Andy Warhol as I swipe through the 5 simple sections.  It makes me smile.  I love it because I feel like I finally made something with my coding skills solely for art's sake, I didn't make it for anyone else and made it in the exactly the way I wanted.  I made something for no reason other than to exist and be beautiful.

Monday, May 25, 2015

6 months into programming.

I'm 6 months into the world of ruby and coding.  I'm still chugging along, trying to improve a little every single day.  I try to write some code everyday.  If I don't do that, I'm at least reading/studying something about coding.

This weekend, I picked up two more advanced Ruby books to read: Sandi Metz's Practical Object-Oriented Design in Ruby and Eloquent Ruby.  I'm really excited to read more in-depth about OOD now that I've been programming for 6 months... I think I'm ready to dive in deeper and that I'm at a point were I will be able to process the information better than a few months ago.  I've already started reading it...

Never a moment wasted....Reading about OOD on the train.

In general, I keep myself pretty busy.  Outside of work, I'm working through the JavaScript courses on Treehouse.  I started with the absolutely most basic ones, so it's a bit of repetition of things such as loops, arrays, etc, but the way I see it, practice is practice and solidly understanding these fundamental concepts is not harmful.  I'm still studying Dutch.  I finished up my Dutch course, and I'm continuing to practice on my commute using the Duolingo app. 

I've been tackling larger tasks at work, building bigger features rather than small modifications on existing features.  I'm getting more comfortable and knowledgeable on some different gems that are used frequently like Interactors and Serializers.  It sometimes feels like I'm a weird mix of knowledge.  Some things that are new, I find easy to tackle and can handle without much guidance, I just kinda know what to do and how to write the tests as I go to guide my coding.  And other tasks, I don't really know where to begin without a good bit of coaching.  My brain feels a bit jumbled and unsorted with all the new information I'm trying to add to it in a fairly short amount of time.  I like the mix of things I get to build, and I like that I split my days between 2 different projects.

Thursday, May 14, 2015

Learning Javascript....

The social networking of coding community is an amazing part of being a software dev.  I have really enjoyed connecting with new folks through emails and twitter.  It's funny that I've also gotten in touch with 2 former colleagues that have or are in the process of making the transition from scientists to software devs!  It's been great to share tips about learning resources and experiences so far.

Since I've very interested in learning JavaScript, jQuery, Angular, etc right now, one of those colleagues who has learned JS himself suggested I check out Treehouse for their JS resources.  So I did.  I have a couple months to check it out for free, so I started today on their Javascript Basics course.  I got 1/2 through the coursework today.  It's extremely basic stuff right now... beginning syntax, using the JS console in the browser, variables, etc.  They have a lot of resources from JS to jQuery to NodeJS to AngularJS, so I'm excited to check it out and see how their material progesses.  One thing that really bugs me with a lot of the online resources is that the coding takes place in their own browser based workspace environment rather than locally.  I do not like that.  I guess it is a ok way to learn the basics, but it bugs me to not have a record of my work and progress locally or on github.

I haven't studied too much Ruby/Rails outside of work this week.  I'm pretty immersed in it during the day since it's my full-time job, so it's nice to break that up with learning JS outside of work.  I have had some moments lately where things that previously did not make a lot of sense getting clearer in my mind and I feel good about it... I can see that I'm making progress.

Saturday, May 9, 2015

Slow going progress.

I'm slowly still working on Ruby/Rails mastery and trying to add some AngularJS and jQuery to that as well.  I've only been working on Ruby/Rails at my job during the week and trying to do some online coursework on AngularJS during the weekends.  My study pace has slowed down the past few weeks because I'm also making time for running and freeletics and trying to find a flat so we can finally move to Amsterdam permanently.

I've been super encouraged over the past few weeks by other aspiring devs out there in the world!  I've gotten messages and tweets from folks that are also working their butts off to become software developers.  It's very humbling to get messages from others that say I'm an inspiration and motivator for them on their own journeys.  I appreciate the fact that others are taking time to contact me, and I love the community of coders worldwide.

I'm glad to give inspiration or advice to others out there!  I love chatting with others in similar situations.  But, I feel it's necessary to clarify my current skills levels.  I'm very much a Junior Ruby developer.  I can figure some stuff out and generally understand tasks set before me, but struggle with how exactly to write code to build out some features.  I need guidance often from my boss, an expert Rails developer.  I hunt google & stackoverflow A LOT.  I know it sounds awesome that after studying & interning for the past 5 months that a got a job as a dev (which it is), but please realize that it wasn't some magical turning point in my coding abilities when I got a job or that I'm some coding rockstar.  I am not.  I struggle everyday, just on new things than the day before.  I am painfully aware of my inadequacies.   I've been working from home for the past 2 weeks with minimal support from senior devs and that has been a struggle...No one around to talk through things I don't really understand or get guidance on problems.  That's definitely added to my frustation with my jr skill level lately.  I sometimes wonder what the hell I'm doing, but I'm hopeful that in a few months, that my skills and confidence will grow a lot more.

I really like learning another new language (jQuery & AngularJS) so far.  It's challenging to think in a new language and learn its context.  I think it is helping me solidify RoR concepts as I push my brain to think in a different language.

Monday, April 6, 2015

Week 8 finished + holiday weekend!

I finished my 8th internship week!  Time is going by fast!

I worked on some new tests and features for the main app project.  I struggled with the proper setup of a cucumber (+capybara+poltergeist) test for 2 forms that are submitted using JS instead of ruby.  I figured out how to get the test to test the JS functionality and pass the individual tests, but then it was breaking a couple other tests in my full test suite.  I then adjusted my test env to run the database cleaner between each test and, voila, it was fixed!  I still am unclear how there the carryover of the @javascript notation for those scenarios were breaking the other tests, but this solution fixed it.

I am also getting more familiar with working on an api within an app.  I struggled a little bit this week with changing a feature on the api.  With everything I work on, it seems the list of stuff to learn gets longer and longer.  It's really amazing the possibilities of what you can build in Ruby on Rails.  I feel like I'm only just learning what is possible with Ruby on Rails and it's both overwhelming (most of the time) but, also, very exciting and motivates me to learn more (all of the time)!  :-)

I am still working through Hartl's Rails Tutorial.  I'm currently on Chapter 10.  I am going back and re-reading some sections from the past couple of chapters on creating user sessions and cookies.  I feel I didn't understand all of that discussion, so I'm trying to look back at some material before continuing on.  I bought the railscasts with the tutorial, so I'm taking the time to watch through those.  I hadn't been watching them, but after watching one on the signup procedure, I found it super useful to get Hartl's commentary as he worked through adding features.  I am going to work on watching more of the screencasts this week particularly the sections on user sessions and cookies.

Tuesday, March 24, 2015

Halfway through my jr dev internship.

I finished up my 6th week at my internship last week.   I'm halfway through my 3-month program.  For me, it was another busy week of working on different tasks for real project code.  I follow a similar formula for everything I build: think about what needs to be built, write a suitable feature test in Cucumber, go through each step in the feature by letting the test steps guide my coding.

I have started working through Hartl's Rails tutorial during my morning and evening train commutes (as long as I find a place to sit).  I felt that only working on it during the weekend was counter-productive since I spent a good bit of time trying to figure out what I was working on from the last time.  I was able to work through 3 chapters last week by simply doing it during my commute!  The book is great and is helping me go back over basics that I might not have fully understood when I started learning Rails.  Plus, reviewing these things while I am doing project work is really helping me think through concepts a lot better.

On Saturday, I finished the third and final week of the free online MOOC Dutch course from futurelearn & University of Groningen.  I really liked the course!  I think it was a good supplement to the in-person course I am taking.  I only wish this course had lasted longer than 3 weeks!

I went to a RailsGirls workshop on Sunday and learned about MeteorJS.  I built a simple to-do list app.  It's easy to follow and I recommend checking it out on their website.  I was super impressed with the ease to setup Meteor (1 command in terminal and it was ready to go.  No error messages - whew!)  It was also really cool how easy/quick it was to deploy it and even make the android APK for my deployed app.  Super easy.  Once I finish Hartl's Rails tutorial, I want to start learning JS and I might try building more in Meteor to get more comfortable with JS since I liked the framework.  I don't think Meteor is at the point that it is production ready since it is so new and they are still adding features.  But it is still really cool to try out

I am still taking an in-person dutch course 1x/week.  I have kinda put dutch on the back burner during the week, since I'm so focused on coding right now.  What I need most for my dutch to improve is to have a patient speaking partner.  I have asked a dutch friend to start meeting with me on the weekend to practice.  Hopefully I can make that a regular, weekly occurrence and get some noticeable improvement with my dutch.

Wednesday, November 26, 2014

Tuesday 11/25...

Went through a couple more Epicodus exercises, but got stuck on some of the exercises.  I got through the leap year exercise, learning how to use chai.js and mocha.js for writing and testing specs and then refractoring my code.

Learning to use Chai.JS and Mocha.JS for spec testing in BDD.



But on the following independent exercises, I felt too challenged without any support - I know the online course is drawn from the in-class materials and I felt without the in-class support, the independent assignments were a good bit above the examples that were illustrated.

So...I'm really proud of my progress in HTML, CSS, and JS over the last 2 weeks, but.... instead of spending a lot of time to figure out javascript challenge exercises on my own, I'm going to go ahead and switch gears to Ruby.  Getting into Ruby and Ruby on Rails is my real goal, so I'm going for it.  The basis of knowledge I learned in these other languages will be useful and help me move quickly into learning the new.

I started reading Chris Pine's Learn to Program book.  I read the first 4 or so chapters tonight.  Reads well and easy to understand.  I'm hoping to get through most of the book this week.

Tuesday, November 25, 2014

Ping Pong Test (aka FizzBuzz Test)

I figured out the ping pong test!  Feeling good with my progress.  Oddly, I got the loops and if/else if statements figured out pretty quick, but what tripped me up the most was figuring out how to get my integers listed properly into my bulleted list.  The solution was so easy once I got that bit finally fixed in my head!


My final solution. 
Here's more info on the Ping Pong test (aka Fizz Buzz), apparently it's a popular interview question:  Why Can't Programmers.. Program?  Really...199 out of 200 programmers can't figure it out?  Maybe my odds are better than I thought then? :-)

I also did a couple lessons on BDD/TDD process.  Happy with today's progress.

Sunday, November 23, 2014

Weekend Progress.

Finished up lessons on looping w/ forEach and for loops.  Got a little stuck on one of the looping exercises:


  • Go back to your page where it would pop up an alert every time you clicked an element and say what kind of tag it was. Refactor your JavaScript for this page to use a loop.

But I slept on it last night and figured out the solution in only a couple minutes this morning!  Whee!  Then finished up the section on debugging, luckily already practicing some of these techniques in my practice exercises.

Tomorrow I will do the next exercise, the Ping-Pong challenge, and then dive into behavior driven development (BDD)!  Yay!

Friday, November 21, 2014

Friday 11/21

Not too much progress today.  Just very fatigued and brain fog, that made it hard to follow/think through new concepts.  I had to keep watching and watching clips again for anything to sink in.  Oh well, everyone has their off days.

I did get through the introduction of arrays and looping in javascript.  Getting closer to closer to the section on Ruby.

I'm feeling reasonable about the progress I've made this week.

Thursday, November 20, 2014

Thursday, 11/20

Another day, more time spent learning/practicing on jQuery.

Learning about branching, if/else criteria, truthy/falsey... Watching epicodus lessons and working through the coding exercises.

Tuesday, November 18, 2014

Tuesday's progress

Progression slowed down today.  I need time to process the jQuery I'm learning in the Epicodus course.  I need it to sink in really well.  I did a lot of studying of new stuff I've learned in a couple lessons today on other sites.  I'm really trying to fully understand how to setup several methods  within the js file.  A little frustrated about how many little errors I make, then I have to go back and debug the code... but I guess that is a good thing to deal with early on... I find my mistakes and then curse myself for these errors!

Monday, November 17, 2014

Monday's Progress!


Today's progress:
  • Finished up the HTML/CSS section on Epicodus.
  • Played around with Bootstrap some more.  I like it.  
    • I think I'm going to surprise my folks and redesign their company's (poorly done) website using a nice bootstrap theme.
  • Learned basics of javascript (variables, strings, methods, functions).
  • Started the section on jQuery.
  • Downloaded jQuery 1.11.1
  • Setup a virtual Ruby on Rails environment on nitrous.io and invited my husband/mentor to join me.  So now I have it on my Macbook and a virtual option.
  • Skipped ahead in the Epicodus course to the start of Ruby on Rails section.  Tried the IRB command and although I could input, but I initially got a error about Headline file missing.  So... I went into crafty IT troubleshoot mode and successfully figured that out and reinstalled RVM and got that error GONE!   (It only took 2 different attempts before success! :-] )
  • I also emailed the nearest RailsGirls meetup group to see if I could join the next beginner class in their series or if I would be totally lost.  I'm going to try to make it over there to that meetup later this month!