Computing desk | ||
---|---|---|
< March 21 | << Feb | March | Apr >> | March 23 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Hello! I'm trying to build a website, wherein a MySQL query would return me a really large text field. I need to print only the first few lines of this text. Is there some function in PHP that will select only the first 1000 characters or bytes from the text and display them? Any help would be appreciated. Thanks!--Seraphiel (talk) 06:00, 22 March 2008 (UTC)
substr($the_string, 0, 1000); //that's characters 0 to 999, the first 1000 characters
i am using internet since last month,from last two days a messsage splash on my screen that your computer has been hacked and aal your vital information are sent though emails to other,it ask me to download that particular spyware tuo remove that virus hat can i do?
If the OP is very distracted by the splash messages, maybe (s)he should get Adblock? What do you think, Grawity? Kushal 12:49, 22 March 2008 (UTC)
No website is ever going to tell you, without you asking it to, whether you have a virus. (There are some online virus scanners, but that's the exception. They cannot run without you explicitly authorizing them to.) Pop-up ads of all sorts should be ignored, especially if they are of the "you have a virus/you are a winner/click here for a free gizmo" variety. Most up-to-date browsers have pop-up ads disabled by default for this reason. --Captain Ref Desk (talk) 16:45, 22 March 2008 (UTC)
Hold on, I understand that we need to ask the OP if he has SP2. However, the way I see it, the message could just be a banner ad on myspace or something. Kushal 22:10, 23 March 2008 (UTC)
I have problems connecting a USB cable to my Canon PowerShot S3 IS digital camera. I have the standard-sized USB plug end of the cable plugged in to my computer's USB port and the mini-sized USB plug end hanging free, ready to be plugged into the camera. When I plug the cable into the camera, the camera notices it by powering up. However, the computer does not recognise the camera. I have to twist the mini-sized plug toward the back of the camera to make the computer recognise it. If I let go of the plug, so that it moves back to its natural position, the computer stops recognising the camera. This is very annoying, as it usually means I have to keep twisting the plug with one hand when I transfer pictures from the camera. What is causing this, and how can I fix it? JIP | Talk 15:28, 22 March 2008 (UTC)
I want to collaborate with someone on some physics review problems, but scanning and emailing diagrams back and forth would be unweildy and time consuming. I know about oekaki and pictochat boards which let two people simulatanteously update the same picture in realtime which would be ideal; however I do not know where to go to find one of these oekaki or pictochat boards. The ideal board would have basic graphical functions like a straight line tool, the picture can be printed, and have an invite only section or something so that I can let in only the people who want to work on the physics problems. Does anyone have any idea where I can find an artboard like I described? Thanks in advance. 64.134.81.84 (talk) 16:09, 22 March 2008 (UTC)
OK. Last one for awhile. I promise. I've tried to figure this one out but it's not coming to me.
I've been setting up this little menu:
<div id="menus">
<ul>
<li id="opt.0" class="unselected"><a href="about.html" target="content" onclick="javascript:select(0);">About</a></li>
<li id="opt.1" class="unselected"><a href="research.html" target="content" onclick="javascript:select(1);">Research</a></li>
<li id="opt.2" class="unselected"><a href="teaching.html" target="content" onclick="javascript:select(2);">Teaching</a></li>
<li id="opt.3" class="unselected"><a href="contact.html" target="content" onclick="javascript:select(3);">Contact</a></li>
</ul>
</div>
Never mind that it uses frames at the moment (this is temporary, maybe. We'll see how it works out. I don't like 'em, but it might make life a lot easier in this case). The Javascript is just a simple little function — entirely aesthetic, just for kicks and giggles — that changes the class of the selected li from "unselected" to "selected" when you click on it.
The problem is, I can't seem to change the color of the link inside the list. I can change its background color no problem. But not the link color itself. WHY NOT?
Here's the CSS:
#menus a:hover, #menus li:hover, .selected {
color: black;
background-color: gold;
}
But the link color never changes to black. It stays its original color, white. I've tried using .selected a, .selected a:link, selected a.visited, .selected a:active, EVERYTHING I can think of, but it stubbornly stays white. I can change all sorts of other things (I can give .selected a a different background color, for example), but I can't change the text/link color. Note that it turns black when it is being hovered over, but it won't STAY black when it is "selected". The second that mouse isn't hovering over it anymore, it becomes white again. Even though the background color stays set as gold like it is supposed to.
I'm doing something wrong... but what is it? --Captain Ref Desk (talk) 19:58, 22 March 2008 (UTC)
a {
color: blue;
}
a.unselected {
color: black;
}
a.selected {
color: white;
}
function selectLink(theid) {
document.getElementById(theid).className = "selected";
}
<div id="menus">
<ul>
<li><a id="opt0" class="unselected" href="#" onclick="selectLink('opt0')">About</a></li>
<li><a id="opt1" class="unselected" href="#" onclick="selectLink('opt1')">Research</a></li>
<li><a id="opt2" class="unselected" href="#" onclick="selectLink('opt2')">Teaching</a></li>
<li><a id="opt3" class="unselected" href="#" onclick="selectLink('opt3')">Contact</a></li>
</ul>
</div>
Some problems that I had getting mine to work that you might want to watch out for... in your select() function are you concatenating "opt" to the argument you passed in? Notice that you're calling selectLink with just a number, and nothing has that ID. Remember to use single quotes like I did if you want to just pass in the full ID in string form. I moved the id and class over to the link tag but you shouldn't have to, it should be fine in the li tag. Also you probably want something in the selectLink function to deselect the other items when one is selected. Also if users are going to be able to navigate between About Research Teaching and Contact through in-text links in the other frame, it would probably be better to have the subpages report to the other frame (perhaps through the parent frameset; javascript and frames and security make a messy situation) that they've been opened instead of switching the styles on the actual click of the nav, since they might not have clicked the nav to get the that page. :D\=< (talk) 21:01, 22 March 2008 (UTC)
(after e.c.)Adding
#menus .selected a
{
color: black;
}
worked when I tried your code. — Matt Eason (Talk • Contribs) 21:14, 22 March 2008 (UTC)
a
elements to color: inherit
is handy for this sort of thing. Also, if you're not already using it, Firebug is really good at sorting out CSS problems. Just my 2 cents. --h2g2bob (talk) 00:40, 23 March 2008 (UTC)