basics

update all NULL fields MySQL

Dear all, i´d like to update all NULL fields in one table to 0. Of course UPDATE mytable SET firstcol=0 WHERE firstcol IS NULL would do the job. But I wonder if there´s a smarter solution than just c&p this line for every column. Thx in advance for any suggestions ...

Representing "X of Y" in SQL

In my database, I have a lot of courses that are compulsory. Some are elective. However, there are courses of a third kind: A list from which you have to choose X courses. The list (and the number X) is different for each study program. How would you represent this relationally? ...

.htaccess headache with perl script?

Trying to get a simple test perl script working. Have the following files/folder structure on a shared hosting service: ~/public_html/ .htaccess ~/public_html/lookup Permissions: "drwxrwxrwx 2 myusername myusername" .htaccess lookup.pl* Permissions: "-rwxr-xr-x myusername myusername" The first .h...

What is meant by "functions with a variable number of parameters"?

In C, what is meant by "functions with a variable number of parameters"? ...

In JavaScript, does it make a difference if I call a function with parentheses?

Hi, I noticed a different when calling a function with empty parentheses, or without any parentheses at all. I am not passing any arguments to the function so I wondered what would be the difference between: window.onload = initAll(); and window.onload = initAll; Please explain the principle behind it. Thanx in advance. ...

Need help on learning java frameworks quickly

I wrote a piece of java code using threads, JDBC, Java Mail API etc. without using any of the frameworks (read Spring). I am frankly not too comfortable learning them first (lots of terminologies to remember!) and use them. So, please suggest me some ways to refine my existing code incorporating few of these framework concepts applicable...

c++: local array definition versus a malloc call

What is the difference between this: somefunction() { ... char *output; output = (char *) malloc((len * 2) + 1); ... } and this: somefunction() { ... char output[(len * 2) + 1]; ... } When is one more appropriate than the other? thanks all for your answers. here is a summary: ...

Flash based website basics, first steps, good practices

I have a bit of Flash experience, did a full featured movie player, other stuff in AS3 and got plenty of programming skills in other languages, BUT now I need to create a multi paged website. Quite easy, a few pages, some animations here and there, nothing fancy, got all the graphics. But time is short on this one, so I need some advice ...

How to take a delimited list, parse it, and add it to list.

Hi, I'm using Groovy and Grails and am trying to take a parameter passed to a controller, parse it, and add each individual element into a list. I thought this would work, but it is adding the whole string into the list, leaving me with only one element. list = [] list.add(params["firstNames"].split()) is returning a list with size ...

grails tag library question

Hello, I am using Grails in an application that allows the inline editing of data in a data grid. There are certain key fields that may be defined and should not be editable. Here is some example code from the tag lib that I am using case "dropdown": out << "<select id='"+prefix + id+"' name='" + fieldData.code + "'>" ...

jquery: context with closures?

Hi there! I got a simple question about jQuery but rather javascript approaches in general... Is it ok, to do this? : this._checkedTexts.length = 0; // <- array belonging to "me" var contextCheckedTexts = this._checkedTexts; $('#valueContainer input:checked').each(function() { contextCheckedTexts.push($(this).text()); }); Since '...

String comparison passing through if statement when it shouldn't...

Hello, I'm comparing values of an excel sheet to record values returned from a database and one record is passing through the if statement when it should fail the if statement. The if statement looks like this: if (record.value.equals(cellVal) == false) { record.value = cellVal record.modifyUser = userId ...

Should functions always return something (Javascript)

Should functions always return something? I often write very basic functions which are used as shorthand to do things that happen a lot such as: function formsAway() { $("#login_form, #booking_form").slideUp(); } Should this function exist - is there a better way, or is this fine? ...

Book on explaining the basics of programming for inexperienced friends

Hey all, I have a friend who's going to jail on Wednesday, for about a year. I want him to utilize his time in county learning how to program and about the internet so I can help him land a job when he gets out. What are some of the best books that teach programming basics, which languages do what, how servers & databases work, how the...

Java Basics - Where are the implementations taking place?

For instance, a method returns an object of type List. public List<Foo> bojangles () ... Some piece of code calls the method FooBar.bojangles.iterator(); I'm new to Java, but from what I can tell.. List is an interface, so the iterator method has to be implemented somewhere else. When digging for the source code for Java.Util and tha...

Do you have to declare overriden @property methods in the .h file?

Hello, Beginner question here. In the .h file of an objective c class.. If you have an @property int someVar; for example.. and you're actually going to write the setter method yourself in the .m file.. do you still have to declare that setter method in the .h file? If you have some @property declarations in the .h file and you are w...

Calling JS functions assigned to varibles

Some time ago I asked a question about the same issue, @BenAlabaster explained it thoroughly in his answer, I guess I am still missing a piece of logic here. I tried to call functions that are assigned to variables like I've shown below, in the last function. Well it didn't work. Assuming it happened because the variable functionThree i...

Javascript: How can I transform an array?

I have this on a javascript var: (it's a http returned data, and I don't know if it's an array or string - (how can we see that?) - Update: using typeof returned "string", so it's a string. [{"nomeDominio":"gggg.fa"},{"nomeDominio":"rarar.fa"}] How can we pass/transform that, into something like this: ["gggg.fa","rarar.fa"] ? Than...

Form with two submits - a newbie scope question

if (isset ($_POST['somethingA'])) { //code for doing something A } elseif (isset ($_POST['somethingB'])) { //code for doing something B } I will need to access some data from somethingA code, into somethingB code. How can I do that in a proper way? Should I declare a variable outside the conditionals, work inside th...

PHP "or" operator within conditional statement - newb question!

Hi there, Forgive me if this has been covered before, I searched to no avail. I have a script that looks into a directory to find the files inside. There is a conditional line that only looks for files with a certain extension: if(strtolower(substr($file, -3)) == "mp4"){... So that will only look for files with an 'mp4' extension. ...