Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 108/297 | < Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >

  • Is it possible to parse a URL into it's composite components?

    - by Paul Alexander
    I'd like to parse an incoming URL into it's component parts for some pre-processing before passing it into the standard MVC routing logic. For example given your standard route {controller}/{action}/{id} and the URL /user/show/10 Is there a way to have the Routing system return a dictionary containing controller, action and id keys with their corresponding values?

    Read the article

  • Accessing controller methods inside a model with Kohana/MVC Framework

    - by eth0
    Hi all, I need to able to access controller methods from a model using the Kohana V2.3 framework. At the moment I'm passing the controller object (by ref.) to the model on creation which works perfectly fine but I can't help think there is a more "cleaner" way - does anybody have any suggestions? Would Kohana V3 resolve this with its HMVC pattern? This may help: http://www.ifc0nfig.com/accessing-the-calling-controller-in-a-model-within-kohana/

    Read the article

  • Dependency Injection: I don't get where to start!

    - by Andy
    I have several articles about Dependency Injection, and I can see the benefits, especially when it comes to unit testing. The units can me loosely coupled, and mocking of dependencies can be made. The trouble is - I just don't get where to start. Consider this snippet below of (much edited for the purpose of this post) code that I have. I am instantiating a Plc object from the main form, and passing in a communications mode via the Connect method. In it's present form it becomes hard to test, because I can't isolate the Plc from the CommsChannel to unit test it. (Can I?) The class depends on using a CommsChannel object, but I am only passing in a mode that is used to create this channel within the Plc itself. To use dependancy injection, I should really pass in an already created CommsChannel (via an 'ICommsChannel' interface perhaps) to the Connect method, or maybe via the Plc constructor. Is that right? But then that would mean creating the CommsChannel in my main form first, and this doesn't seem right either, because it feels like everything will come back to the base layer of the main form, where everything begins. Somehow it feels like I am missing a crucial piece of the puzzle. Where do you start? You have to create an instance of something somewhere, but I'm struggling to understand where that should be. public class Plc() { public bool Connect(CommsMode commsMode) { bool success = false; // Create new comms channel. this._commsChannel = this.GetCommsChannel(commsMode); // Attempt connection success = this._commsChannel.Connect(); return this._connected; } private CommsChannel GetCommsChannel(CommsMode mode) { CommsChannel channel; switch (mode) { case CommsMode.RS232: channel = new SerialCommsChannel( SerialCommsSettings.Default.ComPort, SerialCommsSettings.Default.BaudRate, SerialCommsSettings.Default.DataBits, SerialCommsSettings.Default.Parity, SerialCommsSettings.Default.StopBits); break; case CommsMode.Tcp: channel = new TcpCommsChannel( TCPCommsSettings.Default.IP_Address, TCPCommsSettings.Default.Port); break; default: // Throw unknown comms channel exception. } return channel; } }

    Read the article

  • Contains performs MUCH slower with variable vs constant string MS SQL Server

    - by Greg R
    For some unknown reason I'm running into a problem when passing a variable to a full text search stored procedure performs many times slower than executing the same statement with a constant value. Any idea why and how can that be avoided? This executes very fast: SELECT * FROM table WHERE CONTAINS (comments, '123') This executes very slowly and times out: DECLARE @SearchTerm nvarchar(30) SET @SearchTerm = '123' SET @SearchTerm = '"' + @SearchTerm + '"' SELECT * FROM table WHERE CONTAINS (comments, @SearchTerm) Does this make any sense???

    Read the article

  • How wrong is it to modify the SDP body of a SIP message?

    - by rusbi
    A requirement for the SIP PBX I created for my company was to record all calls passing through it. I solved it by forcing all SIP message to pass through the PBX and to modify the SDP body so the stream passes through it and gets recorded. It works well. I recently found out that this is not allowed. Is there any other way to implement call recording and how "wrong" is this in regard to the protocol?

    Read the article

  • Storing data in HTML, javascript book, articles recommendations.

    - by michael
    I'm looking for articles or books that discuss schemes and techniques adopted by pro javascript developers to store and organize data with html tags. In other words, how to emulate xml data storage with html as semantically as possible. Some various solutions that I've seen mentioned in passing are custom DTD, custom attributes with xhtml, early adoption of html5 and its data- attribute. Now, I'm looking for some tangible material that goes in depth with these concepts.

    Read the article

  • How do I implement graphs and graph algorithms in a functional programming language?

    - by brad
    Basically, I know how to create graph data structures and use Dijkstra's algorithm in programming languages where side effects are allowed. Typically, graph algorithms use a structure to mark certain nodes as 'visited', but this has side effects, which I'm trying to avoid. I can think of one way to implement this in a functional language, but it basically requires passing around large amounts of state to different functions, and I'm wondering if there is a more space-efficient solution.

    Read the article

  • Patterns for wrapping a command line tool in another language

    - by Tom Duckering
    I'm currently writing some Java to wrap around an extensive command line tool. It feels like I'm writing a lot of similar code. I'm wondering if there are any established patterns for wrapping command line tools - passing arguments and handling output and so on. Specific examples in Java would obviously be great, but any general suggestions or pointers are welcome too.

    Read the article

  • Is there an encoding method that is mutual to flash and php?

    - by Gus
    I'm base64 encoding a JPG in AS3 and passing it to PHP where it would be decoded. It appears that AS3's encodeToBase64String() function and and PHP's base64_decode() function do not use the same algorithm. Is there a library or API for either language that would allow it to interface with the other? Alternatively, does anyone even know what PHP's default base64 map is? My Google searching is not yielding results.

    Read the article

  • DVD burn IMAPI2 + getting error, multiple of the sector size

    - by sijith
    hi, I am writing a program which burns data to DVD. When i run my program its showing error code 0xC0AA0403(The size of the provided IStream object is invalid. The size must be a multiple of the sector size, 2048.) Please help me on this. How to specify data as multiple of 2048. I am just passing a single DOC file to burn

    Read the article

  • Getting following warning while compiling

    - by thetna
    warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and the corresponding code is Parent =bsearch((const size_t)ParentNum, ClauseVector, Size, sizeof(CLAUSE),pcheck_CompareNumberAndClause); the compilar is gcc. here CLAUSE is defined as *CLAUSE.

    Read the article

  • Check if something is a list

    - by 8EM
    What is the easiest way to check if something is a list? A method doSomething has the parameters a and b. In the method, it will loop through the list a and do something. I'd like a way to make sure a is a list, before looping through - thus avoiding an error or the unfortunate circumstance of passing in a string then getting back each letter. This question must have been asked before - however my googles failed me. Cheers.

    Read the article

  • java multipart POST library

    - by tom
    Is there a multipart POST library out there that achieve the same effect of doing a POST from a html form? for example - upload a file programmingly in Java versus upload the file using a html form. And on the server side, it just blindly expect the request from client side to be a multipart POST request and parse out the data as appropriate. Has anyone tried this? specifically, I am trying to see if I can simulate the following with Java The user creates a blob by submitting an HTML form that includes one or more file input fields. Your app sets blobstoreService.createUploadUrl() as the destination (action) of this form, passing the function a URL path of a handler in your app. When the user submits the form, the user's browser uploads the specified files directly to the Blobstore. The Blobstore rewrites the user's request and stores the uploaded file data, replacing the uploaded file data with one or more corresponding blob keys, then passes the rewritten request to the handler at the URL path you provided to blobstoreService.createUploadUrl(). This handler can do additional processing based on the blob key. Finally, the handler must return a headers-only, redirect response (301, 302, or 303), typically a browser redirect to another page indicating the status of the blob upload. Set blobstoreService.createUploadUrl as the form action, passing the application path to load when the POST of the form is completed. <body> <form action="<%= blobstoreService.createUploadUrl("/upload") %>" method="post" enctype="multipart/form-data"> <input type="file" name="myFile"> <input type="submit" value="Submit"> </form> </body> Note that this is how the upload form would look if it were created as a JSP. The form must include a file upload field, and the form's enctype must be set to multipart/form-data. When the user submits the form, the POST is handled by the Blobstore API, which creates the blob. The API also creates an info record for the blob and stores the record in the datastore, and passes the rewritten request to your app on the given path as a blob key.

    Read the article

  • iPhone UIWebView touch cause Toolbar to appear

    - by BahaiResearch.com
    I am trying to have a UI which is a full screen UIWebView. When the view is touched the tool bar appears. I can do everything but get the touchend event in the UIWebView. I have tried putting a UIColor.Clear'd UIView ontop and catching TouchEnd there and passing it on, but would like a better solution. I understand that we are not supposed to subclass the UIWebView from the docs. Ideas?

    Read the article

  • magento _redirect with parameters that have + or /

    - by epeleg
    seems like a call to $this->_redirect('*/*/myaction',$myargs); does not properly escape the arguments so if $myargs=array(p1=>'string that has + or / within it') the created URL will be something like: ..../myaction/?p1/string%20that%20has%20+%20or%20/%20within%20it causing the getParams collection on the action to have p1 with value 'string that has or ' <- plus sign missing and value broken and ' within it' with no value or something similar. is there any standard way I should handle the arguments before passing them to _redirect ? Eyal

    Read the article

  • exiting from a blocking select call!

    - by Jay
    I am calling a third party API which creates a socket, does a connect and then calls select API by passing the socket to block forever. I don't have access to the socket. Is there some way in which I can make the select call come out from my application without having access to the socket? My platform is Windows.

    Read the article

  • Python: Pass parameter one time, but use more times

    - by Gabriel L. Oliveira
    I'm trying to do this: commands = { 'py': 'python %s', 'md': 'markdown "%s" "%s.html"; gnome-open "%s.html"', } commands['md'] % 'file.md' But like you see, the commmands['md'] uses the parameter 3 times, but the commands['py'] just use once. How can I repeat the parameter without changing the last line (so, just passing the parameter one time?)

    Read the article

  • assigning a specific record in a ResultSet to a variable

    - by kilhra
    Hi I want to retrieve a set of records from a database, do a rs.next() and then assign the result of this to a variable to pass to a method that will use this record, in the same way that I would without assigning it to a variable and passing it to a method is there any way to do this? I'm using JAVA (1.5)

    Read the article

  • Define integer ranges in C

    - by maddy
    Hi, I want to define a type named Int_1_100_Type which is an integer variable in the range from 1 to 100. How should i typedef this one? for eg: i am passing this variable to a function which accepts variable of type Int_1_100_Type. i.e funca(Int_1_100_Type Var1) Thanks Maddy

    Read the article

< Previous Page | 104 105 106 107 108 109 110 111 112 113 114 115  | Next Page >