Search Results

Search found 20065 results on 803 pages for 'practice problems'.

Page 91/803 | < Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >

  • Sortable with scriptaculous problems

    - by user195257
    hello, Im following a few tutorials to sort a list, but i can't get the DB to update. The drag drop side of things is working, also, i javascript alert() the serialize list onUpdate and the order is printed out as follows: images_list[]=20&images_list[]=19 etc... So the sorting and dragging is working fine, i just cant get the database to update, this is my code. <script type="text/javascript"> Sortable.create("images_list", { onUpdate: function() { new Ajax.Request("processor.php", { method: "post", parameters: { data: Sortable.serialize("images_list") } }); } }); processor.php code: //Connect to DB require_once('connect.php'); parse_str($_POST['data']); for ($i = 0; $i < count($images_list); $i++) { $id = $images_list[$i]; mysql_query("UPDATE `images` SET `ranking` = '$i' WHERE `id` = '$id'"); } Any ideas would be great, thankyou!

    Read the article

  • PRoblems with encondig in ASP.MVC

    - by George
    Hello experts! I'm having a weird issue here. I have a bunch of Views, in which i have characters like this: é, á, ó, etc. In one of my views I can fetch data from the database with accents just fine, but in another one I simply get the "weird" characters :P WHat can i be doing wrong? Do i need to configure something in order to this work? Thanks!

    Read the article

  • Canon MF3200 Printer Problems [closed]

    - by Derick K.
    I bought a Canon MF3200 and used it on an old Windows laptop. The laptop broke, and now I'm trying to setup the printer on a laptop with Windows 7. I downloaded the new driver, and Windows was able to install it and mark it "Ready to Go." But whenever I try to print, an error comes up and it doesn't print. I tried to troubleshoot, to no avail. What else can I do? Any ideas on what the error might be?

    Read the article

  • problems getting HTTPRiot working

    - by bwizzy
    I've got an iphone app where I'm trying to use HTTPRiot to make some API calls to a web app. Problem is I can't see that none of the HTTPRiot delegate methods are being called. I've got a log in all the delegate methods, and I'm also looking at the webserver log. I see that the URL is being hit. //API.h #import <Foundation/Foundation.h> #include <HTTPRiot/HTTPRiot.h> @interface API : HRRestModel { } +(void)runTest; @end //API.m #import "API.h" @implementation API + (void)initialize { NSLog(@"api initialize"); [self setDelegate:self]; [self setBaseURL:[NSURL URLWithString:@"http://localhost:3000/api"]]; [self setBasicAuthWithUsername:@"demo" password:@"123456"]; NSDictionary *params = [NSDictionary dictionaryWithObject:@"1234567" forKey:@"api_key"]; [self setDefaultParams:params]; }//end initialize +(void)runTest { NSLog(@"api run test"); // Would send a request to http://localhost:1234/api/people/1?api_key=1234567 [self getPath:@"/save_diet" withOptions:nil object:nil]; } +(void)restConnection:(NSURLConnection *)connection didReturnResource:(id)resource object:(id)object { NSLog(@"didReturnResource"); } +(void)restConnection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveResponse"); } +(void)restConnection:(NSURLConnection *)connection didReceiveParseError:(NSError *)error responseBody:(NSString *)body object:(id)object { NSLog(@"didReceiveParseError"); } +(void)restConnection:(NSURLConnection *)connection didReceiveError:(NSError *)error response:(NSHTTPURLResponse *)response object:(id)object { NSLog(@"didReceiveError"); } +(void)restConnection:(NSURLConnection *)connection didFailWithError:(NSError *)error object:(id)object { NSLog(@"didFailWithError"); } @end //test code [API runTest]; //log output

    Read the article

  • Hibernate Persistence problems with Bean Mapping (Dozer)

    - by BuffaloBuffalo
    I am using Hibernate 3, and having a particular issue when persisting a new Entity which has an association with an existing detached entity. Easiest way to explain this is via code samples. I have two entities, FooEntity and BarEntity, of which a BarEntity can be associated with many FooEntity: @Entity public class FooEntity implements Foo{ @Id private Long id; @ManyToOne(targetEntity = BarEntity.class) @JoinColumn(name = "bar_id", referencedColumnName = "id") @Cascade(value={CascadeType.ALL}) private Bar bar; } @Entity public class BarEntity implements Bar{ @Id private Long id; @OneToMany(mappedBy = "bar", targetEntity = FooEntity.class) private Set<Foo> foos; } Foo and Bar are interfaces that loosely define getters for the various fields. There are corresponding FooImpl and BarImpl classes that are essentially just the entity objects without the annotations. What I am trying to do is construct a new instance of FooImpl, and persist it after setting a number of fields. The new Foo instance will have its 'bar' member set to an existing Bar (runtime being a BarEntity) from the database (retrieved via session.get(..)). After the FooImpl has all of its properties set, Apache Dozer is used to map between the 'domain' object FooImpl and the Entity FooEntity. What Dozer is doing in the background is instantiating a new FooEntity and setting all of the matching fields. BarEntity is cloned as well via instantiation and set the FooEntity's 'bar' member. After this occurs, passing the new FooEntity object to persist. This throws the exception: org.hibernate.PersistentObjectException: detached entity passed to persist: com.company.entity.BarEntity Below is in code the steps that are occurring FooImpl foo = new FooImpl(); //returns at runtime a persistent BarEntity through session.get() Bar bar = BarService.getBar(1L); foo.setBar(bar); ... //This constructs a new instance of FooEntity, with a member 'bar' which itself is a new instance that is detached) FooEntity entityToPersist = dozerMapper.map(foo, FooEntity.class); ... session.persist(entityToPersist); I have been able to resolve this issue by either removing or changing the @Cascade annotation, but that limits future use for say adding a new Foo with a new Bar attached to it already. Is there some solution here I am missing? I would be surprised if this issue hasn't been solved somewhere before, either by altering how Dozer Maps the children of Foo or how Hibernate reacts to a detached Child Entity.

    Read the article

  • Problems with CoreDataBooks Example from Apple

    - by eemceebee
    Hi I am currently playing with CoreData and have a problem with the CoreDataBooks Example from Apple. Basically I just wanted to extend the data model. I updated the model class aswell and no compiler error, butr a crash when I want to start the example. Unresolved error Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0x1316ce0 "Operation could not be completed. (Cocoa error 134130.)", { URL = file://localhost/.../CoreDataBooks.sqlite; ...some nonsense info ... reason = "Can't find model for source store"; } Do I need to updat the sqlite database ? Thanks

    Read the article

  • Problems with Unity BuildUp Method

    - by Voice
    Hi everybody) I'm using Unity App Block for my project (version 1.2.0.0). I have a problem with Unity Container BuildUp method which I'm using for my ascx controls. Here is some code (that's pretty simple) public class BaseUserControl<T>:UserControl where T:class { protected override void OnInit(EventArgs e) { InjectDependencies(); base.OnInit(e); } protected virtual void InjectDependencies() { var context = HttpContext.Current; if (context == null) { return; } var accessor = context.ApplicationInstance as IContainerAccessor; if (accessor == null) { return; } var container = accessor.Container; if (container == null) { throw new InvalidOperationException("No Unity container found"); } container.BuildUp<T>(this as T); } } This method is called in base control for ascx controls in my solution. And here the property that should be injected in child control: [Dependency] private IStock Stock { get; set; } So after buildup Stock property is still empty. Resolve method works fine for IStock with the same container and configuration. I've tried buildup with simple test class with only one property IStock and got the same result. So what can be wrong with buildup?

    Read the article

  • Problems with Backbone.Model callback and THIS

    - by Rev. Samuel
    I'm building a simple weather widget. The current weather conditions are read out of the National Weather Service xml file and then I want to parse and store the relevant data in the model but the callback for the $.ajax won't connect (the way I'm doing it). var Weather = Backbone.Model.extend({ initialize: function(){ _.bindAll( this, 'update', 'startLoop', 'stopLoop' ); this.startLoop(); }, startLoop: function(){ this.update(); this.interval = window.setInterval( _.bind( this.update, this ), 1000 * 60 * 60 ); }, stopLoop: function(){ this.interval = window.clearInterval( this.interval ); }, store: function( data ){ this.set({ icon : $( data ).find( 'icon_url_name' ).text() }); }, update: function(){ $.ajax({ type: 'GET', url: 'xml/KROC.xml', datatype: 'xml' }) .done( function( data ) { var that = this; that.store( $( data ).find( 'current_observation' )[ 0 ] ); }); } }); var weather = new Weather(); The data is read correctly but I can't get the done function of the call back to call the store function. (I would be happy if the "done" would just parse and then do "this.set". Thanks in advance for your help.

    Read the article

  • Java - problems with polymorphism

    - by cc0
    I have a book class, then a novel- and a science book class that extend the book class. I made an ArrayList using the book class, then inserted the novels and the science books into that. Now I'm trying to iterate through the ArrayList to count how many novels are there. How can I tell? Would love to see some examples of this! I've been at it for a while.

    Read the article

  • having problems with javascript null

    - by user165242
    I have tried rectifying the code below. But I am not able to find a solution. After executing the code, firebug says "document.getElementById(haystack.value) is null". I tried if(document.getElementById(haystack).value ==null) but it was of no use. Please help me out. var haystack=document.getElementById('city1').value; if(!document.getElementById(haystack).value) { alert("null"); } else { alert("not null"); }

    Read the article

  • R problems using rpart with 4000 records and 13 attributes

    - by josh
    I have attempted to email the author of this package without success, just wondering if anybody else has experienced this. I am having an using rpart on 4000 rows of data with 13 attributes. I can run the same test on 300 rows of the same data with no issue. When I run on 4000 rows, Rgui.exe runs consistently at 50% cpu and the UI hangs.... it will stay like this for at least 4-5hours if I let it run, and never exit or become responsive. here is the code I am using both on the 300 and 4000 size subset : train<-read.csv("input.csv",header=T) y<-train[,18] x<-train[,3:17] library(rpart) fit<-rpart(y~.,x) Is this a known limitation of rpart, am I doing something wrong? potential workarounds? any assistance appreciated

    Read the article

  • Performance Problems with Django's F() Object

    - by JayhawksFan93
    Has anyone else noticed performance issues using Django's F() object? I am running Windows XP SP3 and developing against the Django trunk. A snippet of the models I'm using and the query I'm building are below. When I have the F() object in place, each call to a QuerySet method (e.g. filter, exclude, order_by, distinct, etc.) takes approximately 2 seconds, but when I comment out the F() clause the calls are sub-second. I had a co-worker test it on his Ubuntu machine, and he is not experiencing the same performance issues I am with the F() clause. Anyone else seeing this behavior? class Move (models.Model): state_meaning = models.CharField( max_length=16, db_index=True, blank=True, default='' ) drop = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_move_drop' ) class Split(models.Model): state_meaning = models.CharField( max_length=16, db_index=True, blank=True, default='' ) move = models.ForeignKey( Move, related_name='splits' ) pickup = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_split_pickup' ) pickup_date = models.DateField( null=True, default=None ) drop = models.ForeignKey( Org, db_index=True, null=False, default=1, related_name='as_split_drop' ) drop_date = models.DateField( null=True, default=None, db_index=True ) def get_splits(begin_date, end_date): qs = Split.objects \ .filter(state_meaning__in=['INPROGRESS','FULFILLED'], drop=F('move__drop'), # <<< the line in question pickup_date__lte=end_date) elapsed = timer.clock() - start print 'qs1 took %.3f' % elapsed start = timer.clock() qs = qs.filter(Q(drop_date__gte=begin_date) | Q(drop_date__isnull=True)) elapsed = timer.clock() - start print 'qs2 took %.3f' % elapsed start = timer.clock() qs = qs.exclude(move__state_meaning='UNFULFILLED') elapsed = timer.clock() - start print 'qs3 took %.3f' % elapsed start = timer.clock() qs = qs.order_by('pickup_date', 'drop_date') elapsed = timer.clock() - start print 'qs7 took %.3f' % elapsed start = timer.clock() qs = qs.distinct() elapsed = timer.clock() - start print 'qs8 took %.3f' % elapsed

    Read the article

  • how could I pass closure problems in order to increment a global var

    - by hyptos
    I have a simple goal, I would like to increment a variable but I'm facing the closure problem. I've read why this s happening here How do JavaScript closures work? But I can't find the solution to my problem :/ let's assume this part of code I took from the link. function say667() { // Local variable that ends up within closure var num = 666; var sayAlert = function() { alert(num); //incrementation } num++; return sayAlert; } I would like to increment num within the function and to keep the changes to num. How could I do that ? Here is the JsFiddle where I have my problem, I can't figure out how to increment my totalSize and keep it. http://jsfiddle.net/knLbv/2/ I don't want a local variable that ends up with closure.

    Read the article

  • iphone: memory problems after refactor

    - by agilpwc
    I had a NIB with several view controllers in it. I modified the code and used Interface Builder decomose interface to get all the view controllers in their own Nib. But now with empty core data database, I'm getting "message sent to deallocated instance" errors. Here is the code flow: From the RootViewController this is called: if (self.dogController == nil) { DogViewController *controller = [[DogViewController alloc] initWithNibName:@"DogViewController" bundle:nil]; self.dogController = controller; [controller release]; } self.dogController.managedObjectContext = self.managedObjectContext; [self.navigationController pushViewController:self.dogController animated:YES]; Then in a dogController a button is pressed to insert a new object and the following code is excuted and the error hits on the save, according to the trace NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; // If appropriate, configure the new managed object. [newManagedObject setValue:[NSDate date] forKey:@"birthDate"]; [newManagedObject setValue:@"-" forKey:@"callName"]; // Save the context. NSError *error = nil; if (![context save:&error]) { Then the error produced in the console is * -[JudgeViewController numberOfSectionsInTableView:]: message sent to deallocated instance 0x598e580 I'm racking my brain for hours and I can't figure out where my minor changes made something messed up. Any ideas?

    Read the article

  • Haskell: Problems with overloading: Interpreter can´t tell which + to use

    - by Ben
    Hi, I want to make functions Double - Double an instance of the Num typeclass. I want to define the sum of two functions as sum of their images. So I wrote instance Num Function where f + g = (\ x - (f x) + (g x)) Here the compiler complains he can´t tell whether I´m using Prelude.+ or Module.+ in the lambda expression. So I imported Prelude qualified as P and wrote instance Num Function where f + g = (\ x - (f x) P.+ (g x)) This compiles just fine, but when I try to add two functions in GHCi the interpreter complains again he can´t tell whether I´m using Prelude.+ or Module.+. Is there any way I can solve this problem?

    Read the article

  • Problems with instantiating in JAVA

    - by PUPIALEX
    When running, below programme cannot reach the end of the main function.. I am new to JAVA, and cannot find its defections.. I need your help. Thanks. import java.util.*; class Schedule { public String day; private int startTime, endTime; public Schedule(String input_day, int input_start, int input_end) { day = input_day; startTime = input_start; endTime = input_end; } /* clashWith: to check whether this schedule clash with a Schedule called otherSchedule * PRE-Condition : input must be of Schedule type * POST-Condition : return true if two Schedule clash, return false if not. */ public boolean clashWith(Schedule otherSchedule) { if(this.day != otherSchedule.day || this.endTime <= otherSchedule.startTime || this.startTime >= otherSchedule.endTime) return false; return true; } } class Module { String code; Schedule lecture, tutorial, lab; public Module(String input_code, Schedule input_lecture, Schedule input_tutorial, Schedule input_lab) { code = input_code; lecture = input_lecture; tutorial = input_tutorial; lab = input_lab; } /* count: to count number of classes(lecture, tutorial, and lab of only this Module) on day. * For example: when day = "Monday", lecture is on Monday, tutorial is on Monday * but lab is on Tuesday, then return 2. (lecture and tutorial are on Monday). * PRE-Condition : * POST-Condition : */ public int count(String day) { int num = 0; if(lecture.day == day) num++; if(tutorial.day == day) num++; if(lab.day == day) num++; return num; } /* clashWith: to check whether this module clash with a Module called otherModule * PRE-Condition : * POST-Condition : */ public boolean clashWith(Module otherModule) { if(lecture.clashWith(otherModule.lecture) || lecture.clashWith(otherModule.tutorial) || lecture.clashWith(otherModule.lab) ) return true; if(tutorial.clashWith(otherModule.lecture) || tutorial.clashWith(otherModule.tutorial) || tutorial.clashWith(otherModule.lab)) return true; if(lab.clashWith(otherModule.lecture) || lab.clashWith(otherModule.tutorial) || lab.clashWith(otherModule.lab)) return true; return false; } } class Timetable { Vector<Module> listOfModule; public Timetable() { } /* checkClash: to check whether otherModule clash with one of * the modules in our timetable list. * PRE-Condition : * POST-Condition : */ public boolean checkClash(Module otherModule) { for(Module c: listOfModule) if(c.clashWith(otherModule)) return true; return false; } /* add: to add a new module to the timetable list. * PRE-Condition : * POST-Condition : */ public void add(Module module) { listOfModule.add(module); } /* count: to count number of classes on day. * PRE-Condition : * POST-Condition : */ public int count(String day) { int count_day=0; for(Module c: listOfModule) count_day += c.count(day); return count_day; } } public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num_operation; String code ; Timetable userTimetable = new Timetable(); num_operation = input.nextInt(); for(int i=0;i<num_operation;i++) { if(input.next() == "MODULE") { code = input.next(); String day; int start, end; Schedule getLecSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Schedule getTutSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Schedule getLabSche = new Schedule(input.next(),input.nextInt(),input.nextInt()); Module userModule = new Module(code, getLecSche, getTutSche, getLabSche); System.out.println("Reached line 162"); if(!userTimetable.checkClash(userModule)) { userTimetable.add(userModule); System.out.println("Added"); } else System.out.println("Clashed"); } else if(input.next() == "COUNT"){ code = input.next(); System.out.println(userTimetable.count(code)); } } } }

    Read the article

  • Problems with Facebook API - Getting all content from table Stream

    - by Fernando Paiva
    I am trying to get all stream data from a group (I have wall entries, discussions, events and photos). For now, Access on this group is Open. $result = $_fb-api_client-fql_query("SELECT actor_id, message FROM stream WHERE source_id=$gid LIMIT 50"); Only some of the records come back (5 out of 10) (only wall entries and a photo). Just in case, I asked for extra permission when user signed up for the app (just to make sure is not a lack of permissions - even though the Group is "open" right now): Access my News Feed & Wall Send SMS messages to my phone Create and modify events RSVP to events Access my data when I'm not using the application Publish content to my Wall Access my email address Access Insights data for my pages and applications

    Read the article

  • Problems with Getting Remote Contents using Google App Engine

    - by dade
    Here is the client side code. It is running insdide a Google Gadgets var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON; var url = "http://invplatformtest.appspot.com/getrecent/"; gadgets.io.makeRequest(url, response, params); The response function is: function response(obj) { var r = obj.data; alert(r['name']); } while on the server end, the python code sending the JSON is: class GetRecent(webapp.RequestHandler): def get(self): self.response.out.write({'name':'geocities'}) #i know this is where the problem is so how do i encode json in GAE? which is just supposed to send back a Json encoded string but when i run this, the javascript throws the following error: r is null alert(r['name']); If i were recieving just TEXT contents and my server send TEXT everything works fine. I only get this problem when am trying to send JSON. Where exactly is the problem? Am i encoding the JSON the wrong way on AppEngine? I tried using the JSON library but it looks as if this is not supported. Where is the problem exactly? :(

    Read the article

  • Using search to solve problems

    - by dan
    am trying to write a 4 x 4 grid using vertical bars and underscore. I have a class for the puzzle, but i want to know what fields and methods i can use to represent and manipulate a configuration for the puzzle

    Read the article

  • sifr menu list problems, height of object calculated wrong

    - by armyofda12mnkeys
    I am using Drupal and have sifr set on list items, and also a, a:hover are set via Drupal so that the links hover. I looked at the sifr3-rules.js file drupal's render module creates and it looks good. and in fact my other sifr items look fine... But the list item ones are goofing for some reason... There is extra space below the list, so if i have a list item, and inside of that, I have a unordered list with more list items, the Flash Object made in the 1st li (which will cover the rest of the sublist items too), is too bid so you see space under the children until the next parent li comes up. (so looks like extra bottom padding on that portion of the list in IE8... in FF almost similar but each subitem has space at bottom... with javascript turned off, you see the list items look fine by themselves).... Also if the parent list item is shorter than the sub list items text, the width for the flash object is set only as long as the first list item, and therefore cuts off the rest the sublist item's text. Any idea how to resolve any of these? Only unusual thing i see i am doing is setting forceSingleLine and preventWrap (which dont make a difference if taken off). ****Edit, I may just try to figure out how to get Drupal's menu-block module to output a around my hyperlinks in the list items... then i can target the div's with my rule (and the a,a:hover rules will apply), so each menu item gets its own sifr object instead of sifr3 trying to figure out how to do the lists and sublists. Very useful to me is anyone knows a way to target a hyperlink (<a> tag) and also allow a:hover rules. I know how to do it with pretend another tag that includes hyperlinks, like if i had <h2><a>sometitle</a></h2>, i could have a rule for h2, but then use the a, a:hover rules in the sifr3-rules.js file to target that. so i would need a way to target the hyperlink in the list, but also apply a :hover to it (not sure if this can be done since its not underneith for example the h2 tag).

    Read the article

  • Problems with my JS array undefined x 7

    - by Dave
    I have an array im trying to loop through to create a new type of array specific to my current page. My array looks like this: //$_SESSION['data'] = Array ( [0] => 1 [1] => 0 [2] => Tom [8] => 1 [4] => 1 [5] => Array ( [7] => Array ( [0] => Andrew [1] => 1 [2] => 1 [4] => 0 [5] => avatar.jpg [6] => 1 ) ) [6] => Array ( [0] => 1 [1] => 2 ) ) So in my JS file i have this: var stats = <? echo $_SESSION['data'][5]); ?> ; //this is the array my_data = new Array(); for(var key in stats){ if(key in my_data){} else { //prevent double entry my_data[key] = new Array(); my_data[key][0] = stats[key][6]; my_data[key][1] = stats[key][5]; my_data[key][2] = stats[key][2]; my_data[key][3] = stats[key][0]; } } console.log(my_data); Now in console.log i get this : [undefined × 7, Array[4] 0: "1" 1: "avatar.jpg" 2: "1" 3: "Andrew" length: 4 __proto__: Array[0] ] I'm wondering why it is saying undefined x7?

    Read the article

  • Problems opening large csv file

    - by John Tyler
    I have a csv file that is 100mb in size. I need to parse some data out of it into a new format. I tried PHP, but keep running into memory issues. After around the first 150 "rows" or so, the script poops out. This is even on the localhost, and doing everything I can to tune the PHP settings, including max_memory and script_execution_time. Now before I continue, I'd like to know if Python will poop out on me too. Or if I will have to use C++. Can someone name good csv libraries for for these programmin langueage? The file is quoted csv. I mean scheiza I can't even open this text file in OpenOffice without it dying on me. (then again, Java sux as bad as PHP)

    Read the article

  • Problems with variadic macros in C

    - by imikedaman
    Hi, I'm having a problem with optional arguments in #define statements in C, or more specifically with gcc 4.2: bool func1(bool tmp) { return false; } void func2(bool tmp, bool tmp2) {} #define CALL(func, tmp, ...) func(tmp, ##__VA_ARGS__) int main() { // this compiles CALL(func2, CALL(func1, false), false); // this fails with: Implicit declaration of function 'CALL' CALL(func2, false, CALL(func1, false)); } That's obviously a contrived example, but does show the problem. Does anyone know how I can get the optional arguments to "resolve" correctly? Additional information: If I remove the ## before _VA_ARGS_, and do something like this: bool func2(bool tmp, bool tmp2) { return false; } #define CALL(func, tmp, ...) func(tmp, __VA_ARGS__) int main() { CALL(func2, false, CALL(func2, false, false)); } That compiles, but it no longer works with zero arguments since it would resolve to func(tmp, )

    Read the article

  • Python - Problems using mechanize to log into a difficult website

    - by user1781599
    × 139886 I am trying to log in to betfair.com by using mechanize. I have tried several ways but it always fail. This is the code I have developed so far, can anyone help me to identify what is wrong with it and how I can improve it to log into my betfair account? Thanks, import cookielib import urllib import urllib2 from BeautifulSoup import BeautifulSoup import mechanize from mechanize import Browser import re bf_username_name = "username" bf_password_name = "password" bf_form_name = "loginForm" bf_username = "xxxxx" bf_password = "yyyyy" urlLogIn = "http://www.betfair.com/" accountUrl = "https://myaccount.betfair.com/account/home?rlhm=0&" # This url I will use to verify if log in has been successful br = mechanize.Browser(factory=mechanize.RobustFactory()) br.addheaders = [("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.90 Safari/537.1")] br.open(urlLogIn) br.select_form(nr=0) print br.form br.form[bf_username_name] = bf_username br.form[bf_password_name] = bf_password print br.form #just to check username and psw have been recorded correctly responseSubmit = br.submit() response = br.open(accountUrl) text_file = open("LogInResponse.html", "w") text_file.write(responseSubmit.read()) #this file should show the home page with me logged in, but it show home page as if I was not logged it text_file.close() text_file = open("Account.html", "w") text_file.write(response.read()) #this file should show my account page, but it should a pop up with an error text_file.close()

    Read the article

  • 1.8.x Ruby on Rails RESTful nested admin page and form_for problems

    - by Loomer
    So I am creating a website that I want to have an admin directory in rails 1.8.x and I'm struggling a bit to get the form_for to link to the right controller. I am trying to be RESTful. What I basically want is an admin page that has a summary of actions which can then administer sub models such as: /admin (a summary of events) /admin/sales (edit sales on the site) /admin/sales/0 (the normal RESTful stuff) I can't use namespaces since they were introduced in Rails 2.0 (production site that I don't want to mess with updating rails and all that). Anyway, what I have in the routes.rb is: map.resource :admin do |admin| admin.resources :sales end I am using the map.resource as a singleton as recommended by another site. The problem comes in when I try to use the form_for to link to the subresource RESTfully. If i do : form_for(:sales, @sale) it never links to the right controller no matter what I try. I have also tried: form_for [@admin, @sale] do |f| and that doe not work either (I am guessing since admin is a singleton which does not have a model, it's just a placeholder for the admin controller). Am I supposed to add a prefix or something? Or something into the sales controller to specify that it is a subcontroller to admin? Is there an easier way to do this without manually creating a bunch of routes? Thanks for any help.

    Read the article

< Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >