Wednesday 27 April 2016

How to limit a process to a single CPU core?



You probably know how to limit processor to a single core for specific process e.g. some games are required to use on single core only to get best performance in such case you can use this one.


If you're running Windows Vista/7 (p ossibly XP, but not sure).
Type in: Control+Shift+Esc to get your taskmanager up.
Click on the Processes tab
Find the process that needs its processor affinity changed
Right-click on the process
Click on "Set Affinity"
Here you can select which processor(s) your process will use.
Good luck!
EDIT: You have to be administrator to get this to work

You can use command Line as well

from the command line, use
start /affinity 1 program.exe
this will run program.exe on the first CPU as "1" is the hex value of the affinity mask
CPU3 CPU2 CPU1 CPU0  Bin  Hex
---- ---- ---- ----  ---  ---
OFF  OFF  OFF  ON  = 0001 = 1
OFF  OFF  ON   OFF = 0010 = 2
OFF  OFF  ON   ON  = 0011 = 3
OFF  ON   OFF  OFF = 0100 = 4
OFF  ON   OFF  ON  = 0101 = 5 
OFF  ON   ON   OFF = 0110 = 6
OFF  ON   ON   ON  = 0111 = 7
ON   OFF  OFF  OFF = 1000 = 8
ON   OFF  OFF  ON  = 1001 = 9
ON   OFF  ON   OFF = 1010 = A 
ON   OFF  ON   ON  = 1011 = B
ON   ON   OFF  OFF = 1100 = C
ON   ON   OFF  ON  = 1101 = D
ON   ON   ON   OFF = 1110 = E 
ON   ON   ON   ON  = 1111 = F 

Entire Windows Session to single core(Vista/7)
  1. Type bcdedit /set onecpu on on a command prompt
  2. Reboot the system.
  3. When you are done playing, type 2 - Type: bcdedit /set onecpu off and reboot again.
For Reference :
http://superuser.com/questions/309617/how-to-limit-a-process-to-a-single-cpu-core

Commands for Viewing and Managing Boot Configuration Data

BCD Editor (Bcdedit.exe) is a command-line utility that lets you view and manage the BCD store. To use BCD Editor:
1. Click Start, point to All Programs, and then click Accessories.
2. Right-click Command Prompt, and then click Run As Administrator.
3. Type bcdedit at the command prompt.

Create, import, export, and identify the entire BCD store.
Armed with the right set of commands, you can use bcdedit to:
  • Create, delete, and copy individual entries in the BCD store.
  • Set or delete entry option values in the BCD store.
  • Control the boot sequence and the boot manager.
  • Configure and control Emergency Management Services (EMS).
  • Configure and control boot debugging as well as hypervisor debugging. summarizes commands you can use when you are working with the BCD store.

Note that BCD Editor is an advanced command-line tool and you should attempt to modify the BCD store only if you are an experienced IT pro. As a safe¬guard, you should make a full backup of the computer prior to making any changes to the BCD store. Why? If you make a mistake, your computer might end up in a non-bootable state, and then you would need to initiate a recovery.

Here’s a list of commands you can use with BCD Editor and a description of what each does:
/bootdebugEnables or disables boot debugging for a boot application.
/bootemsEnables or disables Emergency Management Services for a boot application.
/bootsequenceSets the one-time boot sequence for the boot manager.
/copyMakes copies of entries in the store.
/create Creates new entries in the store.
/createstore Creates a new (empty) boot configuration data store.
/dbgsettings Sets the global debugger parameters.
/debug Enables or disables kernel debugging for an operating system entry.
/default Sets the default entry that the boot manager will use.
/delete Deletes entries from the store.
/deletevalue Deletes entry options from the store.
/displayorder Sets the order in which the boot manager displays the multiboot menu.
/ems Enables or disables Emergency Management Services for an operating system entry.
/emssettings Sets the global Emergency Management Services parameters.
/enum Lists entries in the store.
/export Exports the contents of the system store to a file. This file can be used later to restore the state of the system store.
/hypervisorsettings Sets the hypervisor parameters.
/import Restores the state of the system store by using a backup file created with the /export command.
/mirror Creates a mirror of entries in the store.
/set Sets entry option values in the store.
/sysstore Sets the system store device. This only affects EFI systems.
/timeout Sets the boot manager timeout value.
/toolsdisplayorder Sets the order in which the boot manager displays the tools menu.
/v Sets output to verbose mode. 

FOR MORE DETAILS:

How to Generate List of StartUp Programs Using CMD OR POWERSHELL?


You Probably know how to get list of startup program just after User Log in Successfully using msconfig.

  1. win + R.









2.Type "msconfig" in Run. 











3. Select StartUp over there.














But if you want to do the same USING



Command Prompt

Step 1: Open the command prompt by going to StartRun and typing in CMD. If you are unfamiliar with the command prompt, feel free to read my command prompt beginner’s guide first.
command prompt
Step 2: Now type in the following WMI (Windows Management Instrumentation) command at the prompt and press Enter.
wmic startup get caption,command
You should now see a list of all the applications along with their paths that run at Windows startup.
cmd startup programs
If you want more information, you can also just type wmic startup and you’ll get a few extra fields like Location, UserSID and User.
Step 3: If you want to export the list out as a text file, type in the following command:
wmic startup get caption,command > c:\StartupApps.txt
And if you want to create an HTML file, just type this instead:
wmic startup get caption,command > c:\StartupApps.htm




PowerShell

If you prefer to use the more modern and powerful PowerShell, the command below will give you pretty much the same results as the WMI command above.
Get-CimInstance Win32_StartupCommand | Select-Object Name, command, Location, User | Format-List 
powershell startup programs
If you want to send the output of a PowerShell command to a text file, you can simply append the following part to the above command after Format-List.
| Out-File c:\scripts\test.txt
Make sure to include the pipe symbol | that is at the very front. I actually prefer the output of PowerShell because the formatting is much easier to view in a text editor.

That’s about it. You should now have a list of startup programs that you can save and reference later. If you have any questions, feel free to post a comment. Enjoy!

Sunday 24 April 2016

ModPower (of BigInteger )Method in Java




Java.math.BigInteger.modPow() Method




Description

The java.math.BigInteger.modPow(BigInteger exponent, BigInteger m)returns a BigInteger whose value is (thisexponent mod m). Unlike pow, this method permits negative exponents.

Declaration

Following is the declaration for java.math.BigInteger.modPow() method
public BigInteger modPow(BigInteger exponent, BigInteger m)

Parameters

  • exponent - the exponent
  • - the modulus

Return Value

This method returns a BigInteger object whose value is thisexponent mod m.

Exception

  • ArithmeticException - if m ≤ 0 or the exponent is negative and this BigInteger is not relatively prime to m.

Example

The following example shows the usage of math.BigInteger.modPow() method
package com.tutorialspoint;

import java.math.*;

public class BigIntegerDemo {

public static void main(String[] args) {

        // create 3 BigInteger objects
        BigInteger bi1, bi2, bi3;

 // create a BigInteger exponent
 BigInteger exponent = new BigInteger("2");

        bi1 = new BigInteger("7");
        bi2 = new BigInteger("20");

        // perform modPow operation on bi1 using bi2 and exp
 bi3 = bi1.modPow(exponent, bi2);

        String str = bi1 + "^" +exponent+ " mod " + bi2 + " is " +bi3;

 // print bi3 value
 System.out.println( str );
    }
}
Let us compile and run the above program, this will produce the following result:
7^2 mod 20 is 9

Reference :
http://www.tutorialspoint.com/java/math/biginteger_modpow.htm

Saturday 23 April 2016

Generator of finite cyclic group


In algebra, a cyclic group or monogenous group is a group that is generated by a single element.[1] That is, it consists of a set of elements with a single invertible associative operation, and it contains an element g such that every other element of the group may be obtained by repeatedly applying the group operation or its inverse to g. Each element can be written as a power of g in multiplicative notation, or as a multiple of g in additive notation. This element g is called agenerator of the group.[1]
Every infinite cyclic group is isomorphic to the additive group of Z, the integers. Every finite cyclic group of order n is isomorphic to the additive group of Z/nZ, the integers modulo n. Every cyclic group is an abelian group (meaning that its group operation is commutative), and every finitely generated abelian group is a direct product of cyclic groups


The six 6th complex roots of unity form a cyclic group under multiplication. zis a primitive element, but z2is not, because the odd powers of z are not a power of z2.
Infinite cyclic groups
p1, (*∞∞)p11g, (22∞)
Frieze group 11.pngFrieze group 1g.png
Frieze example p1.png
Frieze hop.png
Frieze example p11g.png
Frieze step.png
Two frieze groups are isomorphic to Z. With one generator, p1 has translations and p11g has glide reflections.
A group G is called cyclic if there exists an element g in G such thatG = ⟨g⟩ = { gn | n is an integer }. Since any group generated by an element in a group is a subgroup of that group, showing that the only subgroup of a group G that contains g is Gitself suffices to show that G is cyclic.
For example, if G = { g0g1g2g3g4g5 } is a group of order 6, then g6 = g0, and G is cyclic. In fact, G is essentially the same as (that is, isomorphic to) the set { 0, 1, 2, 3, 4, 5 }with addition modulo 6. For example, 1 + 2 ≡ 3 (mod 6) corresponds to g1 · g2 = g3, and2 + 5 ≡ 1 (mod 6) corresponds to g2 · g5 = g7 = g1, and so on. One can use the isomorphism χ defined by χ(gi) = i.
The name "cyclic" may be misleading:[2] it is possible to generate infinitely many elements and not form any literal cycles; that is, every gn is distinct. (It can be thought of as having one infinitely long cycle.) A group generated in this way (for example, the first frieze group, p1) is called an infinite cyclic group, and is isomorphic to the additive group of theintegers(Z, +).
Nicolas Bourbaki, who was the French mathematicians group, called a cyclic group as monogenous group,[note 1] and defined a finite monogenous group as a cyclic group,[note 1] then, Bourbaki avoided the term infinite cyclic group

Thursday 21 April 2016

I am fighting with my own MIND to change my own MIND with help of my own MIND.


I am fighting with my own MIND to change my own MIND with help of my own MIND.


Reference Link :


Sandeep Maheshwari is a name among millions who struggled, failed and surged ahead in search of success, happiness and contentment.Just like any other middle class guy, he too had a bunch of unclear dreams and a blurred vision of his goals in life. All he had was an undying learning attitude to hold on to. Rowing through ups and downs, it was time that taught him the true meaning of his life.And once discovered, he consistently kept resigning from his comfort zone and to share the secret of his success with the entire world. It is this very urge of helping people and doing something good for the society that inspired him to take the initiative of changing people's lives in the form of "Free Life-Changing Seminars and Sessions".No wonder 
people connect with him and his mission of 'Sharing' is now being 
actively propagated and practiced by millions. It is his diligent focus, 
the great support of his family and the faith of his team that keeps 
him going.His family was into the Aluminum business, which collapsed and the onus was onto him to fill in this crucial time of need. And as expected by any young guy, he started doing everything he could. Right from joining a multi-level marketing company to manufacturing & marketing household products. He left no stone unturned.It was during this phase, he discovered interest and need beyond any formal education. Hence, instead of being a brilliant student, he opted to drop out of Kirorimal College, Delhi in the third year of B.Com. Rather, he embarked on the journey of studying yet another interesting subject. A subject called life.Attracted by the scintillating modeling world, he started his career as a model at the age of 19. Witnessing the harassment and exploitation experienced by models,something in him moved. And it was this turning moment when he decided to help countless struggling models. With a mission within, he started small. A 2-week course in photography and there he was, a dime-a-dozen photographer with a camera in his hand. Nothing much changed. Moving ahead with a burning desire to change the modeling world, he set up his own company by the name of Mash Audio Visuals Pvt. Ltd. and started making portfolios.Next, in the year 2002, he along with his three friends, started a company, which was closed within six months. But Sandeep's mind was still open. With the concept of "Sharing" in his heart, he summed up his entire experience in a reversed book on marketing. He was just 21.It was the year 2003. He created a world record by knocking down a juggernaut task of taking more than 10,000 shots of 122 models in just 10 hours and 45 minutes. But as expected, he didn't stop. His focus was not diluted by the glamour and temporary adulation he got. Rather, this fueled his innate desire to revamp the modeling world further. At the age of 26, he launched ImagesBazaar. The year was 2006. Not being a massive setup, he took the job of multi-tasking. Being the counselor,tele-caller and a photographer all by himself, he paved his way forward. And today, ImagesBazaar is the world's largest collection of Indian images with over a million images and more than 7000 clients across 45 countries.
Sandeep has single handedly brought this paradigm shift in the 
modeling world. Countless models have been successfully launched with words like exploitation and harassment sidelined to a large extent.It was this life-changing endeavor that made him one of the most renowned entrepreneurs of India at a young age of 29. His ethics resonating some of the philosophies like 'To Never Fear of Failures' and "Be Truthful to self and others".Apart from being a successful entrepreneur, he is a guide, a mentor, a role model and a youth icon for millions of people all over the world. People love and adore him for his great mission of making everybody believe in them and helping people to make their life 'Aasaan' (Easy).His unshakable faith in the divine power grants him strength to thrive. Being at the helm of success, it is quite astonishing to know that money does not lure him. And that's why, profits don't drive his organisation. It's an emotional bonding with each and every person working in the company that matters for him. Capable of building an entire new industry or an organization, he is satisfied to adhere to his self-made benchmark that states, "If you have more than you need, simply share it with those who need it the most."
With a completely distinct aura than any other person of his age and 
stature, he rose above the rat race and broke through the age-old 
myth of 'Life is tough' with his simple mantra 'Aasaan Hai'

Storage Deduplication



Data outsourcing to a cloud storage brings forth one of new challenges for the efficient resource utilization as well as keeping security for the outsourced data simultaneously. Recently, Zheng and Xu proposed a Proof of Storage with Deduplication (POSD) scheme for a secure and efficient cloud storage service [1]. Exploiting the public verifiability [2], the POSD scheme couples two notions of Proof of Data Possession (PDP) [2][3] and Proof of Data Ownership (POW) [4] and provides a solution to achieve both of security and efficiency. Using the POSD scheme, a client can be assured the integrity of its outsourced data. In addition, a storage server can take advantage of deduplication techniques in a secure manner. That is, the storage server can efficiently utilize resources such as storage space and network bandwidth while preventing information leakage [5][6]. In the POSD scheme, the verification of auditing and deduplication protocol entirely depends on public keys, which are created and provided by clients [1]. Hence, the validity of the scheme is implicitly based on an assumption, which we call random key assumption, that all clients are honest in terms of generating their keys. In the cross-multiple users and the cross-domain environment of the cloud computing, however, such an assumption is unrealistic. Eliminating random key assumption may cause storage systems that utilize the POSD scheme to face a new security threat not considered before. Unfortunately, the scheme 2 has a serious security breach under new attack model allowing malicious clients to make dishonestly manipulated keys. In this paper, we present the security weakness of the POSD scheme. More specifically, we show that the scheme fails to satisfy two security requirements, server unforgeability and (κ, θ)-uncheatability, under new attack model that is very reasonable and effective. A countermeasure against this attack is provided by modifying the scheme such that the clients-created keys are blended with the random values contributed by the storage server. The proposed solution actually weakens the client’s capability to control their keys. The modification is minimized so that our scheme preserves the efficiency while providing more robust security. This paper is organized as follows: In Section 2, we briefly review the POSD scheme. New attack model and some attack scenarios are presented in Section 3, and countermeasure against the attack is described in Section 4. Finally, we conclude this paper in Section 5.


Reference Link:

Human Motion Sensor Using PIR sensor with Arduino

PIR Sensor Arduino Alarm

In this simple project, we’ll build a motion-sensing arduino alarm using a PIR (passive infrared) sensor and an Arduino microcontroller. This is a great way to learn the basics of using digital input (from the sensor) and output (in this case, to a noisy buzzer) on your Arduino.
This arduino alarm is handy for booby traps and practical jokes, and it’s just what you’ll need to detect a zombie invasion! Plus, it’s all built on a breadboard, so no soldering required.


Coding : 



// Uses a PIR sensor to detect movement, buzzes a buzzer
// more info here: http://blog.makezine.com/projects/pir-sensor-arduino-alarm/
// email me, John Park, at jp@jpixl.net
// based upon:
// PIR sensor tester by Limor Fried of Adafruit
// tone code by michael@thegrebs.com

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status
int pinSpeaker = 10;           //Set up a speaker on a PWM pin (digital 9, 10, or 11)

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  pinMode(pinSpeaker, OUTPUT);
  Serial.begin(9600);
}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    playTone(300, 160);
   delay(250);

    
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
      digitalWrite(ledPin, LOW); // turn LED OFF
      playTone(0, 0);
 //     delay(300);    
      if (pirState == HIGH){
      // we have just turned off
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}
// duration in mSecs, frequency in hertz
void playTone(long duration, int freq) {
    duration *= 1000;
    int period = (1.0 / freq) * 1000000;
    long elapsed_time = 0;
    while (elapsed_time < duration) {
        digitalWrite(pinSpeaker,HIGH);
        delayMicroseconds(period / 2);
        digitalWrite(pinSpeaker, LOW);
        delayMicroseconds(period / 2);
        elapsed_time += (period);
    }
}



CirCUIT:

How PIRs Work:

PIR sensors are more complicated than many of the other sensors explained in these tutorials (like photocells, FSRs and tilt switches) because there are multiple variables that affect the sensors input and output. To begin explaining how a basic sensor works, we'll use this rather nice diagram (if anyone knows where it originates plz let me know).
The PIR sensor itself has two slots in it, each slot is made of a special material that is sensitive to IR. The lens used here is not really doing much and so we see that the two slots can 'see' out past some distance (basically the sensitivity of the sensor). When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body like a human or animal passes by, it first intercepts one half of the PIR sensor, which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential change. These change pulses are what is detected.

For more Details:


How to install google-chrome in redhat without redhat subscription

Install google-chrome in redhat  Download the .rpm file of chrome https://www.google.com/chrome/thank-you.html?installdataindex=empty&st...