Well for one thing, your second SELECT is missing the opening tag around the options.

I'm not exactly sure what you're asking. If you're wanting to just change the default selected option, just add the selected attribute to the option tag.

I strongly back up what diafol has said. Right now you're vulnerable to injection attacks. Many folks think that because they can't see POST data that it can't be tampered with, but it's rather simple to not only view it but alter it as well. Look into using filter_var

Does it throw any errors when you compile? Or simply doesn't display?

PHP can do what you want, as long as you don't mind refreshing the page to calculate the answer. Most would say that's a deal breaker, so use javascript as the others have suggested. You can still use PHP, however, to build the initial form if you have a lot of options or the options are dynamic.
Here's a quick and dirty example. If you have the option, use jquery as it makes the code easier and probably shorter.


Also, your question sounds an awful lot like a homework problem to me.

I managed to work it out this morning after reading about mix-blend-mode, but thanks.


Title pretty much says it all. I want a background image to have a linear gradient fade to transparent. I've faded the image out to a color by overlaying a gradient on top of it, which unfortunately would only help me if my site background is a solid color. (see codepend example)

I tried to use an image in place of a color value :p No such luck. Anyone have any ideas?


Right there is your problem. Naming conventions

Just to add to what fredy is talking about, every language tends to have a standard way of naming things, whether official or not. Makes it much easier looking at other people's code.



This isn't a place for people to do your homework for you. Try it yourself, then if having trouble ask a specific question.

I have a fixed header followed by a list with various anchor tags. By default, the anchor will jump to the top of the browser. I need to offset this so it displays below the header.

I found a solution online, but became quite annoyed once I found out that yes it works but only in FF, not webkit.


So if anyone can figure out a nice way to do above that also works with webkit, I'd be so happy. It's one of the last bits of my UI I have left to finish and it's starting to frustrate me.

That only demonstrates what the code already does. I need to change the text of "Select an image" to the name of the selected file.

Basically, how do I select this element input[type="file"]::before in javascript?

I'd put those strings into an array, more efficient doing a simple array lookup than a bunch of IF statements.

echo do_shortcode(codes[get_the_ID()]);

My guess is that you're getting that banner because the ID function is returning 78. Unless you have an error somewhere in your do_shortcode function.

Where's your code for sending the email? Do you have an email server setup yet?

Generating a 6 digit pin is as simple as:
$pin = rand(100000,999999);

Store the pin and associated user id into a table. When the user enters the pin, check it with the table that the username and pin match up. If so, clear the entry from the table and let the user type a new password.

I played around with it for awhile, and I just don't see a way of doing this with pure CSS. You're going to need javascript to change those LI tags when checkboxes are clicked. Unless CSS has some kind of conditional code I'm not aware of. Something like:[if (#select_type_1:checked)] .ff_item_type_1{opacity:1;}

Doing a custom file upload button like so:


input[type="file"]::-webkit-file-upload-button{ visibility:hidden;width:0;height:0;}
input[type="file"]{font-size:30px !important;background:none !important;}
  content: 'Select an image';
  display: inline-block;
  background: -webkit-linear-gradient(top, #f9f9f9, #e3e3e3);
  border: 1px solid #999;
  border-radius: 3px;
  outline: none;
  white-space: nowrap;
  -webkit-user-select: none;
  cursor: pointer;
  text-shadow: 1px 1px #fff;
  font-size: 40px;
  margin:auto auto;



<input name="uploaded_file" id="uploaded_file" type="file" onchange="thing()"/>


function thing(){

    var t = document.getElementById("uploaded_file");
    var f = t.files[0].name;

All I know is how to retrieve the name of the selected file to upload, but I can't figure out how to change the name of the button displayed. I can't figure out how to select that element since it has no ID or name. I read somewhere that using BEFORE will create a child of the element that created it, but when I get the element ('t' in this case) it says there are no children.

I'd say 99% of the contacts will have numbers, but maybe only about 10% will have more than 1.

You could set the ImageIcon.

ImageIcon icon = new ImageIcon("image.png");
JButton button = new JButton(icon);

I used Norton (corporate without the bloatware) for a long time until they were very slow to come out with a 64bit version many years ago. I have since been using Avira, which has some of the best overall scores in testing. I always see AVG mentioned a lot as the best free AV, but I don't think it's even close to the best, just the most popular. But my opinion on AVG is not from personal experience with it, just what I've seen from testing sources over the years.

I've tried BitDefender a year ago and it worked well I think, but too many annoyances drove me from it and it didn't perform well on older hardware.

Lately, recent articles have been calling webroot the best out there.

On a side note, Comodo Firewall is nice.

Which graphics card is best? Usually the newest one. What's typically the best one for most average gamers? The one we can afford.

My current monitor is LED because it's more efficient and also mainly because that's what all monitors seem to be these days. My old westinghouse started to fail, it was not LED, and I had to buy a new one. Despite the fact that my new 24" Asus ProArt is suppose to have some of the best color reproduction, I feel my older westinghouse had a better and brighter image.

Sounds like someone is trying to get answers for their homework because they were too lazy to pay attention in class.

Looks like the Nimbus look n feel.

To change the look and feel, read here:

Hijran, you can't send the redirect header when you've already outputted text to the page. And create a new thread next time instead of hijacking someone elses.

Jason, I'm uncertain what you're having trouble with. Store the image path as a string in the database. Are you having trouble getting the path of the image?

I'm making a kind of address book thingy and seem to have confused myself on the best way of organizing the tables. At the moment, I have two tables, Contact and Number.

Here's a basic representation of my tables:

| Contact   |
| cid       |
| fname     |
| lname     |
| address   |
| email     |

| Number    |
| nid       |
| cid       |
| number    |
| desc      |

The reason a contact's number are stored in a separate table is because each contact may have 0 or more numbers associated with it.

Is this a good design? Cause the way I'm looking at it now, I have to hit the database with an extra call for each contact. One query to get a list of all contacts, then I'll have to loop through each contact to do an additional query to get their numbers. Seems inefficient to me. Is there a better way to query for the results?

SELECT contact.*, number.* FROM contact, number WHERE number.cid=contact.cid

But not only does that return a lot of redundant data (repeating the contact info for each number belonging to the same person) but it also won't return any contacts if they don't have any numbers associated.

There's gotta be a better way than running a query to return a list of 200 contacts, then having to make another 200 queries to get all the numbers associated with each one of those contacts.

Sounds tricky, but here's my first thought. Add a listener to the combo boxes. When a value is selected from one of them, retrieve a list of the other combo boxes from that row. A custom table model can help with that. You don't need to create a new JComboBox, only update their list of data. You can remove the selected item from the other boxes. Do all the rows contain the same items in the JComboBox? Because then it would be easy to keep a master list to help with the updates.

There's probably a better way but that's my idea.

For starters, read up BorderLayout.

Sorry I worded that wrong. By overriding the Person toString to display what she wants in the JList, you can remove the need for a custom renderer. (depending on how she actually wants it to appear) Then on the JList's mouse event, she can customize how the Person's data gets displayed in the label by ordering the values in a new string.

label.setText(person.getName()+" "+person.getAge());

Or simply configure that string structure inside the Person class. My initial thought was the person's details were being set in multiple labels.

I've been away from java for a few years, I'm a little rusty :)

BlueJ? Are schools seriously still using that?

I looked up PPS on wiki to see how it is calculated. Once the proper number is calculated, you can simply cast it to a char to match it up with an ASCII table.

        Random r = new Random();

        StringBuilder sb = new StringBuilder(8);
        int x = 0;
        for(int i=0;i<7;i++){
            int n = r.nextInt(10);
            x = n * (8-i);
        // Add 64 to the modulus result and cast
        // to a char to convert the number to the
        // corresponding letter in the ASCII table
        sb.append((char)(x % 23 + 64));


I believe this method would do the least amount of casting/conversion between numbers and strings. However, it does leave the potential for the following to be generated: 0000000@

For reference, this will help you learn about layout betters: http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html

st is a linked list, not a string. Anytime you output an object like that it's going to use its default toString() method. You can either extend the LinkedList class and override the toString() method to keep the output implementation separate from your existing program, or simply write a new method in the Queues_Lab2 class to take a linkedlist as a parameter and output it vertically like you want by looping through all of the list's elements as stultuske said.