My notes compiled on the topic of working with directories, navigating folders and listing files etc.
Continue reading “Python Working with Directories Reference”
Python File Reading and Writing Reference
Just my personal reference notes for everything related to reading and writing files in Python.
Continue reading “Python File Reading and Writing Reference”
Breaking down a function – updateRecords()
A friend asked me to explain this code in detail for a function called updateRecords()
that they were studying on an online learning site. Actually they expect you to create the guts of the function yourself and make sure it meets certain requirements. This is my solution and explanation. It is designed for somewhat beginners so Its deliberately not succinct because the purpose is to explain whats going on in detail in a simple way that is easy to follow. At the end I will demonstrate alternative ways to write the same function in a more concise manner.
Closures continued
Previously I gave a brief introduction to closures in Javascript. Here I will attempt to provide more understanding on this topic. I will lead into the topic of closures by beginning with a look at an infamous problem with for loops in Javascript. I will also briefly touch on Immediately Invoked Function Expressions (IIFEs).
Returning in Javascript and Intoduction to Closures
Functions return a value of undefinded
by default, unless we explicitly tell it to return another value.
How do we do that?
Continue reading “Returning in Javascript and Intoduction to Closures”Study of a Function – titleCase()
Lets try and do a detailed analysis/deconstruction of a function titleCase()
which takes a string and capitalises the first letter of every word. It uses arrays and some string methods and demonstrates usage of the return keyword and the practice of passing one function as an argument to another.
Reconciling Return
The return keyword and its purpose is actually fairly simple but for some reason it seems to cause beginners a lot of confusion. Even after being exposed to it by example and explanation, it can take some time before understanding really sinks in. I know this was certainly the case for me but I don’t believe it needed to be that way. Lets see if we can’t help lessen that confusion here.
Basic Toggling with javascript
If your not familiar with natural javascript and your only used to using a library like jQuery, then you might be surprised to learn that javascript doesn’t have a predefined toggle function that you can just call up when you want. You need to create your own before you can use it. Here is a bare bones demonstration of toggling in plain old ordinary javascript.
PHP MySQL Inserting Records Reference
First up there are three examples for inserting records into a MySQL database, one for each of the three following techniques:
- Using mysqli in a procedural manner.
- Using mysqli in an object-oriented fashion.
- Using PDO.
After that there is an example of the same three approaches, but with the addition of using prepared statements for improved security and efficiency.
The Definitive Guide to Object-Oriented JavaScript
James Shore has a truly excellent video explaining Javascript Objects and the topic of inheritance in detail at http://www.objectplayground.com/. It covers a few other things and is probably one of the very best videos I’ve seen on the subject. I highly recommend it to anyone who wants to further their knowledge of Javascript.