Thursday, August 22, 2013

Windows 8 idle time, Hogging CPU Problem

http://answers.microsoft.com/en-us/windows/forum/windows_8-performance/can-one-prevent-antimalware-executable-to-start/14d43f26-c682-4b3d-80b6-59ae754b8649

Follow these steps:
a.      Press Windows key + W and type administrative tools.
b.      Select Administrative Tools and select Task Scheduler.
c.       Follow this path in the left hand pane. Task Scheduler Library/Microsoft/Windows/Windows defender
d.      Uncheck all the boxes under IdlePower and Network.
e.      Now it won’t scan your computer.

Tuesday, July 23, 2013

<< in C++

std::ostream& operator<<(std::ostream &, YardBlock*);

std::ostream& operator<<(std::ostream & out, YardBlock* yb) {
  out << "BlockM: [" << yb->getBlockM() << "] ";
  return out;
}

Thursday, July 18, 2013

Unsharp masking

Unsharp masking

The "unsharp" of the name derives from the fact that the technique uses a blurred, or "unsharp", positive image to create a mask of the original image. The unsharped mask is then combined with the negative image, creating an image that is less blurry than the original. 

The software applies a Gaussian blur to a copy of the original image and then compares it to the original. If the difference is greater than a user-specified threshold setting, the images are (in effect) subtracted. The threshold control constrains sharpening to image elements that differ from each other above a certain size threshold, so that sharpening of small image details, such as photographicgrain, can be suppressed.

Blend modes

source: http://en.wikipedia.org/wiki/Blend_modes

Blend modes

 determine how two layers are blended into each other.
Adobe Photoshop photo editing and photo retouching tutorial image

Normal blend mode

f(a, b) = b

Dissolve

The dissolve mode takes random pixels from both layers

Multiply and Screen


Multiply

f(a,b) = ab
For image editing it is sometimes more convenient to simply go to the Curves dialog of the software, as it gives more flexibility in the shape of the curves.

Screen

f(a,b) = 1 - (1 - a)(1 - b)
This yields an inverse effect from multiply. The result is a brighter picture.

Overlay


Overlay combines Multiply and Screen blend modes. The parts of the top layer where base layer is light become lighter, the parts where the base layer is dark become darker
 f(a,b) =
    \begin{cases}
      2 a b,           &\mbox{if } a < 0.5 \\
      1 - 2 ( 1 - a ) ( 1 - b ), &\mbox{otherwise}
    \end{cases}

Hard Light

Hard Light combines Multiply and Screen blend modes. Equivalent to Overlay, but with the bottom and top images swapped.

Soft Light

This is a softer version of Hard Light.
 f_{photoshop}(a,b) =
    \begin{cases}
      2 a b + a^2 (1 - 2 b),           &\mbox{if } b < 0.5 \\
      2 a (1 - b) + \sqrt{a} (2 b - 1), &\mbox{otherwise}
    \end{cases}

Dodge and burn

Dodge and burn change the lightness of the pictures, inspired by the dodging and burning performed in a darkroom.



  • Dodge modes:
    • The Screen blend mode inverts both layers, multiplies them, and then inverts that result.  f(a, b) = 1 - (1-a)(1-b)
    • The Color Dodge blend mode divides the bottom layer by the inverted top layer. This lightens the bottom layer depending on the value of the top layer: the brighter the top layer, the more its color affects the bottom layer. Blending with white gives white. Blending with black does not change the image.  f(a, b) = b / (1-a)
    • The Linear Dodge (Add) blend mode simply sums the values in the two layers. Blending with white gives white. Blending with black does not change the image. f(a, b) = a+b
  • Burn modes:
    • The Multiply mode simply multiplies each component in the two layers.  f(a, b) = a*b
    • The Color Burn mode divides the inverted bottom layer by the top layer, and then inverts the result. This darkens the top layer increasing the contrast to reflect the color of the bottom layer. The darker the bottom layer, the more its color is used. Blending with white produces no difference.  f(a, b) = 1- (1-b)/a
    • The Linear Burn mode sums the value in the two layers and subtracts 1. This is the same as inverting each layer, adding them together (as in Linear Dodge), and then inverting the result. Blending with white leaves the image unchanged. f(a, b) = (a+b) - 1
  • Vivid Light: this blend mode combines Color Dodge and Color Burn (rescaled so that neutral colors become middle gray). Dodge applies when values in the top layer are lighter than middle gray, and burn to darker values. The middle gray is the neutral color. When color is lighter than this, this effectively moves the white point of the bottom layer down by twice the difference; when it is darker, the black point is moved up by twice the difference. (The perceived contrast increases.)
  • Linear Light: this blend mode combines Linear Dodge and Linear Burn (rescaled so that neutral colors become middle gray). Dodge applies to values of top layer lighter than middle gray, and burn to darker values. The calculation simplifies to the sum of bottom layer and twice the top layer, subtract 1. The contrast decreases.

Simple arithmetic blend modes

Divide

This blend mode simply divides pixel values of one layer with the other, but it's useful for brightening photos if the color is on grey or less.

Addition

This blend mode simply adds pixel values of one layer with the other. In case of values above 1 (in the case of RGB), white is displayed.

Subtract

This blend mode simply subtracts pixel values of one layer with the other. In case of negative values, black is displayed.

Difference

Difference subtracts the top layer from the bottom layer or the other way round, to always get a positive value. Blending with black produces no change, as values for all colors are 0. (The RGB value for black is 0,0,0). Blending with white inverts the picture.
One of the main utilities for this is during the editing process, when it can be used to verify alignment of pictures with similar content. Exclusion is a very similar blend mode with lower contrast.

Darken Only

Darken Only creates a resultant pixel that retains the smallest components of the foreground and background pixels. If the foreground pixel has the components r1g1, and b1, and the background has r2g2b2, the resultant pixel is
 [min(r_1, r_2), min(g_1, g_2), min(b_1, b_2)]  

Lighten Only

Lighten Only has the opposite action of Darken Only. It selects the maximum of each component from the foreground and background pixels. The mathematical expression for Lighten Only is
 [max(r_1, r_2), max(g_1, g_2), max(b_1, b_2)]  

Hue, saturation and luminosity

Photoshop’s huesaturationcolor, and luminosity blend modes are based on a color space with dimensions that the article HSL and HSV calls hue, chroma, and luma.

Because these blend modes are based on a color space which is much closer than RGB to perceptually relevant dimensions, it can be used to correct the color of an image without altering perceived lightness, and to manipulate lightness contrast without changing the hue or chroma. The Luminosity mode is commonly used for image sharpening, because human vision is much more sensitive to fine-scale lightness contrast than color contrast.


Monday, July 15, 2013

set and vector in cpp

    std::set<char> terminalList = objTree->getAllTerminalList();
    std::vector<char> terminalVect(terminalList.begin(), terminalList.end());

C++, copy set to vector

std::vector<double> output(input.size());
std::copy(input.begin(), input.end(), output.begin());
Or, you could use the std::vector range constructor:
std::vector<double> output(input.begin(), input.end()); 

Sunday, July 14, 2013

How to bypass the Windows 8 log-in screen

  1. From the Start screen, type netplwiz. The command for netplwiz, aka the User Accounts Control Panel, appears in the search results in the left pane. Click that command.
  2. In the User Accounts Control Panel, select the account you wish to use to log in automatically.
  3. Click off the check-box above the account that says "Users must enter a user name and password to use this computer." Click OK.
  4. Enter your password once and then a second time to confirm it. Click OK.
  5. Restart Windows. Windows now bypasses the lock screen and the log-in screen to automatically take you to the Start screen.
  6. Change your mind? To re-enable the log-in screen, simply return to the User Accounts Control Panel using the steps above and click on the check-box for the "Users must enter a user name and password to use this computer" option.

Tuesday, July 9, 2013

Behaviour of increment and decrement operators in Python

Simply put, the ++ and -- operators don't exist in Python because they wouldn't be operators, they would have to be statements. All namespace modification in Python is a statement, for simplicity and consistency. That's one of the design decisions. And because integers are immutable, the only way to 'change' a variable is by reassigning it.

Python behaves differently here, because it is not C, and is not a low level wrapper around machine code, but a high-level dynamic language, where increments don't make sense, and also are not as necessary as in C, where you use them every time you have a loop, for example.

Tuesday, July 2, 2013

Inclusion Tags

Inclusion Tags

Another common template tag is the type that displays some data by rendering another template. For example, Django’s admin interface uses custom template tags to display the buttons along the bottom of the “add/change” form pages. Those buttons always look the same, but the link targets change depending on the object being edited. They’re a perfect case for using a small template that is filled with details from the current object.
These sorts of tags are called inclusion tags. Writing inclusion tags is probably best demonstrated by example. Let’s write a tag that produces a list of books for a given Author object. We’ll use the tag like this:
{% books_for_author author %}
The result will be something like this:
<ul>
    <li>The Cat In The Hat</li>
    <li>Hop On Pop</li>
    <li>Green Eggs And Ham</li>
</ul>

Advanced string formatting in Python

You can use the dictionary type of formatting:
s='arbit'
string='%(key)s hello world %(key)s hello world %(key)s' % {'key': s,}
You can use advanced string formatting, available in Python 2.6 and Python 3.x:
incoming = 'arbit'
result = '{0} hello world {0} hello world {0}'.format(incoming)

Monday, July 1, 2013

Dynamic Binding in Java

Dynamic Binding

class Father{
a(){ ... }
b(){a();}
}
class Son extends Father{
a(){ ..... }} //override

Sunday, June 30, 2013

Underscores in Python

the following special forms using leading or trailing
underscores are recognized (these can generally be combined with any case
convention):

- _single_leading_underscore: weak "internal use" indicator.  E.g. "from M
  import *" does not import objects whose name starts with an underscore.

- single_trailing_underscore_: used by convention to avoid conflicts with
  Python keyword, e.g.

  Tkinter.Toplevel(master, class_='ClassName')

- __double_leading_underscore: when naming a class attribute, invokes name
  mangling (inside class FooBar, __boo becomes _FooBar__boo; see below).

- __double_leading_and_trailing_underscore__: "magic" objects or
  attributes that live in user-controlled namespaces.  E.g. __init__,
  __import__ or __file__.  Never invent such names; only use them
  as documented.

Tuesday, June 25, 2013

HTML Notes

Overlay one div on another div

 #div_1 {
  position: absolute;
 }
 
thus the two div_1 is overlaid on div_2

Friday, June 21, 2013

Merits in Social Networking

source: http://www.spring.org.uk/2013/03/is-the-internet-goodbad-for-you-and-other-dumb-questions.php

Cannot Sleep? Association Rule Can Help You

Stimulus Control Therapy

  1. Lie down to go to sleep only when you are sleepy.
  2. Do not use your bed for anything except sleep; that is, do not read, watch television, eat, or worry in bed. Sexual activity is the only exception to this rule. On such occasions, the instructions are to be followed afterwards, when you intend to go to sleep.
  3. If you find yourself unable to fall asleep, get up and go into another room. Stay up as long as you wish and then return to the  bedroom to sleep. Although we do not want you to watch the clock, we want you to get out of bed if you do not fall asleep immediately. Remember the goal is to associate your bed with falling asleep quickly! If you are in bed more than about 10 minutes without falling asleep and have not gotten up, you are not following this instruction.
  4. If you still cannot fall asleep, repeat step 3. Do this as often as is necessary throughout the night.
  5. Set your alarm and get up at the same time every morning irrespective of how much sleep you got during the night. This will help your body acquire a consistent sleep rhythm.
  6. Do not nap during the day.

Notes on Memory

How Memory Works: 10 Things Most People Get Wrong

Post image for How Memory Works: 10 Things Most People Get Wrong
"If we remembered everything we should on most occasions be as ill off as if we remembered nothing." ~William James

Change the size of Thumbnail Preview. Aero Peek


Make the Taskbar Thumbnail Preview Bigger in Windows 7


Source: http://www.winhelponline.com/blog/increase-taskbar-thumbnail-preview-size-windows-7/

Wednesday, June 19, 2013

Regular Expression (Regexe)

yet another insignificant Programming Notes

Regular Expression 

Regular Expression, or regexe in short, is extremely and amazingly powerful in searching and manipulating text strings. One line of regexe can easily replace several dozen lines of programming codes. Regexe is supported in almost all the scripting languages (such as Perl, Python, PHP, and JavaScript) as well as general purpose programming languages such as Java, and even word processor such as Word for searching texts. 

>>> convert('CamelCase')
camel_case

Tuesday, June 18, 2013

C++ & Java: args and argv

aAutoDeleteEnginePath = AdaConstants.AUTODELETE_BIN_PATH;
aAutoDeleteEngineOutputFilePath = AdaConstants.AUTODELETE_OUTPUT_FILE_PATH;
aTerminal = args[0];
aTimestamp = args[1];
C++ the argv[0] is the command itself java the args[0] is the first argument

Process in Java

Process

Saturday, June 15, 2013

ERP Implementation Cases Reflection

Zhang Danyang
Overview
This reflection will discuss about the lessons learned from both successful and unsuccessful Enterprise Resource Planning (ERP) implementation cases. The purpose of ERP is to integrate and unify every aspect of the business of an enterprise into one single suite of software system. Many of the ERP implementation cases occurred around late 1990’s, in an attempt to tackle with Y2K problems.  After discussion about the lessons learned from these cases, the reflection will talk about the ERP implementation approaches, and a new approach from Software Engineering is proposed.