Posts
-
Moving from HTML to React
If you know JavaScript and want to get started with React, why not spend a little time seeing how your HTML can be transformed into vanilla JavaScript, and from JavaScript into comparable React code?
-
Don't
let
Hoisting Put Your Variables Up For GrabsJavaScript has a curious behavior if you're coming from another programming language. (Okay, JavaScript has
a lot of curious behaviors regardless of whether you're coming from another language.) In particular, there's a curios behavior around the scope of variable declarations. -
Sticky Search Fields
If you've ever visited the Lowe's web site and performed a search, you may have noticed the site remembers your last search and pre-populates the search box with your last search string. How is this accomplished? It's a simple use of the browser's
localStorage
object. -
Repackaging
XMLHttpRequest
The JavaScript
fetch
API has been around for a few years now, but a couple of browsers (Safari and iOS Safari, for example) have only supported it for a little over a year now. Prior tofetch
, we usedXMLHttpRequest
to request data in JavaScript. If you're a bit late to the game because you're still supporting some of those older browser versions, here's a step-by-step guide for howXMLHttpRequest
can be repackaged into thefetch
API. -
Running Through Arrays
If you're new to JavaScript (or it's been a while since you looked at array iteration in JavaScript), you probably want to understand all the options that are available to you.
-
Borrow, Buy, or Build?
Two little words - "pod install" - and the world is at your fingertips...Is there any reason not to jump right in and borrow the functionality someone else has developed and made available? -
SSL Security Checks
You've obtained an SSL certificate for your web site and now all your visitors see a comforting green padlock in their browser. Whew! You've taken a big step forward in the security of your site, but you may want to take a few more little steps.
-
Delegates Are Not Notifiers
You're an iOS developer. How would you set up a class to notify another object of an event?
In the context of iOS development, a few options may come to mind when answering this question:
NotificationCenter
, blocks/closures, or delegation. By far, the most popular answer I've received in interviews is delegation, which is understandable given the frequent use of the delegate pattern in iOS APIs. However, there is a difference between notification and delegation, just as the names imply. -
Diving Into React Native
React Native looks like it provides a great set of tools to help mobile developers get a new app running on iOS and Android without needing to build the same app twice. Facebook and Instagram have successfully integrated React Native into apps used by millions, so the technology seems to be stable and ready to ship. I recently had an idea for a small app and thought I'd take React Native for a spin to see how it worked. Here's what I found.
-
Getting Started
"I want to become a web/mobile developer/designer. What can I do to get started?"
Here are a few suggestions...
-
What is Closure?
What is closure? If you've worked with languages like C and C++ before coming to JavaScript, it may be unexpected behavior. If you're learning JavaScript as your first programming language, you may not even be aware it's happening.
-
This, That, and Another Thing
Once you've started working with JavaScript objects, you'll quickly need to become very familiar with a special JavaScript variable:
this
. It's often thought of as referring to a specific instance of an object, but it may be better thought of as providing a context for executing a function. -
Working with Forms in Two Functions
Interacting with forms - it's a common need in JavaScript apps. You need to gather information from the form when it's submitted; you need to initialize a form when it's first displayed to the user. Here's a simple form...
-
The (Proto)Typical JavaScript Function
We've seen that constructor functions can be used to initialize JavaScript objects in a consistent manner. The constructor can be used to ensure that an object is always initialized with a known set of properties and default values for those properties. But it's also possible to assign functions to object properties from within a constructor function.
-
Constructing Constructor Functions
When you are first learning JavaScript, you will be introduced to two ubiquitous language features: functions and objects. As you begin to experiment with creating objects, you may find it useful to implement a simple function to create commonly used object types. For instance, here's a function that will create an instance of a photo object...
-
Two Quick Steps to JavaScript Events
If you're just starting out with JavaScript and want to respond to an event on the page, you can keep these two simple steps in mind.
-
Four Quick Steps to C# Events
If you've ever found .NET events a bit confusing, here are four simple steps that will get anyone up and running.
-
Don't Tie Your Threads in Knots
One thing to remember about threads: they're never polite. Ever.
Threads never move themselves out of the way for other threads. When threads contend for a single resource this is not a great concern, but occasionally a situation arises where multiple threads contend for simultaneous access to multiple resources.
-
When does
static
Object Initialization Occur?When working with
static
or global variables in C or C++, we know the compiler allocates storage for them in the application's data segment. However, when the variable is an instance of a C++ class, it must be initialized as well as allocated. While the C++ language specification explains when this initialization takes place, it is a rather simple matter to demonstrate the rules for clarity. -
There's More Than One Way to Skin a Singleton
After working with C++ for a while, we all come across situations where we need to create one and only one instance of a given object type. However, depending on your needs, there's more than one way to go about implementing a singleton.
-
const
-antly ChangingIn addition to the
virtual
andinline
method modifiers, C++ also allows the addition of theconst
modifier on class methods. Theconst
modifier indicates the method does not alter the state of class member variables. -
When
virtual
Functions Won't Fallinline
C++ offers two useful modifiers for class methods:
virtual
andinline
. Avirtual
method can inherit new behavior from derived classes, while theinline
modifier requests that the compiler place the content of the method "inline" wherever the method is invoked rather than having a single instance of the code that is called from multiple places. You can think of it as simply having the compiler expand the content of your method wherever you invoke the method. But how does the compiler handle these modifiers when they are used together? -
More Than Resource Contention
One of the first things we learn about multithreaded programming is the need to guard against simultaneous read-write access to shared resources, but this isn't always a simple matter.
subscribe via RSS