Daily Archives

Articles indexed Friday March 12 2010

Page 8/130 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • [PHP, CSS, & ?] fixed width div, resizing text on the fly based on length

    - by Andrew Heath
    Let's say you've got a simple fixed-width layout that pulls a title from a MySQL database. CSS: #wrapper { width: 800px; } h1 { width: 100%; } HTML: <html> <body> <div id="wrapper"> <h1> $titleString </h1> </div> </body> </html> But the catch is, the length of the title string pulled from your MySQL database varies wildly. Sometimes it might be 10 characters, sometimes it might be 80. It's possible to establish a min & max character count. How, if at all possible, do I get the text-size of my <h1>$titleString</h1> to enlarge/decrease on-the-fly such that the string is only ever on one line and best fit to that line length? I've seen a lot of questions about resizing the div - but in my case the div must always be 100% (800px) and I want to best-fit the title. Obviously a maximum text-size value would have to be set so 5 character strings don't become gargantuan. Does anyone have a suggestion? I'm only using PHP/MySQL/CSS on this page at the moment, but incorporation of another language is fine if it means I can solve the problem. The only thing I can think of is a bruteforce approach whereby through trial and error I establish acceptable string character count ranges matched with CSS em sizes, but that'd be a pretty ugly implementation from the code side.

    Read the article

  • Firefox drags div like it was an image, javascript event handlers possibly to blame

    - by user281434
    Hi, I'm using this HTML,CSS and Javascript code (in one document together if you want to test it out): <style type="text/css"> #slider_container { width: 200px; height: 30px; background-color: red; display:block; } #slider { width: 20px; height: 30px; background-color: blue; display:block; position:absolute; left:0; } </style> <script type="text/javascript" src="../../js/libs/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#slider").mousedown(function() { $(document).mousemove(function(evnt) { $("#test").html("sliding"); }).mouseup(function() { $("#test").html("not sliding"); $(document).unbind("mousemove mouseup"); });}); }); </script> <div id="test">a</div> <div id="slider_container"> <div id="slider"></div> </div> Everything (surprisingly) works fine in IE, but firefox seems to totally clusterf*ck when this javascript is used. The first "slide" is okay, you drag, it says "sliding", you drop, it says "not sliding". On the second "slide" (or mousedown if you will), firefox suddenly thinks the div is an image or link and wants to drag it around. Screenshot of the dragging: http://i.imgur.com/nPJxZ.jpg Obviously the blue div half-positioned in the red div is the one being dragged. Windows does not capture the cursor when you take a screenshot, but it's a stop sign. Is there someway to prevent this default behaviour?

    Read the article

  • Wordpress Custom Themes > How to script Categories, Tags and Excerpt options to appear on "page" edi

    - by Scott B
    I'm using custom WordPress categories for some probably unintended functions, I will admit (things like marking a post no/index just by adding it to my custom "no-index" category, etc). But it sucks that WordPress does not enable pages with all the little extras you get with posts. For example, while the post editor gives you convenient access to Tags, Categories, and a Post excerpt field, pages get left out in the cold. I'd like to know if its possible to add the These items to the Post editor via add_action() directive from a custom theme.

    Read the article

  • Need help understanding "TypeError: default __new__ takes no parameters" error in python

    - by Gordon Fontenot
    For some reason I am having trouble getting my head around __init__ and __new__. I have a bunch of code that runs fine from the terminal, but when I load it as a plugin for Google Quick Search Box, I get the error TypeError: default __new__ takes no parameters. I have been reading about the error, and it's kind of making my brain spin. As it stands I have 3 classes, with no sub-classes, each class has it's own defs. I never use def __init__ or def __new__, but I have gotten the distinct feeling that these are the functions (or the lack thereof) that would be giving me the error. I have no idea how to summarize the code down to a snippet that would be helpful here, since I'm a bit over my head, but the entire script can be found at github. Not expecting anyone to bugfix my code for me, I am just at my wit's end on this. A simple (plain english, not the quote from the python docs which I have read 20 times and still don't really understand) explination of why this error would pop up, or why I should be, or not be, using the __init__ and/or __new__ functions would be seriously appreciated. Thanks for any help you can give in advance.

    Read the article

  • Chinese encoding issue while listing files

    - by Null Pointer
    I am running a Java application on a Solaris10 with Chinese. Now there are some files in a directory with chinese filenames. When I do files = new File(dir).list() where "dir" is the parent directory containing that chinese file, I get the result filename files[0] as ?????(some junk characters). Now the deal is that my programs file.encoding property is already set to GBK and I also do Charset.isSupported("GBK") and it returns true too. So where could be the problem. I am running out of ideas. NOTE: I am not trying to print the filename anywhere or copy the file or something. I am simply openeing a stream to it, something like below: files = new File(dir).list(); new FileInputStream(files[0]); Now this gives me a FileNotFoundExcpetion, so I debug just to find that value inside files[0] is "??????".

    Read the article

  • Why does fprintf start printing out of order or not at all?

    - by Steve Melvin
    This code should take an integer, create pipes, spawn two children, wait until they are dead, and start all over again. However, around the third time around the loop I lose my prompt to enter a number and it no longer prints the number I've entered. Any ideas? #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #define WRITE 1 #define READ 0 int main (int argc, const char * argv[]) { //Pipe file-descriptor array unsigned int isChildA = 0; int pipeA[2]; int pipeB[2]; int num = 0; while(1){ fprintf(stderr,"Enter an integer: "); scanf("%i", &num); if(num == 0){ fprintf(stderr,"You entered zero, exiting...\n"); exit(0); } //Open Pipes if(pipe(pipeA) < 0){ fprintf(stderr,"Could not create pipe A.\n"); exit(1); } if(pipe(pipeB) < 0){ fprintf(stderr,"Could not create pipe B.\n"); exit(1); } fprintf(stderr,"Value read: %i \n", num); fprintf(stderr,"Parent PID: %i\n", getpid()); pid_t procID = fork(); switch (procID) { case -1: fprintf(stderr,"Fork error, quitting...\n"); exit(1); break; case 0: isChildA = 1; break; default: procID = fork(); if (procID<0) { fprintf(stderr,"Fork error, quitting...\n"); exit(1); } else if(procID == 0){ isChildA = 0; } else { write(pipeA[WRITE], &num, sizeof(int)); close(pipeA[WRITE]); close(pipeA[READ]); close(pipeB[WRITE]); close(pipeB[READ]); pid_t pid; while (pid = waitpid(-1, NULL, 0)) { if (errno == ECHILD) { break; } } } break; } if (procID == 0) { //We're a child, do kid-stuff. ssize_t bytesRead = 0; int response; while (1) { while (bytesRead == 0) { bytesRead = read((isChildA?pipeA[READ]:pipeB[READ]), &response, sizeof(int)); } if (response < 2) { //Kill other child and self fprintf(stderr, "Terminating PROCID: %i\n", getpid()); write((isChildA?pipeB[WRITE]:pipeA[WRITE]), &response, sizeof(int)); close(pipeA[WRITE]); close(pipeA[READ]); close(pipeB[WRITE]); close(pipeB[READ]); return 0; } else if(!(response%2)){ //Even response/=2; fprintf(stderr,"PROCID: %i, VALUE: %i\n", getpid(), response); write((isChildA?pipeB[WRITE]:pipeA[WRITE]), &response, sizeof(int)); bytesRead = 0; } else { //Odd response*=3; response++; fprintf(stderr,"PROCID: %i, VALUE: %i\n", getpid(), response); write((isChildA?pipeB[WRITE]:pipeA[WRITE]), &response, sizeof(int)); bytesRead = 0; } } } } return 0; } This is the output I am getting... bash-3.00$ ./proj2 Enter an integer: 101 Value read: 101 Parent PID: 9379 PROCID: 9380, VALUE: 304 PROCID: 9381, VALUE: 152 PROCID: 9380, VALUE: 76 PROCID: 9381, VALUE: 38 PROCID: 9380, VALUE: 19 PROCID: 9381, VALUE: 58 PROCID: 9380, VALUE: 29 PROCID: 9381, VALUE: 88 PROCID: 9380, VALUE: 44 PROCID: 9381, VALUE: 22 PROCID: 9380, VALUE: 11 PROCID: 9381, VALUE: 34 PROCID: 9380, VALUE: 17 PROCID: 9381, VALUE: 52 PROCID: 9380, VALUE: 26 PROCID: 9381, VALUE: 13 PROCID: 9380, VALUE: 40 PROCID: 9381, VALUE: 20 PROCID: 9380, VALUE: 10 PROCID: 9381, VALUE: 5 PROCID: 9380, VALUE: 16 PROCID: 9381, VALUE: 8 PROCID: 9380, VALUE: 4 PROCID: 9381, VALUE: 2 PROCID: 9380, VALUE: 1 Terminating PROCID: 9381 Terminating PROCID: 9380 Enter an integer: 102 Value read: 102 Parent PID: 9379 PROCID: 9386, VALUE: 51 PROCID: 9387, VALUE: 154 PROCID: 9386, VALUE: 77 PROCID: 9387, VALUE: 232 PROCID: 9386, VALUE: 116 PROCID: 9387, VALUE: 58 PROCID: 9386, VALUE: 29 PROCID: 9387, VALUE: 88 PROCID: 9386, VALUE: 44 PROCID: 9387, VALUE: 22 PROCID: 9386, VALUE: 11 PROCID: 9387, VALUE: 34 PROCID: 9386, VALUE: 17 PROCID: 9387, VALUE: 52 PROCID: 9386, VALUE: 26 PROCID: 9387, VALUE: 13 PROCID: 9386, VALUE: 40 PROCID: 9387, VALUE: 20 PROCID: 9386, VALUE: 10 PROCID: 9387, VALUE: 5 PROCID: 9386, VALUE: 16 PROCID: 9387, VALUE: 8 PROCID: 9386, VALUE: 4 PROCID: 9387, VALUE: 2 PROCID: 9386, VALUE: 1 Terminating PROCID: 9387 Terminating PROCID: 9386 Enter an integer: 104 Value read: 104 Parent PID: 9379 Enter an integer: PROCID: 9388, VALUE: 52 PROCID: 9389, VALUE: 26 PROCID: 9388, VALUE: 13 PROCID: 9389, VALUE: 40 PROCID: 9388, VALUE: 20 PROCID: 9389, VALUE: 10 PROCID: 9388, VALUE: 5 PROCID: 9389, VALUE: 16 PROCID: 9388, VALUE: 8 PROCID: 9389, VALUE: 4 PROCID: 9388, VALUE: 2 PROCID: 9389, VALUE: 1 Terminating PROCID: 9388 Terminating PROCID: 9389 105 Value read: 105 Parent PID: 9379 Enter an integer: PROCID: 9395, VALUE: 316 PROCID: 9396, VALUE: 158 PROCID: 9395, VALUE: 79 PROCID: 9396, VALUE: 238 PROCID: 9395, VALUE: 119 PROCID: 9396, VALUE: 358 PROCID: 9395, VALUE: 179 PROCID: 9396, VALUE: 538 PROCID: 9395, VALUE: 269 PROCID: 9396, VALUE: 808 PROCID: 9395, VALUE: 404 PROCID: 9396, VALUE: 202 PROCID: 9395, VALUE: 101 PROCID: 9396, VALUE: 304 PROCID: 9395, VALUE: 152 PROCID: 9396, VALUE: 76 PROCID: 9395, VALUE: 38 PROCID: 9396, VALUE: 19 PROCID: 9395, VALUE: 58 PROCID: 9396, VALUE: 29 PROCID: 9395, VALUE: 88 PROCID: 9396, VALUE: 44 PROCID: 9395, VALUE: 22 PROCID: 9396, VALUE: 11 PROCID: 9395, VALUE: 34 PROCID: 9396, VALUE: 17 PROCID: 9395, VALUE: 52 PROCID: 9396, VALUE: 26 PROCID: 9395, VALUE: 13 PROCID: 9396, VALUE: 40 PROCID: 9395, VALUE: 20 PROCID: 9396, VALUE: 10 PROCID: 9395, VALUE: 5 PROCID: 9396, VALUE: 16 PROCID: 9395, VALUE: 8 PROCID: 9396, VALUE: 4 PROCID: 9395, VALUE: 2 PROCID: 9396, VALUE: 1 Terminating PROCID: 9395 Terminating PROCID: 9396 105 Value read: 105 Parent PID: 9379 Enter an integer: PROCID: 9397, VALUE: 316 PROCID: 9398, VALUE: 158 PROCID: 9397, VALUE: 79 PROCID: 9398, VALUE: 238 PROCID: 9397, VALUE: 119 PROCID: 9398, VALUE: 358 PROCID: 9397, VALUE: 179 PROCID: 9398, VALUE: 538 PROCID: 9397, VALUE: 269 PROCID: 9398, VALUE: 808 PROCID: 9397, VALUE: 404 PROCID: 9398, VALUE: 202 PROCID: 9397, VALUE: 101 PROCID: 9398, VALUE: 304 PROCID: 9397, VALUE: 152 PROCID: 9398, VALUE: 76 PROCID: 9397, VALUE: 38 PROCID: 9398, VALUE: 19 PROCID: 9397, VALUE: 58 PROCID: 9398, VALUE: 29 PROCID: 9397, VALUE: 88 PROCID: 9398, VALUE: 44 PROCID: 9397, VALUE: 22 PROCID: 9398, VALUE: 11 PROCID: 9397, VALUE: 34 PROCID: 9398, VALUE: 17 PROCID: 9397, VALUE: 52 PROCID: 9398, VALUE: 26 PROCID: 9397, VALUE: 13 PROCID: 9398, VALUE: 40 PROCID: 9397, VALUE: 20 PROCID: 9398, VALUE: 10 PROCID: 9397, VALUE: 5 PROCID: 9398, VALUE: 16 PROCID: 9397, VALUE: 8 PROCID: 9398, VALUE: 4 PROCID: 9397, VALUE: 2 PROCID: 9398, VALUE: 1 Terminating PROCID: 9397 Terminating PROCID: 9398 106 Value read: 106 Parent PID: 9379 Enter an integer: PROCID: 9399, VALUE: 53 PROCID: 9400, VALUE: 160 PROCID: 9399, VALUE: 80 PROCID: 9400, VALUE: 40 PROCID: 9399, VALUE: 20 PROCID: 9400, VALUE: 10 PROCID: 9399, VALUE: 5 PROCID: 9400, VALUE: 16 PROCID: 9399, VALUE: 8 PROCID: 9400, VALUE: 4 PROCID: 9399, VALUE: 2 PROCID: 9400, VALUE: 1 Terminating PROCID: 9399 Terminating PROCID: 9400 ^C Another thing that's strange, when ran from within XCode it behaves normally. However, when ran from bash on Solaris or OSX it acts up.

    Read the article

  • C++ Testing framework integrated with Eclipse

    - by Mike
    I'm writing a C++ unit testing framework and I would like it if it could be integrated with Eclipse CDT. In other testing suites that work with Eclipse, JUnit for example, the user is provided a graphical list of all test cases and their results. Something like this would be the ideal. I'm just getting into this, so I need some advice on getting started. There are two approaches I see Use an existing Eclipse testing plugin (such as JUnit) and make the framework return output in the same format as the plugin's input. Write a plugin from scratch that can work with my framework (seems like it would take a lot of time) Thoughts appreciated

    Read the article

  • Problem running iPhone application on iPhone from Xcode (and in Instruments)

    - by Ben
    Hi I have a problem running one application on the iPhone from Xcode (or Instruments). When I try to run the app I get the error message Failed to upload XXX.app in the bottom left corner of Xcode. The strange thing is it actually uploaded the app to the iPhone but it doesn't start it (after this I can start the app by hand on the iPhone). So without being able to start the app from Xcode or instruments I have no chance of debugging/performance testing. Any advice on what might be going wrong here? The iPhone console shows me this: Thu Oct 1 14:25:18 unknown mobile_installationd[1976] <Error>: 00808e00 install_embedded_profile: Skipping the installation of the embedded profile Thu Oct 1 14:25:23 unknown SpringBoard[25] <Warning>: Reloading and rendering all application icons. Other applications work fine. I've tried this on two iPhones (both 3.1) with the same result. I am running Xcode 3.2 on SnowLeopard. Regards

    Read the article

  • Script files returning 404 Error.

    - by Seth Duncan
    Hi, I'm using ASP.Net and whenever I create a script file or try to include a script file like jQuery they aren't working. I am doing just a regular localhost server and none of the scripts are working. Upon further examination using firebug I look at whats being referenced in those scripts and it shows html code for a 404 error. I know the scripts and files are there and I can navigate directly to them in the browser but for some reason I can't reference them in my page. Here is a screenshot:

    Read the article

  • Rails requires Rubygems, 1.3.2; I have 1.3.6

    - by JZ
    What is going on here? I'm getting this odd message: Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org justin-zollarss-mac-pro:barcoden2 justinz$ whereis gem /usr/bin/gem justin-zollarss-mac-pro:barcoden2 justinz$ whereis ruby /usr/bin/ruby justin-zollarss-mac-pro:barcoden2 justinz$ whereis rails /usr/bin/rails justin-zollarss-mac-pro:barcoden2 justinz$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] justin-zollarss-mac-pro:barcoden2 justinz$ rails -v Rails 3.0.0.beta justin-zollarss-mac-pro:barcoden2 justinz$ gem -v 1.3.6 justin-zollarss-mac-pro:barcoden2 justinz$ ruby script/server Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org

    Read the article

  • Open source alternative to Autosys?

    - by oninea
    As an alternative to Autosys, what is the best open source job scheduler? This question is a bit subjective but I'm looking for something that is widely used in production environments, has a good community, and has enterprise grade features.

    Read the article

  • Gauge network traffic for each Citrix session

    - by molecule
    Hi all, We are currently reviewing the bandwidth of our WAN links. How much bandwidth does a "typical" Citrix session utilize over a WAN link? JFYI - we are using Citrix Program Neighborhood V10 and each session is configured to use 256 colors. I have set up PRTG and it appears that for a server hosting 4 users, the traffic is approximately 100k to 300k per session. Is that about right? If you had to set a benchmark on a per-user basis, how much bandwidth would you assign to each user? Thanks in advance.

    Read the article

  • Software to convert .m2ts to .mts (HD video files)

    - by Kelsey
    I am looking to convert some of .m2ts video files (about 80GB worth) to .mts format which the my current camera is produces natively. Is there any free software that anyone has used that can do this? I know the .m2ts is the container so I am not sure just doing a rename of the extension to .mts is valid. It works but I am not sure it is actually producing an mts stream.

    Read the article

  • ubuntu gnome short cut keys

    - by benjipete
    Hi, I have done something quite silly and not sure how to fix it. I modified some of the gnome keyboard short cuts and was trying to disable the "Run Application" command. In the process I assigned it to the delete key and every time I hit delete the "Run Application" window comes up. It would not normally be a problem but the "Keyboard Shortcuts" no long has the short cut in the window so I can't disable it. Any help advice would be appreciated. Cheers Ben

    Read the article

  • Where in an Eclipse workspace is the list of projects stored?

    - by Kris Pruden
    I use eclipse with "external" projects - i.e. projects created from existing source. Poking around in the workspace files, I cannot find any reference to these projects. My question is: how does eclipse keep track of these projects? I'd like to be able to add such a project to the workspace automatically (by generating .project and .classpath files)..

    Read the article

  • ASP.Net MVC: "Random" URLs getting generated by URL.Action

    - by Daniel Magliola
    I have 2 very similar routes, just because i'm trying to generate two different URLs for the same resource (same Controller/Action), and both are very similar. These are the routes definitions: routes.MapRoute("Post2.Mp3", "sites/{siteSlug}/post/{brand}/aconstant-{slug}.mp3", new { controller = "Posts", action = "Mp3" }, new { siteSlug = @"[A-Za-z0-9-_]+", slug = @"[^(aconstant\-)][A-Za-z0-9-_]+", brand = @"[A-Za-z0-9-_]+" }); routes.MapRoute("Post.Mp3", "sites/{siteSlug}/post/{slug}.mp3", new { controller = "Posts", action = "Mp3" }, new { siteSlug = @"[A-Za-z0-9-_]+", slug = @"[A-Za-z0-9-_]+" }); "brand" is going to be my site name, which is the same as "aconstant" in those routes. Now, if I try this: Url.Action("ShowMp3", "Posts", new { siteSlug = post.Site.Slug, slug = post.Slug, origin = "origfeedwithaudio", brand = "aconstant" }) sometimes I get the URL I expect: /sites/site-Name/post/aconstant/aconstant-post-Name.mp3 but sometimes, I get this: /sites/site-Name/post/post-Name.mp3?brand=aconstant By sometimes, I mean that different sets of "slugs" give me one or the other. I haven't seen the same set of slugs give me different URLs. I haven't found any reasonable rule for when i'm getting one or the other, it seems random. What is going on here? How can I be getting different URLs based on esentially the same arguments? Thanks! Daniel

    Read the article

  • How to smooth an image loaded with FileReference?

    - by Lost_in_code
    Been trying to smooth images loaded with FileReferece with no luck. Below is the code I'm using: fileRef = new FileReference(); fileRef.addEventListener(Event.COMPLETE, fileLoaded); private function fileLoaded(e:Event):void{ var ldr:Loader = new Loader(); ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void{ var bm:Bitmap = Bitmap(e.target.content as Bitmap); bm.smoothing = true; img.load(bm) }); ldr.loadBytes(fileRef.data); } <custom:SWFLoaderAdvanced id="img"/> bm.smoothing should've smoothened the loaded image, but for some reason it doesn't. Am I missing something here? Note: SWFLoaderAdvanced automatically smoothens any image that's loaded inside it. It works perfectly with loaded images other than the ones loaded with FileReference.

    Read the article

  • Important Security Issue: Is it possible to put binary image data into html markup code and then get

    - by Joern Akkermann
    Hi, it's an important security issue and I'm sure this should be possible. A simple example: You run a community portal. Users are registered and upload their pictures. Your application gives security rules wenever a picture is allowed to be displayed. For example users must be friends on each sides by the system, in order that you can view someone elses uploaded pictures. Here comes the problem: it is possible that someone crawls the image directories of your server. But you want to protect your users from such attacks. If it's possible to put the binary data of an image directly into the html markup, you can restrict the user access of your image dirs the user and group your web application runs of and pass the image data to your apache user and group directly in the html. The only possible weakness then is the password of the user that your web app runs as. Is there already a possibility? Yours, Joern.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >