Home » Programming Languages » Page 5
When to use Constructor and when to use Collection Initializer?
21/12/2015 7:12 pm by Mistere in Programming Languages

I am having a .Net class which has 10 properties like given below: [the datatypes of individual property is just a placeholder here and it can be anything from a primitive type to an object to a list of objects]

class MyClass
{
   internal int Property1{Get;Set;}
   internal string Property2{Get;Set;}
   internal Myclass2 Property3{Get;Set;}
   internal MyAnotherClass Property4{

In general, is it worth using virtual functions to avoid branching?
21/12/2015 7:12 pm by cpacini in Programming Languages

There seems to be rough equivalents of instructions to equate to the cost of a branch miss virtual functions have a similar tradeoff:

  • instruction vs. data cache miss
  • optimization barrier

If you look at something like:

if (x==1) {
   p->do1();
}
else if (x==2) {
   p->do2();
}
else if (x==3) {
   p->do3();
}
...

New Kind of VM Type
21/12/2015 7:12 pm by scsscs in Programming Languages

I have designed my own kind of vm, a sort of stack-register. It works by having a stack but instead of pushing and popping values, you simply store the values on the stack, and add together different addresses.

For example add would be #add addressTo, address1, address2. It might sound like a register machine, but everything is stored on the stack instead of register and local variables

TAGS : Kind Type

Efficiently determining many-to-many subset relation
21/12/2015 7:12 pm by jmccliment in Programming Languages

I'm doing market basket analysis. I have a set of transactions. Every transaction is a set of items that were bought. I then have a set of itemsets (i.e. a set of items) that I want to determine the support for. The support of an itemset is defined as the number of transactions of which the itemset is a subset. I'm only interested in those itemsets with a support abov


Why is it inappropriate to use UML diagrams to plan how your code will be organized?
21/12/2015 7:12 pm by Timur Asaliev in Programming Languages

So, yes, diagrams can be inappropriate at times. When are they inappropriate? When you create them without code to validate them, and then intend to follow them. There is nothing wrong with drawing a diagram to explore an idea.

Agile


Getting r-sized subsets [on hold]
21/12/2015 7:12 pm by Rit Li in Programming Languages

I'm looking for an efficient algorithm to get all r-sized combinations of a set's elements. This could be achieved by choosing all subsets of the power set of size r. However, since the size n of the set is around 1400, calculating this takes forever (with r = 10). E.g.:

set(itertools.combinations(s, 10))

Tak


Is it true that for Observer Pattern to work, there probably is some polling mechanism underneath?
21/12/2015 7:12 pm by Pedro Varela in Programming Languages

The short question is: is it true that for Observer Pattern to work, there probably is some polling mechanism underneath? (update: in a network situation)

It was quite amazing that if on my Macbook Pro, I save a file Hello World.txt into the Dropbox folder, then I actually see it appearing on my other Macbook within 1 second or 2.

It is even more amazing that, on th


Which OS to base custom UI on? [on hold]
21/12/2015 7:12 pm by Minh Nguyen in Programming Languages

I'm currently doing a hobbyist-build of a custom gaming console. The object of the project is to come away with a mini-itx htpc that when powered on brings up a custom UI that displays a panel holding the loaded game's thumbnail until you start the game with a generic PC controller. My question is, after narrowing down my top two operating systems to android and freebsd, which operating system


How do you reference files inside .cab files?
21/12/2015 7:12 pm by eb. in Programming Languages

I may very well be asking this question wrong, so I apologize if it is.

I am building a .exe program and I am wanting to consolidate the associated files into .cab's (other compression's are open to ideas).

My question is, within the program itself, how do I reference a file that has been put inside the .cab file? So as of right now, a typical example would be src="imagesimage1.


Signature-changing decorator: properly documenting additional argument
21/12/2015 7:12 pm by brennen in Programming Languages

Let's say I have a custom decorator, and I want it to properly handle docstring of decorated function. Problem is: my decorator adds an argument.

from functools import wraps

def custom_decorator(f):
    @wraps(f)
    def wrapper(arg, need_to_do_more):
        '''
        :param need_to_do_more: if True: do more
        '''
        args = do_something(arg)

        if need_to_d

Why are programming language executables so large? [duplicate]
21/12/2015 7:12 pm by evident in Programming Languages
What reasons would someone separate instantiation and data loading? [duplicate]
21/12/2015 7:12 pm by Brian O'Neill in Programming Languages

This question already has an answer here:


Java Game. Preload objects and reuse vs create objects at runtime
21/12/2015 7:12 pm by Soccer55 in Programming Languages

I'm currently developing my first game in Java language.

The game is an endless runner with obstacles to avoid and enemies to kill. Unfortunatelly im still not experience enough and many times im just improvising. I have no idea if my method of loading of obstacles is good or bad in terms of performance (how fast a game runs, how much fps).

Currently my cod


What is the most efficient way to implement a RESTful client app?
21/12/2015 7:12 pm by dreshyne2g in Programming Languages

I am working on a project which basically send an HTTP request to a bunch of RESTful web service and parse the response (" Which is json & XML formatted ), then render the result on a web browser .

The first approach I was thinking of was to code all the logic on a server side using python: recieve requests from user,sending it to the webservice and getting


I need a good practical Julia data frames tutorial
21/12/2015 7:12 pm by avi in Programming Languages

I'm not an advanced programmer, I can figure out how to write programs if I have a good tutorial that shows how to include features of a language in an actual program but I can't learn from documentation or list comprehension examples. Ideally I want a tutorial that shows how to work around a Julia data frame. Right now my problem is that I'm trying to add a column with a simple moving averag


Drawbacks of a master error handler?
21/12/2015 7:12 pm by Adam May in Programming Languages

I'm thinking that I could simplify my life by making an exception handling class that I can just ship all exceptions to and it will handle appropriately.

Ideally:

def dostuff():
  try:
    dothis()
  except Exception e:
    Handler.handle(e)

To avoid

def dostuff():
  try:
    dothis()
  except ValueError e:
    #handle ValueError
  excep

Why is Prolog good for AI programming?
20/12/2015 8:56 am by Mistere in Programming Languages

I am researching programming languages used for AI programming. I know that LISP is taught as an AI programming language in my university, but Prolog rarely is. I am kind of fond of Prolog, but I'm not an AI programmer so I don't think I'm qualified to judge for myself why Prolog is better than LISP/Scheme. I was wondering if Programmers had any input on this topic.

How could you argue


What does it mean when data is scalar?
20/12/2015 8:56 am by tl1000sv in Programming Languages

I don't know what scalar means exactly, but I'm trying to see if I'm thinking about it correctly. Does scalar relate to arbitrariness where the type of data could be any type, or a system is not able to know what the data is in advance.


How to approach syntax errors when developing a lexical analyser?
20/12/2015 8:56 am by FuzzyHornet in Programming Languages

I am writing an interpreted domain-specific language for my application. Each statement is parsed and executed as soon as lexical analyser decides that the end of statement is reached. It's handling one token at a time and makes recursive calls evaluating expressions and reducing current token stack.

It intuitively makes sense for the parser to first check for syntax errors before actua






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