This is a Java question.
What is the fastest way to convert a List<?> to a List<ObjectType>? I am aware that this is possible through iteration please exclude that option.
Example by iteration,
final List<ObjectType> targetList = new ArrayList<ObjectType>();
// API returns List<?> so I have no choice.
List<?> resultList = resultSet.ge...
When I define constant values in my Java code, I generally declare them 'private static final', but recently I've been maintaining code where the constants are defined 'private final'.
I'm optimizing at the moment and was wondering whether to 'static'ize these.
For example
public class X {
private final String SOME_CONST = "Whatev...
Ahoy Stack Overflow! This be mai first post...
I'm attempting to identify users with a salted unique public key.
Algorithm - Should I use uniqid(), sha256, sha512, something else? All hashes will be salted. NIST recommended SHA256, but I like recommendations from geeks/scientists like me.
Generation - Does hash(SALT + AUTO_INCREME...
I learned a trick a while back from a DBA friend to speed up certain SQL queries. I remember him mentioning that it had something to do with how SQL Server compiles the query, and that the query path is forced to use the indexed value.
Here is my original query (takes 20 seconds):
select Part.Id as PartId, Location.Id as LocationId
F...
Hello everyone,
Just a quick question.
I have a loop that looks like this:
for (int i = 0; i < dim * dim; i++)
Is the condition in a for loop re-evaluated on every loop?
If so, would it be more efficient to do something like this?:
int dimSquare = dim * dim;
for (int i = 0; i < dimSquare; i++)
Thanks
-Faken
...
Hi,
I work on asp.net applications 'in-house' and would love to use asp.net mvc, but am not able to as our applications are deployed to web servers that are not in our control and currently only have .net framework v2 and IIS6. As well as there being no possibility of having time/money spent on converting current WebForms applications.....
I wrote a batch file to use PngCrush to optimize a .png image when I drag and drop it onto the batch file.
In the what's next section, I wrote about what I thought would be a good upgrade to the batch file.
My question is: is it possible to create a batch file like I did in the post, but capable of optimizing multiple images at once? D...
Hi,
Does APC module in PHP when running in CLI mode support code optimization? For example, when I run a file with php -f <file> will the file be optimized with APC before executing or not? Presuming APC is set to load in config file. Also, will the scripts included with require_once be also optimized?
I know optimization works fine wh...
I want to print the border of the square...
It may print only one side, or more sides of the square, so , I write this method
printBorder(N, E, S, W) {
if (N) {
square.printBorder(0,0,0,10);
}
if (E) {
square.printBorder(0,10,10,10);
}
if (S) {
square.printBorder(10,0,10,10);
}
if (W) {
square.printBord...
I've got a list of objects that I need to organize as an aesthetic graph. My current approach involves IronPython and a genetic algorithm, but this takes way too long.
I've been reading up on Graphviz, QuickGraph and Graph#, but I don't need the visualization part - I already have an app that will display the nodes given the x/y coordin...
Hi all,
I'm using Dipperstein's bitarray.cpp class to work on bi-level (black and white) images where the image data is natively stored as simply as one pixel one bit.
I need to iterate through each and every bit, on the order of 4--9 megapixels per image, over hundreds of images, using a for loop, something like:
for( int i = 0; i < i...
Hi,
I am working on parallax animation(something like - flordearagua.com) which consist 7-10 layers of quite large(1500x800) bitmaps and MovieClips. To archieve parallax, I wrote code to move all layer at different speed which again depends on some parameters like mouse position and acceleration. All upto this working fine.
I want to m...
I have 2 lists<string> of items, source and target. The items in the source list will have 0 to n matches in the target list, but there will not be duplicate matches.
Considering both lists are sorted, how would you do the matching most effectively in terms of performance.
Example:
source = {"1", "2", "A", "B", ...}
target = {"1 - new...
After reading a pretty good article on regex optimization in java I was wondering what are the other good tips for creating fast and efficient regular expressions?
...
I am using SQl data reader to get value from SQL database.
Language VB.NET
After getting data into reader, i run a while loop
While reader.Read
If reader.HasRows() Then
/* Proessing of data */
End If
End While
I observe that the while loop takes a lot of time to process as there are many rows.
Is there any bett...
Just finished reading the latest stackoverflow blog post about moving static content to a separate domain.
http://blog.stackoverflow.com/2009/08/a-few-speed-improvements/
However my website makes extensive use of Themes for rebranding for our customers. Is there a way of moving this data to a static domain?
...
I've developed a couple of T-SQL stored procedures that iterate over a fair bit of data. The first one takes a couple of minutes to run over a year's worth of data which is fine for my purposes. The second one, which uses the same structure/algorithm, albeit over more data, takes two hours, which is unbearable.
I'm using SQL-Server and...
I have a Qt Application and I use qDebug message for my application.
However I have gotten lazy and left in a load of:
#include <QDebug>
in my header files. Should I remove them for a production deployment and what benefit will it give?
...
Is there any way or tool available that can profile AS3 code without using Flex?
How can I profile existing project written in Flash CS3 and AS3?
...
Hello!
We have a problem with our production environment which uses a modified version of jBPM that has support for priorities. Indices present are:
| JBPM_TIMER | 1 | JBPM_TIMER_DUEDATE__PRIORITY_ | 1 | PRIORITY_ | A | 2 | NULL | NULL | YES | BTREE | |
| JBPM_TIMER | ...