Learning some Python is all.
Learning some Python is all.
seen from China

seen from Italy
seen from Singapore

seen from Malaysia
seen from United States
seen from China

seen from United Kingdom
seen from China
seen from China
seen from China

seen from Netherlands
seen from United States
seen from China
seen from China
seen from United States
seen from United States

seen from Italy
seen from China
seen from Malaysia
seen from China
Learning some Python is all.
Learning some Python is all.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Coding
Somehow...joining this coding boot camp is giving me stress but I am having fun. Currently working on my first app and I gotta say...
Coding helps with me fear of failing. I legit would put off working on a code because I would fear failure.....
Now I fear the lack of sleep and possibly failing the class.
overall...big fun
Day 56 - Writing Tests & New Course
Test Writing is an absolute necessity in programming and I know in order to write great code I need to write automated tests to check that code. I have been having lots of challenges wrapping my head around tests and the relationships they have to the code Iâve written. 3 days ago I decided to buy a course that would help me understand writing them better. I ended up purchasing a course called Ruby Programming from the Team at Pragmatic Studio and Iâm super happy I did.
Prior to Pragmatic Studio I had been attempting to write tests in MiniTest and so the syntax looked something like this:
test âcapitalizes the projectâ do assert_equal âSeinfeldâ, @fundrequest.project end
as opposed to the new RSpec syntax I am learning through Pragmatic Studio:
it "captializes the project" do @fundrequest.project.should == "Seinfeld" end
I prefer the reading and writing of RSpec because I find it easier to write and understand tests when written in this manner.Â
Aside from the tests Iâve been spending lots of time practicing at iterators and blocks. Iâm in the process of writing a few very simple gems, one that will be a very simple game and another that will be a fundraising type gem. Iâve gotten to a point where I understand how to write them (for the most part), the biggest challenge now is deciding when and which iterator to use. (In my example below I am using case as the iterator.)
module GameTurn def self.take_turn(player)   die = Die.new   case die.roll    when 1..2    player.blam    when 3..4    puts "Nothing happened to #{player.name}"    else    player.w00t   end end
Over the last 4 days I put in 25 hours of programming and by the end of week (Sunday), I should come in at about 40 hours of programming. My next week consists of finishing off the Pragmatic Studio Course and then doing some touch-ups on TimeStation. At that point and depending on how comfortable I feel I will be moving on to my main project.Â
Day 49 - Pushing to Heroku
This week I did not reach my goal of 40 hours of learning Ruby/Ruby on Rails. I came in at 22.34 hours, but not included in that time are the hours I spent working on a website design for a new brand called Power Of My People. While I didnât reach that goal in pure Ruby and Ruby on Rails development I did spent lots of time on HTML, CSS and Liquid which pushed me closer to that 40 hour goal.
The time I did spend on learning, I spent most of it working on TimeStation. I made stylistic changes, wrote tests, added Users and set up a home page. When I wasnât working on TimeStation I had a chance to finishRuby Koans and worked through more of the book âThe Well Grounded Rubyistâ.
Today, I spent my morning getting TimeStation deployed on Heroku (which means it now live online!). I learned that Heroku doesnât like SQlite and that I needed to setup a PostgreSQL database for production. The reason for that is SQlite is not intended to be a production grade database. It is more commonly used for small amounts of data because it can be run in the memory and thus commonly used in development instances of small Rails applications.
Iâm finding writing tests to be very challenging, because I still have so much to learn about how the elements of code interact with one another. Typically with TDD you will want to develop tests as you write the code whether that is before, or immediately after. This guy says 20% before 80% after works for him (and he created Rails).
Iâm using Devise for my user generation but I am having trouble running tests where a 'fake' user accomplishes a task when logged in. Iâm close to getting this to work, but I still have some more fiddling to do.
The first test I wrote is so simple, but it feels fantastic to get it up:
test "index, user not signed in" do get :home assert_response :success assert_select "h1", "Log Your Hours." end
This tests whether or not my Home pages loads, and it is searching for the following string âLog Your Hours.â. This is considered a fragile test, however at this point it is all about experimentation for me so I can continue to develop a stronger understanding of Ruby and testing.
Day 41 - Understanding Self & Class Methods
Since building the TimeStation application last week, I've been logging my hours on a regular basis. Over the last 7 days (Wednesday - Wednesday), Iâve logged 41.77 hours and have been splitting my time between books, koans, meet-ups, codewars, and  TimeStation.
Last night I went to my second Ruby meet-up. My goal for this meet-up was to build a few new features on TimeStation, including a re-design of the layout. Prior to the meet-up Iâve been trying to come up with a solution that allows me get the number for the Total Aggregate Time I've spent, and render it in the view. I was trying all sorts of things from adding a new column to my database for total_time, to creating a map in my view, to creating methods in my controller. None of those worked for me (possibly because I was implementing them poorly), however the solution for my problem was incredibly simple. Create a class method using Self.Â
Up until that point, I didnât quite understand why the total_time methods I had never allowed me to call on the entire Clock. I had assumed what I wanted to do needed to be achieved through another approach, so I tried other ways (such as adding a column to the database). Turns out - when I tried to run loops, they never worked because I was only going through a single instance.
For example, my old code looked something like this:Â
Class Clock   def total_time # function   end end a = Clock.new a.total_timeÂ
This never worked because I was only ever creating a method for a single instance of Clock rather than the entire Clock model. After some guidance at the Ruby Meet-Up my new code looked like this:Â
Class Clock   def self.total_time # function   end end Clock.total_timeÂ
Now when I call on the entire Class model of Clock I am able to pull all of the data related to the model rather than pulling data on a single instance of Clock. Now I can go through each unique id, find the total time for that id, add that to a âtotal time poolâ and iterate through every unique clock id until there are none left, and at the end of it I have one succinct number. Â

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Day 35 - Where I'm learning from.
All of my books have finally arrived - they are;Â
 âThe Well-Grounded Rubyistâ David A. Black âEloquent Rubyâ Russ Olsen âAgile Web Development With Railsâ Dave Thoma, David Heinemeier Hansson âThe Rails 4 Wayâ Obie FernandezÂ
In addition to those books, yesterday I discovered a few cool things that are going to help improve and test my Ruby knowledge.
The first is Ruby Koans, which is basically a bunch of tests that iterate through many different Ruby Principles. Iâve made it through about 1/3rd of Ruby Koans so far, and it has already exposed me to so many more use cases for Strings, Arrays, Symbols and more. I haven't known how to answer most of the questions without first testing them in irb, but it has been great at exposing me to new use cases and giving me a better idea of how tests operate.Â
Codewars is this place where other people create these things called a âkataâ, which is essentially a user generated question that other people have the opportunity to answer. The more you answer, the more Honor you earn!Â
All of the new concepts I'm learning I've been trying them out in different .rb files. Ruby (filename).rb seems to be a command I'm running all of the time. Pretty soon I will be trying to tackle my second application, but for the next few weeks I will continue to focus on practicing and learning the fundamentals of Ruby.Â
Day 33 - The TimeStation App
Last week, I attempted to make a TimeStation application where I could log my hours spent on learning how to program. Pretty quickly I realized I had no idea how to start it and instead decided to spend my week learning more about the fundamentals of Ruby.Â
Over the last week I've learned a lot, and with my reformed knowledge and understanding of more programming principles and fundamentals of Ruby, I decided to attempt building TimeStation again. Iâm excited to say that I finished it early this Tuesday morning!Â
My goal for the TimeStation app was to be able to input a date, start time and end time. For every session that I created, I wanted to know how much time I spent on programming by saving that log to a database.Â
I started off by taking the Time.now code which returns the current Local Time and I assigned it to a @time instance variable. I then created an initial class, with methods that I tested in my console. The resulting code was the following;Â
class Timer  def start_time    @time = Time.now     return(@time)   end  def end_time    if Time.now - @time < 60.to_f    return(Time.now - @time).to_f  elsif ((Time.now - @time) / 60 ).to_f > 60   return((Time.now - @time) / 3600).to_f  else   return((Time.now - @time) / 60).to_f  end  end end
When I took that chunk of code put it into my console to test, everything worked.Â
2.1.4 :056 > TimeStation.new => #<TimeStation:0x007f892bdd7b40> 2.1.4 :057 > a = TimeStation.new  => #<TimeStation:0x007f892bdcfc38> 2.1.4 :058 > a.start_time  => 2015-01-13 18:07:12 -0800 2.1.4 :059 > a.end_time  => 3.622796Â
Hooray! This is the first real chunk of code I have written myself, as simple as it is - it worked! After getting this first initial chunk of code to work, my next task was to create a web app that allowed me to create and save multiple time chunks.Â
Rails makes things very easy. I ran the following command in my console to give me a head start on the structure of the application:
Rails generate scaffold Timer Day:Date start_time:time end_time:time
Now that I had the ability to create, destroy, edit etc.., there were a few things that I needed to change.Â
1) The Time.now was rendering in the default UTC timezone and after some testing and reading I was able to change the default timezone in my config/Application.rb file. It required me adding the following code:
config.time_zone = 'Pacific Time (US & Canada)' config.active_record.default_timezone = :local
2) I took that initial chunk of code I wrote earlier and adapted it for the index.html.erb file.Â
 <tbody> <% @clocks.each do |clock| %>  <tr>  <td><%= clock.day %></td>   <td><% if (clock.time_end - clock.time_start) < 60 %>      <%= (clock.time_end - clock.time_start).round(2) %>       <% if clock.present? %>        <%= "Seconds" %>       <% end %>    <% elsif ((clock.time_end - clock.time_start) / 60) > 60 %>       <%= ((clock.time_end - clock.time_start) / 3600).round(2) %>       <% if clock.present? %>        <%= "Hours" %>       <% end %>    <% else %>      <%= ((clock.time_end - clock.time_start) / 60).round(2) %>        <% if clock.present? %>        <%= "Minutes" %>       <% end %>    <% end %>    <td><%= link_to 'Show', clock %></td>    <td><%= link_to 'Edit', edit_clock_path(clock) %></td>    <td><%= link_to 'Destroy', clock, :method => :delete, :data => { :confirm => "Are you sure?" } %>  <% end %></td>  </tr> </tbody>
My code might not be the cleanest but I am so excited that I was able to put this together in a relatively quick matter! In the coming months Iâm going to continue to get better and will be able to come back to this and refactor, clean up my code and add new features.Â
Day 26 - All the Variables!
Lets talk about variables. Variables in programming are like legs are to a chair, absolutely necessary! Variables make clean and sexy programming possible. Instead of having someone write something like âAll Pies are Deliciousâ (forget about the validity of that statement), you might want to assign a variable to that phrase. For example;Â
Pie = âAll pies are deliciousâ  => âAll pies are deliciousâ Pie + â , especially blueberryâ  => âAll pies are delicious, especially blueberryâ.Â
That is a variable. Now you can imagine when you have to use the same code over and over again, by assigning a variable to it you are saving space and making much cleaner code.Â
Now there are several types of variables: local, instance, class and global variables. For the purposes of this post I am just going to focus on local and instance variables.Â
A local variable is a variable that works only within the defined area. For example, lets say that you have a recipe that you use at home, and that recipe requires a mixture of salt, sugar and thyme. You create a jar of the perfect mixture of ingredients and you call it Thymer, that is your generated variable. If you go to create another recipe that requires salt, sugar and thyme - you are not able to use Thymer because it does not have the right ratio of ingredients. It wonât work and will ruin your new recipe. In code, our recipe might look something like.Â
def recipe1 Â thymer = 'sugar, salt, thymeâ Â ingredients = thymer + â meat, flour' end
puts recipe1Â Â => sugar, salt, thyme, meat, flour
And we can see that the local variable will work when it is defined within this recipe method. However, if we try and use the âthymerâ variable in another method it will ruin the recipe and in the case of programming, it causes an error.Â
def recipe2  ingredients = thymer + â blueberries, pie crustâ endÂ
puts recipe2 causes an error because âthymer" has never been defined within the recipe2 method, and therefore will not work with local variables. An instance variable will allow this example to work. The difference is small, but it will make a big impact in the way the code works. The small change is that we are changing the variable âthymerâ to â@thymerâ.Â
def recipe1 Â @thymer = 'sugar, salt, thymeâ Â ingredients = thymer + â meat, flour' end
puts recipe1Â => sugar, salt thyme meat, flour
In recipe2 thymer will work and when we call the method the full recipe will be returned.Â
def recipe2  ingredients = @thymer + â blueberries, pie crustâ endÂ
puts recipe2 Â => sugar, salt thyme, blueberries, pie crustâ