I got a question for you guys on C# code writing:
I had a long debate with collegue of mine:
He says that by declaring and initilizing all variables in the beginning of the function make code more readable and fast.
Please give me at least one sane reason that it could be right.
1. It's not readable as if you have a long function, yo...
I've got a DIV that shows on a hover event, and hides on a hover event on the #main div, but I can't help but feel like I've not done it correctly - more like a hacked together version ..
Can someone take a look and provide options for a more efficient way of doing it?
The jQuery
$(".sign_in").hover(function() {
$("#sign_box")....
Hi,
Recently I'm encountering this type of code ever more frequently:
List<Something> list = new LinkedList<Something>();
// add a bunch of constants to the list
// keep in mind that the number of items added is known on list creation
return list.toArray(new Something[list.size()]);
Now in my honest opinion this is improper use of th...
Hi all,
i´d like to assign factors representing quantiles. Thus I need them to be numeric.
That´s why I wrote the following function, which is basically the answer to my problem:
qdum <- function(v,q){
qd = quantile(v,1:(q)/q)
v = as.data.frame(v)
v$b = 0
names(v) <- c("a","b")
i=1
for (i in 1:q){
if(i == 1)
v$b[ v$a < ...
I'm moving a Google App Engine web application outside "the cloud" to a standard web framework (webpy) and I would like to know how to implement a memcache feature available on Gae.
In my app I just use this cache to store a bunch of data retrieved from a remote api every X hours; in other words I don't stress this cache too much.
I'v...
Hello,
I was wondering if there is anyway to count the total number of code lines from an XCode project.
Thank you very much.
...
Which is the better way(efficiency/best practice wise) to test if a double variable is equal to 0?
1. if(a_double)
.....
else
.....
OR
2. if(a_double == 0)
.....
else
.....
...
Hello everybody,
this seems to be a simple question and I hope you can help me.
I'd like to add that my code works the way I'm describing it. I'm not content with the way I solved my problem concerning my problem in incrementing [i] outside the for-loop.
What I want is to get a sidebar menu shown when one hovers over an image.
My CSS...
I was performing a code review and I saw a class that a developer had created, that only contained public instance-fields. This class is not used in business logic; it is merely used to hold test data (the developer created this for a test).
Is this alright? Why or why not?
...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data;
if the execution of the code is allowed at post back, then for each post back extra column are created.
yes i know the ro...
Hi all,
well, I'm stuck and hope that you can help.
I created a text-example and put it to the end of the post. Thank you in advance.
On a site there are e.g. 50 entries - like comments. Some p-elements in some of those entries are containing a special text. This is just a snippet how I get the special text.
$("p:contains('special tex...
What are the advantages of printing code? Of course it kills many trees, but I know that in many old-school environments (especially professors) some have asked for code printouts. Is there really any advantage to doing this except destroying the environment, such as facilitating code review?
...
I have the following simple method for doing a complete search of a binary tree. I can definitely tell it can be simplified, but it's not coming to me.
bool Node::lookup(int d)
{
if (data==d)
{
return true;
}
else
{
if (left != NULL && right != NULL)
{
return left->lookup(d) && ri...
my aim is to create a db, and check if the db is there or not, at pageload
the confusions are stated beneath "BOLD TEXT" i do not see why its not clear but still as requested i adding more explanations
working fine code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Syst...