instruction stringlengths 34 19.9k |
|---|
I am trying to find max value of an array, firstly i am shorting my array min to max after that i am using array[array.length-1] Is this logic efficient in large arrays?
public static int findMax(int[] array){
Arrays.sort(array);
int max = array[array.length-1];
return max;
}//end method
|
I am working on an HTTP Server in Delphi which simply sends back a custom XML dataset. I am not following any type of standard formatting, such as SOAP. I have the system working seamlessly, except one small flaw: When I have a very large dataset to send back to the client, it might take up to 2 minutes for all the dat... |
Some might argue this question is too general, but because keeping up seems especially relevant to programming, is anyone's experience that:
do employers expect you to stay current? what is the "industry standard" of expected time a programmer should spend keeping up-to-date?
is it generally acceptable that a progra... |
I mean, say you were writing professional grade software that would involve sensitive client information. (Take this in the context of me being an amateur programmer.)
Would you use hlib and hmac? Are they good enough to secure data? Or would you write something fancier by hand?
Edit: In context of those libraries cont... |
I'm attempting to design a single sign on system for use in a distributed architecture. Specifically, I must provide a way for a client website (that is, a website on a different domain/server/network) to allow users to register accounts on my central system.
So, when the user takes an action on a client website, and t... |
I've been writing a website in PHP. As the code becomes more complex, I keep finding problems that can be solved using the factory design pattern. For example: I've a got a class Page which has subclasses HTMLPage, XMLPage, etc. Depending on some input I need to return an object of either one of these classes. I use th... |
I'm new to OOP and design pattern.
I've a simple app that handles the generation of Tables, Columns (that belong to Table), Rows (that belong to Table and have Columns) and Values (that belong to Rows). Each of these object can have a collection of Property, which is in turn defined as an enum.
They are all interfaces:... |
I'm working on an application. I'm using a mixture of TDD and DDD. I'm working hard to separate the layers of my application and that is where my question comes in.
My solution is laid out as follows
Solution
MyApp.Domain (WinRT class library)
Entity (Folder)
Interfaces(Folder)
... |
I failed an interview question in C years ago about converting hex to decimal by not exploiting the ASCII table if (inputDigitByte > 9) hex = inputDigitByte - 'a'. The rise of Unicode has made this question pretty silly, but the point was that the interviewer valued raw execution speed above readability and error hand... |
I want to have fully cacheable pages in my websites, but one cannot do that if they contain user-specific data, like the userbar or things in the UI that can change depending on the permissions the user has.
So I was thinking whether it was possible to pull everything that is user-specific via ajax, and update the UI a... |
I got into an interesting internet argument about getter and setter methods and encapsulation. Someone said that all they should do is an assignment (setters) or a variable access (getters) to keep them "pure" and ensure encapsulation.
Am I right that this would completely defeat the purpose of having getters and sett... |
I'm drawing a flow diagram which should visualize the communication between 4 services I created.
Now I've got a question I'm not quite sure about. There are two ways the services could be started. Is it allowed to have multiple starting-points in a flow chart?
And: do I have to visualize error handling, like a service... |
Where does the term "front-end" come from? Is there a particular presentation/talk/job-posting which is regarded as the first use of the term? Is someone credited with coining the term?
The Merriam-Webster entry for "front-end" claims the first known use of the term was 1973 but it doesn't seem to provide details about... |
I am currently working on a WP8 application. My current design is to have each view bind against a specific view model directly.
Looking through the samples though, it seems that another way is to have all the view models accessed through the Main View Model and then have all the views to their view models through the ... |
What are the best methods of knowledge transfer?
What kinds of documentation should be expected?
What activities should take place before and after handover, both by the external party and ourselves?
|
Let's say I have a big corpus (for example in english or an arbitrary language), and I want to perform some semantic search on it. For example I have the query:
"Be careful: [art] armada of [sg] is coming to [do sg]!"
And the corpus contains the following sentence:
"Be careful: an armada of alien ships is coming to des... |
I'm doing a code-review on someone's code for class.
The class is about 800 lines long, contains a good dozen of functions but the description is like 1 line long.
I'm wondering, generally speaking, how long should the description of a class be? (in Java)?
|
I am a team lead with 5+ developers. I have a developer (let's call him A) who is a good programmer, who writes good clean, easy to understand code. However he is somewhat difficult to manage, and sometimes I wonder whether he is really under-performing or not.
Our company requires the developers to indicate the work ... |
We're evaluating a set of requirements for a customer who wants Liferay which mainly has AAA and Web CMS requirements, and allowing user to upload their own content. Also all inetgration is via web services.
However there is no need for other features such as actual "portlets", i18n, mashups, skins, themes, tagging, so... |
I have two classes Class A and Class B
In Class A, I have three methods that perform the save, delete and select operation based upon the object I pass them. In Class B I perform the logic operations, such as modification to the property of the object before being passed to the methods of Class A.
My problem is in Cla... |
I saw lot of code (for example some Android source code) where fields name start with a m while static fields start with s
Example (taken from Android View class source):
private SparseArray<Object> mKeyedTags;
private static int sNextAccessibilityViewId;
I was wondering what m and s stand for... maybe is m mutable an... |
My company has several versions of its core software in use by our customers at any one time. My job is to write bespoke Java software for the customers based on the version of core software they happen to be running.
I've created a common Java library that performs many of the tasks I regularly require in a normal pro... |
I'm an iOS dev, working for a small agency. I'm currently on a few smaller projects where I'm the only developer. We recently acquired a Jenkins server, but each project is left to fend for themselves as for how to use it.
I'd like to use it for making and distributing builds. My ideal would be:
Every commit is built ... |
Pushing new Sparkle releases of our internal apps is a pain. I have to make the build, make the release notes file, sign the .zip with the private key, and add a new entry to the appcast file tying everything together.
I'd love it if Jenkins could help: use the commit messages for the release notes, and automatically d... |
Most websites set max-age=31536000 (1 year) on the Cache-control headers of static assets such as logo images. Examples:
YouTube
Yahoo
Twitter
BBC
But there is a notable exception: Google's logo has max-age=691200 (8 days).
I've checked the headers on the Google logo in the past, and it definitely used to be 1 year. ... |
I'm new to Java and Eclipse. One of my most recent discoveries was how Eclipse comes shipped with its own java compiler (ejc) for doing incremental builds. Eclipse seems to by default output incrementally built class files to the projRoot/bin folder.
I've noticed too that many projects come with ant files to build the ... |
So we have a team with 2 developers one manager. The dev server sits in a home office and the live server sits in a rack somewhere handled by the larger part of my company. We have freedom to do as we please but I want to incorporate Kiln DSVC and FogBugz for us with some standard procedures to make sense of our decisi... |
I have read these related questions:
I'm a Subversion geek, why should I consider or not consider Mercurial or Git or any other DVCS?
git for personal (one-man) projects. Overkill?
...and I understand why git is useful. What I don't understand is why tools like git-svn that allow git to integrate with svn are useful... |
I just developed my first non-trivial android app. It was a complete nightmare. I came up with an idea, build the app, changed my idea, and implemented a lot of input from others on new features. All in all my app took 10 times longer than I think that it should have, it is almost impossible to look the source code and... |
I work in IT at a university and I'm working with about 5 different departments to develop a new process for students to apply to a specific school within the university (not the university as a whole). We're using a web-based college application vendor and adding the applicant questions for the school itself to the ... |
This may be a very simple question. I'm curious how blocking calls are implemented. Specifically, how do they block? Is this just thread.sleep?
|
In my project, I have a collection of classes. These classes for the most part contain data which is updated infrequently or not at all - that is they don't really do much - their purpose is to be passed around consumer objects that do do things, seperating data from functionality.
I would like to continue this model, ... |
I've spent the past few years working on iOS apps, and I'm now giving some serious consideration to creating an Android port of one of my apps.
I'm sure that complaints about fragmentation are a frustrating cliche to experienced Android programmers, but as an iOS programmer, I'm quite honestly overwhelmed by the number... |
I'm curious if anyone here has any idea how the images were generated as shown in this response: Which hashing algorithm is best for uniqueness and speed?
Ian posted a very well-received response but I can't seem to understand how he went about making the images. I hate to make a new question dedicated to this, but I c... |
I'm attempting to create a dashboard so that people not intimately involved with the project can get an indication of project's health. I'm struggling with determining what to put on said dashboard. I think it needs to be brief to be useful, yet complete. The project I'm working on depends on both 3rd party contractors... |
I watched a bunch of lectures on Clojure and functional programming by Rich Hickey as well as some of the SICP lectures, and I am sold on many concepts of functional programming. I incorporated some of them into my C# code at a previous job, and luckily it was easy to write C# code in a more functional style.
At my new... |
My employer has a need for a web-based application to manage and share data within the department, with approximately 50-75 possible users. I feel I have the ability to write it for them. I would likely use Python/Django with a MySQL database, so it would be open source. However, I'm the only IT person in my departm... |
I am faced with some legacy shell scripts that run batch data processing jobs in Oracle using SQL+. For the most part, the data tier does not have to communicate back to the script with retrieved data to be passed for shell-level processing but in a few cases it does.
The problem is, SQL+ is really meant to be an en... |
There's a bunch of languages that automatically return the last value in a function (mostly functional) like Ruby, Haskell, Lisp, etc.
Does this feature (or what do you call it) affect the performance of these languages?
|
Our team is mantaining and developing a .NET web service written in C#. We have stress tested the web service's farm and we have evidence that the actual architecture doesn't scale well, as the number of requests are constantly increasing.
We analyzed Martin Fowler's conclusion in this article, and our team feels that ... |
We are a group of people who are about to start a software cooperative, which means all of us (and other future workers) will be the owners of the 'company' rather than having bosses and employees. We do this from ideological reasons but also because we believe this allows many advantages - power of democracy (see SE..... |
This is actually a solved problem, but I want to understand why my original method didn't work (hoping someone with more knowledge can explain).
(Keep in mind, I've not very experienced in 3d programming, having only played with the very basic for a little bit...nor do I have a lot of mathematical experience in this ar... |
I want to use the ICSOpenVpn project source code in my commercial application.
If we see the ICSOpenVpn project, it states that its license is New BSD but the libopenvpn.so library it uses is under GNU GPLv2 license.
As per FAQ for version 2 of GNU GPL "If a library is released under the GPL (not the LGPL), does that m... |
Is there any specific language which is designed for mechatronics programming? I know about LabView, which is a data flow language, but not sure about its main platform.
Could you recommend to me, some languages apart from c/c++? Any language which is used in the topic of mechatronics( robotics, sensor programming, etc... |
I'm thinking specifically in Rails here, but I suspect this is a wider question.
In a Rails web application I'm using data from the session in models in order that the models know who is logged in. I use this in a method which filters out some data from the database depending on a very simple permissions system.
The th... |
I've been reading articles on Functional programming everyday and been trying to apply some practices as much as possible. But I don't understand what is unique in currying or partial application.
Take this Groovy code as an example:
def mul = { a, b -> a * b }
def tripler1 = mul.curry(3)
def tripler2 = { mul(3, it) }
... |
To be as restful as possible, is a user login better designed using a GET or a POST on a REST webservice? And why?
|
I have a two classes:
------------ ---------------
X Y
------------ ---------------
relation
------------ ------------------ ---------------
A() C()
B... |
There are many academic/industrial researchs about various development methods (Scrum, XP, waterfall, ect.), telling us how to do it right and stuff. But I never saw something that suggest how to choose a method, what will be better for a given project.
I know that what the developers are used to is an very important a... |
Passwords shouldn't be stored in plain text for obvious security reasons: you have to store hashes, and you should also generate the hash carefully to avoid rainbow table attacks.
However, usually you have the requirement to store the last n passwords and to enforce minimal complexity and minimal change between the dif... |
I've spend a few hours playing around with Maven + reading some stuff on the apache official site and also a few random googled articles. By this I mean that I really tried to find the answers myself - both by reading and by doing things on my own. Also maybe worth to mention that I installed the m2e plugin so most of ... |
I've seen these 2 guidelines in coding c# standard and I’m not sure the what the 2nd one means.
With the exception of zero and one, never hard-code a numeric value; always declare a constant instead.
Use the const directive only on natural constants such as the number of days of the week.
What is the definition of a ... |
Where SQL statements are executed from a program, what is the best practice to store the statement text?
Most often it is in a read only string, in the source file it is executed in.
I think a better approach would be to have a separate text file containing all SQL statements, that are then read in to a dictionary obje... |
I've been debating asking this question for some time. Based several of the comments I read in this question I decided I had to ask.
This feels like I'm stating the obvious, but I believe that regular reading (of books, blogs, StackOverflow, whatever) and/or practice are required just to stay current (let alone excel)... |
I don't have any code for this since I don't know how I am meant to do this.
I have a car and I am able to move it around on a flat plane and I have that working correctly. However, I want it to also be able to move up hills accurately. So that when I drive up a hill the front wheels start going up first and then the b... |
I understand that the "mm" suffix [in various GTK-associated C++ binding libraries] means "minus minus," but where exactly does it come from?
I understand that there is a programming language called "C--," but if there were bindings (and I'm pretty sure I've seen some), they would be suffixed "--".
TL;DR: Is there some... |
We have a Visual SourceSafe installation that 4 developers collaborate on. Inside that there are 30 or so independent projects in different top level folders.
Is it necessary for us to create a new TFS "Project" for each of those 30 items, or can we simply place them in the same overarching project folder... possibly ... |
I'm working on a project where I need heavy numerical calculations to be real-time visualized with something flexible like D3.js. Are there frameworks out there that would let me painlessly achieve this? Or do I need to use some sort of "glue" code written in, say, Python?
|
I am importing a website into TFS that is stored in SourceSafe as
$/MyApp 1.0
$/MyApp 2.0
$/MyApp 3.0
$/MyApp 3.5
Should I import this as several distinct projects (MyApp1.0 ... ) or as one project called "MyApp"?
|
I'm reading part 17.2.1 of Java language specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.2.1
I won't copy a text, it's too long, but I would like to know, why for third step of sequence they're saying that
If thread t was removed from m's wait set in step 2 due to an interrupt
Threa... |
In the context of C#, .NET 4/4.5 used for an application running on a web-server, what is the relationship between "Task Parallel Library" and "Task-based Asynchronous Pattern"?
I understand one is a library and the other is a pattern. But to dig deeper, is it like "The library is used by the pattern to enforce good p... |
I am developing a tool that discovers network services enabled on host and writes short summary on them like this:
init,1
└── login,1560 --
└── bash,1629
└── nc,12137 -lup 50505
{
:net => [
[0] "*:50505 IPv4 UDP "
],
:fds => [
[0] "/root (cwd)",
[1] "/",
[2] "/bi... |
I have seen a lot of advice that it is better to do Type object; than
Type* object = new Type();
in C++ whenever possible—i.e., minimize your use of new. I understand the rational behind this and appreciate it.
But according to my understanding, to practice dependency inversion requires pointers, e.g.:
Type* object = ... |
I've been thinking about solar collectors where several independent mirrors to focus the light on a solar collector, similar to the following design from Energy Innovations.
Because there will be flaws in the assembly of this solar array, I am proceeding with the following assumptions (or lack thereof):
The software ... |
I'm making an application (wxPython) to process some data from Excel documents. I want the user to be able to undo and redo actions, even gigantic actions like processing the contents of 10 000 cells simultaneously. I Googled the topic, and all the solutions I could find involves a lot of black magic or is overly compl... |
Excuse me if I'm not descriptive enough, as I do not have much of a background when it comes to these things:
How would I go about coding a primitive trading strategy and link it to some sort of artificial trading environment? Where do I start, and what are some other essential questions I should be asking?
I am intere... |
I have a rest service that is essentially a proxy to a variety of other services. So if I call
GET /users/{id}
It will get their user profile, as well as order history, and contact info, etc... all from various services, and aggregates them into one nice object. My problem is that each call to a different service has t... |
I recently came across a website that generates a random adjective, surrounded by a prefix and suffix entered by the user. For example, if the user enters "123" for prefix, and "789" for suffix, it might generate "123Productive789". I've been screwing around with it, and I thought I might try something out. I entered t... |
I have been doing some investigation regarding ASP.NET Web API. I have enjoyed using the WCF REST template to create new RESTful web services, and Web API seems to be a cleaner iteration on that.
However, I like the flexibility of WCF in allowing http, TCP, MSMQ. This aspect seems to facilitate a distributed and scalab... |
I really like google golang but could some one explain what the rationale is for the implementors having left out a basic data structure such as sets from the standard library?
|
Basically I want to develop a Address lookup(part of my project) using C# (and I can use SQL if necessary). I have a very large text file which have all the UK address and postcodes. Addresses needs to be looked up from this text file.
For example, as soon as a user type in the first letter of the postcode it should... |
What's the difference between a design pattern and a strategy?
Is the monolith actually an anti-pattern?
|
I've just started creating my very first little Java Swing app. When the program opens, it brings up a single, simple window with a label and a couple buttons. Clicking one of those buttons is supposed to wipe out the welcome screen and replace it with a totally different panel.
I'm not sure what the best way to create... |
While doing my pre-research for this question, I found that there isn't much well-organized information about Java Swing best practices out there on the Internet. So I figure I'll give Stack Exchange a shot at building that One Great List.
What are the best practices of Java Swing development? What have you found to wo... |
Context: I'm an enterprise developer in an all-MS shop.
Can anyone recommend a good way of objectively measuring maintainability of a piece of code or an application?
Why maintainability: I'm tired of "quality" metrics in my group revolving only around number of bugs and code coverage. Both metrics are easy to game, es... |
We have all seen integer, floating point, string, and the occasional decimal type. What are some of the most strange or unique or useful types you have encountered, useful or not?
|
I don't plan on writing a compiler in the near future; still, I'm quite interested with compiler technologies, and how this stuff could be made better.
Starting with compiled languages, most compilers have two error levels: warnings and errors, the first being most of the time non-fatal stuff you should fix, and errors... |
What do recruiters expect you to answer when they ask, "Where do you see yourself in 5 years?" Something like:
I want to improve my technical skills ... blah-blah-blah ... architect?
Is it just to check your ambitions and if you are not going to leave in a month?
|
What is a requirement traceability matrix?
What are the differences between different requirement types and what are the advantages/disadvantages of using these matrices?
|
I have seen many times statements like- "Please make this feature a first class citizen in so and so language/platform". For example, it is said about enums in C#/.net. So, when is a feature considered a "First class citizen" in a programming language/platform?
|
In my current job, there are no coding guidelines. Everyone pretty much codes the way he wants. Which is fine, since the company is small.
However, one new guy recently proposed to always use Hungarian Notation. Until now, some of us used some sort of Hungarian Notation, some of us didn't. You know, it's an engineering... |
I am a long time experienced Windows Forms developer, but now it's time to move to WPF because a new WPF project is comming soon to me and I have only a short lead time to prepare myself to learn WPF.
What is the best way for a experienced Winforms devleoper?
Can you give me some hints and recommendations to learn WPF ... |
I am highly IDE dependent developer (NetBeans and Eclipse as I am a JAVA dev). I can code properly if I have an IDE. I can rely a lot on that for development, debugging and deployment.
But without IDE I can do nothing. Can code a simple hello world program or some simple UI arranging but I need an IDE to do complex thi... |
I want to start using Databases in my C# Applications, unfortunately there appears to be lots of different ways of going about this.
Which is the 'best' way from a learning perspective? (IE: What is likely to be used in a business setup)?
If I want to download mySQL/Postgres and connect to that from C#, is that ok?
|
UPDATE: I've gotten a lot of feedback, but no info on what percent of time people spend on docs. To keep it simple, say the docs are for developers and peer reviewed; meaning the peer understands how to do it, and the comments are more for the what is being done, not how to do it from scratch; which in my case is the r... |
I worked on a project where I did everything from
talking about how the software should be and how they are doing the stuff at the moment
with the client (end users)
...
choosing technology to be used
typing code
installing the application on the web server
previously I was writing in my cv that I worked as a soft... |
I'm working on a personal project (Windows desktop application) and started thinking about trying to make some money from the application (not the source). I'm not expecting to make a billion dollars but who knows right? The easiest way I see is give it out for free and allow people to donate but I'm not sure how wel... |
In preparation for a new release of software our company maintains, I've been working on what I believe to be a really good approach to solving our scalability issues. I have every intention of putting together a proof of concept to validate the design on paper will actually do what I want. When I briefed it to the t... |
I'm wondering how the "evented-io" in node.js any different from the windows async IO model?
Is the callback from node.js executed on a thread, if not, where is it run?
I don't mean to question the productivity or awesomeness of node, but specifically to understand if the architectural design differs from what is commo... |
I have a build computer where Visual Studio not installed, only MSbuild which can build VS2008 projcets without having any Visual Studio installed.
I wonder whether it is possible to use MSbuild with VC++ 6.0 project files, although I am thinking this could not be possible. In the past I have used it with a VS2008 sol... |
I'm currently tasked with writing a wcf service that, for now, will only used inside the company network, the problem is that I'm not sure how I should handle the operations it exposes.
The software that will use this service will have to modify similar tables in different ways. For example a table, that has columns a,... |
Obviously, if management buy into spending time with code reviews, then everyone has to do it.
But there are always those guys (or gals) who resist with every ounce of their being.
How do you effectively manage dealing with this scenario when dealing with it as the peer reviewer?
|
I love prototyping as a fast effective way to put a UI in front of a user.
Many times though, management get their beaks in the way, and the prototype is dragged kicking and screaming into main stream development.
How do you manage management into not doing this?
|
I've always been intrigued by pair programming, but in 12 years development I've never worked in a place they have employed this practice, so I have always been sceptical as to how people see it.
I wonder whether this is because of money/time (Pointy haired boss spotting two people at one computer working on the same c... |
In the last few days, I've heard the term "fast follower" mentioned several times. It's used in the context of an unresolved bug/issue that (supposedly) will be quickly fixed and implemented.
Is this some new corporate jargon? I'm aware of a fast follower strategy, or second mover strategy (as described in this wikiped... |
I have an application with multiple threads that may be run on different hardware. To assist with tuning on different hardware I would like to create a "profiler" that can automatically run a fixed amount of data through using different numbers of threads.
I've thought of several ways of implementing this:
It's a test... |
Design patterns help developers to improve the quality of their design, but only GOF patterns are very known, and paterns like GRASP that gives a good concepts like Information Expert,low coupling and high cohesion are less known.
I think that GRASP patterns could be a good introduction to patterns for students and dev... |
For being a better programmer there are ways to get started like:
Get some open source project and start contributing to it.
Solve some Project Euler or Yodacode Excercise.
But if someone wants to move in the direction of Project/Product Management then in what direction he/she should move and what available options ... |
I recently considered contributing to an open-core software (a product which core is released with an open-source license by the company that developed it, but it retained a paid license for more advanced functionality). But some questions occurred about the nature of working with an open-core project, and I would like... |
I've got a few choices to make as I develop some business websites that will run for the next two to three years.
Currently I run ASP.NET 3.5 with Visual Studio 2008. I do my development rather crudely in WebForms because that's what I learned and am most productive with. I don't use Membership or any other frameworks ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.