Are you over 18 and want to see adult content?
More Annotations
A complete backup of forexmonitor.net
Are you over 18 and want to see adult content?
A complete backup of thekitteryoutlets.com
Are you over 18 and want to see adult content?
A complete backup of luminessbeauty.com
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of barkandbert.wordpress.com
Are you over 18 and want to see adult content?
A complete backup of permanentwaterdicht.nl
Are you over 18 and want to see adult content?
A complete backup of guitarunited.com
Are you over 18 and want to see adult content?
A complete backup of karta-turizma.ru
Are you over 18 and want to see adult content?
A complete backup of losojosdehipatia.com.es
Are you over 18 and want to see adult content?
A complete backup of finewoodworking.com
Are you over 18 and want to see adult content?
Text
Note the return.
WHAT IS EVENT PROGRAMMING? Communicating between components with events is one of the fundamental programming paradigms. One module publishes an event, and other modules respond via listeners. It's an asynchronous model that provides an excellent separation of responsibility yet still allows several components to work together. Beyond just messages, it also introduces a dispatcher, which is a useful HOW DOES A MUTEX WORK? WHAT DOES IT COST? Concurrent programming requires synchronization. We can't have more than one thread accessing data at the same time; otherwise, we end up with a data race. The most common solution is to wrap the critical data access in a mutex. Mutexes are, of course, not free. A mutex can have a significant impact on the cost WHY SWITCH IS BETTER THAN IF-ELSE In Ben’s post, he questions whether switch statements are cleaner than if-else chains. I contend they are, because they better express the semantics of the code, allow less room for errors, reduce duplication, and potentially improve performance.I've never become overly convinced that switch statements are that much cleaner than `if else if else if else WHAT IS RESPONSIVE LAYOUT? THE BITWISE COMPLEMENT, OR NOT OPERATOR, IS UNSAFESEE MORE ONMORTORAY.COM
QUICKLY DRAWING A ROUNDED RECTANGLE WITH A GL SHADER Rectangles appear everywhere in user interfaces, from the backgrounds of elements to rounded border decorations. It's helpful to be able to draw these fast. I set out to draw a rectangle with a small shader program and minimal dynamic data. Replacing tesselation with distance fields My primary goal was to replace the tesselated rectangles we WHAT A COMPILER DOES: SYMBOL RESOLUTION IS REFERENCE COUNTING SLOWER THAN GC? WHY GARBAGE COLLECTION IS NOT NECESSARY AND ACTUALLY In the world of new languages it seems like garbage collection is standard feature. A way for the runtime to locate unused bits of memory and release them. It has become so common that some people can't even imagine using a language without it. Programmers, particularly ones new to the trade, tend to be exposed HOW TO WRITE A CUSTOM SELECTOR IN REACT Each time the state updates, the caller provided selector function is called to select a part of the state. This is compared to what value it had previously, and only if it has changed do we call the set_state function. If we were to call the set_state function every time, then it’d be no better than the caller listening for every state change..Note the return.
WHAT IS EVENT PROGRAMMING? Communicating between components with events is one of the fundamental programming paradigms. One module publishes an event, and other modules respond via listeners. It's an asynchronous model that provides an excellent separation of responsibility yet still allows several components to work together. Beyond just messages, it also introduces a dispatcher, which is a useful HOW DOES A MUTEX WORK? WHAT DOES IT COST? Concurrent programming requires synchronization. We can't have more than one thread accessing data at the same time; otherwise, we end up with a data race. The most common solution is to wrap the critical data access in a mutex. Mutexes are, of course, not free. A mutex can have a significant impact on the cost WHY SWITCH IS BETTER THAN IF-ELSE In Ben’s post, he questions whether switch statements are cleaner than if-else chains. I contend they are, because they better express the semantics of the code, allow less room for errors, reduce duplication, and potentially improve performance.I've never become overly convinced that switch statements are that much cleaner than `if else if else if else WHAT IS RESPONSIVE LAYOUT? THE BITWISE COMPLEMENT, OR NOT OPERATOR, IS UNSAFESEE MORE ONMORTORAY.COM
QUICKLY DRAWING A ROUNDED RECTANGLE WITH A GL SHADER Rectangles appear everywhere in user interfaces, from the backgrounds of elements to rounded border decorations. It's helpful to be able to draw these fast. I set out to draw a rectangle with a small shader program and minimal dynamic data. Replacing tesselation with distance fields My primary goal was to replace the tesselated rectangles we WHAT A COMPILER DOES: SYMBOL RESOLUTION IS REFERENCE COUNTING SLOWER THAN GC? WHY GARBAGE COLLECTION IS NOT NECESSARY AND ACTUALLY In the world of new languages it seems like garbage collection is standard feature. A way for the runtime to locate unused bits of memory and release them. It has become so common that some people can't even imagine using a language without it. Programmers, particularly ones new to the trade, tend to be exposed WHAT IS DECLARATIVE PROGRAMMING? Declarative programming is a paradigm that expresses the desired result, not how to achieve it. It uses rules and constraints to describe a user interface, the layout of a network, the structure of a document, or a language parser. Declarative languages are highly domain specific, offering a concise syntax for those applications. Why Declarative programming WHAT IS REFERENCE COUNTING? Objects are created, live for a while, and then destroyed. While creation is fairly clear, the when and how of destruction is fairly language dependent. In languages like C you're basically on your own, whereas in a very high level language like Python you don't even think about destruction. But whether it is manually done, WHAT IS A NORMAL MAP? AN OBJECT NORMAL MAP? Normal maps preserve the lighting fidelity of a high polygon count model when it is reduced to a lower polygon count. Model designers tend to work with models that are far too detailed to be handled in typical real-time applications, like games. The models are reduced from this high count to a low count, producing A PROGRAMMER’S INTRODUCTION TO USER PORTRAITS As programmers, it's vitally important for us to understand what our code should be doing. This knowledge starts with knowing the people using our product. While we're deep in the code, our mind tends to focus on technical details. But to truly understand the THE COST – A FUNCTION CALL – MUSING MORTORAY In the grand scheme of execution costs function calls come very close to the bottom of the list. They don't cost very much at all -- at least not in most compiled languages. It is nonetheless interesting to examine the costs involved. It is even more interesting to QUICKLY DRAWING A ROUNDED RECTANGLE WITH A GL SHADER Rectangles appear everywhere in user interfaces, from the backgrounds of elements to rounded border decorations. It's helpful to be able to draw these fast. I set out to draw a rectangle with a small shader program and minimal dynamic data. Replacing tesselation with distance fields My primary goal was to replace the tesselated rectangles we CPU MEMORY – WHY DO I NEED A MUTEX? – MUSING MORTORAY Multi-threaded programming calls for semaphores, synchronized blocks, mutexes, or whatever your language happens to call them. Most of us basically understand why we need them: to prevent multiple-threads from accessing the same memory. Have you ever stopped to think about what they actually do? Why do you need to protect the memory, thatsounds like
CALCULATING SQUARE ROOT USING NEWTON’S ITERATIVE METHOD The formula isn’t hard to understand. is the result of our current guess, our goal is to have this number be equal to zero. To do this we divide it by the slope of the curve at this point: the derivative is , the rate of change, is the value we’re looking for.. Now we just pretend we have a straight line formula for the moment (the reason why I used the word “slope”). DOUBLE-CHECKED LOCKING: WHY DOESN’T IT WORK AND HOW TO FIX Double-checked locking is notoriously evil. While it can be a boon to efficiency, it's tricky to do correctly. Lurking at its core are two issues fundamentals to multi-threaded programming. Even if you don't need this pattern, understanding atomicity and visibility is a must for any modern programming. The Pattern Let's look at what adouble-check
CPU REORDERING
We've all heard that a CPU may reorder access to memory. Yet if you've looked further you'd also see that cache coherence ensures the memory is kept in sync at all times. Something doesn't quite add up. If the memory is always coherent, how can any reordering affect user programs? And what actually is beingMUSING MORTORAY
Terrible interview question: Swap variables without a temporary. By mortoray. on 2019-04-25 • ( 1 Comment ) “Clever programming tricks have no place in programming interviews. They usually involve a small amount of code and solve an innocent-sounding question like “find the loop in a linked list”. Often unfair WHY SWITCH IS BETTER THAN IF-ELSE In Ben’s post, he questions whether switch statements are cleaner than if-else chains. I contend they are, because they better express the semantics of the code, allow less room for errors, reduce duplication, and potentially improve performance.I've never become overly convinced that switch statements are that much cleaner than `if else if else if else HOW TO WRITE A CUSTOM SELECTOR IN REACT const held_item = useSelector( game_state => game_state.held_item ) Only when game_state.held_item changes will the component rerender. useSelector itself isn’t magical. It is essentially a layer in between the state and the control. It will listen to every update to the game state, and run the selection function. WHAT IS EVENT PROGRAMMING? Communicating between components with events is one of the fundamental programming paradigms. One module publishes an event, and other modules respond via listeners. It's an asynchronous model that provides an excellent separation of responsibility yet still allows several components to work together. Beyond just messages, it also introduces a dispatcher, which is a useful HOW DOES A MUTEX WORK? WHAT DOES IT COST? The overhead costs of a mutex relate to the test-and-set operation and the system call that implements a mutex. The test-and-set is likely a minuscule cost; being essential to concurrent processing, CPU vendors have a strong incentive to make it efficient. We’ve ignored another important instruction, however: the fence. QUICKLY DRAWING A ROUNDED RECTANGLE WITH A GL SHADER The corners of a rounded rectangle can be treated as quadrants of a circle. The radius of the corner tells us the size of the circle, and the position of its center. The overlayed pink shows the area that completely covers the corner. This is a set of two triangles that I will give to the vertex shader. The pixel shader calculates thedistance
ANTIALIASING WITH A SIGNED DISTANCE FIELD Antialiasing with the edge distance. To get from the hard edges to the smoothed ones requires a relatively small change to the opacity function. This function assumes the distance is being measured in pixels. 1. pixel_opacity = clamp( 0.5 - distance_to_edge, 0, 1 ) Instead of choosing a 1 or 0 as opacity we allow it to be a rangebetween 0 and 1.
IS REFERENCE COUNTING SLOWER THAN GC? WHY GARBAGE COLLECTION IS NOT NECESSARY AND ACTUALLY In the world of new languages it seems like garbage collection is standard feature. A way for the runtime to locate unused bits of memory and release them. It has become so common that some people can't even imagine using a language without it. Programmers, particularly ones new to the trade, tend to be exposed THE BITWISE COMPLEMENT, OR NOT OPERATOR, IS UNSAFESEE MORE ONMORTORAY.COM
MUSING MORTORAY
Terrible interview question: Swap variables without a temporary. By mortoray. on 2019-04-25 • ( 1 Comment ) “Clever programming tricks have no place in programming interviews. They usually involve a small amount of code and solve an innocent-sounding question like “find the loop in a linked list”. Often unfair WHY SWITCH IS BETTER THAN IF-ELSE In Ben’s post, he questions whether switch statements are cleaner than if-else chains. I contend they are, because they better express the semantics of the code, allow less room for errors, reduce duplication, and potentially improve performance.I've never become overly convinced that switch statements are that much cleaner than `if else if else if else HOW TO WRITE A CUSTOM SELECTOR IN REACT const held_item = useSelector( game_state => game_state.held_item ) Only when game_state.held_item changes will the component rerender. useSelector itself isn’t magical. It is essentially a layer in between the state and the control. It will listen to every update to the game state, and run the selection function. WHAT IS EVENT PROGRAMMING? Communicating between components with events is one of the fundamental programming paradigms. One module publishes an event, and other modules respond via listeners. It's an asynchronous model that provides an excellent separation of responsibility yet still allows several components to work together. Beyond just messages, it also introduces a dispatcher, which is a useful HOW DOES A MUTEX WORK? WHAT DOES IT COST? The overhead costs of a mutex relate to the test-and-set operation and the system call that implements a mutex. The test-and-set is likely a minuscule cost; being essential to concurrent processing, CPU vendors have a strong incentive to make it efficient. We’ve ignored another important instruction, however: the fence. QUICKLY DRAWING A ROUNDED RECTANGLE WITH A GL SHADER The corners of a rounded rectangle can be treated as quadrants of a circle. The radius of the corner tells us the size of the circle, and the position of its center. The overlayed pink shows the area that completely covers the corner. This is a set of two triangles that I will give to the vertex shader. The pixel shader calculates thedistance
ANTIALIASING WITH A SIGNED DISTANCE FIELD Antialiasing with the edge distance. To get from the hard edges to the smoothed ones requires a relatively small change to the opacity function. This function assumes the distance is being measured in pixels. 1. pixel_opacity = clamp( 0.5 - distance_to_edge, 0, 1 ) Instead of choosing a 1 or 0 as opacity we allow it to be a rangebetween 0 and 1.
IS REFERENCE COUNTING SLOWER THAN GC? WHY GARBAGE COLLECTION IS NOT NECESSARY AND ACTUALLY In the world of new languages it seems like garbage collection is standard feature. A way for the runtime to locate unused bits of memory and release them. It has become so common that some people can't even imagine using a language without it. Programmers, particularly ones new to the trade, tend to be exposed THE BITWISE COMPLEMENT, OR NOT OPERATOR, IS UNSAFESEE MORE ONMORTORAY.COM
ANTIALIASING WITH A SIGNED DISTANCE FIELD Antialiasing with the edge distance. To get from the hard edges to the smoothed ones requires a relatively small change to the opacity function. This function assumes the distance is being measured in pixels. 1. pixel_opacity = clamp( 0.5 - distance_to_edge, 0, 1 ) Instead of choosing a 1 or 0 as opacity we allow it to be a rangebetween 0 and 1.
WHAT IS RESPONSIVE LAYOUT? A good UI design must accommodate the various device formats and resolutions that users have. Element placement cannot be absolute, but rather be constrained and expanded by the available space. Layouts that adapt themselves dynamically are called responsive layouts and a critical part of modern interface design. This article is part of aseries
DOUBLE-CHECKED LOCKING: WHY DOESN’T IT WORK AND HOW TO FIX Double-checked locking is notoriously evil. While it can be a boon to efficiency, it's tricky to do correctly. Lurking at its core are two issues fundamentals to multi-threaded programming. Even if you don't need this pattern, understanding atomicity and visibility is a must for any modern programming. The Pattern Let's look at what adouble-check
WHAT IS IMPERATIVE PROGRAMMING? Imperative programming is a paradigm that explicitly tells the computer what to do and how to do it. Unlike most other approaches it is a relatively concrete view on data and execution -- there isn't much mystery or abstract runtime behavior involved. The essential aspects of imperative programming are sequenced instructions andmutable data.
WHY I DON’T USE A PARSER GENERATOR Parser generators, like ANTLR or Bison, seem like great tools. Yet when I have to write a parser I now tend to steer clear of them, resorting to writing one manually. When I posted my first entry about Cloverleaf I was asked why I don't use these tools. It's a fair question as these tools COMBINING SEVERAL GL DRAW CALLS INTO ONE: A ROUNDED Combining several GL draw calls into one: a rounded rectangle. My previous article explains how I draw a rounded rectangle using a shader instead of tesselation. The biggest remaining issue is using eight calls to draw; one draw call would be much nicer. Here I show how I merge all these draw calls into one and upload a minimal amountof data
WHY DOES AMAZON TAUNT ME WITH SURROUND SOUND? Despite a label of 5.1 surround I only ever get stereo sound from Amazon Prime. I mange to get surround from other providers and devices, just not Amazon. Is it one of those annoying licensing issues, perhaps a language mismatch, or is it a technical PROGRAMMING WON’T BE AUTOMATED, OR IT ALREADY HAS BEEN A lot of programming is already automated and there has always been a push to get more. Certainly more automation will minimize certain roles, but mainly it’ll improve productivity. Given the volumes of issues most projects have, a significant increase in ANDROID NDK CROSS-COMPILE SETUP (LIBPNG AND FREETYPE Building native libraries for Android can be a bit confusing. My goal, which is likely shared by many, was to get libpng and freetyp2 working for my native OpenGL application. It took me a while to find enough references and examples before I was able to get it working. Now thatI have a solution
CPU REORDERING
This is when reordering rears its ugly-albeit-highly-efficient head and messes with that logic. The CPU looks at your series of stores, decides it can do this more efficiently and actually executes this series of stores: store data 3 store data 4 store is_readyMUSING MORTORAY
PROGRAMMING AND LIFESearch for...
MENU
* About Edaqa
* What is Programming? YOUR 30TH YEAR IN CODEBy mortoray
WHY SWITCH IS BETTER THAN IF-ELSEBy mortoray
FLUID LAYOUT ANIMATION: INVALIDATION AND CACHINGBy mortoray
CREATING A CUSTOM AUTHOR BOX ON WORDPRESSBy mortoray
123456
YOUR 30TH YEAR IN CODE By mortoray on 2019-08-02• ( Leave
a comment
)
WHY SWITCH IS BETTER THAN IF-ELSE By mortoray on 2019-06-29• ( 2 Comments
)
FLUID LAYOUT ANIMATION: INVALIDATION AND CACHING By mortoray on 2019-06-24 • ( Leave a comment)
CREATING A CUSTOM AUTHOR BOX ON WORDPRESS By mortoray on 2019-06-13 • ( Leave a comment)
A FAILED EXPERIMENT WITH PYTHON TYPE ANNOTATIONS By mortoray on 2019-06-11• ( 24 Comments
)
A PARADE OF WEB TECH By mortoray on 2019-05-12• ( Leave a
comment
)
nextprevious
YOUR 30TH YEAR IN CODE By mortoray on 2019-08-02• ( Leave
a comment
)
Becoming a programmer can be a daunting task. After reading Your First Year in Code, you might wonder what awaits you long term. My book, What is Programming covers more of the WHY SWITCH IS BETTER THAN IF-ELSE By mortoray on 2019-06-29• ( 2 Comments
)
In Ben’s post, he questions whether switch statements are cleaner than if-else chains. I contend they are, because they better express the semantics of the code, allow less room for errors, reduce FLUID LAYOUT ANIMATION: INVALIDATION AND CACHING By mortoray on 2019-06-24 • ( Leave a comment)
Dynamic changes in layout properties, either because of user actions, or animations, requires a recalculation of the layout. Maintaining a stable frame rate during recalculation is challenging, as the layoutprocess is
CREATING A CUSTOM AUTHOR BOX ON WORDPRESS By mortoray on 2019-06-13 • ( Leave a comment)
How to use custom short-codes to create an author-box in a template. A FAILED EXPERIMENT WITH PYTHON TYPE ANNOTATIONS By mortoray on 2019-06-11• ( 24 Comments
)
I like Python, but wish it had static typing. The added safety would go a long way to improving quality and reducing development time. So today I tried to make use of A PARADE OF WEB TECH By mortoray on 2019-05-12• ( Leave a
comment
)
Perhaps I wrote that I don’t know how to create a website, but glancing back, I certainlyhave built a lot. And oh boy, there’s quite the variety of technology involved. I thought TERRIBLE INTERVIEW QUESTION: SWAP VARIABLES WITHOUT A TEMPORARY By mortoray on 2019-04-25• ( 1 Comment
)
“Clever programming tricks have no place in programming interviews. They usually involve a small amount of code and solve an innocent-sounding question like “find the loop in a linked list”.Often unfair
A PROGRAMMER’S INTRODUCTION TO USER PORTRAITS By mortoray on 2019-03-28 • ( Leave a comment)
As programmers, it’s vitally important for us to understand what our code should be doing. This knowledge starts with knowing the people using our product. While we’re deep in the code, THE AMORTIZED COST OF VECTOR INSERT IS 3 By mortoray on 2019-03-26• ( 6 Comments
)
C++ requires many algorithms to be implemented in amortized constant time. I was curious about what this meant for vector insertion. To get started I first wrote an article about amortized time LESSONS LEARNED FROM RECORDING MY FIRST CLASS By mortoray on 2019-03-22 • ( Leave a comment)
I published my first video class, How to Write a Great User Story, something all programmers should know how to do. Even though the class only went live recently, there’s already a THE INTERNET LOTTERY™ FOR CONTENT CREATORS By mortoray on 2019-03-13 • ( Leave a comment)
Your cursor hovers over the post button. This will be the one. You researched it, you checked it, you got the graphics, and you have the audience. Today you’ll have that successful INVENTED HERE SYNDROME By mortoray on 2019-03-06• ( 21
Comments
)
Are you afraid to write code? Does the thought linger in your brain that somewhere out there somebody has already done this? Do you find yourself trapped in an analysis cycle where ESSENTIAL CODE FOR LISTS AND VECTORS IN AN INTERVIEW By mortoray on 2019-03-01• ( 1 Comment
)
“Lists are perhaps the fundamental data structure in code. There’s virtually no program that doesn’t use lists. Interviewers love asking questions that involve lists, either intentionally, or just because almost everything uses STOP WAVING THE WAND OF MAGIC NUMBERS By mortoray on 2019-02-25• ( 9 Comments
)
37. You have no idea what that number is, do you? A number without context nor a label is a random value. It doesn’t tell us anything. Imagine walking by a billboard,POSTS NAVIGATION
1 2 3 4
5 6
… 18
Older ›
More Posts
READ MY BOOK
_Do you know what it takes to become a great programmer?_ * PEOPLE are the reason software exists. * At the heart of any software is source CODE. * Behind the screen is a real person: YOU.Read Now
FOLLOW ME
Like my work?
Signup to my mailing list* Medium
SEARCH
Search for...
RECENT POSTS
* Your 30th Year in Code * Why switch is better than if-else * Fluid layout animation: Invalidation and caching * Creating a custom author box on WordPress * A Failed Experiment with Python Type Annotations Several links on my site are affiliate links to Amazon.As an Amazon Associate I earn from qualifying purchases. Hosted by WordPress.com . I use Netim and Hover
for domain names.
* TOP CATEGORIES: Programmingleaf
* SOCIAL LINKS:
Twitter Facebook
Google+
Tumblr
|
Post to
Cancel
* Follow
*
* Musing Mortoray
* Customize
* Follow
* Sign up
* Log in
* Report this content * Manage subscriptions* Collapse this bar
Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0