Wednesday, April 20, 2011

Differences between CTP, Alpha, Beta, Gamma, RTM and Preview for Software Release?

It is quite intuitive that at least Gamma comes after Beta and Alpha.

But how about CTP, RTM and Preview releases? Which one comes first and last?

MEF (Managed Extensibility Framework) is currently on Preview 5 release, but I am not sure if it is a release before Alpha or after Beta, CTP or RTM. Is it OK to use preview releases in production code?

What are the differences between those releases? I am particularly interested in knowing differences between

  • RTM
  • CTP
  • Beta
  • RC
  • Preview

releases.

It seems like everywhere each releases mean different things.

From stackoverflow
  • The answer is "It depends".

    All of these badges mean different things for different people, and things like "CTP" and "Preview" even more so.

    Where relevant (e.g. frameworks) most preview/beta/ctp releases will come with information about whether they should be used in shipping code or not. Generally if they require an end-used redistributable the answer is no.

    Sung Meister : So does that mean, using a Preview release software like MEF probably is not a good idea in a production code?
    : Don't use it in production code!
  • The stages are typically Alpha, Beta (can be broken into Internal vs. External), Release Candidate (RC), Release to Manufacturing (RTM). "Community Technology Preview" (CTP) or just plain "Preview" are, in my opinion, merely euphemisms for Beta (which implies "contains plenty of bugs").

  • It can very by company to company. They are usually defined like this:

    • CTP - Community Technology Preview - Not beta quality, not as wide-spread. Not necessarily feature-complete. Usually intended for partners who will build on top of the product.
    • Preview - Usually like a CTP.
    • Beta - Widespread release. Expected to be mostly stable, feature complete.
    • RTM - Release to manufacturing. Final release of the product, the "Gold" release.

    As for using previews in production code, it depends again, but is usually a bad idea. They are usually not that well supported.

    Sung Meister : I am still not able to grasp the difference between CTP and Preview. But from the description at least RTM comes later than Beta does.
  • I've most commonly seen those terms used in the following ways

    • CTP (Community Technology Preview): Very much like "Show and Tell". Features are present to varying degrees and customer can get an idea of where the release is going
    • Beta: Features are mostly implemented but still have rough edges. Quality is fair at this point. The higher number beta, the higher the quality
    • RC (Release Candidate): Product believes it's ready to ship. One last chance for customers to provide feedback and find major blocking issues
    • RTM (Release to Manufacturing): Product is complete and ready to be shipped to customers

CakePHP Multiple Tables For Model

Can a model have multiple tables in CakePHP?

From stackoverflow
  • Guessing from this sentence in the manual:

    A model is generally an access point to the database, and more specifically, to a certain table in the database. By default, each model uses the table who's name is plural of its own, i.e. a 'User' model uses the 'users' table.

    I don't think so, but you can make relationships maybe thats what you need.

    Check this

  • It can't have multiple tables at the same time..., but you might be able to modify the Model::useTable property to switch the model's table to a different one. Give it a whirl and let us know if it works.

  • Technically, based on the way you're asking the question, not that I know of. Often, though, I'll use relationships to something that might be similar to what you're after. For example, a person has address information that can be dropped in the people table easily enough, but I usually prefer to pull that out because other entities can also have addresses (a business, etc.).

    Same idea if you want to implement some kind of pseudo-inheritance model in your DB. For example, volunteers are people, but so are contractors, vendors and employees. The all share certain properties that you might want to store in a people table and others that are unique to the type of person they are.

    In each case you have two models, but they work together seamlessly via their associations.

    If that's the kind of scenario you're thinking about then a similar approach might work for you although it's not about a model having multiple tables.

  • Hi,

    I guess you want to implement some sort of inheritance in the database (that requires to join the data stored in the parent table when retrieving information from the child table). My approach to solve this was using afterFind callback in the child model. I redefined the callback as follows:

    function afterFind($results) { foreach ($results as $key => $val) { $fieldRetrieved=$this->query("SELECT field FROM *parent_table* WHERE id={$val['ChildModelName']['id']}"); $results[$key]['ChildModelName']['field']=$fieldRetrieved[0]['*parent_table*']['field']; } return $results; }

    In this way I was including the field/s from the parent table to the results obtained from the child table. In this case I've assumed that both tables are index with a field called id and that field, in the child table, is also a foreign key to the parent table (thus creating the pseudo-inheritance).

IronPython and C# - Script Access to C# Objects

Hi all,

Consider the code below:

ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null);
ScriptRuntime runtime = new ScriptRuntime(setup);
ScriptEngine engine = Python.GetEngine(runtime);
ScriptScope scope = engine.CreateScope();

scope.SetVariable("message", "Hello, world!");
string script = @"print message";
ScriptSource source = scope.Engine.CreateScriptSourceFromString(script, SourceCodeKind.Statements);
source.Execute();

This code yields the following exception:

Microsoft.Scripting.Runtime.UnboundNameException was unhandled Message="name 'message' is not defined"

What am I missing?

From stackoverflow

How to highlight only the text on hover, not whitespace? (javascript)

I am using jquery to highlight on hover, but it highlights entire div instead of just text. I tried using an "a tag" but do not want a reference link obviously. im sure this is simple, but im wasting too much time on trial and error. tia

From stackoverflow
  • You should use an inline tag like <span>

  • Wrap the text in a span then highlight that.

Is there any Wicket-like web framework to use with Scala (besides lift)?

Hello

I want to start a project using the Scala language. While searching for web frameworks I've found Lift. However, it is not what I was looking for: a web framework that has complete separation of HTML and code. Lift does have some nice features (and a learning curve) but we need to have complete separation of HTML and code. I was hoping to find something like Wicket, Tapestry or Barracuda for the Scala language.

Although it is nice to be able to reuse html templates, it is more important to us to have the HTML templates work as a "static application" mockup. In Tapestry we can just put links in the static templates and use that to have static navigation and a sort of prototype of the application.

So, do you know of any other web framework that is easy to work with the Scala language?

Thanks, Luis

From stackoverflow
  • Here it is I can understand why you might want it pure Scala, but you haven't stated that's necessary, and with the techniques defined within the blog post, and there is another blog which also helps, you should be able to get it close enough to what you desire.

    DFectuoso : i will vote up any answer that has a link to coderspiel =)
  • Tapestry 5 has many similarities with Wicket and works very well with Scala. I haven't tried it myself, but Francois Armand has being doing it for some time and he's writing about in in his blog.

C function seemingly not defined anywhere!

I'm looking at the vim source code, specifically the file normal.c, and I see this function nv_operator being used, but it's not defined anywhere (I grepped the entire src directory)

It's only declared as:

static void nv_operator __ARGS((cmdarg_T *cap));

I've looked up the definition of __ARGS but it's just ... nothing (pretty much)
in vim.h:

#define __ARGS(x) x

So what could be going on? Is this some kind of C technique to create a dummy function or something?

From stackoverflow
  • It's simply a forward declaration, so that the function is known to the C compiler (and can be used (called from other functions)) before it's actually defined (in line 8247). The actual formatting of the definition (which includes newlines) makes it hard to grep for it's existence.

    Don't get distracted by the __ARGS macro. It's only a compatibility macro for the different function declaration syntaxes of K&R C vs. ANSI C.

    In ANSI C a function declaration must look like this:

    int getopt(int, char * const *, const char *);

    In the (older) Kernighan and Ritchie C http://en.wikipedia.org/wiki/C_(programming_language)#K.26R_C

    int getopt();

    Roboprog : I was wondering when somebody was going to actually name "K&R" (instead of "some older versions") and "ANSI".
    Johannes Schaub - litb : non-prototype function declarations are still ANSI C conform. what's disallowed (in c99) is the implicit int rule and the implicit function declaration (function must be declared before used now) rule.
  • There is a definition present here:

    /*
     * Handle an operator command.
     * The actual work is done by do_pending_operator().
     */
        static void
    nv_operator(cap)
        cmdarg_T    *cap;
    ....
    

    That style of definition is using an identifier list for its parameters. The style is deprecated (obsolescent) but can still be used in C. The identifiers are named in the parameter list, and their type are named in declarations that immediately follow the function declarator but precede the functions body.

    The __ARGS macro is there to handle compilers that don't know about prototypes for functions (the other form to declare parameters - with type and name combined directly in the function parameter list). It would then just emit no parameters at all in declarations, i think.

    Update: See this code in vim.h:

    #if defined(MACOS) && (defined(__MRC__) || defined(__SC__))
       /* Apple's Compilers support prototypes */
    # define __ARGS(x) x
    #endif
    #ifndef __ARGS
    # if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264)
    #  define __ARGS(x) x
    # else
    #  define __ARGS(x) ()
    # endif
    #endif
    
    lothar : The __ARGS was not the original question. The "static void nv_operator __ARGS((cmdarg_T *cap));" is a forward declaration.
    Johannes Schaub - litb : Seen only one version of the question. He seems to ask about __ARGS and where the definition is. The issue with non-prototype functions is an important reason why the definition is difficult to find imho. A definition like "static void f(cmd *t) { .. } would have been way easier for him to find.
    hasen j : I never really asked about __ARGS .. just used it as a supplement to my arguments that nv_operator is not defined (because one could argue that __ARGS does some magic to make the definition work).
    Johannes Schaub - litb : oh ok. never mind then :)
    lothar : I know, that's why I pointed out that the answer to you question is that the construct is a "forward declaration". The fact that the actual definition includes newlines makes it so hard to find (grep).
    hasen j : actually, I know what a forward declaration is, I'm not *that* n00bish :)
    lothar : Never wanted to imlpy you don't know what a forward declaration is. just that it's the answer to your "So what could be going on? Is this some kind of C technique to create a dummy function or something?" question :-)
    hasen j : turned out the trick is to "slaughter" the definition to 3 lines so that you can't find it by simply grepping! >:[
    Johannes Schaub - litb : i found GNU coding guidelines generally put the return type and the function name on separate lines. so you can do this: "grep '^function_name'" and you will find the function definition very easily by that.
  • Its hard to find because of how it is defined:

    nv_operator(cap)

    appears on a line by itself.

    hasen j : I want to accept this answer (more than the other) because it's short and addresses my point directly, but it's somehow confusing in its own right because it doesn't mention where the definition is
    hasen j : and btw who down-voted it? strategic down-voting?
    ojblass : I am a bit of a simplicity nut... I look at the question and it says what could be going on? Well this is what is going on and why it seems like magic. I have seen stuff like this cost thousands of dollars in trouble shooting time.
  • I am not too sure what is going on, but here are some hints to help you in your search:

    First of all, the __ARGS macro seems to be there because there may be versions of C where you shouldn't include the args in the declaration of the functions (Notice that the macro is defined differently depending on other preprocessor symbols... the comments say it).

    Secondly, searching for the function nv_operator may not be good enough. The function might be generated by macros and such, so you can't search for an explicit definition.... for example, maybe the "nv" prefix is added by the preprocessor.

    Hope this helps.

Iterating a read() from a socket

Is this the proper way to iterate over a read on a socket? I am having a hard time getting this to work properly. data.size is an unsigned int that is populated from the socket as well. It is correct. data.data is an unsigned char *.

if ( data.size > 0 ) {
    data.data = (unsigned char*)malloc(data.size);
    memset(&data.data, 0, data.size);
    int remainingSize = data.size;
    unsigned char *iter = data.data;
    int count = 0;
    do {
        count = read(connect_fd, iter, remainingSize);
        iter += count;
        remainingSize -= count;
    } while (count > 0 && remainingSize > 0);
}
else {
    data.data = 0;
}

Thanks in advance.

From stackoverflow
  • You need to check the return value from read before you start adding it to other values.

    You'll get a zero when the socket reports EOF, and -1 on error. Keep in mind that for a socket EOF is not the same as closed.

  • Low level socket programming is very tedious and error prone. If you use C++ you should try to use higher level libraries like Boost or ACE.

    I would also suggest to read C++ Network Programming: Mastering Complexity Using ACE and Patterns and C++ Network Programming: Systematic Reuse with ACE and Frameworks

    Brian R. Bondy : boost asio in particular.
    lothar : oops :-) that happens when one does type and not copy/paste ;-)
  • Put the read as part of the while condition.

    while((remainingSize > 0) && (count = read(connect_fd, iter, remainingSize)) > 0)
    {
        iter += count;
        remainingSize -= count;
    }
    

    This way if it fails you immediately stop the loop.
    It is very common pattern to use the read as part of the loop condition otherwise you need to check the state inside the loop which makes the code uglier.

    Personally:
    I would move the whole above test into a separate function for readability but your milage may very.

    Also using malloc (and company) is going to lead to a whole boat of memory management issues. I would use a std::vector. This also future proofs the code when you modify it to start throwing exceptions, now it will also be exception safe.

    So assuming you change data.data to have a type of std::vector<unsigned char> then

    if ( data.size > 0 )
    {
        std::vector<unsigned char>   buffer(data.size);
    
        unsigned char *iter = &buffer[0];
        while(...  read(connect_fd, iter, remainingSize) )
        {
            .....
        }
    
        ... handle error as required
    
        buffer.resize(buffer.size() - remainingSize);
        data.data.swap(buffer);
    }
    
  • Keep in mind that read() calls are system calls and thus a source of possible blocking, and even if you use non-blocking I/O, are inherently heavyweight. I would recommend minimising them.

    A good way to go that has always served me well in over a decade of BSD socket programming in C is to use non-blocking I/O and issue a FIONREAD ioctl() to get the total amount of data waiting at a given polling interval (assuming you're using some sort of synchronous I/O mux like select()) and then just read() that amount as many times as necessary to capture all of it, and then return the function for the moment until the next timer tick.