Search Results

Search found 4088 results on 164 pages for 'params keyword'.

Page 43/164 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • $.Post with Form submit

    - by Michael
    ...Some form gets submitted... $.("form").submit(function() { saveFormValues($(this), "./../.."; } function saveFormValues(form, path) { var inputs = getFormData(form); var params = createAction("saveFormData", inputs); var url = path + "/scripts/sessions.php"; $.post(url, params); } The weird thing is that if i add a function to the $.post(url, params, function(data) { alert(data); } I get a blank alert statement. Within scripts/sessions.php i have a function to save whatever the $_POST information is to a file, and the sessions.php never saves this saveFormValues call. It never shows up to the file. But if i keep trying to get it to save, about once every 15 will actually allow it to be saved. This leads me to believe that the forms POST is somehow blocking this value saving post. Any help?

    Read the article

  • Ruby on Rails redirect_to not functioning in IF statement?

    - by Hard-Boiled Wonderland
    Hi, I am redirecting a POST request to ensure the URL is correct along with other things. The redirect worked fine before I added in the if statements for town below: if !params[:address].blank? town = Town.find(:all, :conditions => ["name = ?", params[:address]]) @towns = town if !town.blank? redirect_to '/town/' + params[:address] else @town_invalid = 'test' end end end I am sure it is something simple and that I simply cannot see it. Also if you see any glaring errors or code mishaps let me know as I am just starting out. EDIT: I should mention this is what I get back from Safari when a real town is entered: Safari can’t open the page.Safari can’t open the page “http://localhost:3000/” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again. Thanks!

    Read the article

  • Static initializer in Java

    - by Szere Dyeri
    My question is about one particular usage of static keyword. It is possible to use static keyword to cover a code block within a class which does not belong to any function. For example following code compiles: public class Test { private static final int a; static { a = 5; doSomething(a); } private static int doSomething(int x) { return (x+5); } } If you remove the static keyword it complains because the variable a is final. However it is possible to remove both final and static keywords and make it compile. It is confusing for me in both ways. How am I supposed to have a code section that does not belong to any method? How is it possible to invoke it? In general, what is the purpose of this usage? Or better, where can I find documentation about this?

    Read the article

  • iPhone FBConnect, dashboard.addnews

    - by Dmitry
    Hi, The question is: how to add news via FBConnect?? I have the following code: NSString *newsBody = @"[{\"message\": \"News message\" }]"; NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:newsBody forKey:@"news"]; [[FBRequest requestWithDelegate:self] call:@"facebook.dashboard.addnews" params:params dataParam:nil]; After I sent the request I received the success responce. But I can't see the new news in the facebook account!! Also, I tried to add full info into news parameter (http://wiki.developers.facebook.com/index.php/Dashboard.addNews):: NSString *newsBody = @"[{\"message\": \"News message\",\"action_link\": {\"text\": \"link text\", \"href\": \"http: //google.com\"} }]"; But this request returns error :( Thanks in advance!

    Read the article

  • Converting Asynchronous Programming Model (Begin/End methods) into event-based asynchronous model?

    - by David
    Let's say I have code that uses the Asynchronous Programming Model, i.e. it provides the following methods as a group which can be used synchronously or asynchronously: public MethodResult Operation(<method params>); public IAsyncResult BeginOperation(<method params>, AsyncCallback callback, object state); public MethodResult EndOperation(IAsyncResult ar); What I want to do is wrap this code with an additional layer that will transform it into the event-driven asynchronous model, like so: public void OperationAsync(<method params>); public event OperationCompletedEventHandler OperationCompleted; public delegate void OperationCompletedEventHandler(object sender, OperationCompletedEventArgs e); Does anyone have any guidance (or links to such guidance) on how to accomplish this?

    Read the article

  • HTTPService is very slow by sending 10'000 lines of XML to the server...

    - by Markus
    Hi everybody, I have a flex app which allows user to create some content. this content will then be sent via xml back to the server: private function saveBackXMLToServer():void { var params:Object = {}; params["xml_file"] = XML_content(); http_Service.send(params); } My problem is, that the transport of the data this way is very slow... It takes about 20 sec for 10'000 lines of XML... How can this be done better? Thanks in advance! Markus

    Read the article

  • Only show activities from a specific gadget in OpenSocial

    - by corné
    I created a gadget which is able to post activities: function postActivity(text) { var params = {}; params[opensocial.Activity.Field.TITLE] = text; var activity = opensocial.newActivity(params); opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH); }; And I request activities by doing: req.add(req.newFetchActivitiesRequest( new opensocial.IdSpec({'userId' : 'VIEWER', 'groupId' : 'FRIENDS'})), 'friends_activities'); My question is: How can I filter activities to only show activities posted by a specific gadget? I reckon the field "appId" is meant for this, but this field is empty in the response.

    Read the article

  • bad request error 400 while using python requests.post function

    - by Toussah
    I'm trying to make a simple post request via the requests library of Python and I get a bad request error (400) while my url is supposedly correct since I can use it to perform a get. I'm very new in REST requests, I read many tutorials and documentation but I guess there are still things I don't get so my error could be basic. Maybe a lack of understanding on the type of url I'm supposed to send via POST. Here my code : import requests v_username = "username" v_password = "password" v_headers = {'content-type':'application/rdf+xml'} url = 'https://my.url' params = {'param': 'val_param'} payload = {'data': 'my_data'} r = requests.post(url, params = params, auth=(v_username, v_password), data=payload, headers=v_headers, verify=False) print r I used the example of the requests documentation.

    Read the article

  • getting last insert id .sqlalchemy orm

    - by gummmibear
    Hi i use sqlalchemy, i need some help. import hashlib import sqlalchemy as sa from sqlalchemy import orm from allsun.model import meta t_user = sa.Table("users",meta.metadata,autoload=True) class Duplicat(Exception): pass class LoginExistsException(Exception): pass class EmailExistsException(Exception): pass class User(object): """ def __setattr__(self, key, value): if key=='password' : value=unicode(hashlib.sha512(value).hexdigset()) object.__setattr__(self,key,value) """ def loginExists(self): try: meta.Session.query(User).filter(User.login==self.login).one() except orm.exc.NoResultFound: pass else: raise LoginExistsException() def emailExists(self): try: meta.Session.query(User).filter(User.email==self.email).one() except orm.exc.NoResultFound: pass else: raise EmailExistsException() def save(self): meta.Session.begin() meta.Session.save(self) try: meta.Session.commit() except sa.exc.IntegrityError: raise Duplicat() How can i get inserted id when i call? user = User() user.login = request.params['login'] user.password = hashlib.sha512(request.params['password']).hexdigest() user.email = request.params['email'] user.save()

    Read the article

  • Proper snowball analyzer configuration when using Grails Searchable Plugin

    - by Wirsbro
    To improve stemming we want to switch from the default analyzer to snowball, however, having a lot of difficulty with the proper settings and would appreciate any help. In Environment: - Sun's Java 1.6.16 - Grails 1.2.2 - Searchable Plug-In 0.5.5 Config.groovy: Have tried both settings: compassSettings = ['compass.engine.analyzer.stemmed.type': 'snowball', 'compass.engine.analyzer.stemmed.name': 'English'] compassSettings = ['compass.engine.analyzer.snowball.type': 'snowball', 'compass.engine.analyzer.snowball.name': 'English', 'compass.engine.analyzer.search.type': 'snowball', 'compass.engine.analyzer.search.name': 'English'] Search.groovy - The Invocation: def searchResult = searchableService.search(params.q, withHighlighter: { highlighter, index, sr if (!sr.highlights) { sr.highlights = [] } try { sr.highlights[index] = highlighter.fragments("content")[0..2].join(" ") } catch (IndexOutOfBoundsException ex) { sr.highlights[index] = highlighter.fragment("content") } }) def suggestion = searchableService.suggestQuery(params.q) if (suggestion != params.q) { searchResult.suggestedQuery = suggestion }

    Read the article

  • OpenID register on login (authlogic_openid)

    - by Glex
    What is the proper way to register users automatically when they log in with openid? I am using authlogic with an authlogic-oid gem (and an older version of openid_authentication). The stuff I read online so far seems to be obsolete. Does anyone know the proper way to do it with the new gem? What I do now is: options = params[:user_session] || {} [:openid_identifier].each { |k| options[k] = params[k] if params[k] } @user_session = UserSession.new(options) @user_session.save do |result| if result flash[:notice] = "Login successful! (#{result.inspect})" redirect_back_or_default account_url else render :action => :new end end By the way, I don't see the Login Successful flash (but that is not that big of a deal).

    Read the article

  • iPhone facebook connect FQL Query to get Profile URL.

    - by user306641
    Hai. I am using Face book Connect FQL Queries to extract my profile photo url that is src_big,src_small URL. But i am always getting the empty array in below delegate (void)request:(FBRequest*)request didLoad:(id)result My FQL query is. NSString* fql = [NSString stringWithFormat:@"SELECT src_big,src_small FROM photo WHERE pid IN (SELECT cover_pid FROM album WHERE owner =%lld AND name ='Profile Pictures')", session.uid]; NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"]; [[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params]; But - (void)request:(FBRequest*)request didLoad:(id)result always return the empty result. Can any one please correct me if there any mistake.

    Read the article

  • Problem inserting parameters into a function

    - by SoLoGHoST
    Ok, I am trying to place parameters into a function that is called like so: $parameters['function']($parameters['params']); Here is the function and the parameters that I need to be placed into this: $parameters['function'] = 'test_error'; $parameters['params'] = array(0 => $txt['sometext'], 1 => 'critical', 2 => true); The test_error function takes 3 parameters: The error to output The type of error noted within a string value ('general', 'critical', etc. etc.). Whether it should be echoed or not. Here is the output I get: Here is a test error.ArraycriticalArray1 I know this function works perfect, but it only gives me the 1st parameter returned from it. What am I doing wrong here with the $parameters['params']??

    Read the article

  • MongoMapper - undefined method `keys'

    - by nimnull
    I'm trying to create a Document instance with params passed from the post-submitted form: My Mongo mapped document looks like: class Good include MongoMapper::Document key :title, String key :cost, Float key :description, String timestamps! many :attributes validates_presence_of :title, :cost end And create action: def create @good = Good.new(params[:good]) if @good.save redirect_to @good else render :new end end params[:good] containes all valid document attributes - {"good"={"cost"="2.30", "title"="Test good", "description"="Test description"}}, but I've got a strange error from rails: undefined method `keys' for ["title", "Test good"]:Array My gem list: *** LOCAL GEMS *** actionmailer (2.3.8) actionpack (2.3.8) activerecord (2.3.8) activeresource (2.3.8) activesupport (2.3.8) authlogic (2.1.4) bson (1.0) bson_ext (1.0) compass (0.10.1) default_value_for (0.1.0) haml (3.0.6) jnunemaker-validatable (1.8.4) mongo (1.0) mongo_ext (0.19.3) mongo_mapper (0.7.6) plucky (0.1.1) rack (1.1.0) rails (2.3.8) rake (0.8.7) rubygems-update (1.3.7) Any suggestions how to fix this error?

    Read the article

  • C# - Do you use "var"?

    - by Paul Stovell
    C# 3.0 introduces implicitly typed variables, aka the "var" keyword. var daysInAWeek = 7; var paul = FindPerson("Paul"); var result = null as IPerson; Others have asked about what it does or what the problems with it are: http://stackoverflow.com/questions/527685/anonymous-types-vs-local-variables-when-should-one-be-used http://stackoverflow.com/questions/209199/whats-the-point-of-the-var-keyword http://stackoverflow.com/questions/41479/use-of-var-keyword-in-c I am interested in some numbers - do you use it? If so, how do you use it? I never use var (and I never use anonymous types) I only use var for anonymous types I only use var where the type is obvious I use var all the time!

    Read the article

  • Whats wrong with this task queue setup?

    - by Peter Farmer
    I've setup this task queue implementation on a site I host for a customer, it has a cron job which runs each morning at 2am "/admin/tasks/queue", this queues up emails to be sent out, "/admin/tasks/email", and uses cursors so as to do the queuing in small chunks. For some reason last night /admin/tasks/queue kept getting run by this code and so sent out my whole quota of emails :/. Have I done something wrong with this code? class QueueUpEmail(webapp.RequestHandler): def post(self): subscribers = Subscriber.all() subscribers.filter("verified =", True) last_cursor = memcache.get('daily_email_cursor') if last_cursor: subscribers.with_cursor(last_cursor) subs = subscribers.fetch(10) logging.debug("POST - subs count = %i" % len(subs)) if len(subs) < 10: logging.debug("POST - Less than 10 subscribers in subs") # Subscribers left is less than 10, don't reschedule the task for sub in subs: task = taskqueue.Task(url='/admin/tasks/email', params={'email': sub.emailaddress, 'day': sub.day_no}) task.add("email") memcache.delete('daily_email_cursor') else: logging.debug("POST - Greater than 10 subscibers left in subs - reschedule") # Subscribers is 10 or greater, reschedule for sub in subs: task = taskqueue.Task(url='/admin/tasks/email', params={'email': sub.emailaddress, 'day': sub.day_no}) task.add("email") cursor = subscribers.cursor() memcache.set('daily_email_cursor', cursor) task = taskqueue.Task(url="/admin/tasks/queue", params={}) task.add("queueup")

    Read the article

  • Best way to implement keywords for image upload gallery

    - by Dan Berlyoung
    I'm starting to spec out an image gallery type system similar to Facebook's. Members of the site will be able to create image galleries and upload images for others to view. Images will have keywords the the uploader can specify. Here's the question, what's the best way to model this? With image and keyword tables linked vi a HABTM relation? Or a single image table with the keywords saved as comma delimited values in a text field in the image record? Then search them using a LIKE or FULL TEXT index function? I want to be able to pull up all images containing a given keyword as well as generate a keyword cloud. I'm leaning toward the HABTM setup but I wanted to see what everyone else though. Thanks!!

    Read the article

  • Looking for a method to replace a string with a hyperlink

    - by Richard West
    I have a usercontrol in an asp web forms application that I am working on in C#. I am binding to a repeater and outputting a field of information, named "Text", using the following syntax: <%# DataBinder.Eval(Container.DataItem, "Text") %> I am looking for a method that will allow my to search for a keyword within the string that is returned from above, and replace that string with a hyperlink such as <a href="www.anysite.com/keyword">keyword</a>. I'm not very familer with user controls and getting data back in this manner so I am looking for advice on how this might be best handled. Thanks!

    Read the article

  • RESTful membership

    - by FoxDemon
    I am currentlly trying to design a RESTful MembershipsController. The controller action update is used only for promoting, banning, approving,... members. To invoke the update action the URL must contain a Parameter called type with the appropriate value. I am not too sure if that is really RESTful design. Should I rather introduce sepearate actions for promoting,... members? class MembershipsController < ApplicationController def update @membership= Membership.find params[:id] if Membership.aasm_events.keys.include?(params[:type].to_sym) #[:ban, :promote,...] @membership.send("#{params[:type]}!") render :partial => 'update_membership' end end end

    Read the article

  • Init var without copy constructor

    - by Ockonal
    Hello, I have some class(Window) without copy constructor (it's private). I can't understand how to init var of this class in my own class: class MyClass { Window obj; // Hasn't copy constructor public: void init() { obj = Window(/* constructor params */); // [error] obj(/* constructor params */); // [error] } } Error 1: initializing argument 1 of ‘Window::Window(WindowHandle, const sf::WindowSettings&)’ Error 2: ‘NonCopyable& NonCopyable::operator=(const NonCopyable&)’ is private But it works in this way: Window obj(/* constructor params */);

    Read the article

  • Binding key/value pairs loaded from xml

    - by Hichem
    I want to load key/values configuration pairs stored in XML file. To bind a collection of data i know i need to use the ArrayList class, but the problem is that i want to be able to bind the loaded values using their corresponding keys and not by their indexes in the ArrayList object. For example i want to be able to do this : <mx:Text id="errorText" text="{Config.params['someKey']}" /> instead of : <mx:Text id="errorText" text="{Config.params[0]}" /> where Config.params is ArrayList (obviously i couldn't use ArrayList since it doesn't allow selecting a value by key) So the question is how to bind the key/value pairs loaded form XML. I don't want to go manually set variables, i want to bind them so when they are loaded the are set automatically. Did anyone had to do something like that ?

    Read the article

  • Ruby on Rails - Currency : commas causing an issue.

    - by easement
    Looking on SO, I see that the preferred way to currency using RoR is using decimal(8,2) and to output them using number_to_currency(); I can get my numbers out of the DB, but I'm having issues on getting them in. Inside my update action I have the following line: if @non_labor_expense.update_attributes(params[:non_labor_expense]) puts YAML::dump(params) The dump of params shows the correct value. xx,yyy.zz , but what gets stored in the DB is only xx.00 What do I need to do in order to take into account that there may be commas and a user may not enter .zz (the cents). Some regex and for comma? how would you handle the decimal if it were .2 versus .20 . There has to be a builtin or at least a better way. My Migration (I don't know if this helps): class ChangeExpenseToDec < ActiveRecord::Migration def self.up change_column :non_labor_expenses, :amount, :decimal, :precision => 8, :scale => 2 end def self.down change_column :non_labor_expenses, :amount, :integer end end

    Read the article

  • What causes subprocess.call to output blank file when attempting db export with mysqldump?

    - by caldazar
    I am having some problems using subprocess.call to export a database using mysqldump. I'm using Python 3.1 installed on Windows 7. from time import gmtime, strftime import subprocess DumpDir = "c:/apps/sqlbackup/"; DumpFile = "mysqldump-" + strftime("%Y-%m-%d-%H-%M-%S", gmtime()) + ".sql"; params = [r"mysqldump --user root --password=mypassword --force --flush-privileges --compress --comments mydatabase --result-file=" + DumpDir + DumpFile]; subprocess.call(params, shell=True); The above code causes a blank file to be created in the DumpDir. I've tried getting python to print the command so I can test it via the CMD prompt using: print(subprocess.list2cmdline(params)); If I paste the output to the CMD prompt and execute it, everything works fine. Any ideas? I'm new to Python, so I am sure the answer is simple but I've tried so many variations to get this working that I just can't figure this out.

    Read the article

  • mysql - filtering a list against keywords, both list and keywords > 20 million records

    - by threecheeseopera
    I have two tables, both having more than 20 million records; table1 is a list of terms, and table2 is a list of keywords that may or may not appear in those terms. I need to identify the terms that contain a keyword. My current strategy is: SELECT table1.term, table2.keyword FROM table1 INNER JOIN table2 ON table1.term LIKE CONCAT('%', table2.keyword, '%'); This is not working, it takes f o r e v e r. It's not the server (see notes). How might I rewrite this so that it runs in under a day? Notes: As for server optimization: both tables are myisam and have unique indexes on the matching fields; the myisam key buffer is greater than the sum of both index file sizes, and it is not even being fully taxed (key_blocks_unused is ... large); the server is a dual-xeon 2U beast with fast sas drives and 8G of ram, fine-tuned for the mysql workload.

    Read the article

  • PHP OOP: Method Chaining

    - by Isis
    I have the following code, <?php class Templater { static $params = array(); public static function assign($name, $value) { self::$params[] = array($name => $value); } public static function draw() { self::$params; } } $test = Templater::assign('key', 'value'); $test = Templater::draw(); print_r($test); How can I alter this script so I could use this? $test = Templater::assign('key', 'value')->assign('key2', 'value2')->draw(); print_r($test);

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >