Search Results

Search found 1907 results on 77 pages for 'james weng'.

Page 58/77 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • How can I get rails to not render escaped quotes as \&quot;

    - by James
    In my layout I have <% @current_user.popups.each do |p| %> <% content_for :script do %> <%= "$(document).ready ( function() { $.jGrowl(\"#{p.message}\", { sticky: true }) });" %> <% end %> <% end %> And then in the script section I have <%= yield :script %> The problem is that this renders the escaped quotes as \&quot; and javascript doesn't like this. How can I stop this from happening? Or is there another approach to this? I can't use single quotes because I'd like to have some html in the message. I'd appreciate any help.

    Read the article

  • PHP Form - Empty input enter this text - Validation

    - by James Skelton
    No doubt very simple question for someone with php knowledge. I have a form with a datepicker, all is fine when a user has selected a date the email is send with: Date: 2012 04 10 But i would like if the user has skipped this and left blank (as i have not made this required) to send as: Date: Not Entered (<-- Or something) Instead at the minute of course it reads: Date: Form input <input type="text" class="form-control" id="datepicker" name="datepicker" size="50" value="Date Of Wedding" /> This is the validator $(document).ready(function(){ //validation contact form $('#submit').click(function(event){ event.preventDefault(); var fname = $('#name').val(); var validInput = new RegExp(/^[a-zA-Z0-9\s]+$/); var email = $('#email').val(); var validEmail = new RegExp(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/); var message = $('#message').val(); if(fname==''){ showError('<div class="alert alert-danger">Please enter your name.</div>', $('#name')); $('#name').addClass('required'); return;} if(!validInput.test(fname)){ showError('<div class="alert alert-danger">Please enter a valid name.</div>', $('#name')); $('#name').addClass('required'); return;} if(email==''){ showError('<div class="alert alert-danger">Please enter an email address.</div>', $('#email')); $('#email').addClass('required'); return;} if(!validEmail.test(email)){ showError('<div class="alert alert-danger">Please enter a valid email.</div>', $('#email')); $('#email').addClass('required'); return;} if(message==''){ showError('<div class="alert alert-danger">Please enter a message.</div>', $('#message')); $('#message').addClass('required'); return;} // setup some local variables var request; var form = $(this).closest('form'); // serialize the data in the form var serializedData = form.serialize(); // fire off the request to /contact.php request = $.ajax({ url: "contact.php", type: "post", data: serializedData }); // callback handler that will be called on success request.done(function (response, textStatus, jqXHR){ $('.contactWrap').show( 'slow' ).fadeIn("slow").html(' <div class="alert alert-success centered"><h3>Thank you! Your message has been sent.</h3></div> '); }); // callback handler that will be called on failure request.fail(function (jqXHR, textStatus, errorThrown){ // log the error to the console console.error( "The following error occured: "+ textStatus, errorThrown ); }); }); //remove 'required' class and hide error $('input, textarea').keyup( function(event){ if($(this).hasClass('required')){ $(this).removeClass('required'); $('.error').hide("slow").fadeOut("slow"); } }); // show error showError = function (error, target){ $('.error').removeClass('hidden').show("slow").fadeIn("slow").html(error); $('.error').data('target', target); $(target).focus(); console.log(target); console.log(error); return; } });

    Read the article

  • NotificationCenter Widget Failed To Use CoreLocation

    - by James Ye
    I'm writing a notification center widget, and it had to use location information. In normal apps I use CoreLocation and it works fine. But in my widget, I tried to locationServicesEnabled but it didn't go to the callback functions, and the authorizationStatus is always kCLAuthorizationStatusNotDetermined, and the authorize setting didn't show up in Setting - location service. I already set the delegate to the class. The system's Yahoo weather widget can auto locating and it uses CoreLocation too, so the widget do have ability to use location service. Why CoreLocation doesn't work on my widget?

    Read the article

  • How do I completely disable caching in Cakephp?

    - by James Lamiell
    So I opened the cache floodgates in my Cakephp app and now I want to close them... I've done pretty everything I can: delete all files in the tmp folder (but not the folders), turned 'Cache.disable' on in the core.php file in my app, have tried clearing the cache from within some controllers with clearCache() and Cache::clear() (but I suspect this doesn't work because it's not loading the controller -- due to caching). I've pretty much effectively halted my development process just because caching won't turn off. Anyone have some ideas that I could try? I'm starting to think it may be within the browser or maybe my hosting service, but it's probably just Cakephp messing with me.

    Read the article

  • How do I use a MySQL subquery to count the number of rows in a foreign table?

    - by James Skidmore
    I have two tables, users and reports. Each user has no, one, or multiple reports associated with it, and the reports table has a user_id field. I have the following query, and I need to add to each row a count of how many reports the user has: SELECT * FROM users LIMIT 1, 10 Do I need to use a subquery, and if so, how can I use it efficently? The reports table has thousands and thousands of rows.

    Read the article

  • how to execute any function in jquery after few seconds on the click of any link

    - by james Bond
    I have struts2 jquery grid where on click of a row I am calling a jQuery function for performating a struts2 action. My code is running fine. I want to perform my jQuery function after delay of a few seconds. How can I do this? <script type="text/javascript"> //assume this code is working fine on rowselect from my jquery grid, New Updation in it is "i want to execute or load the url after few seconds" $(function(){ $.subscribe('rowselect', function(event,data) { var param = (event.originalEvent.id); $("#myAdvanceDivBoxx").load('<s:url action='InsertbooksToSession' namespace='/admin/setups/secure/jspHomepage/bookstransaction'/>'+"?bid="+event.originalEvent.id); }); }); </script> What i tried is the below code but am unable to get the output which i am looking for: <script type="text/javascript"> $(function(){ $.subscribe('rowselect', function(event,data) { var param = (event.originalEvent.id); $("#myAdvanceDivBoxx").load('<s:url action='InsertbooksToSession' namespace='/admin/setups/secure/jspHomepage/bookstransaction'/>'+"?bid="+event.originalEvent.id); }).delay(9000); }); </script>

    Read the article

  • Flip Vertices Array

    - by James
    Hi, I have an array of position vertices that make up a 2D polygon. Vector2[] _chassisConcaveVertices = { new Vector2(5.122f, 0.572f), new Vector2(3.518f, 0.572f), new Vector2(3.458f, 0.169f), new Vector2(2.553f, 0.169f), new Vector2(2.013f, 0.414f), new Vector2(0.992f, 0.769f), new Vector2(0.992f, 1.363f), new Vector2(5.122f, 1.363f), }; What algorithm can I use to modify the positions so the resultant polygon is flipped? I need to flip the polygon both horizontally and vertically.

    Read the article

  • global applied stylesheet link on debian box

    - by James
    Hi there, Having some trouble identifying what is wrong with my link to an external CSS stylesheet... I am using a debian box to host some things... including a file i am accessing page.py which is located in /var/www/cgi-bin. I need this page to link to a css file which currently has the pathname /var/www/styles.css. Now I know I could link as: <link rel="stylesheet" href="**../styles.css**" type="text/css"> and the problem is solved but I would rather have a 'global' link, that I can use in other py files elsewhere in my filesystem and they will all point to /var/www/styles.css The information I have searched suggests that <link rel="stylesheet" href="**/var/www/styles.css**" type="text/css"> should work fine... but it doesn't. I have tried multiple combinations of everything I know but it doesn't seem to link as I would expect. Can anyone point me in the right direction?

    Read the article

  • How would I go about implementing a stopwatch with different speeds?

    - by James
    Ideally I would like to have something similar to the Stopwatch class but with an extra property called Speed which would determine how quickly the timer changes minutes. I am not quite sure how I would go about implementing this. Edit Since people don't quite seem to understand why I want to do this. Consider playing a soccer game, or any sport game. The halfs are measured in minutes, but the time-frame in which the game is played is significantly lower i.e. a 45 minute half is played in about 2.5 minutes.

    Read the article

  • Help with redirect and query strings

    - by James
    I'm a total novice at mod rewrite so I'll try and present my question as clearly as possible: I'm trying to create a url redirect of the following (static) affiliate url that can append it self to any product links after using a query string: affiliate url: hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1= product url: hxxp:// example.domain.com What I want to achieve is redirecting the affiliate code as below and being able to add dynamic product urls after as the following examples show: rewritten affiliate url: hxxp://domain.com/go affiliate url + product url: hxxp://domain.com/go?=http://example.domain.com redirects to: hxxp://clk.affilite.com/fs-bin/click?id=aFb*BBBBBpQ&subid=&offerid=9999.2&type=5&tmpid=9999&RD_PARM1=http://example.domain.com

    Read the article

  • Need Insight - What is the best practice for syncing up a production database that will be used on a

    - by james
    I have a site set up using CakePHP and MySQL and I want to work on a test database without disrupting my live site in case something goes wrong. I have another busy site, but my test site runs off the live database which can be occasionally nerve wracking. What do I do if I change a table name in the test db and I want it changed in the live database? Or if I remove a record from the test database. Is there a way to diff the changes? How do I even merge those changes? How does this interfere with live user edits and things of that nature? Hopefully some of you working devs can share some insight!

    Read the article

  • Get a number after a character in a string...

    - by James Rattray
    I'm making my own forums and I don't want any BB code on it, but instead my own, so i've gotten [b][u][img] working etc. But i'm having problems with [quote=1][/quote] where the number is the user id... E.G lets say I quote someone So once I submit my post: (The variable $post would be:) '[quote=1] Quoted post :P[/quote]' How would I then get the number out the string? (But not the wrong number -not a number in the quoted post) (So I could then use str_replace() to replace with a table which makes it looked quoted) ?? :)

    Read the article

  • Php pi help... (Loops)

    - by James Rattray
    Is this iteration the best? (Pi^2)/12 = 1 - 1/4 + 1/9 - 1/16 + 1/25 etc. -For converging faster? If not please answer with the iteration -preferably in the form above (an example) -not a splat of algebra ... I'm doing this to find Pi to 1,000,000,000 places online.

    Read the article

  • jQuery. Treat a string as a HTML document?

    - by James Jeffery
    I'm not sure if I worded the title correctly. Basically is it possible to treat a string as HTML as if it was on the page? So I can use $("#elem") and all the other jQuery functions? The HTML is loaded into a string from an ajax request and stored in a string. Instead of using regular expressions to access the data needed is it possible to use jQuery functions? ajaxTextResponse.$("#telephone"); I know the above won't work, but you see what I am getting at. Thanks

    Read the article

  • How do you get the ID of a control in ASP.NET

    - by James
    I am attempting to loop through an array of numbers, match them to the checkbox they they are associated with, and checkmark that box. My checkbox is set up like: <input type="checkbox" runat="server" id="someID" name="somename" value="1234" /> My code when the page loads currently looks like: foreach (string interest in interests_Var){ foreach (var c in Page.Controls) { } } interests_Var is my array containing different numbers. We'll assume one of them is 1234. While looping through the page controls, I want to compare the value of the control to my number. If it equals my number, I want to then apply the attribute checked="checked". I'm assuming I have to find the ID of the control I am using, then use that ID to add a new attribute. Or is there a way I can add the attribute using the c variable? I'm not dead set on this setup, so if you know a better way, I'm all ears. Thanks for any help and suggestions.

    Read the article

  • cron stops running when processing multiple items

    - by James
    Cron stops running (no visible error) after a few hours when I add more than 5 jobs in my cron tab. Each job runs every minute (polls a webpage for information which takes 1 second). I tried putting all of my php jobs in a shell script and called this shell script instead but the same problem occurs. Cron stops running, no error in the log file, no error email sent out either. Anyone encountered this before? Where/how canI debug this?

    Read the article

  • What is user gcc's purpose in requesting code possibly like this?

    - by James Morris
    In the question between syntax, are there any equal function the user gcc is requesting only what I can imagine to be the following code: #include <stdio.h> #include <string.h> /* estimated magic values */ #define MAXFUNCS 8 #define MAXFUNCLEN 3 int the_mainp_compare_func(char** mainp) { char mainp0[MAXFUNCS][MAXFUNCLEN] = { 0 }; char mainp1[MAXFUNCS][MAXFUNCLEN] = { 0 }; char* psrc, *pdst; int i = 0; int func = 0; psrc = mainp[0]; printf("scanning mainp[0] for functions...\n"); while(*psrc) { if (*psrc == '\0') break; else if (*psrc == ',') ++psrc; else { mainp0[func][0] = *psrc++; if (*psrc == ',') { mainp0[func][1] = '\0'; psrc++; } else if (*psrc !='\0') { mainp0[func][1] = *psrc++; mainp0[func][2] = '\0'; } printf("function: '%s'\n", mainp0[func]); } ++func; } printf("\nscanning mainp[1] for functions...\n"); psrc = mainp[1]; func = 0; while(*psrc) { if (*psrc == '\0') break; else if (*psrc == ',') ++psrc; else { mainp1[func][0] = *psrc++; if (*psrc == ',') { mainp1[func][1] = '\0'; psrc++; } else if (*psrc !='\0') { mainp1[func][1] = *psrc++; mainp1[func][2] = '\0'; } printf("function: '%s'\n", mainp1[func]); } ++func; } printf("\ncomparing functions in '%s' with those in '%s'\n", mainp[0], mainp[1] ); int func2; func = 0; while (*mainp0[func] != '\0') { func2 = 0; while(*mainp1[func2] != '\0') { printf("comparing %s with %s\n", mainp0[func], mainp1[func2]); if (strcmp(mainp0[func], mainp1[func2++]) == 0) return 1; /* not sure what to return here */ } ++func; } /* no matches == failure */ return -1; /* not sure what to return on failure */ } int main(int argc, char** argv) { char* mainp[] = { "P,-Q,Q,-R", "R,A,P,B,F" }; if (the_mainp_compare_func(mainp) == 1) printf("a match was found, but I don't know what to do with it!\n"); else printf("no match found, and I'm none the wiser!\n"); return 0; } My question is, what is it's purpose?

    Read the article

  • What is the explanation for "warning: assuming that the loop is not infinite"

    - by James Morris
    I had just taken the decision to change as many variables from unsigned to int and upon recompiling the code in question, was greeted by this warning message: freespace_state.c:203: warning: assuming that the loop is not infinite The line in question: for (x = startx; x <= endx; ++x, ++xptr) This loop is 60 lines of code (inc white space/brackets etc), and has a goto within it, and at least one occurrence of continue. In this case, I think I am appreciative that GCC is assuming this loop is not infinite, because, it should never loop indefinitely. What is GCC trying to tell me here?

    Read the article

  • Codeigniter PHP - loading a view at an anchor point

    - by James Billings
    I have a form at the bottom of a long page, if a user fills out the form but it doesn't validate the page is reloaded in the typical codeigniter fashion: $this->load->view('template',$data); however because the form is way down at the bottom of the page I need the page to load down there like you do with HTML anchors. Does anyone know how to do this in codeigniter? I can't use the codeigniter redirect(); function because it loses the object and the validation errors are gone. Other frameworks I've used like Yii you can call the redirect function like: $this->redirect(); which solves the problem because you keep the object. I've tried using: $this->index() within the controller which works fine as a redirect but the validation errors are in another method which is where the current page is loaded from: $this->item($labs) but when I use this it get stuck in a loop Any ideas? I've seen this question a lot on the net but no clear answers. I'm researching using codeigniter "flash data" but think it's a bit overkill. cheers.

    Read the article

  • How do I set bash environment variables from a script?

    - by James A. Rosen
    I have some proxy settings that I only occasionally want to turn on, so I don't want to put them in my ~/.bash_profile. I tried putting them directly in ~/bin/set_proxy_env.sh, adding ~/bin to my PATH, and chmod +xing the script but though the script runs, the variables don't stick in my shell. Does anyone know how to get them to stick around for the rest of the shell session?

    Read the article

  • How to style just one type of input field without also affecting other input types with CSS

    - by James
    Is there a way to write style rules that will only influence text fields. Suppose I have the following: <div id="helloDiv"> <input type="text" name="something" /><br /> <input type="checkbox" name="somethingElse" /><br /> <input type="submit" name="go" /> </div> div#helloDiv input { border: 1px solid red; } The problem with the above CSS rule is that it will affect ALL input fields not just input text but also radio buttons, submit buttons, etc. So is there a cross browser solution to affect just one type of input field within a div or other page element (without resorting to assigning the input fields styles individually).

    Read the article

  • Would it be useful to change java to support both static and dynamic types?

    - by James A. N. Stauffer
    What if a Java allow both static and dynamic types. That might allow the best of both worlds. i.e.: String str = "Hello"; var temp = str; temp = 10; temp = temp * 5; Would that be possible? Would that be beneficial? Do any languages currently support both and how well does it work out? Here is a better example (generics can't be used but the program does know the type): var username = HttpServletRequest.getSession().getAttribute("username");//Returns a String if(username.length() == 0) { //Error }

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >