Search Results

Search found 3836 results on 154 pages for 'argument'.

Page 8/154 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Python "draw() must be called with Label instance as first argument (got _WindowMetaclass instance i

    - by Amorack
    This is a class I made using Python with pyglet to display a window. class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() pyglet.text.Label("Prototype") windowText = text.Label.draw(Window, "Hello World", font_name = "Times New Roman", font_size = 36, color = (193, 205, 193, 255)) def on_draw(self): self.clear() self.label.draw() Every time I try to run it I get the error "TypeError: unbound method draw() must be called with Label instance as first argument (got _WindowMetaclass instance instead)". I'm pretty sure I know what I have to do (find how to get Label's instance) just not how to do it. Could someone help me understand how to make this work?

    Read the article

  • Specify an inline callback function as an argument.

    - by Matthias Vance
    LS, Let me first explain what I'm trying to achieve using some pseudo-code (JavaScript). // Declare our function that takes a callback as as an argument, and calls the callback with true. B(func) { func(true); } // Call the function B(function(bool success) { /* code that uses success */ }); I hope this says it all. If not, please comment on my question so I can write a little more to clarify my issue. What I want is to have code like this in C++. I have tried to use lambda functions, but I was unable to specify a parameter type for those. Kind regards, Matthias Vance

    Read the article

  • expr non-numeric argument shell script

    - by Kimi
    The below check is not working : expr non-numeric argument shell script. Always it is going to else. Please tell me what is the mistake. Earlier I was no using while so the same thing was woring fine now suddenly when I did put it in the while loop it is no working. echo "`${BOLD}` ***** Checking Memory Utilization User*****`${UNBOLD}`" echo "===================================================" IFS='|' cat configMachineDetails.txt | grep -v "^#" | while read MachineType UserName MachineName do export MEMORY_USAGE1=`ssh -f -T ${UserName}@${MachineName} prstat -t -s rss 1 2 | tr '%' ' '| awk '$5>5.0'` export LEN=`echo "$MEMORY_USAGE1"|wc -l` export CNPROC=`echo "$MEMORY_USAGE1"|grep "NPROC"|wc -l` export CTotal=`echo "$MEMORY_USAGE1"|grep "Total"|wc -l` **if [ $LEN = `expr $CNPROC + $CTotal` ] then echo "`${BOLD}`**************All usages are normal !!!!!! *************`${UNBOLD}`" else echo "`${BOLD}`**** Memory(%) is more than 5% in MachineType $MachineType UserName $UserName MachineName $MachineName *******`${UNBOLD}`" echo "====================================================" echo "$MEMORY_USAGE1" fi** done

    Read the article

  • msginit email address command line argument?

    - by C.W.Holeman II
    msginit prompts for an email address. Is there a way to tell msginit what email address to use without being prompted for it such as a command line argument? cat >hellogt.cxx <<EOF // hellogt.cxx #include <libintl.h> #include <locale.h> #include <iostream> int main (){ setlocale(LC_ALL, ""); bindtextdomain("hellogt", "./"); textdomain( "hellogt" ); std::cout << gettext("hello, world!") << std::endl; } EOF g++ -ohellogt hellogt.cxx xgettext -d hellogt -o hellogt.pot hellogt.cxx msginit -l es_MX -o spanish.po -i hellogt.pot

    Read the article

  • The second argument to copy() function cannot be a directory

    - by Jorm
    Anyone know why this: $title = trim($_POST['title']); $description = trim($_POST['description']); // Array of allowed image file formats $allowedExtensions = array('jpeg', 'jpg', 'jfif', 'png', 'gif', 'bmp'); foreach ($_FILES as $file) { if ($file['tmp_name'] > '') { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { echo '<div class="error">Invalid file type.</div>'; } } } if (strlen($title) < 3) echo '<div class="error">Too short title</div>'; else if (strlen($description) > 70) echo '<div class="error">Too long desccription.</div>'; else { move_uploaded_file($_FILES['userfile']['tmp_name'], 'c:\wamp\www\uploads\images/'); } Gives: Warning: move_uploaded_file() [function.move-uploaded-file]: The second argument to copy() function cannot be a directory in C:\wamp\www\upload.php on line 41 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\wamp\tmp\php1AB.tmp' to 'c:\wamp\www\uploads\images/' in C:\wamp\www\upload.php on line 41

    Read the article

  • setTimeout(fun) with a single argument

    - by Elazar Leibovich
    The HTML5 specifications states that setTimeout can be run without the additional "timeout" argument which is supposed to say after how many milliseconds will the function "handler" be scheduled. handle = window . setTimeout( handler [, timeout [, arguments ] ] ) Schedules a timeout to run handler after timeout milliseconds. Any arguments are passed straight through to the handler. However, I failed to find anywhere which explains what happens when no "timeout" time period is set. An example usage is, the animation implementation int the Raphael library. animationElements[length] && win.setTimeout(animation);

    Read the article

  • fd.seek() IOError: [Errno 22] Invalid argument

    - by Julian Kessel
    My Python Interpreter (v2.6.5) raises the above error in the following codepart: fd = open("some_filename", "r") fd.seek(-2, os.SEEK_END) #same happens if you exchange the second arg. w/ 2 data=fd.read(2); last call is fd.seek() Traceback (most recent call last): File "bot.py", line 250, in <module> fd.seek(iterator, os.SEEK_END); IOError: [Errno 22] Invalid argument The strange thing with this is that the exception occurs just when executing my entire code, not if only the specific part with the file opening. At the runtime of this part of code, the opened file definitely exists, disk is not full, the variable "iterator" contains a correct value like in the first codeblock. What could be my mistake? Thanks in advance

    Read the article

  • Invalid argument when calling linux splice()

    - by benny wallace
    Hi I wanted to try out the splice syscall. I have this function - it should copy content of one file to another: static void test_splice( int in, int out ) { int i = 0, rcvd = 0; int filedes[2]; off_t off = 0; if ( pipe( filedes ) < 0 ) { perror( "Kicha pipe" ); exit( EXIT_FAILURE ); } for ( i = 0; i < NUMLOOPS; ++i ) { if ( ( rcvd = splice( in, NULL, filedes[1], NULL, BUFSIZE, SPLICE_F_MORE | SPLICE_F_MOVE ) ) < 0 ) { perror( "splice" ); exit( EXIT_FAILURE ); } if ( splice( filedes[0], NULL, out, NULL, rcvd, SPLICE_F_MORE | SPLICE_F_MOVE ) < 0 ) { perror( "splice" ); exit( EXIT_FAILURE ); } } } The second call to splice in first iteration returns EINVAL ( invalid argument from perror ) everytime - what could be the reason?

    Read the article

  • [PHP] Invalid argument supplied for foreach()

    - by Roberto Aloi
    It often happens to me to handle data that can be either an array or a null variable and to feed some foreach with these data. $values = get_values(); foreach ($values as $value){ ... } When you feed a foreach with data that are not an array, you get a warning: Warning: Invalid argument supplied for foreach() in [...] Assuming it's not possible to refactor the get_values() function to always return an array (backward compatibility, not available source code, whatever other reason), I'm wondering which is the cleanest and most efficient way to avoid these warnings: Casting $values to array Initializing $values to array Wrapping the foreach with an if Other (please suggest)

    Read the article

  • Passing more than one argument in asp.net button in gridview

    - by MarceloRamires
    I have a TemplateField column in a gridview with a button inside of it. There is NO key value (surely that was not designed by me) , but in the other hand there aren't redundancies when comparing each single column, because they are events, and there is "starting date" and "ending date" of something that could not happen twice at the same time. I've already figured selecting with these values and all, but I just want the button to pass about five arguments to a given function. I've tested: <asp:Button CommandArgument='<%# Eval("day")%>' ID="Button2" runat="server" Text="Button" /> And it works properly, the day of the clicked row is passed, and could be retrieved through: e.CommandArgument.ToString(); in the GridView_RowCommand handler. How do I pass more than one argument? I've thought about concatenating with a separating character (wouldn't be that bad) but besides not knowing how to do it yet (didn't want to invest in a poor solution) I want a smarter one.

    Read the article

  • rubygem "Argument list too long"

    - by mehmermaid
    My problem is that during or after running a process which uses Ruby intensively, when I use any gem command including gem --version or gem install rake, it hangs for just over a minute and then gives me this error: $ gem list /Users/username/.rvm/bin/gem: line 5: /Users/username/.rvm/bin/gem: Argument list too long /Users/username/.rvm/bin/gem: line 5: /Users/username/.rvm/bin/gem: Unknown error: 0 file at : line 5: /Users/username/.rvm/bin/gem #!/usr/bin/env bash if [[ -s "/Users/username/.rvm/environments/ruby-1.8.7-p334" ]] ; then source "/Users/username/.rvm/environments/ruby-1.8.7-p334" exec gem "$@" # this is line 5 else echo "ERROR: Missing RVM environment file: '/Users/username/.rvm/environments/ruby- 1.8.7-p334'" >&2 exit 1 fi The only way that I have found to get this working again is to restart my computer, which is obviously undesirable. I am using OSX 10.6.5 I have spent quite a while trying to find anyone else who has had this problem, and been unsuccessful. Do you have any idea why this might be happening?

    Read the article

  • Argument passing regarding ivars

    - by StoneBreaker
    I am passing an iVar into a function. The iVar is a double. The value of the iVar inside the function is correct, but the value of the iVar outside the function is not changed. This must have something to do with the way that I am receiving the iVar into the function. How do I pass a double iVar in so that its value is changed in the object and not only in the function? I do the same thing with pointers and the results are as expected, so I think I am not understanding scalar argument passing in c/objective-c.

    Read the article

  • 0 not a valid FILE* when provided as a template argument

    - by Seva Alekseyev
    The following code #include <stdio.h> template <typename T, T v> class Tem { T t; Tem() { t = v; } }; typedef Tem<FILE*,NULL> TemFile; when compiled in a .mm file (Objective C++) by Xcode on MacOS X, throws the following error: error: could not convert template argument '0' to 'FILE*'. What's going on, please? The code in question compiled fine under MSVC. Since when is the 0 constant not a valid pointer to anything? Is this an artifact of Objective C++ (as opposed to vanilla C++)?

    Read the article

  • java.io.IOException: Invalid argument

    - by Luixv
    Hi I have a web application running in cluster mode with a load balancer. It consists in two tomcats (T1, and T2) addressing only one DB. T2 is nfs mounted to T1. This is the only dofference between both nodes. I have a java method generating some files. If the request runs on T1 there is no problem but if the request is running on node 2 I get an exception as follows: java.io.IOException: Invalid argument at java.io.FileOutputStream.close0(Native Method) at java.io.FileOutputStream.close(FileOutputStream.java:279) The corresponding code is as follows: for (int i = 0; i < dataFileList.size(); i++) { outputFileName = outputFolder + fileNameList.get(i); FileOutputStream fileOut = new FileOutputStream(outputFileName); fileOut.write(dataFileList.get(i), 0, dataFileList.get(i).length); fileOut.flush(); fileOut.close(); } The exception appears at the fileOut.close() Any hint? Luis

    Read the article

  • Error with default argument in Source.getLines (Scala 2.8.0 RC1)

    - by Derek
    assuming I running Scala 2.8.0 RC1, the following scala code should print out the content of the file "c:/hello.txt" for ( line<-Source.fromPath( "c:/hello.txt" ).getLines ) println( line ) However, when I run it, I get the following error <console>:10: error: missing arguments for method getLines in class Source; follow this method with `_' if you want to treat it as a partially applied function Error occured in an application involving default arguments. val it = Source.fromPath("c:/hello.scala").getLines From what I understand, Scala should use the default argument "compat.Platform.EOL" for "getLines". I am wondering if I did wrong or is it a bug in scala 2.8 Thanks

    Read the article

  • MPI4Py Scatter sendbuf Argument Type?

    - by Noel
    I'm having trouble with the Scatter function in the MPI4Py Python module. My assumption is that I should be able to pass it a single list for the sendbuffer. However, I'm getting a consistent error message when I do that, or indeed add the other two arguments, recvbuf and root: File "code/step3.py", line 682, in subbox_grid i = mpi_communicator.Scatter(station_range, station_data) File "Comm.pyx", line 427, in mpi4py.MPI.Comm.Scatter (src/ mpi4py_MPI.c:44993) File "message.pxi", line 321, in mpi4py.MPI._p_msg_cco.for_scatter (src/mpi4py_MPI.c:14497) File "message.pxi", line 232, in mpi4py.MPI._p_msg_cco.for_cco_send (src/mpi4py_MPI.c:13630) File "message.pxi", line 36, in mpi4py.MPI.message_simple (src/ mpi4py_MPI.c:11904) ValueError: message: expecting 2 or 3 items Here is the relevant code snipped, starting a few lines above 682 mentioned above. for station in stations #snip--do some stuff with station station_data = [] station_range = range(1,len(station)) mpi_communicator = MPI.COMM_WORLD i = mpi_communicator.Scatter(station_range, nsm) #snip--do some stuff with station[i] nsm = combine(avg, wt, dnew, nf1, nl1, wti[i], wtm, station[i].id) station_data = mpi_communicator.Gather(station_range, nsm) I've tried a number of combinations initializing station_range, but I must not be understanding the Scatter argument types properly. Does a Python/MPI guru have a clarification this?

    Read the article

  • datetime command line argument in python 2.4

    - by Ike Walker
    I want to pass a datetime value into my python script on the command line. My first idea was to use optparse and pass the value in as a string, then use datetime.strptime to convert it to a datetime. This works fine on my machine (python 2.6), but I also need to run this script on machines that are running python 2.4, which doesn't have datetime.strptime. How can I pass the datetime value to the script in python 2.4? Here's the code I'm using in 2.6: parser = optparse.OptionParser() parser.add_option("-m", "--max_timestamp", dest="max_timestamp", help="only aggregate items older than MAX_TIMESTAMP", metavar="MAX_TIMESTAMP(YYYY-MM-DD HH24:MM)") options,args = parser.parse_args() if options.max_timestamp: # Try parsing the date argument try: max_timestamp = datetime.datetime.strptime(options.max_timestamp, "%Y-%m-%d %H:%M") except: print "Error parsing date input:",sys.exc_info() sys.exit(1)

    Read the article

  • JSF 2.0 method invocation with argument from var of dataGrid

    - by little_b
    Hello I use primefaces with facelets and i have a quastion: for example i have dataGrid and i want to call method of bean, that registered in faces-config, to include some dynamic content: <p:dataGrid var="provider" value="#{paymentFormBean.providers}"> <ui:include src="contentFactory.getSpecificForm('some attribute')"/> </p:dataGrid> How could i invoke getSpecificForm method with argument from var of dataGrid? Something like: <p:dataGrid var="provider" value="#{paymentFormBean.providers}"> <ui:include src="contentFactory.getSpecificForm(provider.formName)"/> </p:dataGrid> Could anyone help me? Thank you

    Read the article

  • Boost::Container::Vector with Enum Template Argument - Not Legal Base Class

    - by CuppM
    Hi, I'm using Visual Studio 2008 with the Boost v1.42.0 library. If I use an enum as the template argument, I get a compile error when adding a value using push_back(). The compiler error is: 'T': is not a legal base class and the location of the error is move.hpp line 79. #include <boost/interprocess/containers/vector.hpp> class Test { public: enum Types { Unknown = 0, First = 1, Second = 2, Third = 3 }; typedef boost::container::vector<Types> TypesVector; }; int main() { Test::TypesVector o; o.push_back(Test::First); return 0; } If I use a std::vector instead it works. And if I resize the Boost version first and then set the values using the [] operator it also works. Is there some way to make this work using push_back()?

    Read the article

  • Why the "mutable default argument fix" syntax is so ugly, asks python newbie

    - by Cawas
    Now following my series of "python newbie questions" and based on another question. Go to http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables and scroll down to "Default Parameter Values". There you can find the following: def bad_append(new_item, a_list=[]): a_list.append(new_item) return a_list def good_append(new_item, a_list=None): if a_list is None: a_list = [] a_list.append(new_item) return a_list So, question here is: why is the "good" syntax over a known issue ugly like that in a programming language that promotes "elegant syntax" and "easy-to-use"? Why not just something in the definition itself, that the "argument" name is attached to a "localized" mutable object like: def better_append(new_item, a_list=[].local): a_list.append(new_item) return a_list I'm sure there would be a better way to do this syntax, but I'm also almost positive there's a good reason to why it hasn't been done. So, anyone happens to know why?

    Read the article

  • SWT Composite consructor throws IllegalArgumentException on a non-null argument

    - by Alexey Romanov
    This piece of code (in Scala) val contents = { assert(mainWindow.detailsPane != null) new Composite(mainWindow.detailsPane, SWT.NONE) } throws an exception: Exception occurred java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Widget.error(Unknown Source) at org.eclipse.swt.widgets.Widget.checkParent(Unknown Source) at org.eclipse.swt.widgets.Widget.<init>(Unknown Source) at org.eclipse.swt.widgets.Control.<init>(Unknown Source) at org.eclipse.swt.widgets.Scrollable.<init>(Unknown Source) at org.eclipse.swt.widgets.Composite.<init>(Unknown Source) at main.scala.NodeViewPresenter$NodeViewImpl.<init>(NodeViewPresenter.scala:41) According to the documentation, IllegalArgumentException should only be thrown when the parent is null, but I am checking for that. detailsPane is a CTabFolder. Can anybody say why this could happen?

    Read the article

  • AbsoluteTime with numeric argument behaves strangely.

    - by dreeves
    This is strange: DateList@AbsoluteTime[596523] returns {2078, 7, 2, 2, 42, 9.7849} But DateList@AbsoluteTime[596524] returns {1942, 5, 26, 20, 28, 39.5596} The question: What's going on? Note that AbsoluteTime with a numeric argument is undocumented. (I think I now know what it's doing but figured this is useful to have as a StackOverflow question for future reference; and I'm curious if there's some reason for that magic 596523 number.) PS: I encountered this when writing these utility functions for converting to and from unix time in Mathematica: (* Using Unix time (an integer) instead of Mathematica's AbsoluteTime... *) tm[x___] := AbsoluteTime[x] (* tm is an alias for AbsoluteTime. *) uepoch = tm[{1970}, TimeZone->0]; (* unixtm works analogously to tm. *) unixtm[x___] := Round[tm[x]-uepoch] (* tm & unixtm convert between unix & *) unixtm[x_?NumericQ] := Round[x-uepoch] (* mma epoch time when given numeric *) tm[t_?NumericQ] := t+uepoch (* args. Ie, they're inverses. *)

    Read the article

  • c++ variadic macro argument count

    - by chedi
    Hi, is there any way to count the number of argument of a variadic macro, other than this one: #define PP_NARG(...) PP_NARG_(__VA_ARGS__,PP_RSEQ_N()) #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__) #define PP_ARG_N( \ _1, _2, _3, _4, _5, _6, _7, _8, _9,_10, _11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \ _21,_22,_23,_24,_25,_26,_27,_28,_29,_30, _31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \ _41,_42,_43,_44,_45,_46,_47,_48,_49,_50, _51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \ _61,_62,_63,N,...) N #define PP_RSEQ_N() \ 63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40, \ 39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16, \ 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0

    Read the article

  • Invalid argument for foreach()

    - by johnny-kessel
    Error I'm receiving Invalid argument supplied for foreach() The offending portions is this: foreach($subs[$id] as $id2 => $data2) Strange cause I'm using the same construct elsewhere and it works fine.. I'm using it to generate sub-categories and it works but I want to get rid of the error This is more context foreach($parents as $id => $data) { if($x == 0) { $html .= "<tr width='25%' class='row2'>"; } $shtml = ""; $i = 0; ***foreach($subs[$id] as $id2 => $data2)*** { $i++; if($i == 15) { $shtml .= $this->ipsclass->compiled_templates[ 'skin_businesses' ]->portal_categories_sub_row( $id2, $data2['cat_name'], 1 ) . ""; break; } else $shtml .= $this->ipsclass->compiled_templates[ 'skin_businesses' ]->portal_categories_sub_row( $id2, $data2['cat_name'], 0 ) . ""; }

    Read the article

  • jquery to construct a string and pass it as a post argument for file

    - by user253530
    I have this js code: $("#startSearch").live("click", function(event){ $("input:checkbox[name='searchId']:checked").each(function(){ var searchId = $(this).val(); var host = ''; $.post("php/autosearch-get-host.php",{sId: searchId},function(data){ host = 'http://' + data + '/index.php'; }); //alert(host); $.getJSON(host,{searchId: $(this).val()},function(){ pagination("php/pagination.php", $('#currentPage').val(), $('#sortBy').val(), $("#sortMode").val(), "autosearch"); }); }); }); The php file php/autosearch-get-host.php returns a string with the host name. What i want is to get the host from the database, create the URL using string concatenation and pass it as an argument to another $.post. $.post should use that URL like this: $.getJSON(host,{searchId: $(this).val()},function() { pagination("php/pagination.php", $('#currentPage').val(), $('#sortBy').val(), $("#sortMode").val(), "autosearch"); });

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >