Saturday, December 31, 2016

Nuclear fission and atom bonding enegy

Avogardo constant defines the count of atoms per 1 mole.

The number is:
6.022140857(74)×1023 mol−1

Nuclear fission emits about 200MeV, from the bonding energy inside of the atom, when fission occurs. That's thousands of times more powerful than a standard fission of chemical fuels.
However, single atom's fission energy is not enough to do much. However, when multiplied by Avogardo's number, or even a higer value, it comes to a very high value.

PCA analysis explained (Python)

Here is a good tutorial showing how to reduce the number of dimensions / features using SVD and then PCA in Python.
First, we use SVD to obtain covariance matrix, and then we sort the eigenvectors in descending order. We use only top k eigenvectors to create a new projection space, where we transform data using only k dimensions.

Full tutorial:

Friday, December 30, 2016

DIY STM microscope

EM wave , diffraction, minimum hole size

Good discussion here on topic of EM waves passing through holes of different sizes:

You need to distinguish between conductors and non-conductors. If your material is non-conducting then the EM radiation can pass through any size of hole regardless of whether the hole is larger or smaller than the wavelength. The power transmitted is just the incident power per unit are multiplied by the hole area, exactly as you would expect. All very boring really.
But you mention the screen in a microwave, and in this case the screen is conducting, which completely changes the behaviour. The incident EM wave induces oscillations in the metal of the screen, and these oscillations reradiate EM that interferes with the incident wave. It's this process that blocks the incident wave. The process is purely classical and requires no appeal to the existance of photons.
Conducting screens like the screen in a microwave are generically known as Faraday screens or more commonly Faraday cages. Calculating the relationship between the hole size and the transmitted intensity is a somewhat tortuous business, but as it happens there is an excellent description of the calculation here on thi site in David's answer to What is the relationship between Faraday cage mesh size and attenuation of cell phone reception signals?.

Diggression: Entropy and Life

In physics. from the laws of thermodynamics, speaking freely, entropy as a term refers to the level of order in a system. Lower the entropy, higher the order in the system. Famous physicist Ervin Schrodinger said that life in this universe feeds on negative entropy. This actually makes sense. There doesn't seem to be anything else in the universe that works so hard to reduce entropy like life does. Everything that reduces entropy, improves predictability and utility of any system is a good achievement and it should help us concentrate on further and further problems we need to solve. Entropy reduction is the only way we can predict and use things. Otherwise, everything becomes unusable and random.

So, it might be our highest goal on this planet to preserve in our efforts for reducing entropy on the planet.  I see programming as a very powerful way of entropy reduction. It can provide quick and efficient solutions for complex, or seemingly unmanageable problems. It can help us improve ourselves in so many ways, as human beings and as a civilization.

Here's wiki link for the topic of "Entropy and Life":

Thursday, December 29, 2016

Online htpasswd tools don't work for WAMP Apache server

Scenario: You would like to password protect a folder in your website. You are running WAMP Server. The first thing you try is an online .htpasswd generation tool, but it fails to work. Solution: For WAMP server, you can find htpasswd.exe in C:\wamp\bin\apacheX.X\bin\htpasswd.exe. Simply generate contents of .htpasswd file with a command like this one: htpasswd -nb username1 password1 This will print out the resulting .htpasswd file to the console, and you can just copy/paste it to the .htpasswd file where needed. It works for WAMP servers. Probably, WAMP uses different encryption algorithm than standard Linux implementations of Apache. Documentation for Apache's htpasswd tool is here:

Curse of dimensionality

Wednesday, December 28, 2016

Good wiki article in Linear Systems and Machine Learning - Tikhonov Regularization

This is a good Wikipedia article on an important topic in Machine Learning - Regularization: When finding an inverse of matrix, it is possible that one is dealing with a ill-posed (ill-conditioned) problem: Multicolinearity:

Mass rename in BASH - change file extension for all files in folder with a single command

You want to change file extension for all files in a folder? No problem, here is a very quick BASH command for mass rename for all files in a folder. Example: rename .html .php *.html This will change extension from .html to .php for all .html files in the current folder. The command above works on both Linux terminal and Windows BASH editions (i.e. Git Bash for Windows).

GREP - find text in files

You can use grep -ilR: grep -Ril "text-to-find-here" / i stands for ignore case (optional in your case). R stands for recursive. l stands for "show the file name, not the result itself". / stands for starting at the root of your machine. Answer by fedorqui:

Tuesday, December 27, 2016

Lectures on physics and math - Richard Feynman

Super interesting lectures in math and physics from genius Richard Feynman:

Monday, December 26, 2016

FFT Windowing

" 2. Windowing Although performing an FFT on a signal can provide great insight, it is important to know the limitations of the FFT and how to improve the signal clarity using windowing. What is Windowing When you use the FFT to measure the frequency component of a signal, you are basing the analysis on a finite set of data. The actual FFT transform assumes that it is a finite data set, a continuous spectrum that is one period of a periodic signal. For the FFT, both the time domain and the frequency domain are circular topologies, so the two endpoints of the time waveform are interpreted as though they were connected together. When the measured signal is periodic and an integer number of periods fill the acquisition time interval, the FFT turns out fine as it matches this assumption. "

Saturday, December 24, 2016

Relation between image and resolution and wavelength required for taking non-fuzzy images

Q: I have been trying to find the explaination why the wavelength of a wave is the limit of the resolution of an image (i.e. one cannot see the detail smaller than the wavelength), which is sited as the reason why we cannot see an atom using visible light. I don't think I really understand why this is so. can someone please explain to me the physics behind resolving detail with wave and the reason behing this limit? Thank you. Reference A: Firstly, the diffraction limit is wavelength/2 (approximately) - actually a more precise formula is 0.67*wavelength/NA where NA is the numerical aperture of the imaging apparatus and has a practical maximum of about 1.4. When we image something, the light we collect is spatially modulated. That means if I measured the field as a function of distance, in the x direction for example - call it E(x), E(x) would vary with x, as opposed to being a constant. The best resolution we can get actually depends on the Fourier transform of E(x) - what is sometimes called the spatial frequency spectrum in the direction of x, and the label we give to spatial frequency is k (so the Fourier transform E(x), would be E'(k_x) since we are concerned with the x direction only). To further illustrate the above point - take transmission through an aperture at z = 0. E(x) will be a rectangular function at z = 0, and it's spatial frequency spectrum, E'(k_x) will be a sinc function. If we decrease the width of the aperture, the width of the spatial frequency spectrum increases. This is because higher spatial frequency components are needed to "resolve" smaller objects. So where does the diffraction limit come from? It comes from the fact that only a certain range of spatial frequencies can propagate in a vacuum. Take the dispersion relation of free space; c = f λ c=fλ which can also be written c = ω k c=ωk Where omega is the angular frequency and k is the wavevector. If we rearrange the previous equation thus; k 2 = c 2 ω 2 k2=c2ω2 Remember that k is a vector and can be broken down into its constituent components; c 2 ω 2 = k 2 = k 2 x + k 2 y + k 2 z c2ω2=k2=kx2+ky2+kz2 Only components of k that are real will reach the far-field. Imaginary components result in evanescent waves that die off exponentially with distance and thus do not reach the far-field. From the above equation, it is easy to see that; − c ω < k x < c ω −cω Original thread (Answer by Cluade): WIKI:

Friday, December 23, 2016

Remove border (outline) out of customly designed input elements

If your custom input box in HTML still displays default border when hovered, you can try to remove the outline property of it. Like this: input.yourclass{ outline: none; } More info:

Camera Tracking video in Blender- VFX, 3D objects to video

Here's the cool tutorial:

Thursday, December 22, 2016

Wednesday, December 21, 2016

Machine Learning course by Tom Mitchel


How to: Access a router in LAN which is not a DHCP server

If you would like to access admin panel of a router / managed switch in your LAN, and this router is not the DHCP server, and it's connected to DHCP server through the LAN port, you could try to switch your PC / device to manual static IP address, and set the gateway to be the default IP address of the router you want to acceess. The default IP address and username and password can be obtained from product's documentation / user manual. After you have made modifications, and you want to use DHCP on your laptop again, just set PC's IP settings to automatic. Of course , you need direct connection to the router, either via WLAN or LAN cable.

Tuesday, December 20, 2016

Fourier Transform, De Moivre's formula, Ratio test, Laplace Transform, z-plane

A lot of terms from signal processing are well explained in this short Quora thread:

Monday, December 19, 2016

WP -> ACF insert file into a File field inside of a repeater

In ACF, a File type is populated by providing an attachment (post) ID of the file.

Repeater field is populated by an array of arrays, where each nested array represents a single row in the repeater field.

In order to everything work properly all the time, you should provide ACF field keys instead of field names, for your repeater fields.

Here's a code which takes an uploaded file (using normal HTML Input File control) and saves it as a WP attachment:

After that, this attachment ID is used to populate the File field inside a repeater like this:

//$attach_id is obtained from the upload function. It's the attachment ID


"file_upload" => $attach_id,
"file_ description" => "DESC $attach_id",
"file_date" => date("Ymd")




WordPress ACF - how to populate a custom field of type "File" from code

If you would like to upload a new file and store it as an ACF file type, you should probably look at this thread:

The idea behind ACF's file type field is that it accepts a WP Attachment.  WP attachment is a special post type in WP, which can be generated by this function:


Friday, December 16, 2016

Stephen Wolfram

Stephen Wolfram, computational theory of everything - talking about space of  all programs that can be written:

Wednesday, December 14, 2016

adb devices command returns -> "No permissions"

If you run into the problem of having a device status Unknown in Eclipse or adb devices, especially stating "No permissions" in adb devices list -> you should make sure that you are running the adb server with with sudo command (or equivalent level).

grunt - cannot find module "*foo*"

If grunt cannot find a npm module, make sure the module installed with --save-dev flag.

Like this:

npm install less-plugin-autoprefix --save-dev

instead of:

npm install less-plugin-autoprefix -g

Pixel perfect design

Methods of achieving pixel perfect design.
Article incoming................

Font Consistency in Web Design

Here are a few useful articles and forum discussions on the topic of font consistency:

Monday, December 12, 2016

Debugging - reduction of state influencers

In any kind of debugging, especially in difficult problems, we should start debugging by reducing the number of function calls, properties and other state influencers around the Object Being Debugged (OBD).
In case of JS debugging, this means reducing the number of CSS classes on the OBD element, checking the temporal context and lifecycle of the OBD object, etc.
After identifying the corrupted influencer, we need to see why it is conflicting with the OBD and what can be done about it.

Sunday, December 11, 2016

AngularJS - update ng-model from jQuery on input box

If you change input field's value using jQuery, and your ng-model is not my being updated, you should add jQuery("selector").trigger("input").

Triggering input event will update ng-model.

Saturday, December 10, 2016

High ping times on WiFi can be reduced by repositioning the AP for just a single meter!

In my recent attempt to improve my WiFi signal reception at home, I've noticed that even just slight translations of Access Point in space(time :) ) can lead to huge variations in  WiFi connection quality.That's of course expected, but the variation is quite surprisingly high.

Before 1 meter move:
avg. 2500 ms

After the move:

Test method:

Tuesday, December 6, 2016

Java for Android - JobInfo scheduler runs too frequently


Your job service runs too fast. You have created it using JobBuilder class and executing it as a subclass of JobService class.

Potential problems and their solutions are discussed in these threads:

Sunday, December 4, 2016

Possible jQuery bug - jQuery, get fill color of a selector

jQuery seems to return "rgb(0,0,0)" when inline css value for "fill" property is not set.

In a call like this:

var ret = jQuery(".selector").css("fill");

Variable ret is set to "rgb(0,0,0)" when inline css value for "fill" is missing on the element.

Better approach is to use each() and iterate through all elements manually. Even pure JS can be used for this:


Also, to delete fill property from a single element, you can call:"fill") instead of jQuery(".selector").css("fill","").

Thursday, December 1, 2016

Make text non-selectable on double click in HTML - CSS way

There is a pure CSS3 way of making a paragraph, button or even SVG element non selectable. Here it is:

    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    user-select: none;

<p class='nonselectable'>

You cannot select this text


PSR-1 and PSR-2 coding standards for PHP

Visual aspects of code play a significant role in raising or drowning developer's productivity. In case that there's too much clutte...