Search Results

Search found 9416 results on 377 pages for 'dont repeat yourself'.

Page 11/377 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • my jquery code dont work?

    - by kingdom
    UCCN1003Edit <script type="text/javascript"> $(function(){ $('a.edit').click(function(event){ var change = $(this).parent('div').find('p'); var changeText = change.text(); var wrapper = $(this).parent('div'); var clone = change.clone(true); var changeBox = $(this).parent('div').find('.editBox'); var changeBoxText = changeBox.val(); if($(this).text() == 'Edit'){ wrapper.prepend("<input class='editBox' type='text' value='"+ changeText + "'/>"); wrapper.append("<a href='#' class='save' style='margin-left:10px' >Save</a>"); change.remove(); $(this).text("cancel"); }else if($(this).text()=='cancel'){ wrapper.prepend("<p>" + changeBoxText +"</p>"); $('.editBox').remove(); $('.save').remove(); $(this).text('Edit'); } }); $('.save').click(function(event){ var editBox = $(this).parent('div').find('.editBox'); var editBoxText = editBox.text(); var wrapper = $(this).parent('div'); wrapper.prepand("<p>" + editBoxText + "</p>"); editBox.remove(); $(this).remove(); }); }); </script> My part that work work is $('.save').click(function(event){ var editBox = $(this).parent('div').find('.editBox'); var editBoxText = editBox.text(); var wrapper = $(this).parent('div'); wrapper.prepand("<p>" + editBoxText + "</p>"); editBox.remove(); $(this).remove(); }); where the wrapper wont prepand the p tag and the editBox and the .save wont be remove. i try to add alert("work") in this and it wont alert at all. anyone know why?

    Read the article

  • Attributes passed to .build() dont show up in the query

    - by Sebastian
    Hi there guys! Hope your all enjoying your hollydays. Ive run into a pretty funny problem when trying to insert rows into a really really simple database table. The basic idea is pretty simple. The user selects one/multiple users in a multiselect which are supposed to be added to a group. This piece of code will insert a row into the user_group_relationships table, but the users id always @group = Group.find(params[:group_id]) params[:newMember][:users].each do |uid| # For debugging purposes. puts 'Uid:'+uid @rel = @group.user_group_relationships.build( :user_id => uid.to_i ) @rel.save end The user id always gets inserted as null even though it is clearly there. You can see the uid in this example is 5, so it should work. Uid:5 ... SQL (0.3ms) INSERT INTO "user_group_relationships" ("created_at", "group_id", "updated_at", "user_id") VALUES ('2010-12-27 14:03:24.331303', 2, '2010-12-27 14:03:24.331303', NULL) Any ideas why this fails?

    Read the article

  • Bootstrap Carousel dont work propely

    - by olga1011
    <div class="container-fluid"> <div class="row-fluid"> <div class="span8"> <div id="myCarousel" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <div class="active item"><img src="01.jpg" alt=""></div> <div class="item"><img src="02.jpg" alt=""></div> <div class="item"><img src="03.jpg" alt=""></div> <div class="item"><img src="02.jpg" alt=""></div> <div class="item"><img src="03.jpg" alt=""></div> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a> </div> </div> </div> </div> I am working on site based on this theme http://bootstrapwp.rachelbaker.me/ When i put Bootstrap Carousel its jumping on the last frame and show nothing. I have read many tutorials and couldnt understand what i did wrong. I following the theme instruction. My site http://shopogolick.16mb.com Thank in advance!

    Read the article

  • Why repeat database constraints in models?

    - by BWelfel
    In a CakePHP application, for unique constraints that are accounted for in the database, what is the benefit of having the same validation checks in the model? I understand the benefit of having JS validation, but I believe this model validation makes an extra trip to the DB. I am 100% sure that certain validations are made in the DB so the model validation would simply be redundant. The only benefit I see is the app recognizing the mistake and adjusting the view for the user accordingly (repopulating the fields and showing error message on the appropriate field; bettering the ux) but this could be achieved if there was a constraint naming convention and so the app could understand what the problem was with the save (existing method to do this now?)

    Read the article

  • Getting confused why i dont get expected amount ?

    - by Stackfan
    I have 1 result and which i will receive in Bank account, Based on that account i have to Put a balance to user account. How can you find the Handling cost from total tried 491.50 / 0.95 = 517.36 which is wrong ? It should be 500.00 (to my expectation) User balance requires 500.00 When 500.00 selected he gets 5% discount There is a handling cost for this ex: 1) Discount: 500.00 - 5% = 475.00 2) Handling cost: (475.00 x 0.034) + 0.35 = 16.50 3) Total: 475.00 + 16.50 = 491.50 So problem is from 491.50, i have to find atleast handling cost to get promised Balance. Any solution ? Cant figure it out myself...

    Read the article

  • Adding items to dictionary if condition is true, else dont - python

    - by CodeTalk
    I'm trying to take an existing process: if self.path_object is not None: dictpath = {} for path in self.path_object: self.params = path.pathval.split("?")[0] self.params = path.pathval.split("&", 2) if path.pathval.contains(self.params): out = list(map(lambda v: v.split("=")[0] +"=" + str(self.fuzz_vectors), self.params)) else: pass dictpath[path] = out print dictpath I added the sub-if/else block in, but it is failing, stating: AttributeError: 'unicode' object has no attribute 'contains' on the if block . How can I fix it? I'm simply trying to do: if the path.pathval has either ? or & in it: add to dictionary else: pass #forget about it. Thanks!

    Read the article

  • How do I repeat function over several row.

    - by ChrisBD
    I'll admit that I'm not an Excel guru so maybe someone here can help me. On my worksheet I have several blocks of data. I calculate the sum of all items within column D of that block. Within each block I am checking the value of the cell in column C and if it contains the letter "y" and the value in column D of that row is equal to zero I must exclude the total sum of column D. Currently I am doing this by multiplying the sum value by either 1 or 0 which is produced by running a test over the cell contents. Below is an example of what I am using to test rows 23 to row 25 inclusively for data in Column D. I am also performing the same on Column E and G, but the "y" character is always in column C, hence the absolut column reference. =IF(AND($C23="y",D23=0),0,1)*IF(AND($C24="y",D24=0),0,1)*IF(AND($C25="y",D25=0),0,1) There must be a more efficient way to do this. Ideally I would like to write a function that I can paste into a cell and then select the rows or cells over which I run the test. Can anyone point me in the right direction?

    Read the article

  • Github + keep file but dont track changes

    - by Mike
    I have a codeigniter framework thats using github. Within this application I have several files that i will want to have in the repo but not track any changes on.. Example is: i deploy a new installation of this framework to a new client, i want the following files to be downloaded (they have default values 'CHANGEME') and i just have to make changes specific to this client IE(database credentials, email address info, custom css styling). // the production config files i want the files but they need to be updated to specific client needs application/config/production/config.php application/config/production/database.php application/config/production/tank_auth.php // index page, defines the environment (production|development) /index.php // all of the css/js cache (keep the folder but not the contents) /assets/cache/* // production user based styling (color, fonts etc) needs to be updated specific to client needs /assets/frontend/css/user/frontend-user.css currently if i run git clone [email protected]:user123/myRepo.git httpdocs and then i edit the files above, all is great.. until i release a hotfix or patch and run git pull. All of my changes are then overwritten.

    Read the article

  • ipod's repeat mode

    - by gayathri
    my ipod's repeatmode is always in MPMusicRepeatModeDefault,How will turn it off/how to change its mode?.i used setRepeatMode method but that does not work out.thanks

    Read the article

  • mysql error dont understand what it is saying

    - by sea_1987
    Cannot add or update a child row: a foreign key constraint fails (`mydb`.`job_listing_has_employer_details`, CONSTRAINT `job_listing_has_employer_details_ibfk_2` FOREIGN KEY (`employer_details_id`) REFERENCES `employer_details` (`id`)) INSERT INTO `job_listing_has_employer_details` (`job_listing_id`, `employer_details_id`) VALUES (6, '5') What does this mean? The two ID's I am inserting into the table exsist.

    Read the article

  • listbox select count not work dont work

    - by sadpcd
    I recently trying to make a form with multiple select box. When someone select the options the number of selected options will be display on another text. I'm a beginner in JavaScript. The function is called, but it doesn't count the number of the selected options. <select name="element_17_1[ ]" size="7" multiple="multiple" class="element select medium" id="element_17_1[ ]" onfocus="selectCount(this.form);" onClick="selectCount(this.form);" > <option value="Opt1">Opt1</option> <option value="Opt2">Opt2</option> <option value="Opt3">Opt3</option> <option value="Opt4">Opt4</option> <option value="Opt5">Opt5</option> <option value="Opt6">Opt6</option> <option value="Opt7">Opt7</option> </select> and this is the function I tried in the <head> function selectCount(f) { var selObj = myForm.elements['element_17_1[]']; var totalChecked = 0; for (i = 0; i < selObj.options.length; i++) { if (selObj.options[i].selected) { totalChecked++; } } f.element_9.value = totalChecked; }

    Read the article

  • Dont know how to select a few records from a table as utf8

    - by kwokwai
    Hi all, I don't have phpMyAdmin installed in my web site. Sometimes I was doing some select SQL command at the backend, but when I typed in this command to show all records from table Users: select * from Users; The records were printed as ???? | ??? ??? ??? |. I don't want to make any permanent changes to the charset in the database, so, how is it possible to temporarily displayed a few records as utf8 when needed?

    Read the article

  • Dont understand the concept of extends in URL.openConnection() in JAVA

    - by user1722361
    Hi I am trying to learn JAVA deeply and so I am digging into the JDK source code in the following lines: URL url = new URL("http://www.google.com"); URLConnection tmpConn = url.openConnection(); I attached the source code and set the breakpoint at the second line and stepped into the code. I can see the code flow is: URL.openConnection() - sun.net.www.protocol.http.Handler.openConnection() I have two questions about this First In URL.openConnection() the code is: public URLConnection openConnection() throws java.io.IOException { return handler.openConnection(this); } handler is an object of URLStreamHandler, define as blow transient URLStreamHandler handler; But URLStreamHandler is a abstract class and method openConnection() is not implement in it so when handler calls this method, it should go to find a subclass who implement this method, right? But there are a lot classes who implement this methods in sun.net.www.protocol (like http.Hanlder, ftp.Handler ) How should the code know which "openConnection" method it should call? In this example, this handler.openConnection() will go into http.Handler and it is correct. (if I set the url as ftp://www.google.com, it will go into ftp.Handler) I cannot understand the mechanism. second. I have attached the source code so I can step into the JDK and see the variables but for many classes like sun.net.www.protocol.http.Handler, there are not source code in src.zip. I googled this class and there is source code online I can get but why they did not put it (and many other classes) in the src.zip? Where can I find a comprehensive version of source code? Thanks!

    Read the article

  • Des pays proposent que l'ONU soit chargé de « maintenir l'ordre sur Internet », dont la Chine, l'Inde et l'Arabie Saoudite

    Des pays proposent que l'ONU soit chargé de « maintenir l'ordre sur Internet » Dont la Chine, l'Inde et l'Arabie Saoudite Le conseil des Nations Unis pourrait réagir suite à l'affaire Wikileaks, le site polémique qui continue de publier quotidiennement des câbles forts embarrassants pour les diplomaties du monde entier. Le conseil étudie en effet une proposition qui vise à créer un groupe de travail inter-gouvernemental dont le but serait d'harmoniser les efforts des décideurs pour "maintenir l'ordre" sur Internet. Cette proposition émane d'un groupe de plusieurs pays menés par le Brésil et...

    Read the article

  • Google+ compte 400 millions d'utilisateurs dont 100 millions actifs par mois et directement sur le réseau social

    Google+ compte 400 millions d'utilisateurs dont 100 millions actifs Par mois et directement sur le réseau social Un an après le lancement de son réseau social phare en juin 2011, Google annonce qu'il compte aujourd'hui 400 millions d'utilisateurs, dont 100 millions de membres mensuellement et directement actifs sur Google+. [IMG]http://idelways.developpez.com/news/images/google-plus.png[/IMG] Vic Gundotra, vice-président senior ingénierie chez Google, déclare en marge d'une annonce « c'était il y a seulement un an que nous avons ouvert les inscriptions au publique, et nous n'aurions jamais imaginé qu'autant de gens nous rejoindraient en seulement 12 mo...

    Read the article

  • UIImageView Animation Question

    - by James
    Is it possible to run an NSArray UIImageView Animation that plays pictures 1 through 5 only once, plays pictures 5 through 7 on repeat over and over (while holding down IBAction button) then when button is released it plays 7-10 only once?

    Read the article

  • Python: Pass parameter one time, but use more times

    - by Gabriel L. Oliveira
    I'm trying to do this: commands = { 'py': 'python %s', 'md': 'markdown "%s" "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md' But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

    Read the article

  • Pass parameter one time, but use more times

    - by Gabriel L. Oliveira
    I'm trying to do this: commands = { 'py': 'python %s', 'md': 'markdown "%s" "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md' But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

    Read the article

  • 3 divs as background

    - by woody993
    I've been working on this for a couple of hours and can't seem to wrap my head around it. I have three images, below, and I would like the text content to sit on top of these, but how do I do it? The middle image is the image that would need to repeat as the container div expands. Top: Middle repeating: Bottom:

    Read the article

  • Restart program from a certain line with an if statement?

    - by user1744093
    could anyone help me restart my program from line 46 if the user enters 1 (just after the comment where it states that the next code is going to ask the user for 2 inputs) and if the user enters -1 end it. I cannot think how to do it. I'm new to C# any help you could give would be great! class Program { static void Main(string[] args) { //Displays data in correct Format List<float> inputList = new List<float>(); TextReader tr = new StreamReader("c:/users/tom/documents/visual studio 2010/Projects/DistanceCalculator3/DistanceCalculator3/TextFile1.txt"); String input = Convert.ToString(tr.ReadToEnd()); String[] items = input.Split(','); Console.WriteLine("Point Latitude Longtitude Elevation"); for (int i = 0; i < items.Length; i++) { if (i % 3 == 0) { Console.Write((i / 3) + "\t\t"); } Console.Write(items[i]); Console.Write("\t\t"); if (((i - 2) % 3) == 0) { Console.WriteLine(); } } Console.WriteLine(); Console.WriteLine(); // Ask for two inputs from the user which is then converted into 6 floats and transfered in class Coordinates Console.WriteLine("Please enter the two points that you wish to know the distance between:"); string point = Console.ReadLine(); string[] pointInput = point.Split(' '); int pointNumber = Convert.ToInt16(pointInput[0]); int pointNumber2 = Convert.ToInt16(pointInput[1]); Coordinates distance = new Coordinates(); distance.latitude = (Convert.ToDouble(items[pointNumber * 3])); distance.longtitude = (Convert.ToDouble(items[(pointNumber * 3) + 1])); distance.elevation = (Convert.ToDouble(items[(pointNumber * 3) + 2])); distance.latitude2 = (Convert.ToDouble(items[pointNumber2 * 3])); distance.longtitude2 = (Convert.ToDouble(items[(pointNumber2 * 3) + 1])); distance.elevation2 = (Convert.ToDouble(items[(pointNumber2 * 3) + 2])); //Calculate the distance between two points const double PIx = 3.141592653589793; const double RADIO = 6371; double dlat = ((distance.latitude2) * (PIx / 180)) - ((distance.latitude) * (PIx / 180)); double dlon = ((distance.longtitude2) * (PIx / 180)) - ((distance.longtitude) * (PIx / 180)); double a = (Math.Sin(dlat / 2) * Math.Sin(dlat / 2)) + Math.Cos((distance.latitude) * (PIx / 180)) * Math.Cos((distance.latitude2) * (PIx / 180)) * (Math.Sin(dlon / 2) * Math.Sin(dlon / 2)); double angle = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a)); double ultimateDistance = (angle * RADIO); Console.WriteLine("The distance between your two points is..."); Console.WriteLine(ultimateDistance); //Repeat the program if the user enters 1, end the program if the user enters -1 Console.WriteLine("If you wish to calculate another distance type 1 and return, if you wish to end the program, type -1."); Console.ReadLine(); if (Convert.ToInt16(Console.ReadLine()) == 1); { //here is where I need it to repeat }

    Read the article

  • How to repeat a POST request using Chrome's developer tools?

    - by Luke The Obscure
    Not sure if this is the right stack exchange to ask this, but here goes... I'm trying to wean myself off of Firebug, which has served me very well for a lot of years. One feature that seems to be missing in Chrome's dev tools is the ability to repeat an AJAX POST. In firebug I can right click on the request in the console and hit "Open in new tab" and the request is repeated exactly as it was originally sent. In Chrome, the same action just does a normal GET on the link, without any of the post data. Is there any way to repeat an AJAX POST in Chrome's dev tools?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >