Which CMS are you using in Java and what is your experience with it (in terms of extensibility, usage comfort, framework API, memory usage, performance etc.). I am looking for suggestions.
Is there an implementation with a blocking queue for take but bounded by a maximum size. However, when the maximum size is reached, instead of blocking, it will remove from the head.
One usage is that if I have a very slow consumer, the system will not crash ( runs out of memory ) rather these message will be removed.
Hi All,
How can I measure the speed of code written in Java?
I planning to develop software which will solve Sudoku using all presently available AI and ML algorithms and compare time against simple brute-force method. I need to measure time of each algorithm, I would like to ask for suggestions on what is the best way of doing that? Very important, program must be useful on any machine regardless to CPU power/memory.
Thank you.
What are the implications of using a INSERT INTO foo ... SELECT FROM bar JOIN baz ... style insert statement versus using the same SELECT statement to dump (bar, baz) to a file, and then insert into foo by loading the file?
In my messing around, I haven't seen a huge difference. I would assume the former would use more memory, but the machine that this runs on has 8GB of RAM, and I never even see it go past half used.
Are there any huge (or long term) performance implications that I'm not seeing? Advantages/disadvantages of either?
I am using the new Virtual PC Beta on Windows 7 and I saw:
The virtual machines have a special directory, but once you are in it, the VMs are shown.
How can I do the same thing, with custom headings ("Machine status", "Memory", etc.) and custom toolbar buttons ("Create virtual machine")?
I can't seem to find any documentation for this.
I have some questions about singletons in C++.
Under what situations is a singleton a must?
What are the pros and cons of singletons? I was told they could cause memory leaks, how is that? I was also told that initialization is a problem, is that true?
Why is CompareAndSwap instruction considered expensive?
I read in a book:
"Memory barriers are expensive, about as
expensive as an atomic compareAndSet()
instruction."
Thanks!
I would like to have a button in my window such that if I click it (button) the window is closed.
I found out that I can close a window in the following way:
referenceToTheFrame.hide(); //hides the frame from view
refToTheFrame.dispose(); //disposes the frame from memory
But if I do this way, compiler complains:
Note: myProgram.java uses or overrides a deprecated API
Note: Recompile with -Xlint:deprication for details.
Do I do something unsafe?
Hi,
Is their anyway to determine if a object is locked in c#. I have the unenviable position, through design where i'm reading from a queue inside a class, and I need to dump the contents into a collection in the class. But that collection is also read/write from an interface outside the class. So obviously their may be a case when the collection is being written to, as the same time i want to write to it.
I could program round it, say using delegate but it would be ugly.
Bob.
As I remember there is a magic command line option in Java that turn on writing of operations that are currently executed to console. The output was looked like byte code. I do not mean -verbose, because it prints only class loading, while this option outputs information like memory allocation etc.
I have a C# application which sometimes cost the CPU very high. I want to see which part of the code cost most. But the Microsoft CLR Profiler only determins the memory usage, it's not meant for computational profiling according to here. Is there any tools to do this?
Thanks.
Hi, I just encounter a strange problem:
var a:ClassA = new ClassA;
var b:ClassA = a;
The program keeps running sometime, the a = null, b = null.
The program is a complex one, I am sure that no part will touch a, and b. My question is, will the runtime(garbage collector) to collect the memory of "a" and then assign a and b to null?
I am confused, thanks!
what is the difference between a variable declared as an auto and static?
what is the difference in allocation of memory in auto and static variable?
why do we use static with array of pointers and what is its significance?
First i thought that i had to convert javascript to php, but then i found out that cant because of server and client side executions. So now I simply want to send ONE variable
<script type="text/javascript">
function scriptvariable()
{
var theContents = "the variable";
}
</script>
to a php variable
<?php
$phpvariable
?>
That function in the javascript executes when lets say i click on a button.
Now i have Nooo idea how to get that phpvariable Equal to the javascript one so i can use that phpvariable to look up stuff in my Database.
I know i can add it to my url or some thing, and just refresh the page.. But id like to do it with AJAX as further in my webpage i might have to use this Ajax method..
So is there an easy way to do this without having to dump pages of code on my page to do one simple thing?
My Understanding
Static block is executed during class loading, If a class is already loaded then there is no way to load the class other than class reloading
Doubt/Question
1) Is there any time JVM reloads the class?
My Understanding
In Class Loading JVM loads source of the Java file, so it can not keep all thousands files source is a memory, it should discard the rarely used code and reload again when it is necessary and during reload JVM is not initializing static variables and locks again(may be using some tracking mechanism)
Doubt/Question
2) If my above understanding is incorrect then please correct me
Hi,
I was using Sonar to make my code cleaner, and it pointed that I'm using new Integer(1) instead of Integer.valueOf(1). Because it seems that valueOf does not instantiate a new object so is more memory-friendly. How can valueOf not instantiate a new object ? How does it work ? Is this true for all integers ?
thanks.
Hi, I have a structs action object instance that loads a variable from a properties file.I want it to happen only the first time the action is called, so in further executions its read from memory. Any hints ? Thanks.
I'm building a little script that will connect to an IMAP account and grab the content of the email and also the attachments. It works well for the most part, but when a really large file comes in, it causes the script to time out. Is there any way that I can check the file size before trying to grab it? I think that would be the simplest solution. Otherwise, I may have to upgrade to a server that has more memory.
I have a one-time process (hashing all our user passwords) written using datasets. The performance needs improvement so we've profiled the application and found that increasing the 'batch size' of the update will improve performance. I also know that if I load the entire data set into memory the application will start hitting swap and slow down.
The question is: how big is a System.Data.DataRow derived class? I'd like to calculate a batch size which I know won't force the application into swap.
I want to create the activity which will load the images from Web by using urls and i want to load that images in list view and i want some specific text and properties of that image in front of that image like the image below Click to see Image.Is there any way to store that images temporarily in phones memory.So how can i do this activity please give me perfect solution so that i can complete my application.How can i load the images from web.
I'm trying to use the OpenCA library in a C++ application. However, when including the file pki_x509_data_st.h the following code fragment is encountered:
typedef struct pki_x509_callbacks_st {
/* ---------------- Memory Management -------------------- */
void * (*new) (void );
void (*free) (void *x );
void * (*dup) (void *x );
This won't compile because of the "new" pointer declaration.
How can I make it work?
class MyWriter:
def __init__(self, stdout):
self.stdout = stdout
self.dumps = []
def write(self, text):
self.stdout.write(smart_unicode(text).encode('cp1251'))
self.dumps.append(text)
def close(self):
self.stdout.close()
writer = MyWriter(sys.stdout)
save = sys.stdout
sys.stdout = writer
I use self.dumps list to store data obtained from prints. Is there a more convenient object for storing string lines in memory? Ideally I want dump it to one big string. I can get it like this "\n".join(self.dumps) from code above. May be it's better to just concatenate strings - self.dumps += text?
$fp_src=fopen('file','r');
$filter = stream_filter_prepend($fp_src, 'convert.iconv.ISO-8859-1/UTF-8');
while(fread($fp_src,4096)){
++$count;
if($count%1000==0) print ftell($fp_src)."\n";
}
When I run this the script ends up consuming ~ 200 MB of RAM after going through just 35MB of the file.
Running it without the stream_filter zips right through with a constant memory footprint of ~10 MB.
What gives?
I'm trying to get an app working within Facebook, but it seems that no matter what I try including forcing just https in the app settings (see screen shot), the iframe source (Facebooks canvas) seems to change the https address to http (301) which is then producing SEC7111: HTTPS security errors in IE?
(sorry I can't post screen shots or extra links yet:( )
Header dump of page in question:
Request URL:https://[hidden]
Request Method:POST
Status Code:301 Moved Permanently
Request Headers (13)
Form Data (1)
Response Headersview source
Connection:keep-alive
Content-Encoding:gzip
Content-Length:253
Content-Type:text/html; charset=iso-8859-1
Date:Mon, 01 Jul 2013 09:42:32 GMT
Location:http://[hidden]
Server:Apache/2.2.22
Vary:Accept-Encoding
I'm getting so confused by this, and would welcome any help that the community could offer.
I am trying to send terminal commands programmaticly from an android activity. At the moment I'm using something like the following:
Process process = null;
DataOutputStream os = null;
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("./data/program1\n");
os.writeBytes("./data/program2\n");
os.writeBytes("exit\n");
os.flush();
However, my program1 is failing to run successfully and I believe it is due to inadequate user permissions. Now for my question:
Does anyone know how I can dump the terminal to a file and save it on the phone or sdcard? The program is tying into the terminal to feed it commands, I want to know a way to open a connection the otherway and access the (what is normally visual on a terminal screen) output.