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.
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.
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.
I will keep looking. If anyone reading has any solutions, let me know!
In IRB, type the following:
a = 8
b = a
Now try this:
a = 9
You can see that
a has changed, but
b has not. And this makes sense.
b was assigned the value of
a, not to
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"
=>"my string this is"
Seems consistent, right?
So, imagine my surprise when I ran a bit of code something like this…
@arry = [1,2,3]
temp_arry = @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
@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.