What do you wish you'd known leaving College as a CS Major?
List 5 things you wish you'd known/done/emphasized differently now that you're in the workforce (in the context of your college software development). Thanks from KY for your wisdom. ...
List 5 things you wish you'd known/done/emphasized differently now that you're in the workforce (in the context of your college software development). Thanks from KY for your wisdom. ...
I am now profiling an application, who does a lot of disk I/O. At this point, I want to know how much time is spent on disk I/O. So that, I could make a comparison between I/O and the whole execution time, in order to decide the next target of optimization. In short, I am seeking tools or methods to: Calculate and summary the total t...
I have a list view with 100 different images. My cache looks like the following, public class ImageCache { HashMap<String, SoftReference<Drawable>> myCache; .... .... public void putImage(String key, Drawable d) { myCache.put(key, new SoftReference<Drawable>(d)); } public Drawable getImage(String key) { ...
Pretty simple question. I know it would probably be a tiny optimization, but eventually you'll use enough if statements for it to matter. EDIT: Thank you to those of you who have provided answers. To those of you who feel a need to bash me, know that curiosity and a thirst for knowledge do not translate to stupidity. And many thanks t...
If I set this for cache control on my site: Header unset Pragma FileETag None Header unset ETag # 1 YEAR <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$"> Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Last-Modified </FilesMatch> # 2 HOURS <FilesMatch "\.(html|htm|xml|txt|x...
I have a file that contains about 200,000 long values that I want to read as fast as possible into a long[]. It's for an Android app; function calls are slow (so anything involving reading a long at a time with a "for" loop will be super slow) and I need loading to be fast. What can I use? Everything I look at seems to read only bytes fa...
Im trying to make a simple expo tween, it works, but its a bit jittery and FF seems to hang a bit. What can I do to improve it? var distance = (target - x) * dir; x += (distance / 5) * dir; if (dir == 1 && x >= target-1) { return; } if (dir == -1 && x <= target+1) { return; } ...
I'd like to optimize the following snippet using SSE instructions if possible: /* * the data structure */ typedef struct v3d v3d; struct v3d { double x; double y; double z; } tmp = { 1.0, 2.0, 3.0 }; /* * the part that should be "optimized" */ tmp.x /= 4.0; tmp.y /= 4.0; tmp.z /= 4.0; Is this possible at all? ...
If I want to fetch million rows in hibernate, how would it work? Will hibernate crash? How can I optimize that. ...
I read that the best way to store IP addresses in a database is to make an Unsigned Int(10) field. How do I convert the IP addresses using PHP? I've tried using $this->ip = long2ip($_SERVER['REMOTE_ADDR']); But this doesn't seem to work. I found the way to convert it back to an IP address using $this->ip = sprintf("%u", ip2long($resu...
Ok so I managed to solve a problem at work with regex, but the solution is a bit of a monster. The string to be validated must be: zero or more: A-Z a-z 0-9, spaces, or these symbols: . - = + ' , : ( ) / But, the first and/or last characters must not be a forward slash / This was my solution (used preg_match php function): "/^[a-z\...
I am working on an application that allows users to dynamically add questions to web forms. We use MySQL as the backend, and I am trying to find the fastest, most efficient way of storing the form data. Previously, we stored the data in a separate table for each form section. The columns were named according to a system that allowed u...
Hello! I was recently interested in how does Microsoft Visual C++ compiler makes and optimizes static variables. I have the following code: void no_static_initialization() { static int value = 3; } void static_initialization(int new_value) { static int value = new_value; } #include <cstdlib> int main() { no_static_initiali...
Hi All, I am using SUSE10 (64 bit)/AIX (5.1) and HP I64 (11.3) to compile my application. Just to give some background, my application has around 200KLOC (2Lacs) lines of code (without templates). It is purely C++ code. From measurements, I see that compile time ranges from 45 minutes(SUSE) to around 75 minutes(AIX). Question 1 : Is t...
I have a trigger in a table with a good number of columns (perhaps around 100) and quite a lot of updates (for some definition of "a lot of"). If any of some fields have changed, the trigger inserts some data in another table. For obvious reasons, I want this trigger to run as fast as possible. What's the best method to do the compariso...
Since i discovered the concept of non-blocking scripts i have become obsessed with loading all my external scripts this way. I have even hacked Joomla! templates(which i know is a bad practice) in order to load non-blocking scripts in the index.php file. Example code below. (function() { var script = document.createElement('script'...
I need to select a row from table that has more than 5 millions of rows. It is table of all IP ranges. Every row has columns upperbound and lowerbound. All are bigintegers, and the number is integer representation of IP address. The select is: select * from iptocity where lowerbound < 3529167967 and upperbound >= 3529167967 ...
I have a query I turned into a view that works OK. But the site_phrase sp table seems to be not using a column and goes through all the records in the table. Why is that? Here is the query: EXPLAIN SELECT `p`.`id` AS `id`, `p`.`text` AS `phrase`, `p`.`ignored` AS `igno...
Working on a legacy project that includes a fair amount of velocity. Not sure on what I can safely post on her (copyrights and all) but I'll try to be an clear and concise as I can. We have several templateX.vm files. They're not large, only about 200 lines or so long. They do not rely on outside resources. They do not use any macros. I...
I'm testing SSDs for use with MySql and am unable to see any performance benefits. This makes me feel like I must be doing something wrong. Here is the setup: Xeon 5520 2.26 Ghz Quad Core 12 GB Ram 300GB 15k in RAID 1 64GB SSD in RAID 1 For the test I moved the mysql directory on the SSD. I imported a table with 3 million rows. T...