Search Results

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

Page 170/297 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • How do you create a daemon in Python?

    - by DavidM
    Searching on Google reveals x2 code snippets. The first result is to this code recipe which has a lot of documentation and explanation, along with some useful discussion underneath. However, another code sample, whilst not containing so much documentation, includes sample code for passing commands such as start, stop and restart. It also creates a PID file which can be handy for checking if the daemon is already running etc. These samples both explain how to create the daemon. Are there any additional things that need to be considered? Is one sample better than the other, and why?

    Read the article

  • Replace <Unknown Source> in Java Rhino (JSR223) with actual file name

    - by Lord.Quackstar
    Hello everyone, In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5 What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible. Is there a way to replace <Unknown Source> with the actual file name? None of the methods I see support passing a File object, so I'm really confused here.

    Read the article

  • Do fields need to be explicitly final to have a "proper" immutable object?

    - by Yishai
    You often read about immutable objects requiring final fields to be immutable in Java. Is this in fact the case, or is it simply enough to have no public mutability and not actually mutate the state? For example, if you have an immutable object built by the builder pattern, you could do it by having the builder assign the individual fields as it builds, or having the builder hold the fields itself and ultimately return the immutable object by passing the values to its (private) constructor. Having the fields final has the obvious advantage of preventing implementation errors (such as allowing code to retain a reference to the builder and "building" the object multiple times while in fact mutating an existing object), but having the Builder store its data inside the object as it is built would seem to be DRYer. So the question is: Assuming the Builder does not leak the Object early and stops itself from modifying the object once built (say by setting its reference to the object as null) is there actually anything gained (such as improved thread safety) in the "immutability" of the object if the object's fields were made final instead?

    Read the article

  • How to configure Apache to act as an SSL proxy to an application server?

    - by ripper234
    I have one physical server that runs: an Apache (httpd) server another web server (let's say Tomcat for sake of argument) on port 1234 Can I configure the Apache server to act as a proxy for SSL traffic, while keeping the application server blissfully unaware of SSL? What I imagine is: Traffic to http://myserevr.com/app is redirected to https://myserver.com/app Traffic to https://myserver.com/app is proxied to the application server. My SSL certificate is only installed on the Apache server, not on the Application server Other traffic to the Apache server (http://myserver.com/anotherapp) is served directly from the Apache server What's the best setup to achieve this? (On Ubuntu, if that matters)

    Read the article

  • How to check if Google Street View available and display message?

    - by Vafello
    I am passing lat and lng variables and display google sreet view in a div. The problem is that when the StreetView is unavilable then nothing is displayed. I would like to check if there is a streetview for a given lat and lng and display a message. Here is my code: var myPano = new GStreetviewPanorama(document.getElementById("street2"), panoOpts); var location = new GLatLng(lat,lng) myPano.setLocationAndPOV(location); Maybe I should use something like: Event.addListener(myPano, "error", errorMessage()); Any ideas?

    Read the article

  • Call function based off of a string in Lisp

    - by powerj1984
    I am passing in command line arguments to my Lisp program and they are formatted like this when they hit my main function: ("1 1 1" "dot" "2 2 2") I have a dot function and would like to call it directly from the argument, but this isn't possible because something like (funcall (second args)...) receives "dot" and not dot as the function name. I tried variations of this function: (defun remove-quotes (s) (setf (aref s 0) '"")) to no avail, before realizing that the quotes were not really a part of the string. Is there a simple way to do this, or should I just check each string and then call the appropriate function? Thanks!

    Read the article

  • doubt in - Function Objects - c++

    - by Eternal Learner
    I have a class class fobj{ public: fobj(int i):id(i) {} void operator()() { std::cout<<"Prints"<<std::endl; } private: int id; }; template<typename T> void func(T type) { type(); } My Doubt is if I invoke func like Method 1: func(fobj(1); the message I wanted to print is printed. I was always thinking I needed to do something like Method 2: fobj Iobj(1); // create an instance of the fobj class func(Iobj); //call func by passing Iobj(which is a function object) How does Method 1 work? I mean what exactly happens? and how is a call made to the operator() in class fobj ?

    Read the article

  • iPhone view architecture question

    - by Joe
    So I have (for instance) three views: A: root view B: a view functionally identical to root C: a data entry view which collects a few piece of info What I'm trying to do is reuse C to supply the data it collects to either A or B. It should supply the data to whichever of the two it is pushed onto. The data for A is similar, but functionally distinct, to what collects for B. Right now, I'm passing data from C to A or B via a singleton class. What I'm trying to avoid is having two instances of C, one to supply data to A and B (because, in actuality, the program will have 5 total views like C. Does the question make sense?

    Read the article

  • is it a good idea to write tests for environments other than development?

    - by jcollum
    Let's say I have a (fairly typical) set of environments: PROD, UAT, QA, DEV. Is it a good idea to run your tests across all environments? Here's what I'm thinking of. I have a proc in SQL that my code depends on, I'll call it proc_getActiveCustomers. If that proc isn't present my app will go south real fast. So I write a test that checks for the existence of this proc in the database. Nothing new here. But when I then deploy my app to the QA environment, would I also want to have a test that checks that environment for the existence of proc_getActiveCustomers? I think this is a good idea but I've never heard much about testing in environments outside of development. Makes me wonder if there's some downside I'm not aware of. The direction that I'm going is to have a list of environments in code and then passing that environment into my unit test.

    Read the article

  • CakePHP accessing other controllers

    - by James
    CakePHP Newbie :) I am having trouble accessing another controller and passing that data to a view in one of my controllers: In controllers/landings_controller.php: var $uses = 'User'; function home() { $userdata = $this->User->read(); $this->set(compact('userdata')); } In views/landings/home.ctp: <?php echo $this->userdata; ?> When accessing /landings/home I get the following error: Notice (8): Undefined property: View::$userdata [APP/views/landings/home.ctp, line 38] I don't know what I am doing wrong. Any help? Thanks!

    Read the article

  • Data validation between SQL replicated tables

    - by Vikram
    Hi All, I am trying to figure out a way to validate the data in my publisher and subscriber in SQL 2005 replication. I thought of using sp_publication_validation, but it needs db_owner permission and we are not allowed to have it in our company. So I did bit more reading and found out about two other SPs that I think work for me. First one is sp_article_validation, which I plan to run on the publisher. For each article that I call this SP, its gonna give the row count and a checksum. With that info, I intend to call sp_table_validation on the subscriber, passing the row count and checksum from the previous SP, there by validating both tables. What do you guys think? Is this a proven way to validate data in replication? There is very little documentation on these SPs. Here is the link: sp_table_validation - http://msdn.microsoft.com/en-us/library/aa239370(v=sql.80).aspx sp_article_validation - http://msdn.microsoft.com/en-us/library/ms177511(v=SQL.90).aspx Thanks for

    Read the article

  • Run a specific command from a directory

    - by Cameron Kilgore
    I have a bash script where I need to run an init utility within a directory with a configuration file defined. I don't think it's possible to explicitly tell the utility to run the file as an argument, so what I need to do is go to the directory with the config file, and then run the command. I have some logic in place, but its not working -- the utility never runs. Is there any way I can tell the script to go to this directory, and then run the script? cd /var/www/testing-dev.example.co eval "standardprofile"

    Read the article

  • What is "with" used for in PHP?

    - by Jason
    I have come across this line in the eloquent ORM library: return with(new static)->newQuery(); I've never seen "with" used before, and cannot find it in the PHP documentation. I'm guessing "with" is a stop-word in most searches, so I am not even getting close. Never having encountered "with" in many years of programming PHP, I feel like I'm missing out. What does it do? I did come across one passing comment regarding the ORM, that mentioned "with" is no longer needed in PHP-5.4, but that was as much as was said.

    Read the article

  • Change Google Chrome's Process model?

    - by mobius42
    See here: http://imgur.com/lKffI.png Does anyone here know how to stop Chrome doing this? Chrome seems to group all tabs I open through the same page into one process. If I copy and paste the links individually into separate tabs, it creates new processes, but when I just middle click links, it groups them into one. I want to force Chrome to create a new process for every tab because when one page locks up, it freezes pretty much all the tabs I have open and if one of the tabs crashes, it takes the rest with it. You can apparently alter Chrome's process model to one called "--process-per-tab" which seems to be what I'm looking for, but when I try and open Chrome with this argument via the terminal, it doesn't work. It's likely I'm not using the correct command; what I tried was: /Applications/"Google Chrome.app"/Contents/MacOS/"Google Chrome" --process-per-tab I'm on OSX and using the latest dev build 5.0.396.0.

    Read the article

  • how to view all images in android's built- in gallery from a php page

    - by ramz
    Hi, I am developing an application to display all the images in android's built-in gallery in to a php page. I posted the uri(content://media/extrenal/images/media) of the gallery images to the php page. I was not able to recreate images by using webView function loadUrl(). Should i need to upload the whole gallery to another directory and display the images? Or passing the bitmap itself will do? Please suggest me an idea to solve the problem.

    Read the article

  • Best way to create a Unique ID field for an enum

    - by jax
    What is the best way to get a Unique ID from an ENUM that will stay consistent between repeated execution of the program? Currently I am doing this manually by passing an ID to the enum constructor. I don't really want to do this is I can help it. Another option would be to use a static field that gets incremented for each enum value. The problem is that if later I decide to move the enum fields around or delete some this will cause problems with my program as the ID will be saved into user preferences. The ID can be any basic type or a String.

    Read the article

  • How to perform dynamic formatting with perl during write?

    - by Bee
    I have a format which is defined like below: format STDOUT = ------------------------------------ |Field1 | Field2 | Field3 | ------------------------------------ |@<<<<<<<<<<| @<<<<<<<<<<<| @<<<<< |~~ shift(@list1),shift(@list2),shift(@list3) ------------------------------------ . write STDOUT; So the questions are as below: Is it possible to make the list of values printed dynamic? e.g. If list 1 contains 12 elements, and if $flag1 is defined, then print only elements 0..10 instead of all 12. I tried doing this by passing $flag as a parameter to the sub which generates the report. However, the last defined FORMAT seems to always take precedence and the final write when it happens, applies the last format no matter what the condition is. Is it possible to also add/hide fields using the same process. e.g. If $flag2 is defined, then add an additional field Field4 to the list?

    Read the article

  • receive xml file as a parameter to a .net web service

    - by fizch
    My company is currently looking into bringing a new piece of third party software in for online ordering. The software does not handle pricing so they are requesting the pricing information from a web service. Their software is passing an XML file as a parameter, and expecting an XML file as a response. I would think that returning an XML file would be pretty straight forward, but I cannot think of a way to receive an XML file as a parameter. Has anyone done this, or am I missing something really obvious?

    Read the article

  • Protect foreach loop when empty list

    - by SteB
    Using Powershell v2.0 I want to delete any files older than X days: $backups = Get-ChildItem -Path $Backuppath | Where-Object {($_.lastwritetime -lt (Get-Date).addDays(-$DaysKeep)) -and (-not $_.PSIsContainer) -and ($_.Name -like "backup*")} foreach ($file in $backups) { Remove-Item $file.FullName; } However, when $backups is empty I get: Remove-Item : Cannot bind argument to parameter 'Path' because it is null. I've tried: Protecting the foreach with if (!$backups) Protecting the Remove-Item with if (Test-Path $file -PathType Leaf) Protecting the Remove-Item with if ([IO.File]::Exists($file.FullName) -ne $true) None of these seem to work, what if the recommended way of preventing a foreach loop from being entered if the list is empty?

    Read the article

  • How should nested components interact with model in a GUI application?

    - by fig-gnuton
    Broad design/architecture question. If you have nested components in a GUI, what's the most common way for those components to interact with data? For example, let's say a component receives a click on one of its buttons to save data. Should the save request be delegated up that component's ancestors, with the uppermost ancestor ultimately passing the request to a controller? Or are models/datastores in a GUI application typically singletons, so that a component at any level of a hierarchy can directly get/set data? Or is a controller injected as a dependency down the hierarchy of components, so that any given component is only one intermediary away from the datastore/model?

    Read the article

  • Fastest method for SQL Server inserts, updates, selects

    - by Ian
    I use SPs and this isn't an SP vs code-behind "Build your SQL command" question. I'm looking for a high-throughput method for a backend app that handles many small transactions. I use SQLDataReader for most of the returns since forward only works in most cases for me. I've seen it done many ways, and used most of them myself. Methods that define and accept the stored procedure parameters as parameters themselves and build using cmd.Parameters.Add (with or without specifying the DB value type and/or length) Assembling your SP params and their values into an array or hashtable, then passing to a more abstract method that parses the collection and then runs cmd.Parameters.Add Classes that represent tables, initializing the class upon need, setting the public properties that represent the table fields, and calling methods like Save, Load, etc I'm sure there are others I've seen but can't think of at the moment as well. I'm open to all suggestions.

    Read the article

  • Using a database/index sequential file independently of the Unix distribution

    - by Helper Method
    What I'm planning to do is a) parse a file for some lines matching a regular expression b) store the match in some sort of database / file so I don't have to do the parsing again and again c) call another program passing the matches as arguments While I can imagine how to do a) and c), I'm a little bit unsure about b). The matches are of the form key:attribute1:attribute2:attribute3 where attribute 2 may be optional. I'm thinking of storing the results in a simple database but the problem is the database needs to available on a number of Unix platform for the program to work. Are there any (simple) databases which can be found on any Unix platforms? Or should I use some sort of index-sequential file?

    Read the article

  • Do not want Form to display over other application windows

    - by Cat
    I am displaying a Form from one process by passing the Show method a window handle from another process. I only want this new Form to display above the passed Form, like a MessageBox. However, this newly launched Form appears above other application windows, despite: Setting Process.WindowStyle.Hidden to the Form-displaying process Overriding the ShowWithoutActivation and CreateParams properties of the Form. Making sure Form.TopMost is not true I have checked that the window handle is valid from the second process. Focus is not stolen, however. Process A: Pass (Form) window handle to a new Process B via the command line Process B: Display a new Form using Form.Show(anotherProcessWindowHandle)

    Read the article

  • open program once with multiple files as arguments from explorer

    - by Jonathan
    I have a program that works when, a file is opened with it using the right click menu in explorer. But if I select multiple files and then right click and open with my program then it opens multiple instances of my program, instead of just passing the multiple files as arguments to a single instance. The program is written in vb.net but is not a windows form, it is just a module, so I can to tick the Single instance option in the properties in Visual Studio. So how do I open multiple files from explorer context menu in a single instance.

    Read the article

  • Getting Reference to Calling Activity from AsyncTask (NOT as an inner class)

    - by stormin986
    Is it at all possible, from within an AsyncTask that is NOT an inner class of the calling Activity class, to get a reference to the instance of Activity that initiated execution of the AsyncTask? I am aware of this thread, however it doesn't exactly address how to reference the calling Activity. Some suggest passing a reference to the Activity as a parameter to the AsyncTask constructor, however, it's reported that doing so will always result in a NullPointerException. So, I'm at a loss. My AsyncTask provides robust functionality, and I don't want to have to duplicate it as an inner class in every Activity that wants to use it. There must be an elegant solution.

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >