scudzilla 32 Junior Poster

Each image has a file name, and a parent directory (path). What does the images_path field in your database hold? File name, path, or both?

$src=$file_path.'/'.$row["images_path"];

Your code already concatenates the path regardless of your images_path value. If that field also contains the path, then you will of course have duplicate path, which is wrong.

scudzilla 32 Junior Poster

That is because prime number i does not correspond to the index of the vector. Everytime you push a value into a vector, it takes the (n+1)th address. So, if your input is 10, i values 1, 2, 3, 5, and 7 are located at indices 0, 1, 2, 3 and 4 respectively. However, you're calling the elements at indices 1, 2, 3, 5 and 7, which you haven't assigned yet at the time each of them was called.

scudzilla 32 Junior Poster

This might make you better understand:

#include <iostream>

using namespace std;



struct sct {
    int t1[2];
};

struct str {
    sct t2[2];
};

int main(void) {
   str t3[2] = { {0, 2, 4, 6}, {1, 3, 5, 7} };
   cout << t3[1].t2[0].t1[1] << t3[0].t2[1].t1[0];
   return 0;
}


And the crude diagram of your structure values...

|-------t3[0]---------| |--------t3[1]--------|
| |-t2[0]-| |-t2[1]-| | | |-t2[0]-| |-t2[1]-| |
 {  0 , 2  ,  4 , 6  } , {  1 , 3  ,  5 , 7  }
    |   |     |   t1[1]     |   |     |   t1[1]
    |   |    t1[0]          |   |    t1[0]
    |  t1[1]                |  t1[1]
   t1[0]                   t1[0]
scudzilla 32 Junior Poster

One thing you could do, as I said, is to send just the avatar names with Post, and remove the use of $action altogether, making the script one continuous function.

scudzilla 32 Junior Poster

My $0.02

Second life calls your script with three possibilities: a) open a connection; b) insert a row and; c) close the connection

a doesn't have problems, although it does nothing meaningful. It just opens a connection to the database.

b, however, calls an instance of the script different from a and in this instance, there is no connection to the database, hence the 'vangua01'@'localhost' error (b1: according to the script, your indicated user is vangua01_admin2, not vangua01)

c is plainly does nothing at this point, and is redundant anyway because the connection automatically closes when the script ends.

Might I suggest just sending the avatarname with Post, and removing the conditions for mysql connect/close?

Once again, my $0.02

scudzilla 32 Junior Poster

Which marker are you trying to set the center to? If it's one of the markers you get from the XML, which one of them (since there can be more than one)?

scudzilla 32 Junior Poster

After an INSERT query, use $id = $mysqli->insert_id. It gives $id either the last auto_increment id inserted if there is one, 0 if there's no auto_increment id field, or false if the connection failed.

scudzilla 32 Junior Poster

Why not use a list? Or maybe a dictionary?

Gribouillis commented: the good solution +14
scudzilla 32 Junior Poster

Well, for starters, could you explain the relationship of lv1T1 and lv2T1? Based on the code you've posted, the only way I can see that gives that error is that at line 4, currrentrow would equal 25, while lv1T1 has 24 or less items.

scudzilla 32 Junior Poster

The contents of listview start at index 0. If there are 25 items in it, their indices range from 0 to 24. Putting 25 there would of course be invalid for index.

scudzilla 32 Junior Poster

User defined types will pass their pointers, not their contents, when appended to vectors. The memory address of a is stored at the first slot of the vector. Because the A in the vector points to the same memory location as a, the contents of the one in the vector also changes once you execute lines 23 to 27. To prevent the change, make a a new instance of class A before changing the values.

scudzilla 32 Junior Poster

In that case, there's nothing wrong with the method except line 77: int highestrow = numbers[0][0] which should be int highestrow = numbers[row][0] to prevent the possibility of error if numbers[0][0] is higher than any number in all other rows.

scudzilla 32 Junior Poster

What's the highest row output supposed to be?

scudzilla 32 Junior Poster

That happens to me half of the time. The other half, the tab actually closes.

scudzilla 32 Junior Poster

It attempts to retrieve every type of control in the form and cast it into a label. If you want to retrieve only Labels, use oftype.

For Each lbl As Label in Form1.Controls.OfType(Of Label)()

scudzilla 32 Junior Poster

s1 == s2 checks whether s1 and s2 are references to the same object.

s1.equals(s2) checks whether the value of s1 is equal to the value of s2.

Use .equals

scudzilla 32 Junior Poster

That's because your code is trying to cast every type of control present in the form into a label.

Try this:

For Each ctrl As control in Form1.controls
    If TypeOf ctrl is Label then
        code
    End If
Next
scudzilla 32 Junior Poster

Are you referring to Category? Adding a new row with any string for Category works. It's still a single valued field. It's the attachments that's the multivalued field. Excluding attachments from your select query will get no errors in updating or inserting. You'll have to tackle attachments in amother way if you want to include that in the program. Unfortunately, I'm currently on the road so I can't be of much use for a few hours.

scudzilla 32 Junior Poster

When I include the Attachments column, update generates an Update error regarding a multivalued field. Excluding Attachment, the database gets updated correctly.

scudzilla 32 Junior Poster

Strange, it works for me though. Without the prefix and suffix, it gives me the same error. With the prefix and suffix, it gets updated correctly. I used your code exactly. What provider do you use for your oledb? What's your connectionstring and access version?

scudzilla 32 Junior Poster

Hmm try this after declaring cb and before filling data_table?

cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
scudzilla 32 Junior Poster

Wrap column names containing spaces with [ ].

scudzilla 32 Junior Poster

Your chrome bookmarks, passwords and other data are synced with your google account. That way, you can still access your data in another computer, provided you log in your account. I think they are planning on integrating android browser data into that sync as well (or they already have, and I haven't heard about it xD).

scudzilla 32 Junior Poster

In essence, isn't your query trying to get rows within the week starting from today, and not the week prior?

E: nevermind, it works for me >.< BTW in your first post it said May, and your most recent one is June. Which is it?

scudzilla 32 Junior Poster

If you don't use curly braces, only the command immediately after the if statement will be conditional. Any succeeding commands will not rely on the if statement. If you want more than one command to be conditional, place them in a block (use curly braces).

scudzilla 32 Junior Poster

In your code, y is evaluated regardless of the value of n.

scudzilla 32 Junior Poster

Use categories.get(#) to get individual elements of the arraylist. Use a for each loop to get all elements of the arraylist. Use one or the other, not both (usually, that is). JamesCherrill was just showing you both at the same time just to compare.

Anyway, inside your for loop, lines 11 and 12, since you assigned each element of categories to currentObject, use currentObject.toString() and currentObject.getCarbonFootprint()

scudzilla 32 Junior Poster

Nevermind the for loops. I was just showing you that kvothetech's solution works for all 24 combinations of 1, 2, 3 and 4. Since you asked...

scudzilla 32 Junior Poster

Code

#include <stdio.h>

int main(int argc, char *argv[])
{
    int i, a, b, c, d, w1, w2, l1, l2, x, y, arr[24][4];
    i = 0;
    //just to come up with permutations
    for(a=1;a<5;a++){
      for(b=1;b<5;b++){
        for(c=1;c<5;c++){
          for(d=1;d<5;d++){
            if(!(a==b || a==c || a==d || b==c || b==d || c==d)){
            arr[i][0]=a;
            arr[i][1]=b;
            arr[i][2]=c;
            arr[i][3]=d;
            i++;
            }
          }
        }
      }
    }
    for(i=0;i<24;i++){
      //for each combination calculates max and min
      if(arr[i][0]>arr[i][1]){
        w1 = arr[i][0];
        l1 = arr[i][1];
      }
      else{
        w1 = arr[i][1];
        l1 = arr[i][0];
      }
      if(arr[i][2]>arr[i][3]){
        w2 = arr[i][2];
        l2 = arr[i][3];
      }
      else{
        w2 = arr[i][3];
        l2 = arr[i][2];
      }
      if(w1>w2)
        x = w1;
      else
        x = w2;
      if(l1<l2)
        y = l1;
      else
        y = l2;

      printf("%d%d%d%d - %d %d\n", arr[i][0], arr[i][1], arr[i][2], arr[i][3], x, y);
    }
    system("PAUSE");    
    return 0;
}

Output

1234 - 4 1
1243 - 4 1
1324 - 4 1
1342 - 4 1
1423 - 4 1
1432 - 4 1
2134 - 4 1
2143 - 4 1
2314 - 4 1
2341 - 4 1
2413 - 4 1
2431 - 4 1
3124 - 4 1
3142 - 4 1
3214 - 4 1
3241 - 4 1
3412 - 4 1
3421 - 4 1
4123 - 4 1
4132 - 4 1
4213 - 4 1
4231 - 4 1
4312 - 4 1
4321 - 4 1
scudzilla 32 Junior Poster

Okay... logic reasoning here..

Suppose you have a, b, c and d

group those into 2 pairs, ab and cd

if a is greater than b, a cannot be the minimum anymore because it is greater than something, whereas b cannot be maximum anymore.

if c is greater than d, c cannot be minimum and d cannot be max.

You don't have to compare b or d to anything else to get max. So go with the winners a and c.
You don't have to compare a or c to anything else to get min. So go with the losers b and d.

Understand?

scudzilla 32 Junior Poster

Min and Max can be both at AB (or CD). What are you talking about? Can you explain why you think otherwise using logic?

scudzilla 32 Junior Poster

kvothetech's link and solution is actually correct.
It involves four (if-else) pairs.

scudzilla 32 Junior Poster

Use Left$ to get the substring, starting from the first character, with a length specified by you.

scudzilla 32 Junior Poster

How about If not IsNothing(sender) AndAlso ....?

scudzilla 32 Junior Poster

USB keyboard? Any other USB device you've added recently? Have you tried another keyboard?

Personally, I've experienced a similar situation before. It was when I connected both a keyboard and a bluetooth adapter to a 4 port USB hub. The adapter seemed hog the power offered by the single USB port, giving the keyboard a hard time keeping up.

scudzilla 32 Junior Poster

Yea, that's good. Just remember to use the parameter name in the query.

You don't need to define the parameters in the front-end, so no need for Dims. They need to be defined in the back-end, and the Parameters.AddWithValue does exactly that.

scudzilla 32 Junior Poster

1) Yes, we define the search criteria. WHERE specifies conditions for the search. @lastName and @phone are parameters. au_lname like @lastName means that we are looking for records such that au_lname field is similar to whatever @lastName holds. AND phone like @phone, we are looking for records where phone field is similar @phone value in addition to the lastname condition. For more information on SQL syntax, click me.

2) Those lines basically define the parameters and set their values.

scudzilla 32 Junior Poster

Sir Jim's example would be flagged as palindrome because the spaces are symmetrical.

How about this one? "A nut for a jar of tuna". Without normalizing, it will not be flagged as one.

scudzilla 32 Junior Poster

Yeah, the problem's on my end. I can't compile any Cs or Cpps. Which is why I was asking OP what the error is.

scudzilla 32 Junior Poster

What's the error? Something's wrong with my dev C compiler, so I can't even compile.

And do you even need all those references?

scudzilla 32 Junior Poster

How about using javascript? here

scudzilla 32 Junior Poster

^That. And with ds being empty, the dgv would of course be blank. Correct me if I'm wrong, but shouldn't strings in the query be between single quotes?

scudzilla 32 Junior Poster

First of all, unless you place all those pictureboxes in a list<of pictureboxes>, you cannot fill them using a loop; you're gonna have to fill them manually.

Secondly, there is no need for con.Open.

scudzilla 32 Junior Poster

Ok. If that's the case, there's no need retrieve the record(s) with the highest number of votes.

You could use a DataAdapter instead of DataReader for your sqlcouncil query (and select all fields, not just num_of_votes), place the result into a DataTable, and retrieve the first 8 rows.

scudzilla 32 Junior Poster

Lines 1 to 11 gets table with all votes in descending order.. ok
Lines 14 to 18 basically retrieves the highest number of votes.. not really necessary, is it?
Lines 21 to 27 gets the record(s) with the highest number of votes, meaning it gets only 1 record unless there's a tie
Lines 29 to 30 retrieves the image of the first (and only if there's no tie) record retrieved

I'm confused. Where exactly do you intend to place images of winning candidates? How many images would be there to display? You've only 1 control that can display an image, namely piccouncil1.

scudzilla 32 Junior Poster

Use desc with order by to get a descending table

select num_of_votes from tblCouncilors order by num_of_votes desc

scudzilla 32 Junior Poster

Ok. I downloaded Bloodshed Dev-C++ 5 to try and compile your code (lots of syntax error before / token, and for loop initial declaration used outside C99 mode >.<) and I still get all the expected output..

OH, you wrote this in a cpp file instead of a c file?

Er.. even after running it as c or cpp file, I still get all output.

Last edit:... Maybe your command prompt is limited to 300 lines, which is why you see only the last 300 lines of output? =/

el33t commented: Your hint to check the command prompt properties worked!! +0
scudzilla 32 Junior Poster

Tcc for compiling, notepad++ for writing, and command line execution.

Anyway, at lines 163 and 164 of your code, you didn't get any errors when compiling? I did, and ultimately I had to change them because arrays can't be initialized with a variable size.

int* r1 = (int*) malloc(row*sizeof(int));
int* c1 = (int*) malloc(col*sizeof(int));
scudzilla 32 Junior Poster

Here, 15x15. Is this right?

C:\tcc>tcc -run outputtest.c
INPUT THE NUMBER OF ROWS IN THE GRID : 15

INPUT THE NUMBER OF COLUMNS IN THE GRID : 15

 /* ====================================================================== */
 word : TEMPERATURE
m=4 =
n=1 =
 0.N.2count = 5
 1.NE.2count = 5
 2.E.2count = 11
 3.SE.2count = 11
 4.S.2count = 11
 5.SW.2count = 2
 6.W.2count = 2
 7.NW.2count = 2
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : TEACHER
m=2 =
n=3 =
 0.N.2count = 3
 1.NE.2count = 3
 2.E.2count = 7
 3.SE.2count = 2
 4.S.2count = 2
 5.SW.2count = 2
 6.W.2count = 4
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : COMPUTER
m=7 =
n=9 =
 0.N.2count = 3
 1.NE.2count = 6
 2.E.2count = 6
 3.SE.2count = 6
 4.S.2count = 8
 5.SW.2count = 8
 6.W.2count = 8
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 5

 /* ====================================================================== */
 word : ALLOCATE
m=8 =
n=10 =
 0.N.2count = 4
 1.NE.2count = 5
 2.E.2count = 5
 3.SE.2count = 5
 4.S.2count = 7
 5.SW.2count = 7
 6.W.2count = 2
 7.NW.2count = 1
pass1=1 =
pass2=0 =


 DIR : 5

 /* ====================================================================== */
 word : LOVE
m=3 =
n=13 =
 0.N.2count = 4
 1.NE.2count = 2
 2.E.2count = 2
 3.SE.2count = 2
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 4
 7.NW.2count = 4
pass1=1 =
pass2=1 =


 DIR : 4

 /* ====================================================================== */
 word : TREE
m=9 =
n=7 =
 0.N.2count = 0
 1.NE.2count = 0 …
scudzilla 32 Junior Poster

What kind of output are you expecting? Mine did this:

C:\tcc>tcc -run outputtest.c
INPUT THE NUMBER OF ROWS IN THE GRID : 5

INPUT THE NUMBER OF COLUMNS IN THE GRID : 5

 /* ====================================================================== */
 word : TEMPERATURE
m=4 =
n=4 =
 0.N.2count = 5
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 1
 5.SW.2count = 1
 6.W.2count = 5
 7.NW.2count = 5
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : TEACHER
m=3 =
n=0 =
 0.N.2count = 4
 1.NE.2count = 4
 2.E.2count = 5
 3.SE.2count = 2
 4.S.2count = 2
 5.SW.2count = 1
 6.W.2count = 1
 7.NW.2count = 1
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : COMPUTER
m=1 =
n=3 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 2
 3.SE.2count = 2
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 4
 7.NW.2count = 2
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : ALLOCATE
m=1 =
n=4 =
 0.N.2count = 2
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 5
 7.NW.2count = 2
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : LOVE
m=2 =
n=4 =
 0.N.2count = 3
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 3
 5.SW.2count = 3
 6.W.2count = 4
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 6

 /* ====================================================================== */
 word : TREE
m=1 =
n=0 =
 0.N.2count …