Archive for the ‘Yahoo! Answers’ Category.
November 2, 2008, 12:23 AM
Asked recently on Yahoo! Answers:
Multiple nested MySQL functions in PHP?
I was going through code today, trying to make some things more compact. The application worked without problems, so I knew that mysql error statements were superfluous.
This is the type of statement I was changing, I figured that I’d remove the seemingly unnecessary $result2 variable
$result2 = mysql_query($carts) or die(mysql_error());<br />
while ($row2 = mysql_fetch_array($result2)) {<br />
echo "<option>$row2[0]</option>";<br />
}
so this is what I changed it into (I basically replaced where it said $result2, to what $result2 had contained, and removed the error check)
while ($row2 = mysql_fetch_array(mysql_query($carts))) {<br />
echo "<option>$row2[0]</option>";<br />
}
but this code returned infinite loops, much to my surprise. Why is it doing this? is there a way around it?
Recently, I wrote about how PHP’s weak data types often can lead to problems for new programmers who don’t understand the difference between null, empty and zero-length variables. Here’s another opportunity to expose why strong data typing is essential for best programming practices, and to show how PHP’s weak data types — normally, a source of comfort for beginning programmers — can be the source of extensive frustration.
Continue reading ‘The Trouble With PHP’s Weak Data Types: An Example Examined And Explained’ »
Tags:
.NET,
Data Types,
Database,
MySQL,
Objects And Classes,
PHP,
SQL,
VB.NET,
Visual Basic,
XHTML Category:
Programming,
Yahoo! Answers |
2 Comments
September 9, 2008, 12:18 AM
I have launched a new Web site to demo ASP.NET scripts. It is http://www.dhvrm.com.
I decided to create the site after reviewing my last couple of ASP.NET entries on this site and discovering that they have some serious errors. I’ll be updating each with new posts as time allows.
For the moment, there isn’t much to see at dhvrm.com, and my schedulewon’t't allow me to do too much more with it for the next few weeks.
But I will correct my ASP.NET scripts and try to create new demos for older posts that don’t have them in the near future. Stay tuned.
September 3, 2008, 11:40 PM
Recently asked on Yahoo! Answers:
How to map a keyword to a category?
I have a bunch of general categories, such as: Games, Modeling, Business, Finance, etc.
My question is, how can I take a keyword such as “Xbox 360″ and automatically map it to a category such as “Games”? This is an easy example, and I did figure out ways to do this, but if I take a harder example such as “Tyra Banks”, I am unable to map it to a category of mine such as “Modeling” or “Tv Shows”.
I have been thinking of this for a very long time, and I can’t come up with a concrete solution. I have also searched the web and found nothing that would provide this service.
Any ideas?
Basically, computers develop semantic understanding the same way we people do, only far less efficiently: Repetition of example. (In computer science, semantics are called ontology.)
The reason we are far more efficient is that we more easily create connections between things, and more quickly process those connections, than computers can manage.
For example, suppose I give you three categories: colloid, coagulant, polymer. Now, place “chocolate milk” into the proper category.
Continue reading ‘Describing ‘Red’ To A Blind Man: The Dilemma Of Ontology’ »
August 21, 2008, 12:45 AM
Recently asked on Yahoo! Answers:
How do I read and write binary image data from SQL server?
I’m making a website where visitors can upload their images, I’ve done the uploading code and it (probably) works fine because I can see the data is recorded on the database.
The problem is when I want to test it (display the image on the website) theoretically I have to read the data from the SQL server and write it to the web. I’ve done several ways and tests but all of them failed to display the image.
Anybody knows how to do this? I’m using visual web developer 2008 and VB.NET as programming language
Note: no “wizards” please, I want it to be implemented using fully coded like I did with the uploading code
There are other examples on the Web on how to do this, but most are either written in C#, or are very specific to a given set of circumstances, so I thought I would explore this subject for Visual Basic .NET, and in the process try to address a few different ways to display an image.
The executive summary: Displaying an image that’s stored in a database requires you to make a “helper page.” And that’s what we’re about to make.
Continue reading ‘Displaying An Image Stored In A SQL Server Database On An ASP.NET Page Using VB.NET’ »
August 10, 2008, 10:44 PM
Recently asked on Yahoo! Answers:
Im working in dropdown list box in asp .net
where i wan d dropdown list box to have headin for each 10 item, and the heading should not get selected during run time. Plz help
This is easy to do if you dynamically bind each ListItem to your DropDownList; basically, you introduce a while loop to the mix to occasionally insert the requested number of breaks. Then, we add a CustomValidator control to ensure the user can’t select one of the heading items.
I won’t have a working example but I will provide a text file at the end which contains all the code.
Continue reading ‘Adding Non-Selectable ListItems To An ASP.NET DropDownList Control’ »