Home » Programming Languages » Page 1
Efficient way to sort large set of numbers
Programming Languages

I have to sort a set of 100000 integers as a part of a programming Q. The time limit is pretty restrictive, so I have to use the most time-efficient approach possible.

My current code -

#include<cstdio>
#include<algorithm>
using namespace std;

int main() {
    int n,d[100000],i;
    for(i=0;i<n;++i) {
                     scanf("%d",&d[i]);
    }
   

Can profiling be used to verify if optimization was successful?
Programming Languages

I know that profiling is useful to identify bottlenecks and determining what parts of the code require how much time to execute. The latter isn't always very easy to track in the midst of other paths being executed, so once I decide what I want to optimize it might be problematic to see the improvement in numbers. This is especially true in desktop apps which run constantly and it is difficult


JEE MVC, controller calls the interface instead of the interface implementation
Programming Languages

I'm following this tutorial: http://wiki4.caucho.com/Building_a_simple_listing_in_JSP It creates a basic web application in Eclipse using the MVC pattern with Resin as the web container. Here's the part I don't understand.

For the model, it creates a POJO, Interface and Interface Implementation. The


Webdesign MVC - going in the right direction?
Programming Languages

I am trying to learn webdesign using the MVC design pattern. Right now, I am stuck at a point where my code gets more complex, and I am unsure about the structure and where to put which code parts.

I started with an index.php file as my controller, which right now does not much more than loading the Slim framework to render the different views

$app->get('/', function(

Dependency Inversion Principle and Hollywood analogy
Programming Languages

Often DIP is known as the Hollywood principle: "Don't call us, we'll call you.".

But doesn't always higher level module calls lower level module, whether there is dependency inversion or not?

Then why is DIP called the Hollywood principle?

Am I missing something? Thanks!


Should I be using XML to store configuration values in a database?
Programming Languages

There are a couple of answers on SE comparing single-row table vs. name-value-pair table used for config settings, but I haven't seen anyone arguing for using XML (or JSON) as a name-value pair model.

Option A

UserID     AppID     ParamID    Value
1          1         10         5.40
1          1         11         John Smith
2          1         10         4.40
2     

When should you use JNI with native code and when should you just let the JIT handle things?
Programming Languages

If I'm starting a new JVM project and need a particular section of code to be really fast, should I write it in a naively compiled language or just let the JIT handle things?

What is even the point of the JNI if the Does this seem like a good rough design for a minecraft server wrapper program?

Programming Languages

I am doing some research on how to write a Minecraft server wrapper program. Right now I run a minecraft server with the minecraft_server.jar file from Minecraft.net. When I want to execute complex commands I usually draft them in a text editor and copy and paste them into my Mac's terminal where the server is running. This more tedious than I would like it to be, so I have decided to see if it


How to find the kth minimum element in an array [on hold]
Programming Languages

I am looking for an efficient algorithm to find the k'th minimum element in an unsorted array of n elements, where 1 <= k <= n. The obvious thing is to sort the array first, then pick the k'th element, which will result in a running time of O(n * log(n)) But I guess it can be done in a more efficient way, since sorting the array seems to do "too much". For examp


DAO design for writing big XML file on database [on hold]
Programming Languages

I am currently working on JavaEE application (Spring, Hibernate). I have to put a big XML file (more than 1 gigabyte) on a relational database (Postgres).

The application does not use batch processing. I've done some searching but I did not find any solution for the design of the DAO layer: if I use only one transaction, the server will not response to any request until it finishes the


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .