Automatically assigning a value to a Guid
can we automatically assign a value on a Guid? like for example, i want
this to be a value of my guid: "914aaa44-4e11-e311-96f7-d8d3855b1531"
is it even possible?
Butter
Sunday, 1 September 2013
Web proxy script in java or jsp
Web proxy script in java or jsp
Long story short, I want to integrate web proxy in my website.
After much reading, I stumble upon http://www.glype.com/ , but the problem
is they only provide PHP version.
My website is using java and jsp language, so I hope to have the script
written in these two languages.
While it's possible for me to write it myself, I really don't want to
reinvent the wheel, especially with thousands of web proxy out there.
Long story short, I want to integrate web proxy in my website.
After much reading, I stumble upon http://www.glype.com/ , but the problem
is they only provide PHP version.
My website is using java and jsp language, so I hope to have the script
written in these two languages.
While it's possible for me to write it myself, I really don't want to
reinvent the wheel, especially with thousands of web proxy out there.
Monitoring events of web-applications [dashboards]
Monitoring events of web-applications [dashboards]
I'm in search for an application, which allows to monitor events generated
by web-apps. Regarding this question, I'm not interested in
network-monitoring tools.
The primary goal is visualization.
If a tool is additionally able to handle certain events [errors] based on
rules, that could be a plus.
The tool should have an open API, which allows to feed in events.
Please don't stark arguing, why some solution is better, others are less
good.
Please provide:
Links to solutions
Required infrastructure [Java, PHP, MySQL,...]
Probably a dashed list of features of your proposal.
I'm in search for an application, which allows to monitor events generated
by web-apps. Regarding this question, I'm not interested in
network-monitoring tools.
The primary goal is visualization.
If a tool is additionally able to handle certain events [errors] based on
rules, that could be a plus.
The tool should have an open API, which allows to feed in events.
Please don't stark arguing, why some solution is better, others are less
good.
Please provide:
Links to solutions
Required infrastructure [Java, PHP, MySQL,...]
Probably a dashed list of features of your proposal.
CreateFile fails on opening lsass.exe
CreateFile fails on opening lsass.exe
I'm working on a program, which collects some statistics about processes,
which are running on the system.
I've got a code, which retrieves some routine information, such as
executable file version, publisher and so on.
The code works fine for me until I open lsass.exe. When I try to open file
for reading, CreateFile fails with error ERROR_FILE_NOT_FOUND.
Here is the code:
auto FileHandle
= CreateFile(file_to_process.c_str(), // C:\Windows\System32\lsass.exe
GENERIC_READ,
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ( INVALID_HANDLE_VALUE == FileHandle )
{
int err_v = GetLastError(); // ERROR_FILE_NOT_FOUND
}
This code is a part of a system service, which is running with 'SYSTEM'
privileges.
I'm working on a program, which collects some statistics about processes,
which are running on the system.
I've got a code, which retrieves some routine information, such as
executable file version, publisher and so on.
The code works fine for me until I open lsass.exe. When I try to open file
for reading, CreateFile fails with error ERROR_FILE_NOT_FOUND.
Here is the code:
auto FileHandle
= CreateFile(file_to_process.c_str(), // C:\Windows\System32\lsass.exe
GENERIC_READ,
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if ( INVALID_HANDLE_VALUE == FileHandle )
{
int err_v = GetLastError(); // ERROR_FILE_NOT_FOUND
}
This code is a part of a system service, which is running with 'SYSTEM'
privileges.
Saturday, 31 August 2013
Using ConcurrentHashMap efficiently?
Using ConcurrentHashMap efficiently?
I have a Android Application whose core component is a
HashMap<String,float[]>. The System is having high concurrency. e.g here
are the following three situations I have which occur frequently and they
are highly overlapping in nature
Iterate through all the keys in the hashmap and do some operation on its
value(read only operations).
Add new key,value pairs in the Hashmap.
Remove Certain keys from the Hashmap.
I do all these operations in different threads and thus am using a
ConcurrentHashMap since some inconsistency in retrievals doesnt matter.
e.g While iterating the map,if new entries are added then it doesnt matter
to not read in those new values immediately as I ensure that next time
they are read .
Also while removing the entries I am recreating the iterator everytime to
avoid "ConcurrentModificationException"
Suppose , there is a following hashmap(i.e ConcurrentHashmap)
ConcurrentHashMap<String,float[]> test=new ConcurrentHashMap<String,
float[]>(200);
Now for Retrieval I do the following
Iterator<String> reader=test.keySet().iterator();
while(reader.hasNext())
{
String s=reader.next();
float[] temp=test.get(s);
//do some operation with float[] temp here(read only
operation)
}
and for removal I do the following
boolean temp = true;
while (temp) {
for (String key : test.keySet()) {
temp = false;
if (key.equals("abc")) {
test.remove(key);
temp = true;
break;
}
}
}
and when inserting in new values I simply do
test.put("temp value", new float[10]);
I am not sure if its a very efficient utilisation. Also it does matter not
to read in removed values(however I need efficiency ,and since the
iterator is again created during the function call,its guaranteed that in
the next time I don't get the removed values)so that much inconsistency
can be tolerated?
Could someone please tell me an efficient way to do it?
I have a Android Application whose core component is a
HashMap<String,float[]>. The System is having high concurrency. e.g here
are the following three situations I have which occur frequently and they
are highly overlapping in nature
Iterate through all the keys in the hashmap and do some operation on its
value(read only operations).
Add new key,value pairs in the Hashmap.
Remove Certain keys from the Hashmap.
I do all these operations in different threads and thus am using a
ConcurrentHashMap since some inconsistency in retrievals doesnt matter.
e.g While iterating the map,if new entries are added then it doesnt matter
to not read in those new values immediately as I ensure that next time
they are read .
Also while removing the entries I am recreating the iterator everytime to
avoid "ConcurrentModificationException"
Suppose , there is a following hashmap(i.e ConcurrentHashmap)
ConcurrentHashMap<String,float[]> test=new ConcurrentHashMap<String,
float[]>(200);
Now for Retrieval I do the following
Iterator<String> reader=test.keySet().iterator();
while(reader.hasNext())
{
String s=reader.next();
float[] temp=test.get(s);
//do some operation with float[] temp here(read only
operation)
}
and for removal I do the following
boolean temp = true;
while (temp) {
for (String key : test.keySet()) {
temp = false;
if (key.equals("abc")) {
test.remove(key);
temp = true;
break;
}
}
}
and when inserting in new values I simply do
test.put("temp value", new float[10]);
I am not sure if its a very efficient utilisation. Also it does matter not
to read in removed values(however I need efficiency ,and since the
iterator is again created during the function call,its guaranteed that in
the next time I don't get the removed values)so that much inconsistency
can be tolerated?
Could someone please tell me an efficient way to do it?
Java: How to make a final subarray?
Java: How to make a final subarray?
Consider the following snippet:
public class TestBench {
private static final short matrix[][] = new short[][] {new short[] {}};
public static void main (String args[]) {
matrix = new short[][] {new short[] {}}; // illegal
matrix[0] = new short[] {} // ok
}
}
Is there a way to make that sub array final? While reading the similar
questions, I realised I can do this with a custom class, but I'm curious
about using primitive types.
Thanks in advance.
Consider the following snippet:
public class TestBench {
private static final short matrix[][] = new short[][] {new short[] {}};
public static void main (String args[]) {
matrix = new short[][] {new short[] {}}; // illegal
matrix[0] = new short[] {} // ok
}
}
Is there a way to make that sub array final? While reading the similar
questions, I realised I can do this with a custom class, but I'm curious
about using primitive types.
Thanks in advance.
I'm trying to find the sum of primes below million
I'm trying to find the sum of primes below million
I'm trying to find the sum of primes below millions..my code works when I
try to find the sum of primes below hundred thousands but when I go large
numbers it doesn't work....so I need some help to get this work for big
numbers...
import java.util.Scanner;
public class sumPrime {
public static void main (String args []){
long n = 2000000; int i; int j;int sum =0;
for (i=2; i <n; i++){
for (j=2; j<i; j++){
if (i%j==0){
break;
}
}
if (i==j){
sum +=i;
}
}
System.out.print(sum);
}
}
I'm trying to find the sum of primes below millions..my code works when I
try to find the sum of primes below hundred thousands but when I go large
numbers it doesn't work....so I need some help to get this work for big
numbers...
import java.util.Scanner;
public class sumPrime {
public static void main (String args []){
long n = 2000000; int i; int j;int sum =0;
for (i=2; i <n; i++){
for (j=2; j<i; j++){
if (i%j==0){
break;
}
}
if (i==j){
sum +=i;
}
}
System.out.print(sum);
}
}
Subscribe to:
Posts (Atom)