Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- pseudo-element



  The danger of target=_blank and opener

When want to open a new page in a new tab on clicking a link on a page, the usual way of achieving this is to use target="_blank" property in a tag. However, the use of this leaves space for phishing website. Background parent and opener Before talking about the opener object, let's know a bit about parent object when using iframe. HTML provides a parent object which is used to communicate between the parent page and the embedded iframe element. This parent object can be accessed using...

   HTML,TARGET BLANK,REL NOOPENER,REL NOREFERRER     2018-09-15 04:53:56

  Why accessing Java HashMap may cause infinite loop in concurrent environment

HashMap in Java is frequently used to handle key/value pairs. But it is not a good candidate to be used in concurrent environment where ConcurrentHashMap should be used instead. If used in concurrent environment, it may cause lots of unexpected behavior even including make the program getting into an infinite loop situation. To understand how this can happen, let's first discuss how HaspMap works internally. In this post we will use implementation of HashMap before Java 8 as example, Java 8 prov...

   JAVA,HASHMAP,INFINITE LOOP     2020-03-29 01:47:00

  CSS Box Shadow Illustration

Used in casting shadows off block-level elements (like divs)..shadow { -moz-box-shadow: 5px 5px 5px #ccc; -webkit-box-shadow: 5px 5px 5px #ccc; box-shadow: 5px 5px 5px #ccc; }The horizontal offset of the shadow, positive means the shadow will be on the right of the box, a negative offset will put the shadow on the left of the box.The vertical offset of the shadow, a negative one means the box-shadow will be above the box, a positive one means the shadow will be below the box.The blur r...

   CSS,Box Shadow,Apple,Chrome,Safari,IE,Il     2011-06-30 04:03:38

  SkipList in Go

Algorithmic thinking is the must-have in the coding world, so I have been keeping the routine of algorithm practice every week, consolidating my knowledge of data structures on one hand, and improving my coding skills as well. A difficult one happened to be stuck in my mind- Implement SkipList with Go, which took me quite a weekend. Below is the front-line report of how I finally got the hang of it. First, from its concept. Wiki has explained it well. a skip list is a probab...

   GOLANG,SKIPLIST     2022-04-05 02:21:59

  How to be jQuery-free?

jQuery is now the most famous JavaScript library. There are around 57.3% websites in the world using jQuery, i.e, 6 out of 10 websites are using jQuery. If we only consider those websites which use libraries, then the percentage is even higher which is 91.7%. Although jQuery is very popular, its size is still a headache to many websites maintainers. The uncompressed jQuery 2.0 has a size of 235KB, the size is 81KB after optimization.The jQuery 1.8.3 which supports IE 6/7/8 has a uncompressed si...

   jQuery,JavaScript,ECMAScript,CSS3     2013-05-13 11:53:20

  A New Experimental Feature: scoped stylesheets

Chromium recently implemented a new feature from HTML5: scoped stylesheets, aka. <style scoped>. A web author can limit style rules to only apply to a part of a page by setting the ‘scoped’ attribute on a <style> element that is the direct child of the root element of the subtree you want the styles to be applied to. This limits the styles to affect just the element that is the parent of the <style> element and all of its descendants. Example Here’s a...

   HTML5,Style,Draw,Use case     2012-03-23 12:11:47

  A Python assignment trap

Python has no assignment, it only has reference. Assume, we have following code snippet: >>> values = [0, 1, 2] >>> values[1] = values >>> values [0, [...], 2] Why the result is not [0, [0, 1, 2], 2], instead it goes into an infinite loop? To understand this, we need to understand some basics about Python. Python has no variables, it only has labels. When we run: values = [0, 1, 2] Python will first create a list object [0,1,2], then it labels it as values. If we later...

   Python,Assignment,Trap,Shallow copy     2013-07-19 22:08:36

  CSS Animation vs. JavaScript: Which One Is Better?

You know that there are two ways of creating animations on the web: with CSS and JavaScript. And, their selection completely depends on the dependencies of the project. But many web developers hold a wrong perception that CSS is the only way of creating the animations. In fact, CSS has established as the most pampered system of the web development industry and most of the developers recommend it because it is mobile-friendly and powerful system. No doubt CSS is good, but JavaScript is the best....

   CSS animation, JS animation     2015-07-24 02:45:01

  Simple Animation in the HTML5 Canvas Element

HTML5 is generating all kinds of buzz these days. Some of the buzz is about HTML5 being a replacement for Adobe’s Flash. I don’t think it’s there yet but it’s certainly on the way to changing the way content is presented on the web. This is a description of a very simple animation in an HTML5 canvas element. It is coded for readability and not for optimized operation. We’ll add a canvas element to a web page and then use javascript to draw on it. We will...

   HTML5,Canvas,Animation,Sample code     2011-07-01 10:20:08

  Difference between ConcurrentHashMap and Hashtable

Both ConcurrentHashMap and Hashtable are Collection classes for storing key value pairs and they both provide fast element search with a supplied key. They have much in common. However, we will not discuss the similarities between them here, instead we will focus on the differences between them. ConcurrentHashMap and Hashtable are both thread safe. But the mechanism for thread safe is different between them. Hashtable is synchronized, it utilizes the synchronization mechanism; while ConcurrentHa...

   ConcurrentHashMap,Hashtable     2013-11-18 08:06:54