_id
stringlengths
1
6
title
stringlengths
15
150
text
stringlengths
30
21.8k
85405
Apply for supercomputing time
For testing and running some very intensive C++ number crunching applications, we need to apply for supercomputing time. I would like to get feedback and opinions from you; which calls do you follow, which supercomputing centers do you apply to, etc. As of now I only know DEISA in Europe.
125164
Resumes: Open-Source Projects, Reinventing the Wheel?
When writing a resume, should I be concerned that certain open source projects I've created might be a hindrance to me because they would be perceived as reinventing the wheel? I've created a few open source libraries that might be perceived as such by hiring managers, because there are much more established tools that perform similar tasks. I have my reasons for wanting to start from scratch, but they're virtually impossible to explain on a resume and might be mildly controversial among techies. Basically, these libraries are written in D, and there was no D library that did what I wanted. I felt that creating bindings to libraries in another language instead of starting from scratch would constrain my ability to take advantage of D-specific features too much and make the libraries too brittle and hard to get up and running. On the other hand, these projects are related to the domain I'm applying for and would be a good way to show my domain knowledge. Should I put them on my resume or leave them off?
45855
Is it safe to display information about old passwords on login failure?
When I changed my Facebook password yesterday, by mistake I entered the old one and got this: ![Screen capture of facebook login](http://i.stack.imgur.com/T1M59.png) Am I missing something here or this is a big potencial risk for users. In my opinion this is a problem BECAUSE it is FaceBook and is used by, well, everyone and the latest statistics show that 76.3% of the users are idiots [source:me], that is more that 3/4!! All kidding aside: * Isn't this useful information for an attacker? * It reveals private information about the user! * It could help the attacker gain access to another site in which the user used the same password * Granted, you should't use use the same password twice (but remember: 76.3%!!!) * Doesn't this simply increase the surface area for attackers? * It increases the chances of getting useful information at least. * In a site like Facebook 1st choice for hackers and (bad) people interested in valued personal information shouldn't anything increasing the chance of a vulnerability be removed? Am I missing something? Am I being paranoid? Will 76.3% of the accounts will be hacked after this post?
45856
How to tell your boss that his programming style is really bad?
I'm a student and in my spare time I'm working for a big enterprise as Java developer. The job is good, but the problem is, my boss writes very strange code. I don't want to complain, but some issues are in my opinion really strange. For example: * he doesn't know any booleans. All boolean conditions are Strings called "YesOrNo" and then in the condition he uses if (YesOrNo == "Yes") * there are a lot of very strange characters in method names and variables like é õ ô or è * all loops are infinite loops in the style of for(;;). Then at the end of the loop the condition is tested and if the conditions is fulfilled break; is called. I don't know if I should tell him that I think this isn't a good practice, since he is my boss and decides how and what to do. On the other hand some of his examples are really very weird. Any hints how to cope with? And is this only me who thinks that's bad style?
122191
What benefits are there to native JavaScript development?
Given how much simpler jQuery development is, when compared to native JavaScript, what makes people forgo libraries like jQuery altogether? Is this because jQuery has limitations or it is slow? I mean, if jQuery is so easy compared to native javascript, what reasons do people have to still use pure javascript?
122190
With PHP frameworks, why is the "route" concept used?
The reason I ask this is because isn't a PHP script a route? For example, if you have an article.php then your route is simply http://mysite.com/article.php. Why further abstract away the concept of a route when it already exists as a simple file?
122197
Why is scanf called scanf? (Same for printf.)
I am just curious why in the C programming language the function to read formatted input was called "scanf" as opposed to "readf". I assume it is derived from an earlier language, so in that case why was it named that way in the earlier language? (Recurse.) Also, why "printf" rather than "writef"? In languages other than C, why "print" or "write" rather than "display"?
202972
what's a good approach to working with multiple databases?
I'm working on a project that has its own database call it InternalDb, but also it queries two other databases, call them ExternalDb1 and ExternalDb2. Both ExternalDb1 and ExternalDb2 are actually required by a few other projects. I'm wondering what the best approach for dealing with this is? Currently, I've just created a project for each of these external databases and then generated Edmx and entities using the entity-framework approach. My thought was that I could then include these projects in any of my solutions that require access to these databases. Also, I don't have any separate business layers. I just have a solution like below: Project.Domain ExternalDb1Project.Domain ExternalDb2Project.Domain Project.Web So my Domain projects contain the data access as well as the POCOs generated by Entity Framework and any business logic. But I'm not sure if this is a good approach. For example if I want to do Validation in my Project.Domain on the entities in the InternalDb, it's fine. But if I want to do Validation for entities from either of the ExternalDbs, then I wonder where it should go? To be more specific, I retrieve Employees from ExternalDb1Project.Domain. However, I want to make sure they are Active. Where should this Validation go? How to architect a project like this at a high level? Also, I want to make sure that I use IoC for my data contexts so I can create Fakes when writing tests. I wonder where the interfaces for these various data contexts would reside?
202975
Minimizing data sent over a webservice call on expensive connection
I am working on a system that has many remote laptops all connected to the internet through cellular data connections. The application will synchronize periodically to a central database. The problem is, due to factors outside our control, the cost to move data across the cellular networks are spectacularly expensive. Currently the we are sending a compressed XML file across the wire where it is being processed and various things are done with (mainly stuffing it into a database). My first couple of thoughts were to convert that XML doc to json, just prior to transmission and convert back to XML just after receipt on the other end, and get some extra compression for free without changing much. Another thought was to test various other compression algorithms to determine the smallest one possible. Although, I am not entirely sure how much difference json vs xml would make once it is compressed. I thought that their must be resources available that address this problem from an information theory perspective. Does anyone know of any such resources or suggestions on what direction to go in. This developed on the MS .net stack on windows for reference.
133778
How can I extract words from a sentence and determine what part of speech each is?
I want to write something that takes a sentence and identifies each word it contains and defines what part of speech each word is. For example > Hello World, I am a sentence would return this verb noun, pronoun verb adjective noun Ideally, I'd like to eventually take it one step further and take a sentence and programmatically have it understand what it is trying to interpret and maybe do something about it. So my question is, has someone heard of something like this?
218364
Which data structure for representing possible navigations between a game's screens?
I am trying to find an appropriate data structure for representing available navigations between a game's screens. * Using a _linked list_ , a node can only have one node after it : inappropriate. * Using a _tree_ seems up to the job as nodes can have many children nodes but it's inconsistent in the sense that a supposedly children item _Options_ can have a parent _Title_ as a children. Also how am I supposed to represent the infinite sequence of the case _Title -> Race -> Title -> Race ..._ without endlessly repeating it in my tree ? Still, this is the best structure I found to accomplish the job. Here is an example of the possible sequences : 1. Title * Options * Race 2. Options * Title * Race 3. Race * Options * Title Do you know whether a _tree_ is the way to go or if there's a better structure for this job ? * * * **Edit:** There is a great library for creating graphs for C#/WPF : http://graphsharp.codeplex.com/ It uses http://quickgraph.codeplex.com/ internally. Here's a small example : ![enter image description here](http://i.stack.imgur.com/jsYew.png) Code-behind: using System.Collections.Generic; using System.Windows; using GraphSharp.Controls; using QuickGraph; namespace WpfApplication15graph { internal class ScreenVertex { public string Hello { get; set; } } internal class ScreenEdge : Edge<ScreenVertex> { public ScreenEdge(ScreenVertex source, ScreenVertex target) : base(source, target) { } } internal class ScreenLayout : GraphLayout<ScreenVertex, ScreenEdge, ScreenGraph> { } internal class ScreenGraph : BidirectionalGraph<ScreenVertex, ScreenEdge> { } public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { // build graph var screenGraph = new ScreenGraph(); var screenVertex1 = new ScreenVertex {Hello = "1"}; var screenVertex2 = new ScreenVertex {Hello = "2"}; var screenVertex3 = new ScreenVertex {Hello = "3"}; screenGraph.AddVertex(screenVertex1); screenGraph.AddVertex(screenVertex2); screenGraph.AddVertex(screenVertex3); screenGraph.AddEdge(new ScreenEdge(screenVertex1, screenVertex2)); screenGraph.AddEdge(new ScreenEdge(screenVertex2, screenVertex1)); screenGraph.AddEdge(new ScreenEdge(screenVertex1, screenVertex3)); screenGraph.AddEdge(new ScreenEdge(screenVertex3, screenVertex1)); screenGraph.AddEdge(new ScreenEdge(screenVertex3, screenVertex2)); ScreenLayout.Graph = screenGraph; // get connections for a particular vertex IEnumerable<ScreenEdge> inEdges = screenGraph.InEdges(screenVertex3); IEnumerable<ScreenEdge> outEdges = screenGraph.OutEdges(screenVertex3); } } } XAML : <Window x:Class="WpfApplication15graph.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions" xmlns:controls1="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls" xmlns:wpfApplication15Graph="clr-namespace:WpfApplication15graph" Title="MainWindow" Width="525" Height="350"> <Window.Resources> <DataTemplate x:Key="SvTemplate" DataType="wpfApplication15Graph:ScreenVertex"> <Grid> <TextBlock Text="{Binding Hello}" /> </Grid> </DataTemplate> <Style TargetType="controls1:VertexControl"> <Style.Setters> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="controls1:VertexControl"> <Border CornerRadius="5" Width="50" Height="50" Background="LightBlue"> <ContentPresenter Content="{TemplateBinding Vertex}" ContentTemplate="{DynamicResource SvTemplate}" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style.Setters> </Style> </Window.Resources> <Grid> <controls:ZoomControl> <wpfApplication15Graph:ScreenLayout x:Name="ScreenLayout" HighlightAlgorithmType="Simple" LayoutAlgorithmType="Circular" OverlapRemovalAlgorithmType="FSA" /> </controls:ZoomControl> </Grid> </Window>
167744
How can I get better at explaining complex software processes to developers?
I'm really struggling with my software specs. I am not a professional programmer but enjoy doing it for fun and made some software that I want to sell later but I'm not happy with the code quality. So I wanted to hire a real developer to rewrite my software in a more professional way so it will be maintainable by other developers in the future. I read and found some sample specs and made my own by applying their structure to my document and wanted to get my developer friend to read it and give me advice. After an hour and a half he understood exactly what I was trying to do and how I did it(my algorithms,stack,etc.). **How can I get better at explaining things to developers?** I add many details and explanations for everything(including working code) but I'm unsure the best way I can learn to pass detailed domain knowledge(my software applies big data, machine learning, graph theory to finance). My end goal is to get them to understand as much as possible from the document and then ask anything they do not understand, but right now it seems they need to extract alot of information from me. How can I get better at communicating domain knowledge to developers?
203372
RESTful applications logic and cross resource operations
I have an RESTful api that allows my users to receive enquiries about their business e.g. 'I would like to book service x on date y. Is this available?'. The api saves this information as a resource to the following URI users/{userId}/enquiries/{enquiryId} The information shown when this resource is retrieved are the standard sort of things you'd expect from an enquiry - email, first_name, last_name, address, message The api also allows customers to be created for a user. The customer has a login and password and also a profile. The following URIs expose these two resources PUT users/{userId}/customers/{customerId} PUT users/{userId}/customers/{customerId}/profile The problem I am having is that I would like to have the ability to allow users to create a customer from an enquiry. For example, the user is able to offer their service on the date requested and will then want to setup a customer with login details etc to allow them to manage the rest of the process. The obvious answer would be to use a URI like users/{userId}/enquiries/{enquiryId}/convert-to-client The problem with this is is that it somewhat goes against a lot of what I've been reading about how to implement REST (specifically from the book Restful Web Services which suggests that URIs should point to resources not operations on resources). The other option would be to get the client application (i.e. the code that calls the api) to handle some of this application logic. This doesn't quite feel right to me. I have implemented in my design that the client app is fairly dumb. It knows just enough to display the results from the API, and does not contain any application logic. Would be great to hear what others views are on the best way of setting this up Am I wrong to have no application logic in the client app? How would I perform this operation purely in the REST api?
203371
Is sticking to one language on a particular project a good practice?
I'm developing a pipeline for processing text that will go into production. The question I keep asking myself is: should I stick to one language for the project when I'm looking for a tool to do a particular task (e.g. NLTK, PDFMiner, CLD, CRFsuite, etc.)? Or is it OK to mix and match languages on the project? So I pick the best tool regardless of what language it's written in (e.g. OpenNLP, ParsCit, poppler, CFR++, etc.) and warp (wrap) my code around it? Note, I am _not_ asking about should a developer stick to just one language for their career.
15895
WPF - What are the implications of the current rumours
My personal experience has always been with web applications and lots of "back-end stuff" but recently I've been poking around for some personal projects to widen my knowledge. An obvious thing to look at as I'm in the .net world is WPF but now I read this: WPF has no product manager And from the same guy's blog (he is a former Silverlight Product Manager): > WPF has no investment, it’s kept together by a skeleton crew and its > evangelism / community efforts have little to no funding attached to it. > It’s dead, the question now is how is the corpse going to be buried and no > amount of cheer leading will change that outcome in the near future. Although it won't change my short term plans - should this affect the amount of effort I put into learning WPF? What are my alternatives to look at if I want some up-to-date winapp gui knowledge?
15896
When do we need assembly language?
In what kind of situations, assembly language will be the only solution?
15897
shortening url to cms
Hi We have a CMS application that lets people create websites under our domain. The system was built a few years ago and it used a method that transfers parameters such as website id, folder code and more using the url. this method created a giant url for every item in the website For example: My domain is www.domain.com A users website on my domain is www.domain.com/user and every time that a user enters his website he gets a link like this www.domain.com/page.aspx?code=blablasdsdsdsdsds&folder=blablablablablabla and more. We are trying to reduce the string size in the url. What are our options? can we show the user one url like a virtual one and still work the same with the old url? We are trying to locate a solution that wont make us rewrite our entire application. the application is built in c# and the web server is iis 6. Thanks
238408
How to use data shaped by the UI from the ViewModel while keeping concerns separated?
I'm coming from a winforms background and trying to get ahold of MVVM and XAML. Right now I'm wondering how I can take advantage from a data-shaping control (either native or provided by a third party) while maintaining separation of concerns intact. An example: I have a typical third party grid that comes with data grouping, sorting and filtering functionalities. I want the end user to be able to use these features so that he can get a custom set of data on which he can perform actions. These actions are exposed by the view model. Of course it knows about the record collection but it has absolutely no clue about how it is currently displayed in the UI. Given that, how can the view model know on which data actions should be performed, **without knowing about the control in which it is displayed**? Right now the only way I can think of is exposing an additional property in the ViewModel (something like `CurrentUIData`) and handling every single data- shaping events within the View so that the property is always representative of the UI state. This, however, feels kind of wrong to me. Is this how I should proceed, or am I missing something here?
123570
Learning C for C++ programmers
That's right, I learned to program in C++, and of course know the common set of features of both languages, so I can program in C. But I'd really like to read tutorials or books that teach you C, and _the C way_ of programming, from a C++ programmer's perspective.
37498
How to deal with a 'public' work environment?
In the last 6 months, I have changed desks at my office 4 times. I don't mind, as it's due to expansion of the company and acquiring new office space and getting everybody settled. However, I truly miss the semi-private office I sat in 2 desks ago. I am now sitting in a large room with a number of other people. My problem with this isn't with my co-workers; everybody here is great. My problem is that based on the configuration of the room, no matter which desk I sit in, my monitors WILL be facing an open window. This causes a glare on my monitors, and it drives me crazy. I prefer a dark IDE theme as I find it easier on the eyes, however this just makes the glare that much worse. How should programmers cope with public office settings? Secondly, how should I cope with my specific problem? Should I give in and adopt a light IDE theme that will reduce the visibility of the glare but increase eye strain, or should I stick to my guns and find another solution?
37495
How do you measure the value of your software?
One of the principles of agile is that you should measure working software: > Working software is the primary measure of progress - 12 principles of Agile The thing is, while I can measure my software in terms of stories done, bugs squashed or the volume of defect reports decreasing, I'm stuck on how to measure the value of my software. If I use Mike Cohn as an example and his helping SalesForce.com deliver 500% more value to it's customers compared to the previous year* - how do I measure that increase? How do I measure where I am right now? Other metrics he uses are the number of features and the number of features per developer. This is something I could work out if my backlog was in good order and the stories were cut up by 'feature', but we're just starting out with Agile, so I need some way of working out what the value is we deliver now, then use a similar metric in say, six months, to see if we've increased our output. I've heard about measuring value of software by an uptick in revenue, or an increase in customer satisfaction (how would you measure that though?) but those increases could be attributed to anything in the company (sales, accounting, support) and not directly to the work my department is doing. So, how do you guys measure the value of your software and how did you start? * Succeeding With Agile \- Mike Cohn
18912
Book recommendations for a high school drop out
If one of your friend dropped of high-school and wanted to sharpen his programming & software engineering skills which book would you advise him to read & study to make up for the knowledge he could have gained from a top US Computer Sciences University. All type of books are welcomed : Algorithms, Data Structures, Compiler Design, languages, design patterns, Machine Language, Maths (absolute minimum required for Sofware Engineers), Problem Solving, General Engineering book that can be of some help for SE ...
198235
Best Practice for Argument Checking
Say I have a web service with a method `MyWebServiceMethod(string passedValue)`. The web service calls a method `MyServiceMethod(string passedValue)` where the value from the web service is passed along. The service calls a repository method `MyRepositoryMethod(string passedValue)` where again, the value from the service is passed along. I hope that is clear enough. I can post code if need be. **My question is around null argument checking.** Should I check `passedValue` and throw an exception in: 1. The Web Service 2. The Service 3. The Repository Obviously, if `passedValue` is null in the web service, the following methods will never get invoked but should I check in case the solution changes in the future? Edit I should have said that I don't expect null to ever be a valid value. Also, My worry in these situations is that someone may change the web service or create another client with no argument checking that will call the service with invalid arguments. So I tend to think the checking should be in both places. Then I think of YAGNI and wonder if we should cross that bridge when we come to it. What is considered best practice in these situations?
232725
Can the Jacquard loom be considered stateless?
Can the Jacquard loom, pictured below complete with its chains of paper cards ![Jacquard loom](http://i.stack.imgur.com/zyqKB.jpg) be considered stateless? As far as I can tell I can tell, each operation is not dependant on the previous. Or did it have any concept of branching and/or looping?
96209
Ideas for Offline & Sync Across Multiple Platforms
I'm looking for some implementation ideas to be able to have offline apps sync data to a central server. The server will be Sql Server 2008. The clients will download data from the server when internet access is available and will need to allow the user to make changes offline and then sync the changes back to the server when it becomes available again. The clients will come in multiple flavors ranging from Windows to Android, so whatever I use needs to be easily translated into multiple OSes. I have been looking at using Microsoft's Odata (odata.org) on the server. It looks to have some pretty neat features and appears to even partially support what I want (by means of a concurrency token) -- though I'm not sure how the logic would revolve around the use of this token yet, that's what I hope to get from this. So - my question is this: Is there a 3rd party tool or app that I can use on multiple platforms which can handle offline & sync scenarios? If not, can anyone provide me with ideas on how to implement logic for syncing data back to a server and handle things like conflicts, etc.?
229091
Is there any use for a smart algorithm developer who will delegate the coding?
In my job as an algorithms developer, I am responsible not only for developing algorithms, but also for implementing them, all the way down to writing the code that goes into production. I've heard that there are companies where there is a separation between algorithms development and implementation. The algorithm people come up with the "concept", and don't write any code except for research purposes. Then there are programmers in charge of implementing the algorithms. At my company there are thoughts recently of hiring designated algorithm developers who will not write code, as described above. I am intuitively opposed to that idea, but I've never worked in such a place before, so I may be biased. Is this a viable model for software development?
229096
Is Lisp the first language to adopt structured programming?
I couldn't find any links or books claiming that Lisp is the first programming language to adopt structured programming (actually, most of them don't even mention Lisp at all), but if conditionals were invented by McCarthy and got into Algol later, is it fair to say that Lisp is the first?
196526
Was C designed to facilitate Object-Oriented programming?
I am trying to broaden my understanding of the history and development of object-oriented programming, and I am curious to find out **if C was designed to facilitate Object-Oriented programming?** (like **C++** and **Objective-C** definitely are) or if it was, on the contrary, simply just a clever exploitation of the language's constructs. I cannot seem to find any sources, including _K &R_, where the original authors comment on this approach. Recently I have been looking into OOP in ANSI-C, which is described in **Object-Oriented Programming With ANSI-C** by **Axel Schreiner**. For a freely available PDF version visit http://www.cs.rit.edu/~ats/books/ooc.pdf. A slightly different approach is used in the part of the Linux kernel dealing with file systems, visit http://lwn.net/Articles/444910/ for more info. The common idea is to put `function pointers` in a `struct` along with `fields` in order to 'emulate' a `class`' methods and `data members`. **Chronology** From Wikipedia.org/wiki/Object-oriented_programming#History > Objects as a formal concept in programming were introduced in the 1960s in > Simula 67 While Wikipedia.org/wiki/C_programming#K.26R_C states that > In 1978, Brian Kernighan and Dennis Ritchie published the first edition of > The C Programming Language. The chronology seem to suggests that K&R must have been well aware of OOP. So again: **Was C designed to facilitate Object-Oriented programming?**
149964
Effective way to gain practical knowledge
I am currently nearing the end of my first year of my CS degree and have been disappointed with the lack of coding I have been asked to do (one unit). I am basically looking for an effective way to gain practical knowledge but am unsure where to look for experience from a near **beginner's** perspective.
159634
Should one generally develop a client library for REST services to help prevent API breakages?
We have a project where UI code will be developed by the same team but in a different language (Python/Django) from the services layer (REST/Java). The code for each layer exits in different code repositories and which _can_ follow different release cycles. I'm trying to come up with a process that will prevent/reduce breaking changes in the services layer from the perspective of the UI layer. I've thought to write integration tests at the UI layer level that we'll run whenever we build the UI or the services layer (we're using Jenkins as our CI tool to build the code which is in two Git repos) and if there are failures then something in the services layer broke and the commit is not accepted. Would it also be a good idea (is it a best practice?) to have the developer of the services layer create and maintain a client library for the REST service that exists in the UI layer that they will update whenever there is a breaking change in their Service API? Conceivably, we would then have the advantage of a statically-typed API that the UI code builds against. If the client library API changes, then the UI code won't compile (so we'll know sooner that there was a breaking change). I'd also still run the integration tests upon building the UI or services layer to further validate that the integration between UI and the service(s) still works.
159633
User Configuration of a Shell Script. Best practices?
I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. The script in question is aimed at other developers. This can be implemented in a number of ways: 1. **Use placeholders** in the script itself and use `sed` to replace them during installation (something like this: http://stackoverflow.com/questions/415677/how-to-replace-placeholders-in-a-text-file) * Pros: All variable definitions are contained within the script. It's easy to download the script manually and configure the variables for users who prefer an editor over the installer. * Cons: It's hard to reconfigure the variables through the installer once they are in place. Unless I create a more complex regexp which would be prone to errors. 2. **Use a config file** , basically another shell script with assignments, and use `source` to include it. (And probably place it in `~/.scriptname`? The main script is copied to `/usr/local/bin`) * Pros: It's easy to reconfigure the script. Could even add a parameter for doing so from the main script (Would probably work in the first solution as well, but editing a script from itself doesn't sound like a very good idea) * Cons: The script is now dependent on two files and the user is required to run the installer for the configuration file to be created. This can be solved by auto generating a config file if none exists. But locating an external configuration file will still be more cumbersome for users who just want to download the script, edit it, and be done with it. Also, a few options regarding how the configuration should be managed by the user after the installation: 1. **Git like** $ myscript config server.host example.org $ myscript config server.proxypath /home/johndoe/proxy $ myscript config server.httppath /home/johndoe/web 2. **Interactive** $ myscript config Enter the server hostname: example.org Enter the path to the proxy on the server: /home/johndoe/proxy Enter the path to the http directory on the server: /home/johndoe/web 3. **getopts with long options** $ myscript --host example.org --proxypath /home/johndoe/proxy --httppath /home/johndoe/web 4. **Simple** $ myscript config example.org /home/johndoe/proxy /home/johndoe/web Are there any other ways of doing this that you would consider? Any best practices, anything elegant?
202399
What specific features of NHibernate cause it to be recommended for legacy database systems?
So, I've been evaluating Entity Framework and NHibernate (I'm not looking for an EF vs. NH battle here, though!). One thing that I see come up very often is that NHibernate is recommended for "legacy"/brownfield database projects, and lighter-weight ORMs (Dapper, etc) are sometimes recommended for newer dbs. I will be applying my ORM to a brownfield database. What specific features of NHibernate make it so widely recommended for "legacy" dbs. (I have never heard anyone say "here's _why_ NHibernate is better for legacy DB's -- I really want to know that, so that I can evaluate NHibernate appropriately) And by the way, what is the definition of legacy here? Do people mean * "databases that are not well normalized"? (or) * "databases that are being accessed through non-ORM means, such as SQL queries or stored procs? (or) * not talking about the database at all, but referring to classic 2 tier systesms (or 2-tier web apps, where there is thick session state, and no application tier)? (or) * Any database that is isn't a noSQL database? If it's of any use the discussion. I will be using this ORM to build distributed, multi-tier software. So I think that a lot the stateful features in ORMs -- like change tracking, etc, will not matter to me very much.
212043
Use ruby's array sort() method, or add items in correct place with a binary lookup?
If I am loading a whole load of items (un-ordered words from a file or something) would it be more efficient to load them all to a Ruby array, and then use the built in `sort!` method or to do a binary lookup for the place of each item in the list as I load it, and add it in that position. Basic code: array = [] lines.each do |line| array.push line end array.sort! vs array = [] lines.each do |line| array.insert(find_index(line), line) end `find_index()` would lookup the correct index for the item in the array using a binary search.
212042
Is there any way to limit the scope of a knockout.js application?
I have a legacy project which I have been approved to work in a `knockout.js` module. This is great, however the application is extremely complex and I need to use some of the pre-built form validation of our application. My form validators work fine until a dynamic template gets switched out. I can't for the life of me figure out the error. Nothing in the console and my vast debugging efforts have been fruitless. I'm thinking that my solution could be something along the lines of limiting the scope of the knockout application similar to how one can declare `ng-app` in `angular.js`. I can't find a working example of how to do this or any documentation relevant to `knockout.js`
226313
Why does Apple only allow for Static Frameworks on iOS?
Clearly Apple has the ability to create dynamically loaded libraries (known as frameworks) for iOS, as they ship several with XCode (such as UIKit). App developers only have the ability to create static libraries, or at best, trick Xcode into thinking it's loading a framework when it's actually loading a static library, this is known as creating a fake framework, some of the drag- and-drop convenience, but none of the dynamic loading benefits. What is Apple's reasoning for keeping dynamic frameworks from app developers? It seems like it would ease using external libraries considerably, since developers wouldn't have to rely on finicky linker flags or open-source library dependency chains. Edit: I see a common reason is security. Why then does Apple allow it on OSX and not iOS? Isn't security a requirement there as well?
219098
impact of product information leak due to matrix resource models for development projects
I read somewhere that Amazon has a dedicated team for each of its major products. This approach facilitates the growth of the domain knowledge for each product team and as a result of this retained knowledge, it allows Amazon to rapidly add new functionality to products. I have experience working with lots of companies where they follow more of a matrix based resource model. In this model, the company has a portfolio of products, but architects, developers and project managers are very frequently moved around from product to product. For example, if new functionality is to be added to a product, a completely new project team will be created for this. The project team is likely to have no previous exposure to the product. As a result of this matrix resourcing, the product technical architecture becomes weak (each architect will use a different approach/style), and adding new functionality takes much longer because of the domain knowledge that the new project team needs to acquire before starting the project. Information leak is sometimes used to describe the effects of lost knowledge such, which seems to be exacerbated by the matrix resourcing approach. **Questions** : Is there any research or documentation that supports my experience and identifies the impact (cost/time) of information lost due to matrix resource models? * * * EDIT: Also, most of the companies had a tendency to switch resources mid-project. This cost a lot of time lost due to: * handovers required between old and new staff (if they even happened at all) * new staff getting up-to-speed on the project * low morale due to constant resource changes on projects Link describing Amazon's Philosophy: you build it; you own it. * * *
84464
Builds, continuous integration and deployment for python projects?
Could you please tell me which tools are used in python to build projects, as well as which continuous integration servers are used and how to deploy projects to the server? What I mean is web projects, but will still be happy to know more of this information not only around the web.
132824
Is there somewhere I can post code used to hack my site?
I left a bit of a door open recently on my site. Someone tried to post PHP code to a CMS page editing module, but it wasn't executed. I have this code and was wondering if there is somewhere I should post this code for peoples interest etc. It's PHP code.
37141
How to switch From Java to .Net?
Has anyone out there done this? Did you have to spend a few years learning .NET before you could get a job or were there employers just willing to throw you into the fire based on your Java experience? I'm wondering if it would be good for me to start learning .NET now in case a few years down the road I end up wanting to make the switch or maybe I don't need to worry.
219095
When does one NOT need to use queues in an application?
I've been developing an application using the Laravel Framework & have been exposed to the idea of queues for the first time. There are a multitude of tutorials & articles about using queues & examples of what to use for, but I've never seen anyone writing about or highlighting when one does not need to actually use any. I've seen examples or even forum questions about using say beanstalked or iron.mq for offloading jobs that then take place in a managed manner, I understand the concept; but is there a need to make use of queues if say my application makes use of a mailing service like Postmark or Mandrill? Is there a benefit in that case? I mean I've tested both & obviously they both queue jobs on their service to allow their service to function; do I need a queue for email when I'm offloading the act of mailing to a service detached from my application. ( my application has not been released into the wild, I do not actually have benchmark type information at present ) How different is giving jobs to ironmq (which still calls an api and sends data) to making a call to say Mandrill by sending data? More to the point; does one need to have a queue like using iron.mq to send mail requests to mandrill which happens to queue stuff too?
219097
Basic OOP theory: misunderstanding surrounding database and user classes
New to OOP and trying to understand some basic fundamentals. Currently using PHP5 to build a basic web app. In using PHP's built in PDO as my database class and a separately created user class that handles, among other things, user log in and out, is it best to have the db class connect to the database in a log in situation, or does the user class need to directly connect to the db? If the latter, I think I'm likely misunderstanding how PDO would standalone. If the former, presumably some kind of 'helper class' needs to be created that would facilitate the db connection between PDO and my user class?
197214
How do I include the copyright/license for a library if I use on 1 function?
How do I include the copyright/license for a library if I use on 1 function? Say if I have a class that I have taking 1 function from another library: class MyClass { ... public function someOtherLibrariesFunction() {} } And the at the top of the file I took the function from it says: /* * This file is part of the Other Library package. * * (c) James Smith <j.smith@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ And the LICENSE file: Copyright (c) 2004-2013 James Smith Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ...standard as is warranty... So my understanding is I would have to have a copy of the LICENSE file included with my code, and I would also somehow point out the exact function it it applies to?
83118
Interview question: Percentage of time spent coding
I've been asked to estimate the percentage of time I spend coding at my current position in a job interview (I said about 70%). This excludes time for things like documentation and meetings. What does this statistic tell an interviewer? I'm guessing that they are looking for a balance between coding too little (thus being out of practice) and coding too much (not seeing the bigger picture of product development). * * * EDIT: After reviewing your answers I'm even more curious what the actual reasoning behind this question was... I should have just asked the interviewer! Your answers are actually really funny in the context of this company.
242884
REST Service and CQRS
I am struggling with architecture on a new project. I am using the following patterns/technology. * CQRS - anything going in goes through a command * REST - using WebAPI * MVC - asp.net mvc * Angular - building a spa * nhibernate I belive this provides some great separation and should help keep a very complex domain from growing into a giant set of services that mix queries with other business logic. * The REST services have become non restful. They are putting methods in rest that are "SearchByDate", "SearchByItem" etc. * Service Methods that execute commands are called with a "web" model class, a new command is built in the service and executed, I feel like there is a lot of extra code. I expected this to be much different but I wasn't around to keep things on track. Finally my questions are this... I would have liked to see `PUT Person (CreatePersonCommand)` but then I realized that isn't restful either is it? the put should be a person entity not a command. Can I make CQRS and REST service work together or am I going about this all wrong? How do I handle service methods that don't fit into a REST model. I am not performing CRUD on the object but rather executing some business logic. I.E. I don't want the UI to be responsible for how a shipment is "unshipped" I want the service layer to worry about that.
178847
"Mac" vs "OS X" vs "Mac OS X"
I am writing server software that gives administrators options that apply only to Mac OS X clients. When naming those options, I need to decide how I am going to refer to such clients. I can see three choices: * Mac OS X * Mac * OS X In context, I feel that "Mac OS X" might be a little clumsy: "Default protocol for Mac OS X clients"; "Change Mac OS X protocol". In discussing with my boss, he suggests "OS X", as that's the name for the OS itself, while I think that "Mac" is more recognizable. While "OS X" is technically correct and is what Apple recommends, I feel that it has a lot less name recognition than "Mac"; in particular, administrators who work in a Windows-only environment may not even recognize "OS X" and wonder what the options is about, while I think everyone knows what "Mac" refers to. In looking at what several popular pieces of software choose, I see that Microsoft has "Office for Mac". Adobe calls it "Macintosh" (which sounds very outdated, I believe that Apple stopped using that "Macintosh" years ago). Firefox uses "Mac OS X". Google has "Google Software Downloads for Mac". I don't see many popular pieces of software that refer to it solely as OS X; it seems that either "Mac OS X" or "Mac" is used most often. Apple does refer to it as OS X, but I think the fact that it's coming from Apple provides the disambiguation that you need, so it's not confusing coming from them, while it may be in another context. Is there any good solution for this? Should I just use the somewhat clumsy "Mac OS X" everywhere (or at least, the first time I refer to it in any given screen)? Obviously, my boss has final say, but I'd like to be able to provide a coherent argument.
86197
Terminology For Web Development and General Programming/Software?
EDIT: I should clarify. THe particular terms I listed below I fully understand. I also understand w3schools doesn't have the greatest information. These are just examples. I don't expect everybody to understand what an example is, but I hope the majority do. Does anybody have any resources listing terms related to programming and web development, or care to pitch in? Things like: Runtime Build time Framework Library Normalize I'm primarily a PHP developer so anything about that. I really am looking for general terms and specific terms related to web development, PHP, SQL, CSS, HTML. Appreciate any input. Couple I found: http://www.w3schools.com/site/site_glossary.asp http://docs.roxen.com/pike/7.0/tutorial/fundamentals/concepts.xml
219543
Should a class know about its subclasses?
Should a class know about its subclasses? Should a class do something that is specific for a given subclass for instance? My instincts tells me that is a bad design, it seems like an anti-pattern of some sort.
14411
How would I unit test database logic?
I am still having a issue getting over a small issue when it comes to TDD. I need a method that will get a certain record set of filtered data from the data layer (linq2SQL). Please note that i am using the linq generated classes from that are generated from the DBML. Now the problem is that i want to write a test for this. do i: a) first insert the records in the test and then execute the method and test the results b) use data that might be in the database. Not to keen on this logic cause it could cause things to break. c) what ever you suggest?
230386
What is the difference between a Splay Tree and an Optimal Binary Search Tree?
Both these trees try to keep the most frequently accessed element at the top. Is there any difference between these two trees?
58145
How Scala Developers Are Being Interviewed
How are Scala programmers being interviewed? What are the aspects that the interviewer looks for when interviewing a Scala developer?
14206
How do I showcase my work experience in programming?
I'm a student of web development languages like PHP, Ruby, and Python. Currently I'm working on some school projects but I'm trying to work on some weekend projects which I can use to showcase for potential employers, what's the best way to set this up? Specifically, are there any tips you have for a new programmer because I don't want opinions on how this or that should or shouldn't be set up. If possible please give real examples. **Edit:** what about Git? Is this a good place to show my projects?
14419
How do you deal with e-mail overload?
Probably many of you receive hundreds/thousands of e-mail every week. This happens especially when you are part of wide distribution lists. How do you find the relevant ones? Do you use any _smart_ plugins (for Outlook)? Until now I tried: 1. Sorting them in folders but it failed because then I got into folder overload 2. Making rules. Fails especially when doing text matching because is not taking into account the context.
76415
i want to make some programmer friends but dont know where to really look
I know this is one good place but what I'm really looking for is contacts, maybe seeing them online, have intelligent conversations etc. Where I live there isn't that many programmers around me because I'm self employed. I'm sure if I were to work in a company I would be surrounded by some. I don't know maybe sharing our screen names or facebooks or something.
76414
Development setup in a company with external developers
EDIT: This is about where the users will have their files, and TEST their changes - a development server so they can edit, save and then refresh a page to see whats changed. I am currently looking over our systems we have in place, here we have 2 internal developers, and 2 designers. All 4 used the same server for development work with their own enviroments and databases and code all housed in an external SVN repo, this works pretty sweet however we are looking at opening up this server for external staff. We have 2 external designers who we'd like to be able to edit files/insert designs etc etc. One runs a mac, other windows - ideally we'd like to open up access to our development server but one of these users it outside the country so access would be slow for anything other than something which runs in terminal however they use graphical IDEs. Do anyone have any experience/how their companies handle doing this? Not really keen on FTP to upload, check, edit, upload, check etc
234895
Why separate unit tests into an assembly
I primarily develop in .Net, and have been playing around with F#. It's a nice concise language, but I'm just using it for throwaway code currently. I've taken to sitting my tests in the same file as the main code that I'm writing. I am under the unexamined opinion that this is done so that we don't have testing code floating around in production, and that we have separate dependencies for testing which we don't want to go to production. This has raised the question for me: why do we traditionally separate out test assemblies and not just use conditional compilation?
207611
How to implement interactive programs (like games/simulations) using logic programming?
I've heard that logic programming can serve as a general-purpose alternative to other programming paradigms such as OO or functional programming. (Since Prolog is Turing-complete, this must be so!) However, I'm having trouble seeing how one would implement an interactive program, like a simple, graphical console game in Prolog or a similar language. You have facts, rules which can derive more facts, and queries which retrieve facts. It's easy to see how you can use those basic elements to create something like a sudoku solver. But how about Pac-man, or more simply, Pong? **PLEASE NOTE:** I'm not looking for low-level details, but a conceptual overview. (For example: in high-level terms, how would you handle I/O? How would you store the game state? How would you implement something like a "main loop"? How would you measure and respond to the passing of time?)
207612
How to structure a modern web application
## Background I recently developed, for two different projects, two web applications. The two followed quite different approaches. The first one was a classic inventory application (lists of stuff to view, select, edit.. very CRUD) and was developed with Razor and ASP.NET MVC: controller accepting requests, getting a model through a Repository, building different Viewmodels out of it for view and editing, pass the Viewmodel to the view engine and render of the page. Very direct stuff (you can almost build such an application with wizards only using ASP.NET MVC), with very little Javascript "magic" (only the minimal offered out of the box by the MVC framework, mainly for validation). The second one was quite different: this application is basically a bunch of screens (views) through which the user can navigate back and forth, which appearance change as users input data in different places - it is basically a hub in which the user views and reviews information linked to his account(s). I built this second application as a REST service (built with ServiceStack, and therefore following the design patterns it enforces - like Data Transfer Object) and a SPA application implemented using AngularJS. The angular application uses its (excellent) http service to get the JSON objects from the rest service, and then populate its (client side) Viewmodel (the scope). Very neat and clean; it is easy to navigate back and forth the various account information (which is visualized in many different ways: lists, graphs, ...) It is maybe a little more difficult to code at times (authentication/authorization is a bit more difficult (you have to be careful to mimic control on client and server, for example). Now, I am starting a third project. It is something in between: it is still a CRUD application, but it needs to be very responsive. For example, in a page, we have a complex information to enter (combo of form and list); in the list the user need to select a item from another list, but if the item is not there we want to open the "edit list items" view, let him/her insert the item, and go back to the original page... all without refresh/pushback/... You got the idea. ## The question Which is the best way to accomplish this, to develop a modern, quick, responsive web application? I have seen too many different approaches: * "control based" (jQuery) approach: build the page using your MVC framework (which will produce html, a table for example), use jQuery to "enrich" the html and make it ajax * "data based" (Angular): build the page as an html page with data bindings, a JS application, and structure the server side as a REST service, that the JS app uses to get/post data * the mix #1: part of the app is built using your MVC framework (which spits out html), part using a data-based framework (like angular). Angular scope/model is initialized using jQuery to extract the initial data out of the html DOM. * the mix #2: part of the app is built using your MVC framework (which spits out html), part using a data-based framework (like angular). In addition to html, the server writes a "script", which is JSON data, and embeds it into the page. Angular then uses it as its model to render the data visualization (client side) * the mix #3: same, but this time no embedded JSON: the server exposes a REST service that is used by Angular to retrieve the data it needs. It is essentially part generated on the server, part on the client through a secon call to get e JSON object * (more...?) I personally find the mix #1 and #2 ugly, but I am too "new" to modern Javascript development to judge. Are they common? I see for example that one advantage of mix #1 is that you get the initial view immediately, you do not need to wait for JS to render it. And both mix #1 and #2 do only one call to the server. So, which one is the best practice? Or which one(s) should I really avoid? I (personally) am more comfortable with a mix of server-side generated pages and client-side JS; making a SPA completely using services was not that easy, more than one time I wished to have something generated using server-side logic, but I may be doing it wrong (that is why I am asking!)
207613
Encoding a bash script for use in Python
I am writing some code in Python which checks for the validity of a license key after polling a server. If it is valid then the Python program in turn runs some bash scripts. How to create a combined binary of the python script (to check the license) and the bash script (which performs the task)? Here are what I think could be the solutions but I am really not sure: 1. I use the encode function in python and encode the bash script file once and add combine that file and the license_checker.py file into a single binary. When the binary runs, the python code should decode the file into a temp file, run the script and delete the temp file. 2. Find a mechanism which wraps/embeds the bash code in the python script. I have heard of decorators but I haven't used them and do not know if they would serve the purpose.
131841
How can I defend Ruby on Rails against customers' not technical opinion?
My customer, a translations business owner, just told me that he has been reading about Ruby on Rails and told me that " _there are more PHP guys around there_ " and " _it seems the community prefers it_ ". What would you, as software engineer and freelancer, say to the customer to achieve these goals: * Sell * Make him see that the technology is my expert decision and Rails is as good or better than PHP (+ whatever framework) for this particular project. UPDATE: Thank you all for the suggestions! Tomorrow I've got another meeting with him, let's see how it goes, I will update again :) UPDATE 2: Finally I told him to read this thread and the result has been fantastic: He gave me the project and we are going to start right now. Thank you all for the help, you have free beer in my charge if we see someday :) BTW: I learned the lesson: be as transparent as possible, because if you believe in yourself and your work, there is no question compromising enough to beat you. regards
222814
Google App Engine overview
I have gone through many Google App Engine tutorials, and I became quite familiar with how to do basic stuff like implementing a `webapp2.RequestHandler`, and using `ndb.Models` to manage your data. Now, I kind of reached a wall with a few small concepts that were either missing from the resources I went over, or I simply missed them. So, here they are: ### What happens to class variables? As far as I understood, once I set my app to threadsafe, it can handle multiple requests concurrently, not to mention possibly on different machines. Does that mean I simply cannot use class variables (that can be changed at anytime)? ### How to model an application wide logic? It is very straight forward to write logic associated with requests. I don't have to worry about locking or any of that stuff, since a new RequestHandler is instantiated for each request. What about application-wide logic? Like, if I had a python module called "Game", and after importing it, I do somthing like: `Game.matchmaking_queue.append(player)` As far as I can tell, there is just one `Game` instance, and it has an instance variable accessed from within the `RequestHandler` logic. Will that be OK? Must I make the `matchmaking_queue` backed on memcache and/or datastore in order for **all** requests to see it? Do I have to do any thread-saftey magic on `Game`?
201619
Tests for emptiness vs tests for nothingness
Is there any consensus between languages how tests for emptiness are distinct from tests for noneness? In python the following expression is false: `{} is {}` However this expression evaluates to True `False is False` Why is the first expression not evaluated to True?
170334
How do you pronounce the '...' operator
Now, in c++ '...' became a first class operator. In speech, how do you pronounce it? So far I've heard: * dot dot dot * triple dot * ellipsis related: Is it OK to replace ... with ellipsis in writing? e.g. "The ellipsis operator expands the pack" EDIT (clarification): We are all aware that '...' as a **punctuation** mark is indeed called ellipsis. But in the context of C++ we don't pronounce the names of the punctuation mark. For example, the '&' operator, depends on the context is pronounced as 'and', 'bitwise and', 'address of', 'logical and' (when && is used), or 'reference'. It is rarely pronounced as 'ampersand'. In speeches, I've a feeling that 'dot dot dot' is used more often. For example: http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Variadic- Templates-are-Funadic (an excellent presentation about variadic templates). On the other hand, 'dot dot dot' is awkward hard to pronouce ('d' and 't' are both pronounce with the tongue). Can we pronounce it 'unpack'?
170335
How can I get rid of just the untracked files in git?
In Mercurial I can do this with the bundled Purge Extension and executing the following command: hg purge Also good to get rid of ignored files: hg purge --all I'm curious about the most practical/used equivalent solution in git. **Edit** : I want to just get rid of the untracked files, not reset everything (e.g. suppose I have a program generating cache files or generated code and I want to delete them with git's help)
230658
Build Once, Deploy to Multiple Enironments
I build one **MAIN** branch. This is our trunk and our only code base for the project. Once this is built, ideally it would continuously deploy to our Dev environment. Once the developers have confirmed operation in that Dev environment, I'd like to simply publish the binaries that were previously built, to the Test environment. Once QA has confirmed operation in the Test environment, I'd like to publish the same original binaries to the Stage environment, and then to the Production environment. I guess it's sort of like deploying old school where you just copy over the binaries onto the box you're doing the deployment to. Any strategies, tuturials, tips, links and third party software recommendations (preferably with link to tutorial) are appreciated. I'd like to keep everything within Visual Studio if possible.
242882
Processing a list of atomic operations, allowing for interruptions
I'm looking for a design pattern that addresses the following situation: 1. There exists a list of tasks that must be processed. 2. Tasks may be added at any time. 3. Each task is wholly independent from all other tasks. 4. The order in which tasks are processed has no effect on the overall system or on the tasks themselves. 5. Every task must be processed once and only once. 6. The "main" process which launches the task processors may start and stop without warning. When stopped, the "main" process loses all in-memory data. Obviously this is going to involve some state, but are there any design patterns which discuss where and how to maintain that state? Are there any relevant anti-patterns? Named patterns are especially helpful so that we can discuss this topic with other organizations without having to describe the entire problem domain.
234766
How much segregation is too much in this design?
We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results. We have segregated the functionality into user controls and each user control has its own view and presenter. 1. Search -> It consists of search fields along with submit button. It contains validations inside the presenter. After the page is validated, it raises the custom event. 2. Search criteria -> Contains DataList control to display the readonly search criteria by subscribing to search event. 3. Search results -> Communicates with controller and binds the grid by subscribing to search event. It also contains sorting and all grid related events. Since each control has its own controls and behavior following SOLID principles, views and presenters are thin and testable. Also, it increased the productivity by facilitating developers to be able to work on tasks independently. But on the other end, we are thinking whether we over-engineered and increased the complexity by introducing the user controls, custom events, etc. for this simple functionality?
230650
RESTful API development : is it web developer's work or software developer's work?
First of all, I am sorry that the issue I'm going to say is not about a technical thing. I'm just confused. I am trying applying to several companies as a software engineer. The latest work that I developed is to develop RESTful APIs which is written in Python django. Here's the problem that I'm curious. can this work be classified as a software engineer's work? or is it just a web developer's work?
96205
Why shouldn't "responsive" web design be a consideration?
This might seem like more of a graphic design question than a programming question, but I think it has much more technical/programming merit than actual graphic design. The concept of "responsive" web design revolves around using media queries in CSS3 to detect the size of the viewing device and adjust the CSS rules accordingly - essentially, dynamic CSS. This fills the void on a lot of deployment cases - mobile, in particular. I think use of media queries is surfacing slowly (I've found that many people don't really know about it), but I'm wondering if there is a reason for slow adoption. Is it impractical for web applications? Is there something I'm missing that might be a fundamental pitfall?
230654
Is there a design pattern for updating lists?
I want to modify one list (actually info stored in a database). A person doesn't have access to update every part of the list, but can update and delete parts they do have access to and add whatever they want to the list. Here's my pseudocode: ModifiedList OriginalList OriginalListWithUserRights for each Thing in ModifiedList do if Thing in OriginalList then //Leave Along - nothing to change else OriginalList.add(Thing) for each Thing in OriginalList do if (Thing in ModifiedList) then //LeaveAlone - nothing to change (same as above) else for each RightsThing in OriginalListWithUserRights do if RightsThing not in OriginalList then //Leave Alone - don't remove things you don't have rights to else OriginalList.Remove(RightsThing) OriginalList.ReIndex() //because there will be some gaps So, I guess this would work, but I think it's not right because it's just an obvious solution. I don't need to start with three lists as my inputs to this function. I could look up particular pieces of information while I'm iterating through my modified list. It just seems to structured and not object oriented enough for 2014. One problem I have is that I'm going to be adding everything to the end of the list, seems like I should be adding things relative to where they were in the passed in list, but in a way that doesn't mess up the order of things that are not in my OriginalListWithUserRights.
245356
How to stop the WCF service (database queriying) running behind
I have a WCF service which will get an object with huge data from database in the form of collection. I have a UI which has get and cancel buttons . Get button : make service request and continue with data population with the returned data from service.I start it as below Thread _workerThread = new Thread(DoExportTreeLoad); _workerThread.Start(); Cancel : stops the above thread.It does as below _workerThread.Abort() My DoExportTreeLoad() has the synchronous service call which in turn hits database and gets data. result = serivce.GetData(criteria); Problem: When I cancel the operation after requesting the service, the DAL code is still running in the background (getting data from database) where it should not happen. As soon as i cancel the operation from UI ,the transaction (to get the data ) from database need to be aborted. It leads to big performance problem. Please help me with any way to end up the backend task when thread is cancelled. Thanks in advance.
229327
Pythonic design for controlling multiple devices through an I2C bus
I'm writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the communication and data conversion in some sensible way. The operations that each of the device modules perform are drastically different. My main concern is the I2C bus control. I fear that sharing the bus, by for example having each of the device modules instantiate a new I2C bus control object results in code that is hard to follow and I'm not sure how these objects would communicate if the there's an interrupt in the bus. However, not sharing it, I fear I'll end up with a _huge_ control class that is hard to maintain and extend. If I lean towards the control class, each of the device modules would hold a map of operations, like an `OrderedDict` or a list of tuples of functions with expected result values or ranges. The I2C control object could then iterate that dictionary, write and read the results from the bus and move to the next function if the result is in the expected range. This sounds like a state machine design, but I'm not sure if I can really generalize all operations enough. I suppose my question boils down to _does anyone have a good suggestion for a design pattern_?
245350
Split up large interfaces
I'm using a large interface with about 50 methods to access a database. The interface has been written by a colleague of mine. We discussed this: Me: 50 methods is too much. It's a code smell. Colleague: What shall I do about it? You want the DB access - you have it. Me: Yeah, but it's unclear and hardly maintainable in the future. Colleague: OK, you are right, it's not nice. How should the interface look like then? Me: How about 5 methods that return objects that have, like, 10 methods each? Mmmh, but wouldn't this be the same? Does this really lead to more clarity? Is it worth the effort? Every now and then I'm in a situation where I want an interface and the first thing that comes to mind is _one, big_ interface. Is there a general design pattern for this? * * * **Update** (responding to SJuan's comment): The "kind of methods": It's an interface for fetching data from a database. All methods have the form (pseudocode) List<Typename> createTablenameList() Methods and tables are not exactly in a 1-1-relation, the emphasis is more on the fact that you always get some kind of list that comes from a database.
38341
Web Development Law/Ownership of Website
I'm a budding web developer, and I wondered if it was illegal to edit a website for a client to include a link that says 'encourage the owner of this site to pay their web developer' and follows up with a pre-made email encouraging the man to pay me. Here are the conditions: * I've completed the work for the contract. * I've asked to be paid, and tried to set up meetings with the owner. * I've informed the owner of the site that my work will not continue unless I am paid. * I should have been paid nearly a month ago (12/27) Any thoughts other than small claims? This is my first web-development job!
38340
Career Advice: Change from developer to tester
I have three years and nine months of java development experience specifically in finance domain and now I want to move into testing (functional). But I took a break from my job due to location change. Is it advisable and how should I do it?
229328
Should front-end integration tests make HTTP requests?
I am developing a single-page web application using AngularJS. Data for this application is consumed over a REST API which is well tested in its own right. The Angular application has a bunch of unit tests that test e.g. individual controllers and their methods. It also has a bunch of integration tests that currently verify that those controllers behave correctly when applied to a view. Both the unit and integration tests are currently sharing a set of stubbed JSON data that is returned when certain HTTP requests are about to be made (by way of the `$httpBackend` Angular service). No actual HTTP requests are sent to the API server during testing. **Is this a good approach for front-end integration testing?** The way I see it, the unit tests are testing small units of code (such as individual methods in controllers) and the integration tests are testing the way those units behave in the wider context of a view or template. The setup allows the front- end application to be tested completely independently. However, the developers of Protractor (the integration testing framework I'm using) have stated on numerous occasion that they believe integration tests should make HTTP requests to a real server (see this GitHub issue): > Protractor is intended for end to end tests, so the primary use case is when > you have an actual backend hooked up. Assuming the answer to the above question is "yes" (or "maybe"), should there be a third set of tests that do actually test the communication between front- end application and REST API?
213799
SQLite with two python processes accessing it: one reading, one writing
I'm developing a small system with two components: one polls data from an internet resource and translates it into sql data to persist it locally; the second one reads that sql data from the local instance and serves it via json and a restful api. I was originally planning to persist the data with postgresql, but because the application will have a very low-volume of data to store and traffic to serve, I thought that was overkill. Is SQLite up to the job? I love the idea of the small footprint and no need to maintain yet another sql server for this one task, but am concerned about concurrency. It seems that with write ahead logging enabled, concurrently reading and writing a SQLite database can happen without locking either process out of the database. Can a single SQLite instance sustain two concurrent processes accessing it, if only one reads and the other writes? I started writing the code but was wondering if this is a misapplication of SQLite.