Sunday, April 12, 2015

Installing Tor on Unbuntu

I am, by no means, an expert on either. But here's a little hint:

On Unbuntu, downloading Tor is not a 1-click deal. Here is a link to the commands you need to run on Terminal to get Tor working. It's not hard; just a few extra steps. I think the only big deal about this is realizing that Ubuntu is a little different.


Tuesday, February 3, 2015

Reflection of a string using Javascript and CSS

What I wanted to do was reflect a string in the same way CSS can be used to reflect an image. I didn't readily find a way to do this, although it is fairly easy. My code is here.

First, I have 2 divs wrapped in a container div. This is simply for convenience of moving the inner divs around since they need to stay "stuck" together for the effect of reflection.

Second, I used transform in CSS to rotate the original image to make it upside down but only applied this to the second div where the reflection occurs. At the end of the Javascript function, I make this upside down image the value of the second div which is otherwise empty.

Third, the Javascript code first stores the original value ("Heather") in a variable. This string is then broken up into a char array using charAt and stored in another variable. I then use reverse() to reverse the order of the chars.

Finally, my last task is to get rid of the commas separating the chars, so I use join("") and store the new string in a third variable. (Hint: Don't forget to use a separator or join won't get rid of the commas.)

Wednesday, January 28, 2015

CSS: Background and repeat

I was playing around with displaying an image via img src in HTML and background in CSS. I did this:
      #image_id{
width: 45px;
height: 45px;
background:     url(/*insert location of image here*/);
}

The result was the image displayed two times and appeared to be trying to display a third time, except that it was partially blocked by another image. I didn't have this problem using img src in HTML. Why?

Because background causes the image to repeat. The solution is to add:
        background-repeat: no-repeat;

There is also the option of having the image repeat on the x-axis or y-axis only.

I make no representation as to the validity or desirability of using background instead of img src. I do, however, hope to save someone a little time when they start going batty trying to figure out where in their code they made the image appear twice when they use background. Happy cascading!



Thursday, January 8, 2015

Simple marquee/ticker in Javascript/HTML

First, here is my code. Second, you can find code to make a marquee here or here.

Third, what I wanted to do was count the number of days since the Chibok girls in Nigeria had been kidnapped by Boko Haram. The main thing for me to figure out was how to count so that the number of days would be updated each day. I discovered Date.parse() and decided to subtract the date of the kidnapping from the current date using Date.parse(). That total is then divided by 86400000 because Date.parse() will give you the number of milliseconds since 1/1/70, so you have to convert that to days. I then used Math.round.

Finally, I just inserted the marquee code.

Now go make a ticker!

Sunday, January 4, 2015

Planning your first app/program

First of all, I'm talking about something more than "Hello Word". Second, I started this process in the fall and "completed" it at the end of December with not quite the result I expected. I learned a little more about Javascript and a lot about planning.

1) Don't get caught up in the details - survey the big picture first:
    I wanted to create a real estate app. I spent a significant amount of time researching how to access the local MLS database. What I finally discovered was that I couldn't get access to the database unless I had major financial backing.  But before I spent any time researching the database, I should've considered what OS my target (an individual in this case) used. It was a Mac. I do not own a Mac. I do not intend to own a Mac. You may naturally conclude at this point that I do not know Swift and don't plan on learning it anytime soon. Hmmm. What to do.

2) You're about to spend $$ - do you really need to?
     I found a solution to my Mac predicament. It would be a small investment but if I could make a cool, functional, pretty app, it would be worth it. Again, I spent a lot of time learning about the solution in question. Then the reality of car tags, HOA dues and bar dues hit me. I wondered if there was another way that wouldn't cost as much. Free would be good.

3) Don't overcomplicate:
    Yes, there was an option. It's called Javascript. It'd didn't accomplish half of what my original app idea would do. However, it would accomplish one essential function that was the most important part of all. I got that part right - if you can't make your app do everything, focus on what is absolutely essential, the real reason for your app existing in the first place.
     What I did not get right is, once more, spending hours upon hours, figuring out how to do a particular task with Javascript. I don't mind that I did this. I learned about uploading a csv file with Javascript and I spent some quality time with regexp. In the real world, however, customers won't wait while you spend a few months exploring options in depth without exploring the real potential of those options.
      After spending quite a lot of time overcomplicating, I realized my end user already had half of what I needed - a pivot table that I could import with html. In the end, I made a simple web page that would display multiple pivot tables and accomplished what I intended in the beginning. It was not as great as my original idea, but it was free and that increased its value significantly under the circumstances. It was, in fact, prettier and more professional looking than the result would've been with my pre-Javascript and Javascript solutions.

As I embark on my next project, I've learned to flit around. I bounce from topic to topic because I inevitably hit on something that tells me I need to study this less and that more. I also am keeping in mind the big picture and I'm trying to do a better job of connecting the dots in advance.