instruction stringlengths 34 19.9k |
|---|
I have a website. I've been testing crossbrowser on my windows PC, and it looks good in all browsers, but on Mac in Safari it looks like the CSS is not getting interpreted right, or there is a critical javascript error.
When I look in the console cross-browser, the error log shows exactly the same. Chrome on mac interp... |
I get that /dev/random is a good source of entropy, and is what is usually used-- It's just as I'm reading up on GC, at least in Java, it seems accepted that the garbage collection daemon executes non-deterministically. If this it true, why don't we use the timing of the garbage collection as a source of entropy inste... |
It is pretty common for a web application to display a list of items and for each item in the list to indicate to the current user whether they have already viewed the associated item.
An approach that I have taken in the past is to store HasViewed objects that contain the Id of a viewed item/object and the Id of the U... |
I am working on an GBA emulator and stuck at implementing CPU cycles.
I just know the basic knowledge about it, each instruction of ARM and
THUMB mode as each different set of cycles for each instructions.
Currently I am simply saying every ARM instructions cost 4 cycles and
THUMB instructions cost 2 cycles. But how d... |
I'm still possibly a little green about object-pooling, and I want to make sure something like this is a sound design pattern before really embarking upon it. Take the following code (which uses the Starling framework in ActionScript 3):
[Embed(source = "/../assets/images/game/misc/red_door.png")]
private const RED_DO... |
So this might be overly vague, but here it is anyway
I'm not really looking for a specific answer, but rather general design principles or direction towards resources that deal with problems like this. It's one of my first large-scale applications, and I would like to do it right.
Brief Explanation
My basic problem is ... |
I've this really simple program written in C with ncurses that's basically a front-end to sqlite3. I would like to implement TDD to continue the development and have found a nice C unit framework for this.
However I'm totally stuck on how to implement it.
Take this case for example:
A user types a letter 'l' that is ca... |
Is it better to have constructors with or without parameters and why?
public NewClass( String a, String b, int c) throws IOException
{
//something
}
OR
public NewClass()
{
//something
}
|
I'm creating a question to see if my understanding of MVC separation is correct, I haven't been able to find a clear answer anywhere online. So is this the right way to implement it (in Java):
I would have 3 .java files, one each for Model, Controller, View.
I would put all the classes related to Model in the Model.jav... |
At the company I work for, we're currently splitting up our monolith solution into a number of small services (SOA).
The purpose of this is to make the developers working on each chunk of code (service) more independent, and on the whole to make the code base more manageable. When a change in code is introduced, only ... |
The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was:
user.isAdmin()
This prompted a comment which was repeated several times and up-voted many times:
A user shouldn't decide whether it is an Adm... |
In the application I am currently working on, there are generally 3 types of HTTP calls:
pure GETs
pure POSTs (updating the model with new data)
"GET" POSTs (posting down an object to get some data back, no updates to the model)
In the integration service, generally we name methods that post "postSomething()", and me... |
I've always programmed in procedural languages and currently I'm moving towards object orientation. The main problem I've faced is that I can't see a way to practice object orientation in an effective way. I'll explain my point. When I've learned PHP and C it was pretty easy to practice: it was just matter of choosing ... |
Using TYPE_LINEAR_ACCELERATION suppose I found out that the device is moving at 4 m/s².
a(t)=s"(t)=+4
v(t)=∫4tdt
s(t)=2/3t³
s(3)=18m
How much accurate it would be?
|
I'm building a WPF application using the MVVM pattern. Right now, my viewmodels calls the service layer to retrieve models (how is not relevant to the viewmodel) and convert them to viewmodels. I'm using constructor injection to pass the service required to the viewmodel.
It's easily testable and works well for viewmod... |
I have table data containing an integer value X ranging from 1.... unknown, and an integer value Y ranging from 1..9
The data need to be presented in order 'X then Y'.
For one visual component I can set multiple index names: X;Y
But for another component I need a one-dimensional integer value as index (sort order).
If ... |
This is a question on a home work. I've been up and down my notes and I can't even see how the two are related. Googling this gives me questions/answers on one or the other, but never both.
|
It seems I heard that header files are not considered copyrightable since they can only be written one way (like a list of ingredients or facts). So a header file for a specific DLL will always look the same when written in a given programming language. Unfortunately I can't find any resources to back this up.
So if a... |
Like the title says. The post conditions of a routine must be a subset of the preconditions for the routine?
The way I understand post-conditions is that they are entirely independent of preconditions, so my understanding leads me to think that they are not a subset of preconditions.
Any input would be appreciated.
|
I work in a company where multiple teams each work on different parts of a software product in a vaguely agile/scrum manner. Mostly the organisation works well but there have been instances where a team may make a change without realising its impact on other teams.
Where dependence is known communication has been good... |
The New York Times is reporting that the Healthcare.gov website contains "about 500 million lines of software code." This number, attributed to "one specialist", and widely repeated across the interwebs, seems incredibly far-fetched (even assuming a large fraction of that number includes standard libraries). If this is... |
I am trying to build a very simple console-based game with a focus on using OOP instead of procedural programming because I intend to build up on that code for more complex projects.
I am wondering if there is a design pattern that nicely handles this use case:
There is a Player class with a MakeMove() method interac... |
I have 3 levels of permission to see the product:
Brand -> Allow/Deny
Category -> Allow/Deny
Product -> Allow/Deny
For example, product A has:
Category: Allow
Product: Deny
=> product A cannot be seen because product A isn't allowed in Product level.
if(allowForCategory == true) {
if(allowForProduct == false) r... |
AFAIK, a lot of C++ projects don't allow exceptions and deny them in coding guidelines. I have a lot of reasons, for example, exception is hard to handle correctly if your binary needs to be compiled by separate and different compilers.
But it doesn't fully convince me, there is a lot of projects which are just using o... |
I am working on writing a service layer for an order system in php. It's the typical scenario, you have an Order that can have multiple Line Items. So lets say a request is received to store a line item with pictures and comments. I might receive a json request such as
{
'type': 'Bike',
'color': 'Red',
'c... |
I have a set of data about songs. Each entry is a line of text which includes the artist name, song title, and some extra text. Some entries are only "extra text". My goal is to resolve as many entries as possible to songs on Spotify using their web API.
My strategy so far has been to search for the entry via the API -... |
I have a program in Microsoft Access that processes text and also inserts data in MySQL database. This operation takes 30 mins or less to finished.
I translated it into VB.NET and it takes 2 hours to finish.
The program goes like this:
A text file contains individual swipe from a corresponding person,
it contains the... |
I am working on a "spaghetti-code" project, and while I am fixing bugs and implementing new features, I also do some refactoring in order to make the code unit-testable.
The code is often so tightly coupled or complicated that fixing a small bug would result in a lot of classes being rewritten. So I decided to draw a l... |
I'm looking for a HashFunction(X,Y: Integer): Integer that is monotonically increasing on X, then Y.
So:
HashFunction(x1,y1) > HashFunction(x2,y2) if x1>x2
HashFunction(x,y1) > HashFunction(x,y2) if y1>y2
Does such an animal exist?
Background: This question arises from a comment on
How to create single integer index v... |
As Reactive Programming model is perfectly suited to address the change propagation required for transaction processing, that is, when the server receives change (Insert, Update, or Delete) requests. The key approach borrows heavily from Domain Driven Design to provide declarative Domain Logic. But how does it differ f... |
I'm writing a grails application and am not sure what the best practice is with regard to comments outside of method blocks. I've done a bit of research and there seems to be conflicting views on how and when these sort of comments should be used.
In lots of source code I have seen there seems to be comments above ever... |
I have a client who is given a tab delimited .txt file containing hundreds of thousands of rows.
I have a user story as follows:
As a user I want to take the text file and add a new value at the end of each line which contains the concatenated value of two of the columns.
for example if the file read
text_one text... |
From my understanding, an ElementCollection has no primary key, is embedded with the class, and cannot be queried. This sounds pretty hefty, but it allows me the comfort of writing an enum class which also helps with internationalization (using the enum key for lookup in my ResourceBundle).
Example: We have a user on a... |
I am involved with an international research project which involves many different universities, national labs, and companies. The project is developed by national grants and in-kind support.
One task in the project is to develop code to streamline workflow in our domain (energy simulation) by scripting common pre- and... |
I need some advice on project management.
I start a project, and often times it will a large project for a solo developer. Usually its a web project. I handle everything from the UI, to the JS, PHP, server management etc. Half way in I feel out of my depth. I lose where I am, so I spend a couple of days away from the p... |
I don't quite follow how it works. According to the MSDN Article there is a big hierarchy of keys protecting other keys and passwords. At some point the database is encrypted. You query the database which is encrypted, and it works seamlessly.
If you're able to simply connect to the database as normal and not have to w... |
I want to create two applications that will have a lot of common functionality. Basically, one system is a more advanced version of the other system. Let's call them Simple and Advanced. The Advanced system will add to, extend, alter and sometimes replace the functionality of the Simple system. For instance, the Advanc... |
I work for a company in software research department. We use algorithms from our real software and wrap them so that we can use them for prototyping. Every time an algorithm interface changes, we need to adapt our wrappers respectively.
Recently all algorithms have been refactored in such a manner that instead of accep... |
Can anyone explain me what byte stream actually contains? Does it contain bytes (hex data) or binary data or english letters only? I am also confused about the term "raw data". If someone asked me to "reverse the 4 byte data", then what should I assume the data is hex code or binary code?
|
I'm diving deeper into developing RESTful APIs and have so far worked with a few different frameworks to achieve this. Of course I've run into the same-origin policy, and now I'm wondering how web servers (rather than web browsers) enforce it. From what I understand, some enforcing seems to happen in the browser's end ... |
I'm writing a Server/Client application where clients will connect to the server. What I want to do, is make sure that the client connecting to the server is actually using my protocol and I can "trust" the data being sent from the client to the server.
What I thought about doing is creating a sort of hash on the clie... |
I am working on developing a personal temperature logging viewer based on my rasppi curl'ing data into my web server's api. Temperatures are taken every 2 seconds and I can have several temperature sensors posting data. Needless to say I will have a lot of data to handle even within the scope of an hour. I have impl... |
It may sound naive, but is there any programming language, or research thereof, based entirely on category theory?
I mean this as opposed to embedding CT concepts as an additional feature (like for Haskell or scala).
Would it be too abstract or too complex as an approach, or are there any known reasons that makes it im... |
I'm looking for a data structure for working with a set of data which is most efficient to do the following :
Check whether an item has been categorized or not. (The categorized and uncategorized set are disjoint sets).
Get the category of an item.
Get all the items in a particular category.
Get all the uncategorized ... |
Sometimes, especially when working with third party code, I write unit-test specific code in my production code. This happens when third party code uses singletons, relies on constants, accesses the file-system/a resource I don't want to access in a test situation, or overuses inheritance. The form my unit-test specifi... |
Are there any programming languages that support the use of unicode logic operators? For example, many programming languages use "!=" as the "does not equal"
operator, but in mathematics the symbol is "≠".
Since unicode is now more standardized, why don't programming languages support their use as logical operators? M... |
Our web application has static content packaged as part of WAR. We have been planning to move it out of the project and host it directly on Apache to achieve the following objectives.
It's getting too big and bloating the EAR size resulting in slower deployment across nodes. Faster deployment times.
Take the load of A... |
I'm trying to create a rails app that allows users to submit information about their pets. I've come to a point where my knowledge is limited and I don't know enough about what/how this could be done so I'm hoping this will be relatively easy to answer.
At the moment I have a model called Pet, this model currently sto... |
Why do we use to talk about addresses and memory of variable in C, where in other languages (like in Java, .Net etc) we do not talk about variable address and memory in a program, we will directly use the variables.
But in C Language we are listening the word address and memory.
How to explain this?
I hope C is high le... |
I am a beginner in programming in general and web development in particular. I am especially bad at regular expressions. Recently I was involved in building a couple of cPanel plugins(Perl-CGI) and that's when I realized how bad I am in regex. As a result, I have decided to build an online regex builder - this will hel... |
I am working on a tool which has been developed for the use in my organization. Recently the management decided to make this open source. This will be the first open source contribution from my company and by me .
How can I make a project open source which will also show that this is from this organization?
Is just na... |
I currently feel like I am over-using multi-threading.
I have 3 types of data, A, B and C.
Each A can be converted to multiple Bs and each B can be converted to multiple Cs.
I am only interested in treating Cs.
I could write this fairly easily with a couple of conversion functions. But I caught myself implementing it w... |
I was recently told that using Enum:
public enum TaskEndState { Error, Completed, Running }
may have compatibility/serialization issues, and thus sometimes it's better to use const string:
public const string TASK_END_STATE = "END_STATE";
public const string TASK_END_STATE_ERROR = "TASK_END_STATE_ERROR";
public const ... |
There is a two-dimensional array describing a HTML table. Each element of the array consists of:
the cell content
rowspan
colspan
Every row of this two dimensional array corresponds to <td> cells of a <tr> of the table which my software should generate.
I need to "reverse" the array (interchange vertical and horizont... |
Why do we say "Object-oriented programming" and not simply "Object programming"? Why do we speak of orientation in just this case, and not "Functionally-oriented programming" and so?
|
One of the things that I have never been happy with on any project I have worked on over the years and have really not been able to resolve myself is exactly at what tier in an application should human readable error information be retrieved for display to a user.
A common approach that has worked well has been to retu... |
Would like to hear from those working in a PCI compliance environment and is practicing agile development and devops methodology, how you maintain compliance with PCI requirements.
Specifically, what do you do to address:
separation of duties between development/test and production
alignment of continuous integration ... |
I'm trying to figure out a way to match users based on specific personality traits. Each trait will have its own category.
I figure in my user table I'll add a column for each category:
id name cat1 cat2 cat3
1 Sean ? ? ?
2 Other ? ? ?
Let's say I ask each user 3 questi... |
I just read that the execution time of the append operation for a List (:+) grows linearly with the size of the List.
Appending to a List seems like a pretty common operation. Why should the idiomatic way to do this be prepending the components and then reversing the list? It can't also be a design failure as implement... |
So I am trying to understand this TLB (Translation Lookaside Buffer). But I am having a hard time grasping it.
in context of having two streams of addresses, tlb and pagetable.
I don't understand the association of the TLB to the streamed addresses/tags and page tables.
a. 4669, 2227, 13916, 34587, 48870, 12608, 49... |
In Haskell, there are a few different options to "parsing text". I know of Alex & Happy, Parsec and Attoparsec. Probably some others.
I'd like to put together a library where the user can input pieces of a URL (scheme e.g. HTTP, hostname, username, port, path, query, etc.) I'd like to validate the pieces according to t... |
Sorry if I am asking a trivial question but I have been searching for a while without any luck. I need to design a system and I am looking for advice on the technology that should be used.
The layout is very simple: it is a sales application with a centralized database and multiple clients. Each salesperson has GUI app... |
Lets say I'm using Node-Webkit, an MIT licensed app runtime. Now, let's say I decide to include a Javascript library which is GPL licensed: while I do not modify the downloaded JS file, I do write my own code making use of the library's functions. I plan to sell the final obfuscated executable and I'm wondering: what's... |
I'm building a website in ASP.NET (Web Forms) on top of an engine with business rules (which basically resides in a separate DLL), connected to a database mapped with Entity Framework (in a 3rd, separate project).
I designed the Engine first, which has an Entity Framework context, and then went on to work on the websit... |
I'm a bit confused about architectural choices for the web-applications/java/python world. For c/c++ world the available (open source) choices to implement web applications is pretty limited to zero, involving java or python the choices explode to a,- hard to sort out -, mess of available 'frameworks' and application a... |
Motivation
The main idea is to explore and understand the limits of how far one can go with the basic LINQ primitives (Select, SelectMany, Concat, etc.). These primitives can all be considered functional operations on a theoretical sequence type. Taking examples from Haskell:
Select 'lifts' a function into the sequenc... |
I am presented with a dilemma while trying to re-designing the class structure for my PHP/MySQL application to make it more elegant and conform it to the SOLID principle.
The problem goes like this:
Let as assume, there is an abstract class called person which has certain properties to define a generic person, such as ... |
We are developing application level code that runs on an ARM processor. The BSP (low level code) is being delivered by a 3d party so our code sits just on top of this abstraction layer (code is written in c++).
To do unit testing, I assume we will have to mock/stub out the BSP library(essentially abstracting out the HW... |
Everyone says sequence diagrams are so easy but I just cannot figure this out. Basically user clicks on an 'Import from temp folder' button, the program opens a window with a list populated with filenames, user clicks on a filename, clicks on OK and the document is imported.
I know the order of the actions but how to d... |
What are the steps needed to be taken to group related classes into packages in Java?
In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC pattern. One package for Model classes, one package for View classes and one package for Controller classes. I've identified ... |
I'm working on an old vb6/access2003 app which is used to handle orders, bills of materials and that sort of things. I'm thinking about creating a form that I call every time the users needs to search for something. This should work like these:
Click on the field to complete, let's say name of a buyer
Open new form, s... |
In some computer master program online application, it says:
Please list the programming languages in which you have written
programs. For each language, indicate the length in lines of the
longest working program you have written in that language. You may
approximate, but only count those parts of the program ... |
I'm noticing a trend towards using a dictionary of string to object (or sometimes string to string), instead of strongly typed objects. For example, the new Katana project makes heavy use of IDictionary<string,object>. This approach avoids the need to continually update your entity classes/DTOs and the database tables... |
In an interview with John Hughes where he talks about Erlang and Haskell, he has the following to say about using stateful libraries in Erlang:
If I want to use a stateful library, I usually build a side
effect-free interface on top of it so that I can then use it safely in
the rest of my code.
What does he mean ... |
Let's say we have a backlog of User Stories, each with an estimated number of Story Points, and now we're doing the Sprint Planning.
Now, the Stories should be broken down into tasks and many Scrum resources suggest that each task should be estimated in person-hours. Since all questions have been discussed by the team... |
I am trying to understand the point of Odata and when it would make sense. Right now how I work is I use ASP.NET and MVC/WebApi controller to serialize/deserialize objects into JSON and have javascript do something with it.
From what I can tell the benefit of OData is being able to query directly from the URL ... But ... |
I couldn't think of a good way to word the title, sorry. But what I mean is, is it considered bad practice to do:
print get_array()[2]
over:
output=get_array()
print output[2]
(where get_array() is a function that returns an array, if that wasn't clear). Which method is better? Why?
|
I want to use a MS-PL licensed library in a proprietary software, but it'll run inside my company, with no external distribution.
Does the license allows this kind of usage or it constitutes a violation of the license?
|
Conventionally, which of the above documents is deemed to hold the most weight when it comes to system acceptance?
I recently had a conversation along these lines:
It was argued that the initial requirements / tender documentation should be used to determine system acceptance. It was said that the solution design only ... |
I am currently working on the definition of the documentation architecture of a system, from customers needs to software/hardware requirements.
I encounter a big problem with the level of refinement of requirements.
The classic architecture is : PTS --> SSS --> SSDD --> SRS/HRS
with PTS : Purshaser Technical Specifica... |
I write web-based software and simple website ("Home", "Who we are", "Contact").
For a simple website I'm using a covered GPL v3 framework. The user surf the website, send an email, take info, etc. I repeat: simple website, not a Joomla or Wordpress.
1) Will the website be covered with the GPL? I don't modify the frame... |
OK. I am learning design patterns. Every time I see someone code an example of a design pattern they use interfaces. Here is an example:
http://visualstudiomagazine.com/Articles/2013/06/18/the-facade-pattern-in-net.aspx?Page=1
Can someone explain to me why was the interfaces needed in this example to demonstrate the fa... |
Every single time there's a discussion about a new programming language targetting the JVM, there are inevitably people saying things like:
"The JVM doesn't support tail-call optimization, so I predict lots of exploding stacks"
There are thousands of variations on that theme.
Now I know that some language, like Clojure... |
I studied in the field of Computer Science for 6 years, bachelor's degree and master's degree. I have studied all the basic programming like C, Java, VB, C#, Python, and etc. When I have free times, I will learn new programming languages and follow new programming trends by myself , such as PHP, HTML5, CSS5, LESS, Boo... |
is it good Coding Practice to add style to the <html> tag of a web document?
why should you not style the <html> tag of a web document?
I ask this because of this answer on a StackOverflow question.
Personally I don't think this is good coding practice.
is there a WC3 standard that says this is good/bad?
|
Say you have a range of values (or anything else) and you want to iterate over the range and stop at some indeterminate point.
Because the stopping value could be anywhere in the range, iterating sequentially is no good because it causes the early values to be accessed more often than later values (which is bad for thi... |
In SQL, NULL means "unknown value". Thus, every comparison with NULL yields NULL (unknown) rather than TRUE or FALSE.
From a conceptional point of view, this three-valued logic makes sense. From a practical point of view, every learner of SQL has, one time or another, made the classic WHERE myField = NULL mistake or le... |
Core Data seems to add a needless layer of complexity. If you want to save data created natively by the user in an app why not just use an object and then write the data all to SQLite or back to a server using a RESTful script if necessary.
Android doesn't have Core Data (though if it has something similar I haven't s... |
I'm designing a 3-tiered application using ASP.NET MVC 4. I used the following resources as a reference.
CodeProject: MVC + N-tier + Entity Framework
Separating data access in ASP.NET MVC
I have the following desingn so far.
Presentation Layer (PL) (main MVC project, where M of MVC was moved to Data Access Layer):
My... |
I am busy designing a TCP Server class in C# that has events and allows the user of the class to define packets that the server can send a receive by registering a class that is derived from my "GenericPacket" class. My TCPListener uses Async methods such as .BeginReceive(..);
My issue is that because I am using the .... |
Is there a Convention or common way for using super class functions and members?
For example the super class has the function protected void Foo() and protected int myInt;
In subclass would I want to refer to those simply as the Foo() and myInt or as super.foo() and super.myInt . Or some other way.
|
In my ASP MVC application I decided to add another Business Layer and made the model only to have properties.
All other functionality like save to db, get from db is done on this new Business layer. So now the controller will be calling this business layer and model for various operations. Is it a good approach to desi... |
In Python we have yield which is very similar to that one which is proposed in ES6 (in fact, pythonic co-routines were the main source of inspiration for implementing co-routines in
I wonder what are the reasons for choosing a separate function* () syntax for generators compared to just defining "regular" functions wit... |
I'm using a CRON on AppEngine and the cron calls my web app at a specific app.
I only want to execute functionality when called by my AppEngine app.
What's is/are recommended approach to confirming that the caller is legitimate? I don't wish to rely on no one else knowing the specific URL.
|
I know that in agile requirement changes should not only be planned for but also embraced. But I still don't know agile how to handle these changes.
|
I've been working for a consulting firm for some time, with clients of various sizes, and I've seen web applications ranging in complexity from really simple:
MVC
Service Layer
EF
DB
To really complex:
MVC
UoW
DI / IoC
Repository
Service
UI Tests
Unit Tests
Integration Tests
But on both ends of the spectrum, the qu... |
What would be the way to design a system which has logic that may change year wise?
There is an application which conducts online exams.
There are five questions for a particular subject. The questions may (or may not) change year wise.
As per my current design, the questions in database are stored year wise. There are... |
I am working on a project for school, where I have to analyze the performances of a few fixed-priority servers algorithms (polling server, deferrable server, priority exchange) using a simulator in the case of hybrid scheduling, where we have both hard periodic tasks and soft aperiodic tasks.
In my model I consider tha... |
I inherited some old javascript code for a website tracker that submits data to the server using a script url:
var src = "http://domain.zzz/log/method?value1=x&value2=x"
var e = document.createElement('script');
e.src = src;
I guess the idea was that cross domain requests didn't haven't to be enabled... |
In certain corners of the PHP meta-programming world, it's become fashionable to use PHPDoc comments as a mechanism for providing semantically meaningful information to a program. That is, other code will parse the doc blocks and do something significant with the information encoded in those comments.
Doctrine's annot... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.