Search Results

Search found 1083 results on 44 pages for 'mysite'.

Page 41/44 | < Previous Page | 37 38 39 40 41 42 43 44  | Next Page >

  • Load Balancing of PHP/MYSQL script without big code changes

    - by DR.GEWA
    Sorry for my Dummy Question, but... I am making a script on php/mysql (codeigniter) and I am extremally interested in knowing if there is a way without big architectural changes of the script make a load balancing. I mean, that for example now I will rent a medium dedicated server with 2GB ram, 200GB memory and good processor, and this will be enough lets say half year for the users which will come. But when they will become more and more, and as its a social net and at nights the server is waiting to have 500-1500 or 5000-8000 users online, I wander if there is a way for lets say just add second server with some config which will bear next pressure. After again one and so on... ???? <? if($answer=YES) { how(??); } esle{ whatToDo(??); } ?> If there is no way, than maybe you could point to a easiest way of load balancing solution.... I will be extremally thanksfull if you can tell me for such purposes , should I move lets say to PostgreSQl or FireBird? Which of them will be more easy in the future to handle ? I am getting on the mysite.com/users/show/$userId page something like 60queries for all data... maybe too much, but anyway....after some optimization it can be 20-30....

    Read the article

  • Simple ASP.NET MVC views without writing a controller

    - by Jake Stevenson
    We're building a site that will have very minimal code, it's mostly just going to be a bunch of static pages served up. I know over time that will change and we'll want to swap in more dynamic information, so I've decided to go ahead and build a web application using ASP.NET MVC2 and the Spark view engine. There will be a couple of controllers that will have to do actual work (like in the /products area), but most of it will be static. I want my designer to be able to build and modify the site without having to ask me to write a new controller or route every time they decide to add or move a page. So if he wants to add a "http://mysite.com/News" page he can just create a "News" folder under Views and put an index.spark page within it. Then later if he decides he wants a /News/Community page, he can drop a community.spark file within that folder and have it work. I'm able to have a view without a specific action by making my controllers override HandleUnknownAction, but I still have to create a controller for each of these folders. It seems silly to have to add an empty controller and recompile every time they decide to add an area to the site. Is there any way to make this easier, so I only have to write a controller and recompile if there's actual logic to be done? Some sort of "master" controller that will handle any requests where there was no specific controller defined?

    Read the article

  • Run a PHP script every second using CLI

    - by Saif Bechan
    Hello, I have a dedicated server running Cent OS with a Parallel PLESK panel. I need to run a php script every second, that updates my database. These is no alternative way timewise, i have checked every method, it needs to be updated every second. I can find my script using the url: http://www.mysite.com/phpfile.php?key=123, and this has to be executed every second. Does anyone have any knowledge at all on doing this, i can not seem to find the answer. I heard about doing it with CLI and putty, but i have no knowledge of this at all. Or can this be done using the PLESK Panel? And can the file be executed locally every second. Like \phpfile.php If someone helps me on answering these question i would really appreciate it. Regards EDIT It has been a few months since i added this question. I ended up using the following code: #!/user/bin/php $start = microtime(true); set_time_limit(60); for (i = 0; i < 59; ++$i) { doMyThings(); time_sleep_until($start + $i + 1); } Thank you for this code guys! My cronjob is set to every minute. I have been running this for some time now in a test environment, and this works out great. It works really supperfast, and i see no increase in CPU nor Memory usage.

    Read the article

  • How can I test for an empty Breeze predicate?

    - by Megan
    I'm using Breeze to filter data requested on the client. My code looks a little like this: Client - Creating Filter Predicate var predicates = []; var criteriaPredicate = null; $.each(selectedFilterCriteria(), function (index, item) { criteriaPredicate = (index == 0) ? breeze.Predicate.create('criteriaId', breeze.FilterQueryOp.Equals, item) : criteriaPredicate.or('criteriaId', breeze.FilterQueryOp.Equals, item); if (breeze.Predicate.isPredicate(criteriaPredicate)) { predicates.push(criteriaPredicate); } // Repeat for X Filter Criteria var filter = breeze.Predicate.and(predicates); return context.getAll(filter, data); Client - Context Query function getAll(predicate, dataObservable) { var query = breeze.EntityQuery.from('Data'); if (breeze.Predicate.isPredicate(predicate)) { query = query.where(predicate); } return manager.executeQuery(query).then(success).fail(failure); } Issue I'm having an issue with the request because, if there are no filters set, I apply an "empty" predicate (due to the var filter = breeze.Predicate.and([]) line) resulting in a request like http://mysite/api/app/Data?$filter=. The request is an invalid OData query since the value of the $filter argument cannot be empty. Is there a good way for me to check for an empty predicate? I know I can refactor my client code to not use a predicate unless there is at least one filterable item, but I thought I would check first to see if I overlooked some property or method on the Breeze Predicate.

    Read the article

  • Browser: Cookie lost on refresh

    - by Nirmal
    I am experiencing a strange behaviour of my application in Chrome browser (No problem with other browsers). When I refresh a page, the cookie is being sent properly, but intermittently the browser doesn't seem to pass the cookie on some refreshes. This is how I set my cookie: $identifier = / some weird string /; $key = md5(uniqid(rand(), true)); $timeout = number_format(time(), 0, '.', '') + 43200; setcookie('fboxauth', $identifier . ":" . $key, $timeout, "/", "fbox.mysite.com", 0); This is what I am using for page headers: header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Thu, 25 Nov 1982 08:24:00 GMT"); // Date in the past Do you see any issue here that might affect the cookie handling? Thank you for any suggestion. EDIT-01: It seems that the cookie is not being sent with some requests. This happens intermittently and I am seeing this behaviour for ALL the browsers now. Has anyone come across such situation? Is there any situation where a cookie will not be sent with the request? Thanks again, for any guideline.

    Read the article

  • Creating LINQ to SQL Data Models' Data Contexts with ASP.NET MVC

    - by Maxim Z.
    I'm just getting started with ASP.NET MVC, mostly by reading ScottGu's tutorial. To create my database connections, I followed the steps he outlined, which were to create a LINQ-to-SQL dbml model, add in the database tables through the Server Explorer, and finally to create a DataContext class. That last part is the part I'm stuck on. In this class, I'm trying to create methods that work around the exposed data. Following the example in the tutorial, I created this: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MySite.Models { public partial class MyDataContext { public List<Post> GetPosts() { return Posts.ToList(); } public Post GetPostById(int id) { return Posts.Single(p => p.ID == id); } } } As you can see, I'm trying to use my Post data table. However, it doesn't recognize the "Posts" part of my code. What am I doing wrong? I have a feeling that my problem is related to my not adding the data tables correctly, but I'm not sure. Thanks in advance.

    Read the article

  • Send POSTs to a PHP script on a server

    - by Sam Jarman
    I have a PHP script on a server <?php // retrieve POST vars $comment = $_POST['comment']; $email = $_POST['email']; // remove trailing whitespace etc $comment = trim($comment); $email = trim($email); // format date accoring to http://www.w3schools.com/php/func_date_date.asp $date_time = date("Y-m-d-H-i-s"); // i.e. 2010-04-15-09-45-23 // prepare message $to = "(removed my email addy)"; //who to send the mail to $subject = "Feedback from iPhone app"; //what to put in the subject line $message = "Name/Email: $email \r\n Comment: $comment"; mail($to, $subject,$message) or "bad"; echo "ok"; ?> How do I now send a POST request from my iPhone app... ive tried this sort of thing... NSURL *url = [NSURL URLWithString:@"mysite.com/script.php"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSString *message = boxForSuggestion.text; NSString *userEmailString = usersEmail.text; NSString *requestBodyString = [NSString stringWithFormat:@"comment:%@&email%@", message , userEmailString]; NSData *requestBody = [requestBodyString dataUsingEncoding:NSUTF8StringEncoding]; [request setHTTPMethod:@"POST" [request setHTTPBody:requestBody]; NSURLResponse *response = NULL; NSError *requestError = NULL; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&requestError]; NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease]; NSLog(@"%@", responseString); Any ideas? Thanks guys Sam

    Read the article

  • How to disable mod_security2 rule (false positive) for one domain on centos 5

    - by nicholas.alipaz
    Hi I have mod_security enabled on a centos5 server and one of the rules is keeping a user from posting some text on a form. The text is legitimate but it has the words 'create' and an html <table> tag later in it so it is causing a false positive. The error I am receiving is below: [Sun Apr 25 20:36:53 2010] [error] [client 76.171.171.xxx] ModSecurity: Access denied with code 500 (phase 2). Pattern match "((alter|create|drop)[[:space:]]+(column|database|procedure|table)|delete[[:space:]]+from|update.+set.+=)" at ARGS:body. [file "/usr/local/apache/conf/modsec2.user.conf"] [line "352"] [id "300015"] [rev "1"] [msg "Generic SQL injection protection"] [severity "CRITICAL"] [hostname "www.mysite.com"] [uri "/node/181/edit"] [unique_id "@TaVDEWnlusAABQv9@oAAAAD"] and here is /usr/local/apache/conf/modsec2.user.conf (line 352) #Generic SQL sigs SecRule ARGS "((alter|create|drop)[[:space:]]+(column|database|procedure|table)|delete[[:space:]]+from|update.+set.+=)" "id:1,rev:1,severity:2,msg:'Generic SQL injection protection'" The questions I have are: What should I do to "whitelist" or allow this rule to get through? What file do I create and where? How should I alter this rule? Can I set it to only be allowed for the one domain, since it is the only one having the issue on this dedicated server or is there a better way to exclude table tags perhaps? Thanks guys

    Read the article

  • ASP.NET MVC Paging for a search form

    - by James Alexander
    I've read several different posts on paging w/ in MVC but none describe a scenario where I have something like a search form and then want to display the results of the search criteria (with paging) beneath the form once the user clicks submit. My problem is that, the paging solution I'm using will create <a href="..."> links that will pass the desired page like so: http://mysite.com/search/2/ and while that's all fine and dandy, I don't have the results of the query being sent to the db in memory or anything so I need to query the DB again. If the results are handled by the POST controller action for /Search and the first page of the data is rendered as such, how do I get the same results (based on the form criteria specified by the user) when the user clicks to move to page 2? Some javascript voodoo? Leverage Session State? Make my GET controller action have the same variables expected by the search criteria (but optional), when the GET action is called, instantiate a FormCollection instance, populate it and pass it to the POST action method (there-by satisfying DRY)? Can someone point me in the right direction for this scenario or provide examples that have been implemented in the past? Thanks!

    Read the article

  • vs10 not deploying all required files - then not over-writing updated files

    - by justSteve
    I'm in the habit of deploying to alternating folders (/inetpub/wwwroot/mySite & /inetpub/wwwroot/mySite2) so if something unexpected happens with the deploy i can quickly swap back to a previous version just by changing the path in IIS So i was deploying an MVC2 webapp to a empty folder figuring that VS would send up all the files it needs. Not even close. Initially, it didn't even upload a couple required nHibernate.dlls. Later, after manually copying files referenced in the thrown exceptions, i just copied all the files from the previous compile and then re-published over the top expecting VS to over-write the changed files. Failed that too. No reports of errors by VS....just failed to over-write a number of pre-existing (but changed/updated) files. Hard to believe these kinds of errors (and lack of feedback that errors were encountered) in a state of the art tool like VS. Clearly, I'm doing something wrong. I'm using VisualSVN for source control and connect to my colocated server via a VPN-based mapped network drive (so I can use FileSystem to publish). (both of which can complicate file properties) VS08 had more choices for which files it would send up - i found i needed to use the 'All files in source' on an initial deployment, the 'Replace Matching'. If I choose 'delete all existing...' I'd be back to square 1 and have to deploy with the 'All files in source project folder'. But VS10 doesn't have the 'All files in source project folder. I ended up manually copying the files - which seems not right in the extreme. Are these known issues others have to deal with? What's best practice for deploying a web-app? thx

    Read the article

  • NSURLConnection and empty post variables

    - by SooDesuNe
    I'm at my wits end with this one, because I've used very similar code in the past, and it worked just fine. The following code results in empty $_POST variables on the server. I verified this with: file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); the only contents of log_file_name was "log: " I then verified the PHP with a simple HTML form. It performed as expected. The Objective-C: NSString *word = "this_word_gets_lost"; NSString *myRequestString = [NSString stringWithFormat:@"word=%@", word]; [self postAsynchronousPHPRequest:myRequestString toPage:@"http://www.mysite.com/mypage.php" delegate:nil]; } -(void) postAsynchronousPHPRequest:(NSString*)request toPage:(NSString*)URL delegate:(id)delegate{ NSData *requestData = [ NSData dataWithBytes: [ request UTF8String ] length: [ request length ] ]; NSMutableURLRequest *URLrequest = [ [ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ]; [ URLrequest setHTTPMethod: @"POST" ]; [ URLrequest setHTTPBody: requestData ]; [ NSURLConnection connectionWithRequest:URLrequest delegate:delegate]; [URLrequest release]; } The PHP: $word = $_POST['word']; file_put_contents('log_file_name', "log: ".$word, FILE_APPEND); What am I doing wrong in the Objective-C that would cause the $_POST variable to be empty on the server?

    Read the article

  • Correctly encode characters in a PHP mail form ("I'm" turns to be "I\'m")

    - by Peanuts
    Hello guys, I'm testing a PHP mail form, a very barebones one, found here: <?php if(isset($_POST['submit'])) { //The form has been submitted, prep a nice thank you message $output = '<h3>Thanks for your message</h3>'; //Deal with the email $to = '[email protected]'; $subject = 'you have a mail'; $contactname = strip_tags($_POST['contactname']); $adress = strip_tags($_POST['adress']); $contactemail = strip_tags($_POST['contactemail']); $textmessage = strip_tags($_POST['textmessage']); $boundary =md5(date('r', time())); $headers = "From: My Site\r\nReply-To: [email protected]"; $message = "Name: ".$contactname."\n"; $message .= "Adress: ".$adress."\n"; $message .= "E-mail: ".$contactemail."\n"; $message .= "Message: ".$textmessage."\n"; mail($to, $subject, $message, $headers); } ?> The problem is I'm receiving an unwanted slash "\" everytime I write a single or a double quote in my message, so "I'm" appear as "I\'m" in my mailbox. I know it have to do with the way PHP distinguishes code quotes from only lecture quotes, but I wouldn't know what to add in my form to get it properly running. Any help is appreciated,

    Read the article

  • mySQL not saving data?

    - by tony noriega
    i have a PHP contact form that submits data, and an email...: <?php $dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("guest"); if (isset($_POST['submit'])) { if (!$_POST['name'] | !$_POST['email']) { echo"<div class='error'>Error<br />Please provide your Name and Email Address so we may properly contact you.</div>"; } else { $age = $_POST['age']; $name = $_POST['name']; $gender = $_POST['gender']; $email = $_POST['email']; $phone = $_POST['phone']; $comments = $_POST['comments']; $query = "INSERT INTO contact_us (age,name,gender,email,phone,comments) VALUES ('$age','$name','$gender','$email','$phone','$comments')"; mysql_query($query); mysql_close(); $yoursite = "Mysite "; $youremail = $email; $subject = "Website Guest Contact Us Form"; $message = "$name would like you to contact them Contact PH: $phone Email: $email Age: $age Gender: $gender Comments: $comments"; $email2 = "[email protected]"; mail($email2, $subject, $message, "From: $email"); echo"<div class='thankyou'>Thank you for contacting us,<br /> we will respond as soon as we can.</div>"; } } ?> The email is coming through fine, but the data is not storing the dbase... am i missing something? Its the same script as i use on another contact us page, only difference is instead of parsing the data on teh same page, i now send this data to a "thankyou.php" page... i tried changing $_POST to $_GET but that killed the page... what am i doing wrong?

    Read the article

  • What's a good plugin or guide I can use to create javascript widgets from a Rails App?

    - by nicosuria
    I've been looking around for a while now and the best guide I've seen so far is Dr Nic's DIY widgets how to (here). I haven't been able to make something like this work: Assuming this is my widget code: <script src="http://mysite/nomnoms.js"> </script> And my nomnoms controller looks like (assume that the list partial exists and simply lists down a link to the show page of each nomnom in the @nomnoms variable): class NomnomsController < ApplicationController def index @nomnoms = Nomnom.find(:all) @content = render_to_string(:partial => 'list') end end And in the index.js of my nomnoms_controller I have: page << "document.write('<div>'" page << "document.write('#{@content.to_json}')" page << "</div>" The above setup doesn't render anything :(. But when I change the second line of index.js to: page << "document.write('nomnoms should be here') ...the widget renders the text. Any help or even a point in the right direction would be greatly appreciated. Thanks in advance.

    Read the article

  • Drupal rest services in Json format

    - by Sreekanth Chandrabhatla
    Amworking on drupal 7. Created a rest services in drupal views. I want to consume this service in my android app. When i try to view my service http://mysite.com/ubercart/?q=doctor am getting response like this [{,"foaf:Document"],"title":{"predicates":["dc:title"]},"created":{"predicates":["dc:date","dc:created"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"changed":{"predicates":["dc:modified"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"body":{"predicates":[""vid":"12","uid":"1","title":"raja","log":"","status":"1","comment":"2","promote":"0","sticky":"0","nid":"12","type":"doctor","language":"und","created":"1351849158","changed":"1351849158","tnid":"0","translate":"0","revision_timestamp":"1351849158","revision_uid":"1","field_rating":{"und":[{"value":"4"}]},"field_place":{"und":[{"value":"Guntur","format":null,"safe_value":"Guntur"}]},"rdf_mapping":{"rdftype":["sioc:Item","foaf:Document"],"title":{"predicates":["dc:title"]},"created":{"predicates":["dc:date","dc:created"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"changed":{"predicates":["dc:modified"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"body":{"predicates":["content:encoded"]},"uid":{"predicates":["sioc:has_creator"],"type":"rel"},"name":{"predicates":["foaf:name"]},"comment_count":{"predicates":["sioc:num_replies"],"datatype":"xsd:integer"},"last_activity":{"predicates":["sioc:last_activity_date"],"datatype":"xsd:dateTime","callback":"date_iso8601"}},"cid":"0","last_comment_timestamp":"1351849158","last_comment_name":null,"last_comment_uid":"1","comment_count":"0","name":"admin","picture":"0","data":"b:0;","uc_order_product_id":false,"ucnc_product_nid":false},{"vid":"11","uid":"1","title":"ravi","log":"","status":"1","comment":"2","promote":"0","sticky":"0","nid":"11","type":"doctor","language":"und","created":"1351849131","changed":"1351849131","tnid":"0","translate":"0","revision_timestamp":"1351849131","revision_uid":"1","field_rating":{"und":[{"value":"5"}]},"field_place":{"und":[{"value":"Hyderabad","format":null,"safe_value":"Hyderabad"}]},"rdf_mapping":{"rdftype":["sioc:Item","foaf:Document"],"title":{"predicates":["dc:title"]},"created":{"predicates":["dc:date","dc:created"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"changed":{"predicates":["dc:modified"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"body":{"predicates":["content:encoded"]},"uid":{"predicates":["sioc:has_creator"],"type":"rel"},"name":{"predicates":["foaf:name"]},"comment_count":{"predicates":["sioc:num_replies"],"datatype":"xsd:integer"},"last_activity":{"predicates":["sioc:last_activity_date"],"datatype":"xsd:dateTime","callback":"date_iso8601"}},"cid":"0","last_comment_timestamp":"1351849131","last_comment_name":null,"last_comment_uid":"1","comment_count":"0","name":"admin","picture":"0","data":"b:0;","uc_order_product_id":false,"ucnc_product_nid":false},{"vid":"10","uid":"1","title":"sree","log":"","status":"1","comment":"2","promote":"0","sticky":"0","nid":"10","type":"doctor","language":"und","created":"1351849109","changed":"1351849109","tnid":"0","translate":"0","revision_timestamp":"1351849109","revision_uid":"1","field_rating":{"und":[{"value":"4"}]},"field_place":{"und":[{"value":"Hyderabad","format":null,"safe_value":"Hyderabad"}]},"rdf_mapping":{"rdftype":["sioc:Item"content:encoded"]},"uid":{"predicates":["sioc:has_creator"],"type":"rel"},"name":{"predicates":["foaf:name"]},"comment_count":{"predicates":["sioc:num_replies"],"datatype":"xsd:integer"},"last_activity":{"predicates":["sioc:last_activity_date"],"datatype":"xsd:dateTime","callback":"date_iso8601"}},"cid":"0","last_comment_timestamp":"1351849109","last_comment_name":null,"last_comment_uid":"1","comment_count":"0","name":"admin","picture":"0","data":"b:0;","uc_order_product_id":false,"ucnc_product_nid":false}] Actually i need response like this {"nodes":{"0":{"node":{"title":"raja","field_place":"Guntur","rating":"4"}},"1":{"node":{"title":"ravi","field_place":"Hyderabad","rating":"5"}},"2":{"node":{"title":"sree","field_place":"Hyderabad","rating":"4"}}}} Do any one can me out?

    Read the article

  • getting error as Internal Server error

    - by Rishi2686
    Hi There, When I try to run my site it gives error as Internal Server error, when I refresh the page I get my result properly.The error page looks like this: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I also checked error_log file on my server, it gives error as: [Sat Jun 12 01:21:55 2010] [error] [client 117.195.6.76] File does not exist: /home/rohit25/public_html/test/500.shtml, referer: http://www.test.mysite.com/home.php sometimes error can be; [Sat May 29 19:35:12 2010] [error] [client 97.85.189.208] File does not exist: /home2/carlton/public_html/test/favicon.ico Are there any changes required in configuration file, I also tried to involve this error code in custom error page, it shows error page, which could not resolve this issue. Your urgent help will be greatly appreciated.

    Read the article

  • Stop scrolling to ID when opening jQuery Modal via URL

    - by markedup
    I need to be able to open an ID'd jQuery UI Modal on a page when that modal's ID is passed in the page's URL. For example: http://mysite.com/visit.html#directions #directions is an ID'd DIV at the very bottom of the page, right before the closing BODY element. It's instantiated as a jQuery UI dialog on page load, then I'm running a function to check the current URL for the modal's ID. If the URL contains the modal's ID, the modal is opened. Here's what my auto-open function looks like: function autoOpenModal() { if ( document.location.href.indexOf('#') ) { var uriParts = document.location.href.split('#'); var hashID = '#' + uriParts[1]; if ( $(hashID) && $(hashID).hasClass('dialog')) { $(hashID).dialog('open'); } } } The problem I'm having is that the browser is automatically scrolling down to the ID at the very bottom of the page before the modal is opened. So when the user closes the modal they're at the bottom of the page (which seems "broken" to me). Can anyone tell me how I stop the browser from auto-scrolling down to the ID please? I've had a look at event.preventDefault() but without success; I'm not sure where or how to use it in the event chain.

    Read the article

  • JQuery tablesorter - Second click on column header doesn't resort

    - by Jonathan
    I'm using tablesorter in on a table I added to a view in django's admin (although I'm not sure this is relevant). I'm extending the html's header: {% block extrahead %} <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript" src="http://mysite.com/media/tablesorter/jquery.tablesorter.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#myTable").tablesorter(); } ); </script> {% endblock %} When I click on a column header, it sorts the table using this column in descending order - that's ok. When I click the same column header a second time - it does not reorder to ascending order. What's wrong with it? the table's html looks like: <table id="myTable" border="1"> <thead> <tr> <th>column_name_1</th> <th>column_name_2</th> <th>column_name_3</th> </tr> </thead> <tbody> {% for item in extra.items %} <tr> <td>{{ item.0|safe }} </td> <td>{{ item.1|safe }} </td> <td>{{ item.2|safe }} </td> </tr> {% endfor %} </tbody> </table>

    Read the article

  • Installing django on dreamhost (help a newb out)

    - by augustfirst
    I'm trying to get django running on my dreahost account. I've been trying to sort of use two tutorials at once: the one on the dreamhost wiki and the one in the django book. I installed django using the script on the wiki page, but I ran into trouble immediately while trying to work through the django book. It says: To start the server, change into your project directory (cd mysite), if you haven’t already, and run this command: python manage.py runserver This launches the server locally, on port 8000, accessible only to connections from your own computer. Now that it’s running, visit 127.0.0.1:8000 with your Web browser. You’ll see a “Welcome to Django” page shaded in a pleasant pastel blue. It worked! Those instructions seem to assume that you're developing locally, not on a shared server. Where the heck am I supposed to look for the "Welcome to Django" page after starting the server? In my webroot? No dice. Anyway, I tried to blunder ahead through the django book to its hello world tutorial (chapter 3). But once I've edited the view file and the URLconf, I don't get a nice clean "hello world" text. Instead (as you can see) I get an "import error". Any help would be greatly appreciated.

    Read the article

  • Why is alert not run even though $.getJSON runs fine? (Callback not executed, even though the reques

    - by Emre Sevinç
    I have a snippet of code such as: $.getJSON("http://mysite.org/polls/saveLanguageTest?url=" + escape(window.location.href) + "&callback=?", function (data) { var serverResponse = data.result; console.log(serverResponse); alert(serverResponse); }); It works fine in the sense that it makes a cross-domain request to my server and the server saves the data as I expect. Unfortunately, even though the server saves data and sends back a response I just can't get any alert or the console.log run. Why may be that? The server side code is (if that is relevant): def saveLanguageTest(request): callback = request.GET.get('callback', '') person = Person(firstName = 'Anonymous', ipAddress = request.META['REMOTE_ADDR']) person.save() webPage = WebPage(url = request.GET.get('url')) webPage.save() langTest = LanguageTest(type = 'prepositionTest') langTest.person = person langTest.webPage = webPage langTest.save() req ['result'] = 'Your test is saved.' response = json.dumps(req) response = callback + '(' + response + ');' return HttpResponse(response, mimetype = "application/json") What am I missing? (I tried the same code both within my web pages and inside the Firebug and I always have the problem stated above.)

    Read the article

  • JQuery Post caused permission denied warning in IE 6 and IE 7

    - by kwokwai
    Hi all, I am using firefox 3 and IE 6, 7 to test if a simple php web page using JQuery Post to pass some data to and from another server web page. $(document).ready(function(){ $("#data\\[User\\]\\[name\\]").click(function(){ var usr=$("#data\\[User\\]\\[name\\]").val(); if(usr.length >= 4){ $("#username").append('<span id="loaderimg" name="loaderimg"><img align="absmiddle" src="loader.gif"/> Checking data availability,&nbsp;please wait.</span>'); var url = "http://mysite.com/site1/toavail/"+usr; $.post( url, function(data) {alert(data);}); }); }); //--> </script> <table border=0 width="100%"> <tr> <td>Username</td> <td> <div id="username"> <input type="text" name="data[User][name]" id="data[User][name]"> </div> </td> </tr> </table> In Firefox 3, the alert box showed empty message. In IE 6 and IE 7, I got an error message saying "Permssion denied"

    Read the article

  • Is the following valid XHTML 1.0 Transitional?

    - by willem
    The w3c validator service complains that the following html is invalid. It does not like the ampersand(&) in my javascript. But ampersands are allowed in javascript strings, aren't they? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Page Title</title> </head> <body> <script type="text/javascript"> function search(query) { redir = "http://search.mysite.com/search?s=FIN&ref=&q=" + query; window.location.href = redir return false; } </script> <span>This is all valid HTML</span> </body> </html>

    Read the article

  • javascript read a text file

    - by Cyprus106
    I have looked everywhere and surprisingly can't find a good solution to this! I've got the following code that is supposed to read a text file and display it's contents. But it's not reading, for some reason. Am I doing something wrong? FTR, I can't use PHP for this. It's gotta be Javascript. var txtFile = new XMLHttpRequest(); txtFile.open("GET", "http://www.mysite.com/todaysTrivia.txt", true); txtFile.send(null); txtFile.onreadystatechange = function() { if (txtFile.readyState == 4) { // Makes sure the document is ready to parse. alert(txtFile.responseText+" - "+txtFile.status); //if (txtFile.status === 200) { // Makes sure it's found the file. var doc = document.getElementById("Trivia-Widget"); if (doc) { doc.innerHTML = txtFile.responseText ; } //} } txtFile.send(null); } Any good ideas what I'm doing wrong? It just keeps givimg me a zero status.

    Read the article

  • send email to list of users with different timezones?

    - by ylazez
    i use the following method to send email to list of users i want the (To) in each email to be for just the user only not all users i.e appears to the users that the email is sent to only him my guess is to loop on: message.addRecipients(Message.RecipientType.TO, address); then send the message right? , but this is a heavy process sending an email many times any ideas ? suppose that i have the timezone for each user and i want to send each user the message in his timzone, the same issue i guess setting sent date for each user in his timezone then sending the message, right ? the method is: try { Properties props = System.getProperties(); props.put("mail.smtp.host", "localhost"); // Get a mail session Session session = Session.getDefaultInstance(props, null); // Define a new mail message Message message = new MimeMessage(session); InternetAddress ia = new InternetAddress(); ia.setPersonal("MySite"); ia.setAddress(from); message.setFrom(ia); Address[] address = new Address[recievers.size()]; for (int i = 0; i < recievers.size(); i++) { address[i] = new InternetAddress(recievers.get(i)); } message.addRecipients(Message.RecipientType.TO, address); message.setSubject(subject); // Create a message part to represent the body text BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setContent(body, "text/html"); // use a MimeMultipart as we need to handle the file attachments Multipart multipart = new MimeMultipart(); // add the message body to the mime message multipart.addBodyPart(messageBodyPart); // Put all message parts in the message message.setContent(multipart); message.setSentDate(getCurrentDate()); // Send the message Transport.send(message); } catch (Exception ex) {}

    Read the article

  • Unable to use certain Fonts programatically in ASP.Net

    - by TooFat
    I am trying to programatically create a bitmap with a specified font in ASP.Net. The idea is that the text, font name, size color etc. will be passed in from variables and a bitmap of the text using the font etc will be returned. However, I have been finding that I am only able to do so using the following code with certain fonts. <div> <% string fontName = "Segoe Script"; //Change Font here System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(100, 100); System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bmp); System.Drawing.Font fnt = new System.Drawing.Font(fontName, 20); System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); graph.DrawString("Help", fnt, brush, new System.Drawing.Point(10, 10)); bmp.Save(@"C:\Development\Path\image1.bmp"); this.Image1.ImageUrl = "http://mysite/Images/image1.bmp"; %> <asp:Label ID="Label1" runat="server" Text="Label" Font-Names="Segoe Script"> <%Response.Write("Help"); %></asp:Label> //Change font here <asp:Image ID="Image1" runat="server" /> </div> If I change the font name in the areas indicated by the comments to Arial or Verdana both the image and the label appear with the correct font. If however, I change the font name in both locations to something "Segoe Script" the Label will show up in Segoe Script but the image is in what looks like Arial.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44  | Next Page >