Blog Archive » Why Programmers Suck at C If I had a dime for every time I heard a web programmer apologize for the way his/her pages looked before revealing them, I certainly wouldn’t need to work anymore. As with color picking, I think that programmers tend to avoid doing certain things not because they are inherently bad at it, but because they don’t know how to proceed. They find themselves in an uncharted and foggy territory, without a map, no sense of direction, and with a limited ability to know if they’re getting any closer to where they want to be. Also, when they talk to people that don’t share such problems and find it all too natural and obvious, it’s hard for the two to communicate in terms that make sense to a programmer. There is a general tendency to believe that programmers can’t style things because they have no style themselves. Don’t get me wrong: I don’t think anybody can design something truly beautiful, innovative, simple and that can resonate with a big percentage of the population. Em vs.
You must remember 'this' Of all the tech blogs in all the sites in all the worldwide web, you walk into mine... If you hang out in JavaScript-oriented newsgroups like these for any length of time, you will eventually see some variation of this question: Hey, why doesn't this work?function MyWidget(name){ this.name = name; this.element = null;}MyWidget.prototype.showName = function(){ alert('The name is ' + this.name);}MyWidget.prototype.hookElement = function(element){ this.element = element; Event.observe(this.element, 'click', this.showName);}function test(){ var widget; widget = new MyWidget('Test Name'); widget.hookElement(document.getElementById('testDiv'));}"testDiv" is a div in the document, and I know that I'm not calling the test() function before the DOM is loaded, so why is it when I click the div I get the message "The name is undefined"?! (As always, I'm using some convenience syntax in the above for hooking up the event handler.) The OP (original poster) might even follow on with: And that's it!
Understand JavaScript Callback Functions and Use Them (Learn JavaScript Higher-order Functions, aka Callback Functions) In JavaScript, functions are first-class objects; that is, functions are of the type Object and they can be used in a first-class manner like any other object (String, Array, Number, etc.) since they are in fact objects themselves. They can be “stored in variables, passed as arguments to functions, created within functions, and returned from functions”1. Become an Elite/Highly Paid Specialized Software Engineer (Frontend, Fullstack, etc.) Within 8–10 Months, Earn MORE than the Avg. 45%-Off Tuition for the December Session By the founder of JavaScriptIsSexy Because functions are first-class objects, we can pass a function as an argument in another function and later execute that passed-in function or even return it to be executed later. Callback functions are derived from a programming paradigm known as functional programming. What is a Callback or Higher-order Function? How Callback Functions Work? Final Words
35 Designers x 5 Questions Advertisement 35 designers. 5 questions. 5 precise answers. Result: 175 professional suggestions, tips and ideas from some of the best web-developers all around the world. 35 Designers: how did we find them? How do you find the best designers worldwide? We didn’t choose by our intuition, we weren’t looking for any suggestions. We’ve browsed through numerous articles and hundreds of portfolios and in the end we’ve managed to select over 45 out of them. Five Questions Link We’ve asked five questions. 1 aspect of design you give the highest priority to.1 most useful CSS-technique you use very often.1 font you use in your projects very often.1 design-related book you highly recommend to read.1 design magazine you read on a daily/weekly basis (online or offline). In the end we’ve received more answers than we expected. 1 aspect of design you give the highest priority to. The initial part of the design process is probably the most creative and sophisticated part of web-development. 1.2. 1.3.
Static variables Using the JavaScript API | JW Player | Best HTML5 & Flash Online Video Player Home / JavaScript API / JavaScript API Quick Start This article explains how to use the JavaScript API component of JW Player. This API can be used to enhance the functionality of your video embeds and/or to implement rich video-page interactions. It abstracts any differences between Flash and HTML5, so the code you write will work with both technologies. Getting Started Before it is possible to interact with a player, that player should be setup. When the player is setup, API calls can immediately be made. <p><a onclick='jwplayer().play()'>Toggle playback</a> | <a onclick='alert(jwplayer().getVolume())'>Get audio volume</a></p> Here is the combination of setup code and API links in action: Toggle playback | Report volume Multiple Players When you have multiple players on a page, you must be specific about which player you want to interact with. Note the selector jwplayer(0) is actually the same as jwplayer(). API Calls Cheat Sheet The table below act as a cheat sheet of all API calls.
John Manoogian III » Blog Archive » (The Only) Ten Things To Kno AKA, “Secrets of the patented JM3 Gasbag Model™” - a getting-started list to make sense of CSS. [2,547 diggs and counting.] The Point of CSS is to use clean, simple HTML in your page, then write CSS “rules” that style the objects on your page. The page stays clean and looks cool, and your HTML page works on both mobile devices and regular browsers. * to style **all** `<h1>` tags, use css rule `**h1 {...**` * to style all tags **in a certain place**, e.g. for `<b>`'s inside `<p>` tags, use css rule `**p b {...**` * to style all `<h1>` headers **of a certain kind**, add `**class="myheader"**` to the `<h1>` tags you want to style, and use css rule `**.myheader {...**` * to style **just one** `<h1>` header, add `**id="myheader"**` to the `**<h1>**` tag you want to style, and use css rule `**#myheader { You can combine the above rules in different ways, too; to style all <h1>tags of type "barleymash" inside of forms of type "magicform", use css rule **form.magicform h1.barleymash {
Public, Privileged, Private Douglas Crockford www.crockford.com JavaScript is the world's most misunderstood programming language. Some believe that it lacks the property of information hiding because objects cannot have private instance variables and methods. Objects JavaScript is fundamentally about objects. If a value is a function, we can consider it a method. Objects can be produced by constructors, which are functions which initialize objects. Public The members of an object are all public members. In the constructor This technique is usually used to initialize public instance variables. function Container(param) { this.member = param; } So, if we construct a new object var myContainer = new Container('abc'); then myContainer.member contains 'abc'. In the prototype This technique is usually used to add public methods. Container.prototype.stamp = function (string) { return this.member + string; } So, we can invoke the method myContainer.stamp('def') which produces 'abcdef'. Private Privileged Closures Patterns Public Private
Object Constructor and prototyping Object Constructor and prototyping In the world of OOP, the previous ways of defining an object is too limiting in many situations. We need a way to create an object "type" that can be used multiple times without having to redefine the object every time to meet each particular instance's needs. The standard way to achieve this is to use the Object Constructor function. An object constructor is merely a regular JavaScript function, so it's just as robust (ie: define parameters, call other functions etc). Lets use a real world item "cat" as an example. Here the function "cat()" is an object constructor, and its properties and methods are declared inside it by prefixing them with the keyword "this." Adding methods to our object using prototype We saw above how to add a method to our constructor function by merely declaring it inside the function. Lets extend our original cat() object above with an additional method to change the cat's name, using prototype: The possibilities are endless.
my favorite discussion of static vs instanciable objects in javascript. i've had to explain this concept an uncountable number of times and have never been able to do it so simply. by snarfel Nov 18