So does anyone else read Stack Overflow? I've been finding it really useful and educational, even if I don't have a question to ask. Just skimming the various topics that interest me (they have a great tagging system) offers up tons of information. It's fun to read through the code golf topics, too.
This is in the event handler that fires when an item is clicked. It works fine on the first click, but the second one causes this exception.
The lists (SubTitleList and co.) are all List<string>.
edit: And lstFeeds is a ListView control.
Just a guess, but if you don't have the ListView set to Multiselect = true, then you might be running into a weird issue where nothing's selected at the moment the click happens. As in the item you clicked the first time has become deselected, the click has occured, but the ListView hasn't caught up to making the new item you've clicked Selected = true. You might try using a SelectionChanged event instead of Click or MouseClick.
Keyboard users were at the top of my mind when I set the event up, so that's already done. :P
And now I have a program that is almost functional. Some values are prefilled for testing, but it's easy enough to change it out. But it works, and is a lot more than I was expecting yesterday when I was on the bring of giving up.
So far this is the most complex application I've attempted.
It echos out the correct value of i for each link, but 5 also gives this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 92
This is why I said you need to add error checking after every call. You're getting an error at a previous step but blazing through and then the end result is all you get told is "shit done blown up" instead of something meaningful.
It echos out the correct value of i for each link, but 5 also gives this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 92
This is why I said you need to add error checking after every call. You're getting an error at a previous step but blazing through and then the end result is all you get told is "shit done blown up" instead of something meaningful.
Specifically, it sounds as though you're not connecting to the db correctly, or your queries are messed up.
EDIT: In PHP, you don't use ` in queries. Use ' instead.
I'd get rid of the quotes. They don't help you and they're not there for tables anyways.
$artist = "SELECT * FROM Artist"
The fact that the query runs, and the result in HTML actually outputs a whole slew of TD/TRs leads me to believe there's either no data in those rows (unlikely) or the columns don't exist (more likely).
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
It echos out the correct value of i for each link, but 5 also gives this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 92
This is why I said you need to add error checking after every call. You're getting an error at a previous step but blazing through and then the end result is all you get told is "shit done blown up" instead of something meaningful.
Specifically, it sounds as though you're not connecting to the db correctly, or your queries are messed up.
EDIT: In PHP, you don't use` in queries. Use ' instead.
Changing `to ' yields:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 91
Ditched the quotes entirely and back to blank screen.
It echos out the correct value of i for each link, but 5 also gives this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 92
This is why I said you need to add error checking after every call. You're getting an error at a previous step but blazing through and then the end result is all you get told is "shit done blown up" instead of something meaningful.
Specifically, it sounds as though you're not connecting to the db correctly, or your queries are messed up.
EDIT: In PHP, you don't use` in queries. Use ' instead.
Changing `to ' yields:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 91
Edit: Heres a print views of that artist query from the phpMyAdmin interface of my database
SQL result
Host: localhost
Database: mfarrell
Generation Time: May 24, 2010 at 12:21 PM
Generated by: phpMyAdmin 3.2.5 / MySQL 5.1.44
SQL query: SELECT * FROM `Artist` LIMIT 0, 30 ;
Rows: 19
Artist_Id Artist_Name Artist_Rating
100000 Bruce Springsteen 5
100001 Alan Jackson 4
100002 Aerosmith 3
100003 Ludacris 2
100004 The Eagles 1
100005 Poison 5
100006 Motley Crue 4
100007 ABBA 3
100008 Acker Bilk 5
100009 Adam Sandler 4
100010 Alabama 4
100011 Alanis Morissette 5
100012 Alison Krauss + Union Station 5
100013 All-4-One 2
100014 America 3
100015 American Hi-Fi 4
100016 Anderson 3
100017 The Angels 3
100018 Anthrax 3
No problem, my method is more old school debugging. Most of the error checking that's possible (or die kind of stuff) would've completely missed this issue, so it's good to learn how to debug stuff with this method.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Is there any way in Rails to create a DB model in a text file of some sort and then do a rake afterwards? That way I have the model file to keep track of and edit as necessary.
All the tutorials (like, all 2 I have read so far), just have you create models in the terminal command, which is annoying if you need a big model, and it's not apparent if the terminal command method even lets you specify relations.
No problem, my method is more old school debugging. Most of the error checking that's possible (or die kind of stuff) would've completely missed this issue, so it's good to learn how to debug stuff with this method.
Is there any way in Rails to create a DB model in a text file of some sort and then do a rake afterwards? That way I have the model file to keep track of and edit as necessary.
All the tutorials (like, all 2 I have read so far), just have you create models in the terminal command, which is annoying if you need a big model, and it's not apparent if the terminal command method even lets you specify relations.
There must be a sophisticated way of doing this.
/script/generate migration [name] will generate a database migration file for you that you can code using text editor of choice however you want, then call rake db:migrate whenever your ready to commit those changes.
No problem, my method is more old school debugging. Most of the error checking that's possible (or die kind of stuff) would've completely missed this issue, so it's good to learn how to debug stuff with this method.
Whats the method?
Outputting various variables throughout the way, checking expected output to see how it plays in. In your case I saw about 20 or so td/trs so I assumed it had gotten to the point where it was looping through the elements, which means that the names of the columns were most likely bad (or there was no data for that column).
But outputting your variables is a great way to debug, think of it like a rudimentary debugger, without the ability to step-in.
bowen on
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Oh yea. cout has been my best friend debugging c++ crap
I'm a big fan of error_log in PHP. I also set up a custom exception handler that uses error_log, so I don't even have to set up error code for a lot of the stuff I've been doing lately.
I do have a question, though. I have a page parameter for my url (e.g. index.php?page=home). Is there a guide to RewriteRule for .htaccess files anywhere? Does it use a standardized regex syntax that I can look up?
RewriteEngine On
RewriteRule ^(\d+)$ view.php?id=$1 [L,QSA]
Turns /sheets/1099 into /sheets/view.php?id=1099
Note that this is under the /sheets/ directory, the pattern matching is relative so it looks for a pure number, no paths.
L means Last rule (stop processing) and QSA means that it will handle the conversions if any are needed to make it properly escaped as a querystring (which is also what you are interested in right?)
The pattern stuff itself is pretty straightforward regex as you can see.
I kinda assumed it was standard regex, but as all regular expressions look like [strike]insane[/strike] evil chicken scratches to me, I could not tell.
Ok, so using <form action="adhoc.php" method="get"> in my index.php I get a text box. How is data appended to the url, if say, "Big sky" is entered? Is it <url>?Big+sky ?
Ok, so using <form action="adhoc.php" method="get"> in my index.php I get a text box. How is data appended to the url, if say, "Big sky" is entered? Is it <url>?Big+sky ?
quick question for a java noob
I'm just trying to write some functions to query a SQL Server db, so I looked up some stuff and I'm trying to use the JTDS driver. Downloaded it and dropped the .jar file in C:\Program Files\Java\jre1.6.0_07\lib is that correct?
Because I get a ClassNotFoundException when I do this Class.forName("net.sourceforge.jtds.jdbc.Driver");
I should probably go grab Head First Java or something, but I'm not doing anything too complicated.
Starfuck on
jackfaces
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
Posts
Also, echoing $result yields: Resource id #4
See how many books I've read so far in 2010
I'd imagine so, it's a MySql query resource.
I was talking about this:
Change it to:
Robots Will Be Our Superiors (Blog)
http://michaelhermes.com
See how many books I've read so far in 2010
I'm actually not convinced the tables/queries are set up right.
Taking $i = 0 for instance, you have a table called 'Artist' ?
And then the table Artist has columns with the format: artist_name, date_released?
All your tables follow this format? Seems really weird to have tons of tables with the same structure/information.
The relevant code:
This is in the event handler that fires when an item is clicked. It works fine on the first click, but the second one causes this exception.
The lists (SubTitleList and co.) are all List<string>.
edit: And lstFeeds is a ListView control.
edit: I tossed a check in there to make sure SelectedItems.Count >= 1 and it works fine now. Any explanation for this? I can only idly speculate.
And now I have a program that is almost functional. Some values are prefilled for testing, but it's easy enough to change it out. But it works, and is a lot more than I was expecting yesterday when I was on the bring of giving up.
So far this is the most complex application I've attempted.
This is why I said you need to add error checking after every call. You're getting an error at a previous step but blazing through and then the end result is all you get told is "shit done blown up" instead of something meaningful.
Specifically, it sounds as though you're not connecting to the db correctly, or your queries are messed up.
EDIT: In PHP, you don't use ` in queries. Use ' instead.
What the fuck is this control (table thing often used for settings) called?
EDIT: Nevermind, found it: Grouped Table View
Yea, we do have those tables with that format. Its for a class, so you know how that goes sometimes.
See how many books I've read so far in 2010
$artist = "SELECT * FROM Artist"
The fact that the query runs, and the result in HTML actually outputs a whole slew of TD/TRs leads me to believe there's either no data in those rows (unlikely) or the columns don't exist (more likely).
Changing `to ' yields:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 91
Ditched the quotes entirely and back to blank screen.
See how many books I've read so far in 2010
Changing `to ' yields:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /user/student/mfarrell/public_html/cs4250/query.php on line 91
Edit: Heres a print views of that artist query from the phpMyAdmin interface of my database
See how many books I've read so far in 2010
we've got data!
See how many books I've read so far in 2010
And, it appears, there's no date_released column in this table.
There is Date_Released for a few different tables. Now that I've got that, I need to switch that for the different fields for each tables.
Right. Thanks Bowen & Infidel!
edit: and I'm also confusing my tables. this one has Artist_Rating. Check.
See how many books I've read so far in 2010
All the tutorials (like, all 2 I have read so far), just have you create models in the terminal command, which is annoying if you need a big model, and it's not apparent if the terminal command method even lets you specify relations.
There must be a sophisticated way of doing this.
Whats the method?
See how many books I've read so far in 2010
/script/generate migration [name] will generate a database migration file for you that you can code using text editor of choice however you want, then call rake db:migrate whenever your ready to commit those changes.
http://api.rubyonrails.org/classes/ActiveRecord/Migration.html has more information.
Also: Relationships will be defined in your model class files:
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
Outputting various variables throughout the way, checking expected output to see how it plays in. In your case I saw about 20 or so td/trs so I assumed it had gotten to the point where it was looping through the elements, which means that the names of the columns were most likely bad (or there was no data for that column).
But outputting your variables is a great way to debug, think of it like a rudimentary debugger, without the ability to step-in.
See how many books I've read so far in 2010
I'm a big fan of error_log in PHP. I also set up a custom exception handler that uses error_log, so I don't even have to set up error code for a lot of the stuff I've been doing lately.
I do have a question, though. I have a page parameter for my url (e.g. index.php?page=home). Is there a guide to RewriteRule for .htaccess files anywhere? Does it use a standardized regex syntax that I can look up?
Turns /sheets/1099 into /sheets/view.php?id=1099
Note that this is under the /sheets/ directory, the pattern matching is relative so it looks for a pure number, no paths.
L means Last rule (stop processing) and QSA means that it will handle the conversions if any are needed to make it properly escaped as a querystring (which is also what you are interested in right?)
The pattern stuff itself is pretty straightforward regex as you can see.
Apache mod_rewrite -- In particular, you probably want to look at the useful examples page.
It uses pretty typical regular expressions (either PCRE or a subset of PCRE, I forget which). Edit: Looks like it is PCRE.
Thanks, guys!
And how would I capture this in my _GET?
See how many books I've read so far in 2010
You need some web forms 101:
http://www.w3schools.com/html/html_forms.asp
http://www.w3schools.com/php/php_get.asp
See how many books I've read so far in 2010
The title needs to be in Erlang!
Fixed.
See how many books I've read so far in 2010
I'm just trying to write some functions to query a SQL Server db, so I looked up some stuff and I'm trying to use the JTDS driver. Downloaded it and dropped the .jar file in C:\Program Files\Java\jre1.6.0_07\lib is that correct?
Because I get a ClassNotFoundException when I do this
Class.forName("net.sourceforge.jtds.jdbc.Driver");
I should probably go grab Head First Java or something, but I'm not doing anything too complicated.
"If you're going to play tiddly winks, play it with man hole covers."
- John McCallum
See how many books I've read so far in 2010