Updating OpenSSL on Windows

My last post was about some problems I ran into with authenticating a twitter spam-bot project, using git bash and the twitter API. I finally figured out how to update Open SSL for my git – I just installed the newest version of Git! I had been using Git for Windows. Installing Git, instead of Git for Windows, updated my SSH version.

After hours of searching for a solution, I was happy to find one. I fired up git and ran ruby micro_blogger.rb, and…

certificate verify failed

Again, certificate verify failed.

I guess it could be that I’m running an older version of ruby? Or maybe something has changed about Twitter’s API. I really have no idea.

This is the frustrating part about learning to code. I am getting confident in my ability to bang out some lines of code that will do what I want. But I spend a lot of time trying to figure out how to make the code work, and many of the tutorials online don’t really address these strange little things that pop up, like the LOAD_PATH not working. I suppose it will get easier eventually.

Meanwhile I think I am going to do Codecademy’s Twitter API course and see if that offers any clues.

Updating OpenSSL on Windows… not so simple

So I figured out the problem in my last post. Then, after getting some things working, I ran into another problem and decided to move on to the next project, creating a Twitter spambot.

Here I ran into a problem with OpenSSL. I googled the problem and discovered a solution. The problem is, the solution doesn’t work for Windows.

I have tried to install a linux virtual machine in the past. I spent hours on it and could never get it to work quite right. I could also partition my drive and install linux on my desktop, I suppose. Again, it seems like a lot of work.

xkcd - talk to your kids about linux

I will keep looking. If anyone reading has any solutions, let me know!

Variables and arrays

In IRB, type the following:

a = 8
b = a
puts a
=> 8
puts b
=> 8

Make sense?

Now try this:

a = 9
puts a
=> 9
puts b
=> 8

You can see that a has changed, but b has not. And this makes sense. b was assigned the value of a, not to a itself.

This is pretty close to the basic explanation I have gotten from every basic ruby textbook I have read so far. Chris Pine’s Learn to Program shows almost exactly this example.

Here’s another example:

a = "my string"
b = a
a = a + " this is"
puts a
=>"my string this is"
puts b
=>"my string"

Seems consistent, right?

So, imagine my surprise when I ran a bit of code something like this…

class MyArray
def initialize
@arry = [1,2,3]
puts "initialized"

attr_reader :arry

def manipulate_array
temp_arry = @arry
2.times do
puts temp_arry
puts @arry


new_arry = MyArray.new

…and found that the function was emptying out both arrays!

It makes even less sense to me because I created an attr_reader for @arry. I thought this would make @arry “read only” so to speak.

I posted about it on stack overflow, and I kind of know what’s going on, but I still don’t really grok it.