Programming

Continuous posting on blog

Posted on

Was watching a YouTube video by simple programmer where he pointed out that one should keep blogging and putting down their thoughts.  It shows that you have been working on a particular tech.

That’s was a good point. It reinforces your own learning and can help others who are also looking for information. When I was learning VMware I wrote tons of articles that were used by others. I would even surprise myself and find my own articles when looking for an answer.

Downloaded the WordPress app and will arrive for more as we all should 

Advertisement

favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)

Posted on Updated on

One of those things that only rears it’s head once you place a project into production.

I kept getting this error even though I have not specified any favicon in my code.

Now I ask myself, what is a favicon? According to wikipedia a favicon is that little image that shows up next to a web address. Accoding to this stackoverflow link, chrome will request favicon 3 times for each IFRAME

Following the SO link, yahoo says “The favicon.ico is an image that stays in the root of your server. It’s a necessary evil because even if you don’t care about it the browser will still request it, so it’s better not to respond with a 404 Not Found

Options:

  1. Create a small 1kb ico to satisfy the browser
  2. use this to override:
    <link rel="icon" href="data:;base64,iVBORw0KGgo=">
    

What is the end goal? Musings on programming.

Posted on

I a doing FreeCodeCamp’s Build a Weather app for the 2nd time. (maybe 3rd? who knows)

This time I thought I would get fancy, try to get the location from HTML5 first, then if an error, get the location from a IP geolocation service.

Well, I am finding that some functions don’t wait for the return of data from another, and rather than having an orchastrator function I would need to chain the functions together.

example:

Original:  master() call geoHTML5; if error master() call geoIP;

now: master() call geoHTML5 call geoIP() call….

Now I could just forgo HTML5 geolocation since IP geolocation works and actually has better data than HTML5 gelocation.

What is my end goal? To finish the project? Then ip geolocation would be the right choice, dont waster time on other things.

But what is my REAL end goal? TO get better at programming and learn the ins and outs of javascropt. That means I need to deal with my original plan and found out how to implement it..

What is the end goal? I’ve already done a weather app. The goal is to get better at programming.

paper.js hue problems

Posted on Updated on

Had this code:

var animatedCircle = new Path.Circle(new Point(300,300), 100).fillColor=”green”;
function onFrame(event){ animatedCircle.fillColor.hue += 1 ;}

was getting and error  :  Cannot read property ‘hue’ of undefined

solution was to add fillColor to animatedCircle AFTER initialization on a new line.

animatedCircle.fillColor=”green”;

 

 

 

Ruby : Force Sublime Text 2 to indent two spaces per tab

Posted on Updated on

To limit this configuration to Ruby files, first open up a Ruby file in the editor, and then go to Preferences -> Settings -> More -> Syntax Specific -> User. This should open a settings window named Ruby.sublime-settings

Save these settings:

{
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}


from:
http://stackoverflow.com/questions/9474090/how-do-i-force-sublime-text-2-to-indent-two-spaces-per-tab

Good advice on learning programming from scratch

Posted on Updated on

 

 

I see similar advice over and over, learn one core language, C++ or Java; Learn one scripting language, python, etc; Learn Linux; Build Code; Get job: Im reposting this here because out it’s well layed out

 

 

I am 100% sure that if you are intelligent you can do this, and that it will likely be financially worth it.

I will teach you how to obtain the skills to get a job at an amazon or google type company (at LEAST 90k starting salary):

  1. You must be a competent programmer in a main stream lower level language (say c++ or java) as well as a scripting language (python, bash, etc.).

    -Learn C++ from C for dummies follow by something like “accelerated c++” or Stanley Lippman, Essential C++, or Absolute C++ -Learn python similarly and by simply reading the python docs online. -You must also practise using these languages which you will do by doing your own simple projects as well as programming solutions to contest problems as I outline in further steps.

  2. You must understand the unix operating system. -Install linux (say ubuntu) and use it as your primary operating system. Start using the command line as often as possible. -Read a basic book about unix “teach yourself unix in 24 hours” and “unix in a nutshell” should get you going. Make sure you know about grep and chmod
  3. Data structures. Understand and be able to describe: -binary search trees (including self balancing such as red-black and AVL) -hash tables -stack, queue, array, priority queue.

    -Read the relevant sections in Sedgwick’s “Algorithms in C” or any data structures in C book. (Internet reviews should help).

  4. You must be able to solve ‘difficult’ algorithmic problems using techniques such as: -dynamic programming -divide and conquer

Buy Algorithm Design Manual and Introduction to Algorithms by Cormen, et al (CLRS). Work through these books slowly. You will have to take time to master everything in them and ask questions as necessary. They are not simply understood.

  1. Understand basic networking (how the internet works). Key concept examples: DNS, tcp/ip

There’s probably an article on how stuff works or just get a book about this stuff if you have to.

  1. Understand how a program is built. What an assembler, compiler and linker are. Just google this stuff. To truly understand this fully you should disassemble a program. Ollydbg is a program that can do this. A good place to try out your skills is osix.net . They have a series of ‘reverser’ challenges that will teach you about this (passing even the first level or 2 is good enough).
  2. Object oriented Design and design patterns:
  3. You should have some sense of OOP (object oriented programming) from learning C++ through the books above. Learn more if necessary by finding an OOP specific book. -Read ‘head first design patterns’ (CRUCIAL BOOK)
  4. Other tidbits: SQL helps (a language used to query a database) sqlzoo.net should get you started. Functional programming (a language like Scheme or Haskell) is usually helpful in learning how to program well. Structure and interpretation of programs is a good book.

Projects I’d implement: -A simple mysql backed website. Just make it so you can click a button and that will initiate a python script which will insert something into your db as an example. Simple, but shows you how everything works together. -Work through the ‘geek’ challenges on osix.net as well as the ‘reverser’ challenges. -Try to work through about 1/5 or 1/10 of the challenges in ‘algorithm design manual’ -Enter a few programming contests online the ‘google ai challenge’ was really good. -Try to make a simple version of anything you are interested or anything you have ever wondered how it could/would work.

Remember practise, practise, practise. Everyday read and implement.

https://www.reddit.com/r/learnprogramming/comments/13mo6u/im_30_with_a_liberal_arts_degree_and_no_coding/c75kw2d

Identity: Change GIT author id and email

Posted on Updated on

Did you want to use a different author name and email then the default one GIT has for you?

Change Authorname:
git config --global user.name "New Authorname"

Change email:
git config --global user.email username@domain.com

 

“you need to do this only once if you pass the --global option, because then Git will always use that information for anything you do on that system. If you want to override this with a different name or email address for specific projects, you can run the command without the --global option when you’re in that project.”

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

 

Can you edit a character in a string ?How do you change a string in python?

Posted on

Can you edit a character in a string ?How do you change a string in python?

If p=”nice”

how do I make “nice” into “Nice” ?

The answer is that strings are immutable, meaning they cant be changed.

so you would need to assign p to a a new string

p=”Nice”

cannot do p[0]=’N’

Google app engine : Viewing the different versions of your app

Posted on Updated on

your app is you_project_id.appspot.com

you can view different versions of your app by adding versionnumber and dash in front of that

example: (URLs aren’t mean to work)

my example project url is:

http://coolaproject-1231-1231.appspot.com

i can view both version 1 and version 2

to view version 1 it would be

http://1-dot-coolaproject-1231-1231.appspot.com

to view version 2 it would be

http://2-dot-coolaproject-1231-1231.appspot.com

etc.

Google App Engine : when connecting to http://localhost:8080 get HTTP Error 500 Internal server error

Posted on Updated on

So I was running google app engine in order to get some code running.

while it should have ran out of the box it didn’t.

Checked firewall, which would have been my first suspect.

that wasn’t it.

http://localhost:8000 was working fine.

Looked around and found the solution below:

had the same problem. This seemed to fix it:

cd to google_appengine, run

python dev_appserver.py –port=8080 –host=127.0.0.1 /path/to/application

at this point there is a prompt to allow updates on running, I said Yes.

At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.

http://stackoverflow.com/questions/16474027/cant-connect-to-localhost8080-when-trying-to-run-google-app-engine-program

Once I ran the command dev_appserver.py it was able to give me feedback on my code via error messages that  I wasnt getting with GAE. And it’s always something simple….