Search Results

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

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

  • only 1 record is being inserted

    - by bobobobo
    I'm running an insert statement using OLE DB and an ICommandWithParameters. In the ICommandText, I made sure to set: params.cParamSets = n ; Then cmdTxt-Execute( NULL, IID_NULL, ¶ms, &rowsAffected, NULL ) ; Where n 1, but in my database, all I see is 1 insert happening. The docs say cParamSets is greater than one) can be specified only if DBPROP_MULTIPLEPARAMSETS is VARIANT_TRUE and the command does not return any rowsets. But I set DBPROP_MULTIPLEPARAMSETS in my DBPROPs, and its and INSERT statement so it should not return any rowsets.

    Read the article

  • Creating Mock object of Interface with type-hint in method fails on PHPUnit

    - by Mark
    I created the following interface: <?php interface Action { public function execute(\requests\Request $request, array $params); } Then I try to make a Mock object of this interface with PHPUnit 3.4, but I get the following error: Fatal error: Declaration of Mock_Action_b389c0b1::execute() must be compatible with that of Action::execute() in D:\Xampp\xampp\php\PEAR\PHPUnit\Framework\TestCase.php(1121) : eval()'d code on line 2 I looked through the stack trace I got from PHPUnit and found that it creates a Mock object that implements the interface Action, but creates the execute method in the following way: <?php public function execute($request, array $params) As you can see, PHPUnit takes over the array type-hint, but forgets about \requests\Request. Which obviously leads to an error. Does anyone knows a workaround for this error? I also tried it without namespaces, but I still get the same error.

    Read the article

  • Trouble with RSpec's with method

    - by Thiago
    Hi there, I've coded the following spec: it "should call user.invite_friend" do user = mock_model(User, :id = 1) other_user = mock_model(User, :id = 2) User.stub!(:find).with(user.id).and_return(user) User.stub!(:find).with(other_user.id).and_return(other_user) user.should_receive(:invite_friend).with(other_user) post :invite, { :id = other_user.id }, {:user_id = user.id} end But I'm getting the following error when I run the specs NoMethodError in 'UsersController POST invite should call user.invite_friend' undefined method `find' for # Class:0x86d6918 app/controllers/users_controller.rb:144:in `invite' ./spec/controllers/users_controller_spec.rb:13: What's the mistake? Without .with it works just fine, but I want different return values for different arguments to the stub method. The following controller's actions might be relevant: def invite me.invite_friend(User.find params[:id]) respond_to do |format| format.html { redirect_to user_path(params[:id]) } end end def me User.find(session[:user_id]) end

    Read the article

  • Never render a layout in response to xhrs

    - by Horace Loeb
    Most of the time I don't want to render a layout when the request comes from AJAX. To this end I've been writing render :layout => !request.xhr? frequently in my controller actions. How can I make this the default? I.e., I'd like to be able to write def new Post.find(params[:id]) end and have the functionality be def show Post.find(params[:id]) render :layout => !request.xhr? end (I'm fine manually specifying a layout in the rare cases in which I want to use one.)

    Read the article

  • Parse http GET and POST parameters from BaseHTTPHandler?

    - by ataylor
    BaseHTTPHandler from the BaseHTTPServer module doesn't seem to provide any convenient way to access http request parameters. What is the best way to parse the GET parameters from the path, and the POST parameters from the request body? Right now, I'm using this for GET: def do_GET(self): parsed_path = urlparse.urlparse(self.path) try: params = dict([p.split('=') for p in parsed_path[4].split('&')]) except: params = {} This works for most cases, but I'd like something more robust that handles encodings and cases like empty parameters properly. Ideally, I'd like something small and standalone, rather than a full web framework.

    Read the article

  • Android: handle unexpected internet disconnect while downloading data

    - by M.A. Cape
    Hi, I have here a function that downloads data from a remote server to file. I am still not confident with my code. My question is, what if while reading the stream and saving the data to a file and suddenly I was disconnected in the internet, will these catch exceptions below can really catch that kind of incident? If not, can you suggest how to handle this kind of incident? Note: I call this function in a thread so that the UI won't be blocked. public static boolean getFromRemote(String link, String fileName, Context context){ boolean dataReceived = false; ConnectivityManager connec = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connec.getNetworkInfo(0).isConnected() || connec.getNetworkInfo(1).isConnected()){ try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(link); HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, 30000); HttpConnectionParams.setSoTimeout(params, 30000); HttpResponse response; response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 200){ HttpEntity entity = response.getEntity(); InputStream in = null; OutputStream output = null; try{ in = entity.getContent(); String secondLevelCacheDir = context.getCacheDir() + fileName; File imageFile = new File(secondLevelCacheDir); output= new FileOutputStream(imageFile); IOUtilities.copy(in, output); output.flush(); } catch (IOException e) { Log.e("SAVING", "Could not load xml", e); } finally { IOUtilities.closeStream(in); IOUtilities.closeStream(output); dataReceived = true; } } }catch (SocketTimeoutException e){ //Handle not connecting to client !!!! Log.d("SocketTimeoutException Thrown", e.toString()); dataReceived = false; } catch (ClientProtocolException e) { //Handle not connecting to client !!!! Log.d("ClientProtocolException Thrown", e.toString()); dataReceived = false; }catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); dataReceived = false; Log.d("MalformedURLException Thrown", e.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); dataReceived = false; Log.d("IOException Thrown", e.toString()); } } return dataReceived; }

    Read the article

  • symfony save submitted form to database

    - by Sejanus
    Maybe I am missing something, but in symfony examples, in form submission action there's nothing which indicates form data is saved to database. (link). How can I save everything to db? Example from the link: public function executeSubmit($request) { $this->forward404Unless($request->isMethod('post')); $params = array( 'name' => $request->getParameter('name'), 'email' => $request->getParameter('email'), 'message' => $request->getParameter('message'), ); $this->redirect('contact/thankyou?'.http_build_query($params)); }

    Read the article

  • Validating class and superclass on RoR

    - by Luís Guilherme
    In ruby, you have an attribute called "type" which is the class of the object. Rails stores this at the database in a column called type. So, if I have several blog "types", I can do something like this def create @blog = Blog.new(params[:blog]) @blog[:type] = params[:blog][:type] # ... end If I add someone like this, and then load it, and ask its class (for instance, at the console), I have the right class name answered back. However, when I save it afterwards, rails will run only the superclass validators, not the ones I defined in the subclass. How should I make rails run the subclass validators?

    Read the article

  • Rails: AJAX Controller JS not firing...

    - by neezer
    I'm having an issue with one of my controller's AJAX functionality. Here's what I have: class PhotosController < ApplicationController # ... def create @photo = Photo.new(params[:photo]) @photo.image_content_type = MIME::Types.type_for(@photo.image_file_name).to_s @photo.image_width = Paperclip::Geometry.from_file(params[:photo][:image]).width.to_i @photo.image_height = Paperclip::Geometry.from_file(params[:photo][:image]).height.to_i @photo.save! respond_to do |format| format.js end end # ... end This is called through a POST request sent by this code: $(function() { // add photos link $('a.add-photos-link').colorbox({ overlayClose: false, onComplete: function() { wire_add_photo_modal(); } }); function wire_add_photo_modal() { <% session_key = ActionController::Base.session_options[:key] %> $('#upload_photo').uploadify({ uploader: '/swf/uploadify.swf', script: '/photos', cancelImg: '/images/buttons/cancel.png', buttonText: 'Upload Photo(s)', auto: true, queueID: 'queue', fileDataName: 'photo[image]', scriptData: { '<%= session_key %>': '<%= u cookies[session_key] %>', commit: 'Adding Photo', controller: 'photos', action: 'create', '_method': 'post', 'photo[gallery_id]': $('#gallery_id').val(), 'photo[user_id]': $('#user_id').val(), authenticity_token: encodeURIComponent('<%= u form_authenticity_token if protect_against_forgery? %>') }, multi: true }); } }); Finally, I have my response code in app/views/photos/create.js.erb: alert('photo added!'); My log file shows that the request was successful (the photo was successfully uploaded), and it even says that it rendered the create action, yet I never get the alert. My browser shows NO javascript errors. Here's the log AFTER a request from the above POST request is submitted: Processing PhotosController#create (for 127.0.0.1 at 2010-03-16 14:35:33) [POST] Parameters: {"Filename"=>"tumblr_kx74k06IuI1qzt6cxo1_400.jpg", "photo"=>{"user_id"=>"1", "image"=>#<File:/tmp/RackMultipart20100316-54303-7r2npu-0>}, "commit"=>"Adding Photo", "_edited_session"=>"edited", "folder"=>"/kakagiloon/", "authenticity_token"=>"edited", "action"=>"create", "_method"=>"post", "Upload"=>"Submit Query", "controller"=>"photos"} [paperclip] Saving attachments. [paperclip] saving /public/images/assets/kakagiloon/thumbnail/tumblr_kx74k06IuI1qzt6cxo1_400.jpg [paperclip] saving /public/images/assets/kakagiloon/profile/tumblr_kx74k06IuI1qzt6cxo1_400.jpg [paperclip] saving /public/images/assets/kakagiloon/original/tumblr_kx74k06IuI1qzt6cxo1_400.jpg Rendering photos/create Completed in 248ms (View: 1, DB: 6) | 200 OK [http://edited.local/photos] NOTE: I edited out all the SQL statements and I put "edited" in place of sensitive info. What gives? Why aren't I getting my alert();? Please let me know if you need anymore info to help me solve this issue! Thanks.

    Read the article

  • Chaining multiple ShellExecute calls

    - by IVlad
    Consider the following code and its executable - runner.exe: #include <iostream> #include <string> #include <windows.h> using namespace std; int main(int argc, char *argv[]) { SHELLEXECUTEINFO shExecInfo; shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); shExecInfo.fMask = NULL; shExecInfo.hwnd = NULL; shExecInfo.lpVerb = "open"; shExecInfo.lpFile = argv[1]; string Params = ""; for ( int i = 2; i < argc; ++i ) Params += argv[i] + ' '; shExecInfo.lpParameters = Params.c_str(); shExecInfo.lpDirectory = NULL; shExecInfo.nShow = SW_SHOWNORMAL; shExecInfo.hInstApp = NULL; ShellExecuteEx(&shExecInfo); return 0; } These two batch files both do what they're supposed to, which is run notepad.exe and run notepad.exe and tell it to try to open test.txt: 1. runner.exe notepad.exe 2. runner.exe notepad.exe test.txt Now, consider this batch file: 3. runner.exe runner.exe notepad.exe This one should run runner.exe and send notepad.exe as one of its command line arguments, shouldn't it? Then, that second instance of runner.exe should run notepad.exe - which doesn't happen, I get a "Windows cannot find 'am'. Make sure you typed the name correctly, and then try again" error. If I print the argc argument, it's 14 for the second instance of runner.exe, and they are all weird stuff like Files\Microsoft, SQL, Files\Common and so on. I can't figure out why this happens. I want to be able to string as many runner.exe calls using command line arguments as possible, or at least 2. How can I do that? I am using Windows 7 if that makes a difference.

    Read the article

  • Finding indexes of each element in a multidimensional array in ruby

    - by Shreyas Satish
    Eg :a=[["hello", "world"], ["good", "lord"], ["hello", "lord"]] I need to find and record the indexes of each word with respect to the super-array. i.e hello => 0,2 world => 0 lord => 1,2. here's my shot ,but its very amateurish and lengthy. all_tokens=tokens.flatten all_tokens.each do|keyword| tokens.each do|token_array| if token_array.include?keyword x << i end i=i+1 end y[k] = x.clone y=y.clear end

    Read the article

  • cakephp - try/catch an Action

    - by joshs
    I would like to somehow apply a try catch statement to all Actions as a backstop for any uncaught exceptions. I think this would be particularly helpful for Ajax Actions, because the catch statement could send back a default 4xx status code. Prototype's onFailure() function could then do the client-side error handling. How can I do this without wrapping the Action call with a try/catch in the cake dispatcher like this: try { output = $controller->dispatchMethod($params['action'], $params['pass']); } catch {...} Does anybody have a suggestion or another workable strategy for gaining this functionality without touching the dispatcher? How do people feel about putting exception handling in the Displatcher? I imagine when cake drops php 4 support, there will be a built-in mechanism for this.

    Read the article

  • Return value from ajax call?

    - by Dan
    Hi, I'm making a basic ajax function in jquery which echoes the number of rows found in a MySQL Query. function checkEventIDClass(id) { var params = 'method=checkEventIDClash&table=test&id=' + id; $.ajax({ type: "POST", url: "ajax.php", data: params, success: function(result){ return result; } }); } Is it possible to use this returned value in another function? I have tried but only get undefined values. In this situation, it will be acceptable to use synchronous calls. Any advice appreciated. Thanks

    Read the article

  • URL Friendly regular expression

    - by Caesar
    Can anyone help me with regular expression for this: basically I have a search form and users type in whatever keywords they want to search and when a search button is clicked, the search keyword is appended to the url (see examples below). Note the keyword may contain any character. Example 1 Search key: whatever you want URL: www.example.com/search/whatever+you+want/ Example 2 Search key: oh boy! what's going on? URL: www.example.com/search/oh+boy!+what's+goin+on%3F What regular expression can I use to capture all characters in the ASCII table between 32 to 126?

    Read the article

  • Grouping search results with thinking_sphinx plugin for rails

    - by Shagymoe
    I can use the following to group results, but it only returns one result per group. @results = Model.search params[:search_query], :group_by => 'created_at', :group_function => :day, :page => params[:page], :per_page => 50 So, if I display the results by day, I only get one result per day. <% @results.each_with_groupby do |result, group| %> <div class="group"><%= group %></div> <ul class="result"> <li><%= result.name %></li> </ul> <% end %> Do I have to parse the @results array and group them by date manually or am I missing something? Here is the line from the sphinx docs: http://sphinxsearch.com/docs/current.html#clustering "The final search result set then contains one best match per group."

    Read the article

  • Setting up java configurations in eclipse. multiple .param files

    - by Charlie
    I'm going to be using ECJ for doing genetic programming and I haven't touched java in years. I'm working on setting up the eclipse environment and I'm catching a few snags. The ECJ source has several packages, and several sample programs come along with it. I ran one sample program (called tutorial1) by going to the run configurations and adding -file pathToParamsFile to the program arguments. This made it point to the params file of that tutorial and run that sample. In a new example I am testing (from the package gui) there are TWO params files. I tried pointing to just one param file and a program ran in the console, but there was supposed to be a GUI which did not load. I'm not sure what I'm doing wrong. Any help would be greaaatly appreciated.

    Read the article

  • Multiple Forms on the Same Page with Rails

    - by Eric Koslow
    So I'm building a rails app for high school students and I've hit a problem when it comes to creating users. I want the students to only be able to create accounts if they select their school and type in their school's password correctly. What is the correct / easiest way of doing this? Should I create a gatekeeper to the user#new action that they have to pass first or if their a way that on the same page a student can submit to forms. One would be the regular username, email, password using: form_for @user do ... end But then creating another form for the high-school / high-school password selection. Ideally the controller would be able to get the params of the high-school form, validate those, then go on to create the user from the user params. Is this possible using rails? My setup: Rails 3 and Ruby 1.9.2dev Thank you!

    Read the article

  • Dailymotion Javascript API problem

    - by Sandip
    include js file "swfobject.js" js code is as follows: var params = { allowScriptAccess: "always" }; var atts = { id: "mydmplayer" }; swfobject.embedSWF("http://www.dailymotion.com/swf/VIDEO_ID&enablejsapi=1& playerapiid=dmplayer", "dmapiplayer", "425", "356", "8", null, null, params, atts); I am newbie to javascript and SWF. I am using this code to embed video into my html. Now I want to create custom links like "play","fast forward" etc. Could you please guide me, how to acheive this? Please reply ASAP. It's urgent. I would be very thankful to you.

    Read the article

  • How should I do custom sort in Python 3?

    - by S.Mark
    In Python 2.x, I could pass custom function to sorted and .sort functions >>> x=['kar','htar','har','ar'] >>> >>> sorted(x) ['ar', 'har', 'htar', 'kar'] >>> >>> sorted(x,cmp=customsort) ['kar', 'htar', 'har', 'ar'] Because, in My language, consonents are comes with this order "k","kh",....,"ht",..."h",...,"a" But In Python 3.x, looks like I could not pass cmp keyword >>> sorted(x,cmp=customsort) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'cmp' is an invalid keyword argument for this function Is there any alternatives or should I write my own sorted function too?

    Read the article

  • Releasing Xmlparser and NSXMLParser objects

    - by erastusnjuki
    How can I release the variables xmlParser and parser safely in the function below? - (id)callRestService: (NSString *) methodName : (NSDictionary *) params { NSURL *url=[self getRestUrl: methodName : params]; XmlParser *xmlParser = [[XmlParser alloc] init]; NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:xmlParser]; [parser setShouldProcessNamespaces:NO]; [parser setShouldReportNamespacePrefixes:NO]; [parser setShouldResolveExternalEntities:NO]; [parser parse]; [parser setDelegate:nil]; return xmlParser.dictionaryArray; }

    Read the article

  • How do I fix this NameError?

    - by Kyle Kaitan
    I want to use the value v inside of an instance method on the metaclass of a particular object: v = ParserMap[kind][:validation] # We want to use this value later. s = ParserMap[kind][:specs] const_set(name, lambda { p = Parser.new(&s) # This line starts a new scope... class << p define_method :validate do |opts| v.call(self, opts) # => NameError! The `class` keyword above # has started a new scope and we lost # old `v`. end end p }) Unfortunately, the class keyword starts a new scope, so I lose the old scope and I get a NameError. How do I fix this?

    Read the article

  • Superfish and Flash again. Please help

    - by alexandru.vladoiu
    Hello there, I know there's a lot about this issue but i'm embedding flash like this: (i don't know how t escape code so sorry if it looks weird) var flashvars = {} var params = { base: "." } var attributes = {} swfobject.embedSWF("http://www.zakochaniwfotografii.pl/html5/slideshow/ceremonia.swf", "flashcontent", "932", "450", "9.0.0", false, flashvars, params, attributes); and the flash appears in here div class="imageHolder" id="flashcontent" /div You can see all of it here: http://www.zakochaniwfotografii.pl/html5/fotografia-weselna.php I'm trying to setup my website but only Firefox displays this well. I solved the issue on my index page zakochaniwfotografii.pl/html5/ but here i am embeding flash differently due to a different gallery, so i cannot do it the same on the underpages. I'd appreciate your help, Thank you.

    Read the article

  • Zend Framework and UTF-8 characters (æøå)

    - by Randy Mayer
    Hi, I use Zend Framework and I have problem with JSON and UTF-8. Output \u00c3\u00ad\u00c4\u008d Ã­Ä I use... JavaScript (jQuery) contentType : "application/json; charset=utf-8", dataType : "json" Zend Framework $view->setEncoding('UTF-8'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8'); header('Content-Type: application/json; charset=utf-8'); utf8_encode(); Zend_Json::encode Database resources.db.params.charset = "utf8" resources.db.params.driver_options.1002 = "SET NAMES utf8" resources.db.isDefaultTableAdapter = true Collation utf8_unicode_ci Type MyISAM Server PHP Version 5.2.6 What did I do wrong? Thank you for your reply!

    Read the article

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