Search Results

Search found 1785 results on 72 pages for 'beauness round'.

Page 29/72 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Django/jquery: Address forms - dyamically adding state drop down list if country is United States?

    - by User
    I have a django html form for address information. There is standard street, city, state/province, postal code, country fields. The country field is a drop down list. How can I make the state/province field a drop down list if the selected country is united states and a free form text box if the country is anything else? I'd prefer not to have to do a round trip to the server so probably through jquery?

    Read the article

  • Rounded image corners in IE and Firefox

    - by Brian
    I cannot make the image a background image to a div and round the div's corners because the image is resized, and as far as I know, you cannot resize a background image. What are my options, if any? Open to all suggestions including wrapper divs and corner images. Also, if it cannot be done in IE but there's a solution for Firefox, that's just fine with me.

    Read the article

  • Workaround for stopping propagation with live()?

    - by bobsoap
    I've run into the problem that has been addressed here without a workaround: I can't use stopPropagation() on dynamically spawned elements. I've tried creating a condition to exclude a click within the dimensions of the spawned element, but that doesn't seem to work at all. Here is what I got: 1) a large background element ("canvas") that is activated to be "sensitive to clicks on it" by a button 2) the canvas, if activated, catches all clicks on it and spawns a small child form ("child") within it 3) the child is positioned relative to the mouse click position. If the mouse click was on the right half of the canvas, the child will be positioned 200 pixels to the left of that spot. (On the right if the click was in the left half) 4) every new click on the canvas removes the existing child (if any) and spawns a new child at the new position (relative to the click) The problem: Since the spawned child element is on top of the canvas, a click on it counts as a click on the canvas. Even if the child is outside of the boundaries of the canvas, clicking on it will trigger the action as described in 4) again . This shouldn't happen. =========== CODE: The button to activate the canvas: $('a#activate').click(function(event){ event.preventDefault(); canvasActive(); }); I referenced the above to show you that the canvas click-catching is happening in a function. Not sure if this is relevant... This is the function that catches clicks on the canvas: function canvasActive() { $('#canvas').click(function(e){ e.preventDefault(); //get click position relative to canvas posClick = { x : Math.round(e.pageX - $(this).offset().left), y : Math.round(e.pageY - $(this).offset().top) }; //calculate child position if(posClick.x <= $canvas.outerWidth(false)/2) { posChild = { x: posClick.x + 200, //if dot is on the left side of canvas y: posClick.y }; } else { posChild = { x: posClick.x - 600, //if dot is on the right y: posClick.y }; } $(this).append(markup); //markup is just the HTML for the child }); } I left out the unimportant stuff. The question is: How can I prevent a click inside of a spawned child from executing the function? I tried getting the child's dimensions and doing something like "if posClick is within this range, don't do anything" - but I can't seem to get it right. Perhaps someone has come across this dilemma before. Any help is appreciated.

    Read the article

  • Read file as its being uploaded

    - by zaf
    By default you cannot access a file that is uploaded until it has been fully transferred to the server. What is the best way to get round this and be able to access the 'byte stream' as the file upload is in progress?

    Read the article

  • Vertical text in a Horizontal UIButton

    - by ArQangel
    I'm using a vertical UIButton in a portrait app (Just a normal button that is of width 60 and Height 160) I want to put the label Vetically down the button instead of across it. When I use the following code to rotate the label [workPackageButton.titleLabel setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; It rotates the label but the length seems to be constrained by the original width, so I get the ... abreviation in the middle. Is there an easy way round this?

    Read the article

  • c# video equivalent to image.fromstream? Or changing the scope of the following script to allow vide

    - by Daniel
    The following is a part of an upload class in a c# script. I'm a php programmer, I've never messed with c# much but I'm trying to learn. This upload script will not handle anything except images, I need to adapt this class to handle other types of media also, or rewrite it all together. If I'm correct, I realize that using (Image image = Image.FromStream(file.InputStream)) basically says that the scope of the following is Image, only an image can be used or the object is discarded? And also that the variable image is being created from an Image from the file stream, which I understand to be, like... the $_FILES array in php? I dunno, I don't really care about making thumbnails right now either way, so if this can be taken out and still process the upload I'm totally cool with that, I just haven't had any luck getting this thing to take anything but images, even when commenting out that whole part of the class... protected void Page_Load(object sender, EventArgs e) { string dir = Path.Combine(Request.PhysicalApplicationPath, "files"); if (Request.Files.Count == 0) { // No files were posted Response.StatusCode = 500; } else { try { // Only one file at a time is posted HttpPostedFile file = Request.Files[0]; // Size limit 100MB if (file.ContentLength > 102400000) { // File too large Response.StatusCode = 500; } else { string id = Request.QueryString["userId"]; string[] folders = userDir(id); foreach (string folder in folders) { dir = Path.Combine(dir, folder); if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); } string path = Path.Combine(dir, String.Concat(Request.QueryString["batchId"], "_", file.FileName)); file.SaveAs(path); // Create thumbnail int dot = path.LastIndexOf('.'); string thumbpath = String.Concat(path.Substring(0, dot), "_thumb", path.Substring(dot)); using (Image image = Image.FromStream(file.InputStream)) { // Find the ratio that will create maximum height or width of 100px. double ratio = Math.Max(image.Width / 100.0, image.Height / 100.0); using (Image thumb = new Bitmap(image, new Size((int)Math.Round(image.Width / ratio), (int)Math.Round(image.Height / ratio)))) { using (Graphics graphic = Graphics.FromImage(thumb)) { // Make sure thumbnail is not crappy graphic.SmoothingMode = SmoothingMode.HighQuality; graphic.InterpolationMode = InterpolationMode.High; graphic.CompositingQuality = CompositingQuality.HighQuality; // JPEG ImageCodecInfo codec = ImageCodecInfo.GetImageEncoders()[1]; // 90% quality EncoderParameters encode = new EncoderParameters(1); encode.Param[0] = new EncoderParameter(Encoder.Quality, 90L); // Resize graphic.DrawImage(image, new Rectangle(0, 0, thumb.Width, thumb.Height)); // Save thumb.Save(thumbpath, codec, encode); } } } // Success Response.StatusCode = 200; } } catch { // Something went wrong Response.StatusCode = 500; } } }

    Read the article

  • Limit a double to two decimal places

    - by Jacob
    How do I achieve the following conversion from double to a string: 1.4324 => "1.43" 9.4000 => "9.4" 43.000 => "43" ie I want to round to to decimal places but dont want any trailing zeros, ie i dont want 9.4 => "9.40" (wrong) 43.000 => "43.00" (wrong) So this code which I have now doesn't work as it displays excess twos: [NSString stringWithFormat: @"%.2f", total]

    Read the article

  • is it possible to get the duration of a streaming mp3 in Flash

    - by dubbeat
    Hi, I'm wondering if it is at all possible to get the total duration of an mp3 being streamed in flash? At the moment I'm using the following code to estimate the lenght but it is always inaccurate var loadTime:Number=_track.bytesLoaded / _track.bytesTotal; var loadPercent:uint=Math.round(100 * loadTime); estimatedLength=Math.ceil(_track.length / (loadTime));

    Read the article

  • Showing pagination with only single page using will_paginate

    - by James
    I'm using will_paginate as standard, but it only shows the pagination controls (< 1 2 etc) when there's more than one page to display. Normally, this would be what is wanted, but I want to see the pagination controls (for UI consistency and to get round an annoying CSS quirk in the system I'm working on) even when there's only 1 page to display (showing < 1 ). Is this possible?

    Read the article

  • How to access CRM 4.0 settings programmatically?

    - by Shaamaan
    Some of the plugins I wrote (re)calculate various prices, and I used Math.Round to keep results accurate with the default 2 digit setting in CRM. But I figured... what if a user decides to set his CRM to use a different precision? So, I need to access the CRM settings programmatically, so that my functions can work with whatever setting the user chooses. How would I go about accessing the General (and, possibly, other) CRM settings from my code?

    Read the article

  • Calculating percent of votes inside mysql statement.

    - by Beck
    UPDATE polls_options SET `votes`=`votes`+1, `percent`=ROUND((`votes`+1) / (SELECT voters FROM polls WHERE poll_id=? LIMIT 1) * 100,1) WHERE option_id=? AND poll_id=? Don't have table data yet, to test it properly. :) And by the way, in what type % integers should be stored in database? Thanks for the help!

    Read the article

  • Jmagick rounding corners

    - by SPC
    Hello, I've a question concerning Jmagick, how can I round corners of an image, and does this make sense or would it be better to do this using CSS in HTML ? Thanks

    Read the article

  • Android imageButton reset

    - by Dorin Rusu
    I have an app in which I need to use ImageButtons.The app has tabs, and when I click on a tab the ImageButton should be calling setBackgroundResource(), and when I click on another tab the imageButton should call setBackgroundColor() instead. The problem is that once the resource has been set (in my case a shape with round corners, a stroke and a transparent background), any use of setBackgroundColor() will just recolor the shape, and not the whole button. Is there a way to reset/clear the resource of an ImageButton?

    Read the article

  • Heap Behavior in C++

    - by wowus
    Is there anything wrong with the optimization of overloading the global operator new to round up all allocations to the next power of two? Theoretically, this would lower fragmentation at the cost of higher worst-case memory consumption, but does the OS already have redundant behavior with this technique, or does it do its best to conserve memory? Basically, given that memory usage isn't as much of an issue as performance, should I do this?

    Read the article

  • Random Number Generator

    - by skinni
    - (IBAction)randomnum{ int randomNumber1 = 1+ arc4random() %(49); label1.text = [NSString stringWithFormat:@"d", randomNumber]; Local declaration of randomNumber hides instance variable. How can i get round this warning? thanks

    Read the article

  • LAbeling with Percentage in R plot

    - by Libo Cannici
    Hi I have made this function that takes a table and prepare the label for a barplot prepare_labels <- function(ft){ labs <- ft labs <- paste(labs, "\n", sep="") labs <- paste(labs, round(prop.table(ft)*100,2), sep="") labs <- paste(labs, "%", sep="") return(labs) } It actually works fine, but is there any better way to write that function, the above code looks ugly and I want to write beautiful code :-) ex: ft <- table(mydata$phone_partner_products) prepare_labels(ft) [1] "3752\n34.09%" "226\n2.05%" "2907\n26.41%" "1404\n12.76%" "1653\n15.02%" [6] "1065\n9.68%"

    Read the article

  • mongodb insert and return id with REST API

    - by abhi
    New to Mongodb,trying to get _id after mongodb insert without a round trip. $.ajax( { url: "https://api.mongolab.com/api/1/databases/xxx/collections/xx?apiKey=xxx", data: JSON.stringify( [ { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} ] ), type: "POST", contentType: "application/json" } ); Thanks edit: Solved buy removing square bracers JSON.stringify( { "x" : 2,"c1" : 34,"c2" : getUrlVars()["c2"]} )

    Read the article

  • Alternative to subqueries

    - by Juanma
    I'm using Mysql 5.1, and have this query, is there a way to not use the subqueries and accomplish the same result? SELECT oref.affiliate_id, ROUND(sum( oph.amount ) * 0.10 ,2) AS tsum FROM operators_referer AS oref LEFT JOIN operators_payments_history AS oph ON oref.operator_id = oph.operator_id WHERE oref.affiliate_id = 28221 AND ( oph.date_paid > ( SELECT MAX(aph.date_paid) FROM affiliates_payments_history AS aph WHERE aph.operator_id = oref.affiliate_id ) OR ( SELECT MAX(aph.date_paid) FROM affiliates_payments_history AS aph WHERE aph.operator_id = oref.affiliate_id ) is NULL )

    Read the article

  • Git ignore all folders apart from

    - by digital
    I want to ignore all the files in my folder structure apart from the following conditions: profiles (and all folders/files recursive) sites/xxx (and all folders/files recursive) Currently my gitignore file looks like: `*` !sites/xxx !sites/xxx/modules !sites/xxx/modules/* !profiles !profiles/xxx !profiles/xxx/* This doesn't allow me to track sites/xxx/modules/new though, is there anyway round this.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >