Search Results

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

Page 81/297 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • Autoconf (newbie) -- building with static library

    - by EB
    I am trying to migrate from manual build to autoconf, which is working very nicely so far. But I have one static library that I can't figure out how to integrate. That library will NOT be located in the usual library locations - the location of the binary (.a file) and header (.h file) will be given as a configure argument. (Notably, even if I move the .a file to /usr/lib or anywhere else I can think of, it still won't work.) Manual compilation is working with these: gcc ... -I/path/to/header/file/directory /full/path/to/the/.a/file/itself (Uh, I actually don't understand why the .a file is referenced directly, not with -L or anything. Yes, I have a half-baked understanding of building C programs.) I can use the configure argument to successfully find the header (.h file) using AC_CHECK_HEADER. Inside the AC_CHECK_HEADER I then add the location to CPFLAGS and the #include of the header file in the actual C code picks it up nicely. Given a configure argument that has been put into $location and the name of the needed files are myprog.h and myprog.a (which are both in the same directory), here is what works so far: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"]) Where I run into difficulties is getting the binary (.a file) linked in. No matter what I try, I always get an error about undefined references to the function calls for that library. I'm pretty sure it's a linkage issue, because I can fuss with the C code and make an intentional error in the function calls to that library which produces earlier errors that indicate that the function prototypes have been loaded and used to compile. I tried adding the location that contains the .a file to LDFLAGS and then doing a AC_CHECK_LIB but it is not found. Maybe my syntax is wrong, or maybe I'm missing something more fundamental, which would not be surprising since I'm a newbie and don't really know what I'm doing. Here is what I have tried: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS -L$location"; AC_CHECK_LIB(myprog)]) No dice. AC_CHECK_LIB is looking for -lmyprog I guess (or libmyprog?) so I'm not sure if that's a problem, so I tried this, too (omit AC_CHECK_LIB and include the .a directly in LDFLAGS), without luck: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS -L$location/myprog.a"]) To emulate the manual compilation, I tried removing the -L but that doesn't help: AC_CHECK_HEADER([$location/myprog.h], [AC_DEFINE([HAVE_MYPROG_H], [1], [found myprog.h]) CFLAGS="$CFLAGS -I$location"; LDFLAGS="$LDFLAGS $location/myprog.a"]) I tried other combinations and permutations, but I think I might be missing something more fundamental....

    Read the article

  • SCJP question: Method ambiguous

    - by Markos Fragkakis
    Take a look at this code: public class Test { public static void main(String... args) { flipFlop("hello", new Integer(4), 2004); // flipFlop("hello", 10, 2004); // this works! } private static void flipFlop(String str, int i, Integer iRef) { System.out.println(str + " (String, int, Integer)"); } private static void flipFlop(String str, int i, int j) { System.out.println(str + " (String, int, int)"); } } The compiler gives an error that the invocation is ambiguous: Description Resource Path Location Type The method flipFlop(String, int, Integer) is ambiguous for the type Test Test.java scjp19 - inheritence/src line 3 Java Problem But if the commented-out line is used ti invoke flip-flop, the method is unambiguously invoked (the second one, because autoboxing comes after using the primitive itself). I would expect the compiler to see that the second argument will be unboxed one way or the other, and judge what method must be invoked depending on the third argument. Why does not this happen? What is the rationale?

    Read the article

  • Is it possible for parent window to notice if child window has been closed ???

    - by masato-san
    I have parent window (opener) and child (popup) ---------- -------------- | | | | | parent | -----> opens popup | child | | | | | ----------- -------------- Let's say, in parent page, I have js function hello() In order for child to call parent's hello() when the child window is closed and also pass an argument, I can do, window.close(); window.opener.hello(someArgument); This will close the window and also call parent's hello(); But what if I don't want to have the code window.opener.hello() in child page? I mean I want the code to be in parent page only One thing I can think of is: Somewhat parent knows when the child is closed (event listenr??? not sure in js) But in such case how to receive the argument? (i.e. some data back from the child)

    Read the article

  • Java2D OpenGL Hardware Acceleration Doesn't Work

    - by Aaron
    It doesn't work with OpenGL with even the simplest of programs. Here is what I am doing.. java -Dsun.java2d.opengl=True -jar Java2Demo.jar (Java2Demo.jar is usually included with the JDK..) The text output is: OpenGL pipeline enabled for default config on screen 0 When I don't pass in the above VM argument things work fine (but slowly). When I do pass in the above argument nothing shows up... If I move the window around it captures whatever image it was on top of and jumbles it into nonsense. I'm running Windows XP Pro SP3 (Microsoft Windows XP [Version 5.1.2600]) (under Parallels on OS X 10.5.8) I used "Geeks3D GPU Caps Viewer" to tell me I have Open GL version: 2.0 NVIDIA-1.5.48 I have tried this with two version of the JVM. First: java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode) and second: java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

    Read the article

  • Javas Math.sin() produces NaN all the time

    - by milan1612
    Forgive me if this is a dumb beginners problem, but I really don't get it. I have a member variable declared like so: public Double Value; When I assign 3.14159265 to Value and try to compute the sine of it, this happens: system.out.println(Value.toString()); //outputs 3.14159265 Value = Math.sin(Value); system.out.println(Value.toString()); //outputs NaN In fact, this happens with every single value I tried - even with 0! Math.sin() seems to always produce NaN as a result, regardless of the arguments value. The docs say: If the argument is NaN or an infinity, then the result is NaN. But my argument is clearly not NaN or infinity! What the heck is happening there?

    Read the article

  • C++: posix regex error reporting?

    - by Helltone
    I'm writing a small C++ program that parses some strings. I chose to use C's regex.h because I only need POSIX Extended Syntax and I'm concerned with portability. However, I've just noticed that when regexec fails to match, it returns != 0 and I have no idea of what was wrong :-(. I expected to be able to display at least a small message like: line:col: Syntax error or giig sdoigosdigo* sodfg ^ Syntax error Is there a way to know which character did not match? Should I use boost:regex instead? For reference, my regex is: "^" "[ ;\t\n]*" "(" // (1) identifier "[a-zA-Z_][a-zA-Z0-9_]*" ")" "[ \t]*" "(" // (2) non-marking "\[" "(" // (3) non-marking "[ \t]*" "(" // (4..n-1) argument "[a-zA-Z0-9_]+" ")" "[ \t]*" "," ")*" "[ \t]*" "(" // (n) last argument "[a-zA-Z0-9_]+" ")" "]" ")?" "[ \t\n]*" ";" Which matches for instance blablabla[arg1, arg2];

    Read the article

  • C++ template name pretty print

    - by aaa
    hello. I have need to print indented template names for debugging purposes. For example, instead of single-line, I would like to indent name like this: boost::phoenix::actor< boost::phoenix::composite< boost::phoenix::less_eval, boost::fusion::vector< boost::phoenix::argument<0>, boost::phoenix::argument<1>, I started writing my own but is getting to be complicated. Is there an existing solution? if there is not one, can you help me to finish up my implementation? I will post it if so. Thanks

    Read the article

  • javascript regex: match altered version of first match with only one expression

    - by theseion
    Hi there I'm writing a brush for Alex Gorbatchev's Syntax Highlighter to get highlighting for Smalltalk code. Now, consider the following Smalltalk code: aCollection do: [ :each | each shout ] I want to find the block argument ":each" and then match "each" every time it occurrs afterwards (for simplicity, let's say every occurrence an not just inside the brackets). Note that the argument can have any name, e.g. ":myArg". My attempt to match ":each": \:([\d\w]+) This seems to work. The problem is for me to match the occurrences of "each". I thought something like this could work: \:([\d\w]+)|\1 but the right hand side of the alternation seems to be treated as an independent expression, so backreferencing doesn't work. So my question is: is it even possible to accomplish what I want in a single expression? Or would I have to use the backreference within a second expression (via another function call)? Cheers.

    Read the article

  • Multiple GET arguments

    - by AJ Ravindiran
    Hello, I've been working with PHP lately, and I came across something I couldn't solve. So basically, I have a form: <form method="get"> <fieldset class="display-options" style="float: left"> Search by name or ip: <input type="text" name="key" value="" />&nbsp; <input type="submit" class="button2" value="Search" /> </fieldset> </form> The problem is, I currently already have a argument: http://example.com/logs.php?type=admin&page=1 How would i pass the given form argument with the already existing arguments? Like so: http://example.com/logs.php?type=admin&page=1&key=name Thanks in advance, AJ.

    Read the article

  • Use of serialization in JMX calls on Websphere Appserver to avoid ClasscastException

    - by hstoerr
    We are using JMX for communication between different EARs on the same Websphere application server (6.1). All works well if we only use Java types as arguments, but if we use or own the problem is that we get ClassCastExceptions on the receiver side. This is obviously a classloader problem: if the jar with the argument types is put into the JRE endorsed directory, such that all classloaders use exactly the same class, the Exception disappear. But we would much prefer to put the library that defines the argument types in the EAR itself. Now my question: is there a trick to persuade WAS to serialize and deserialize the arguments during the JMX call? I guess in this case the ClassCastException would dissappear.

    Read the article

  • Given a string describing a Javascript function. convert it to a Javascript function

    - by brainjam
    Say I've got a Javascript string like the following var fnStr = "function(){blah1;blah2;blah3; }" ; (This may be from an expression the user has typed in, duly sanitized, or it may be the result of some symbolic computation. It really doesn't matter). I want to define fn as if the following line was in my code: var fn = function(){blah1;blah2;blah3; } ; How do I do that? The best I've come up with is the following: var fn = eval("var f = function(){ return "+fnStr+";}; f() ;") ; This seems to do the trick, even though it uses the dreaded eval(), and uses a slightly convoluted argument. Can I do better? I.e. either not use eval(), or supply it with a simpler argument?

    Read the article

  • Warning when using qsort in C

    - by controlfreak123
    I wrote my comparison function int cmp(const int * a,const int * b) { if (*a==*b) return 0; else if (*a < *b) return -1; else return 1; } and i have my declaration int cmp (const int * value1,const int * value2); and I'm calling qsort in my program like so qsort(currentCases,round,sizeof(int),cmp); when i compile it I get the following warning warning: passing argument 4 of ‘qsort’ from incompatible pointer type /usr/include/stdlib.h:710: note: expected ‘__compar_fn_t’ but argument is of type ‘int (*)(const int *, const int *)’ The program works just fine so my only concern is why it doesn't like the way im using that?

    Read the article

  • Fortran intent(inout) v's no intent

    - by Andrew Walker
    Good practice dictates that subroutine arguments in Fortran should each have a specified intent (i.e. intent(in), intent(out) or intent(inout) as described this question): subroutine bar (a, b) real, intent(in) :: a real, intent(inout) :: b b = b + a ... However, not specifying an intent is valid Fortran: subroutine bar (a, b) real, intent(in) :: a real :: b b = b + a ... Are there any real differences beyond compile time checking for an argument specified as intent(inout) and an argument without a specified intent? Is there anything I should worry about if I'm retrofitting intents to older, intent free, code?

    Read the article

  • Does .NET Regex support global matching?

    - by Dave
    I haven't been able to find anything online regarding this. There's RegexOptions, but it doesn't have Global as one of its options. The inline modifiers list also doesn't mention global matching. In a nutshell, I've got a regex to parse something like --arga= "arg1" --argb ="arg2" into separate argument name/value pairs using this regex: --(\\w+)\\s*=\\s*\"(\\w+)\"\\s* but the .NET Regex class doesn't do it globally (iteratively). So in order for me to get this to work, I'd have to do a match, then remove this from the argument string, and loop over and over again until I've exhausted all of the arguments. It would be nicer to run the regex once, and then loop over the match groups to get the name value pairs. Is this possible? What am I missing?

    Read the article

  • How can I process command line arguments in Python?

    - by photographer
    What would be an easy expression to process command line arguments if I'm expecting anything like 001 or 999 (let's limit expectations to 001...999 range for this time), and few other arguments passed, and would like to ignore any unexpected? I understand if for example I need to find out if "debug" was passed among parameters it'll be something like that: if 'debug' in argv[1:]: print 'Will be running in debug mode.' How to find out if 009 or 575 was passed? All those are expected calls: python script.py python script.py 011 python script.py 256 debug python script.py 391 xls python script.py 999 debug pdf At this point I don't care about calls like that: python script.py 001 002 245 568 python script.py some unexpected argument python script.py 0001 python script.py 02 ...first one - because of more than one "numeric" argument; second - because of... well, unexpected arguments; third and fourth - because of non-3-digits arguments.

    Read the article

  • C# to Java: where T : new() Syntax

    - by Shiftbit
    I am porting some C# code over to Java. I am having trouble with the where Syntax, specifically new(). I understand that where is similar to Java's generic: T extends FOO. How I can replicate the new() argument in Java? "The new() Constraint lets the compiler know that any type argument supplied must have an accessible parameterless--or default-- constructor." - MSDN ie: public class BAR<T> : BAR where T : FOO, new() Right now I have: public class BAR<T extends FOO> extends ABSTRACTBAR { public HXIT(T t){ this.value = t; } .... }

    Read the article

  • Flex Button CSS skinning

    - by dta
    I have a CSS file containing the following definition : .Tab{ up-skin:Embed(skinClass='XUpSkin'); over-skin:Embed(skinClass='XOverSkin'); disabled-skin:Embed(skinClass='XDisabledSkin'); } And a Flex file : <mx:Button id="b1" style="Tab"/> Now, I want to use the disabled-skin defined in the CSS, as the upSkin of b1. So something like b1.setStyle("upSkin","Tab.disabled-skin"); But I am struggling with the exact syntax of the second argument for setStyle. What should I use for the second argument for setStyle method?

    Read the article

  • Why is Django reverse() failing with unicode?

    - by JeffS
    Here is a django models file that is not working as I would expect. I would expect the to_url method to do the reverse lookup in the urls.py file, and get a url that would correspond to calling that view with arguments supplied by the Arguments model. from django.db import models class Element(models.Model): viewname = models.CharField(max_length = 200) arguments = models.ManyToManyField('Argument', null = True, blank = True ) @models.permalink def to_url(self): d = dict( self.arguments.values_list('key', 'value') ) return (self.viewname, (), d) class Argument(models.Model): key = models.CharField(max_length=200) value = models.CharField(max_length=200) The value d ends up as a dictionary from a unicode string to another unicode string, which I believe, should work fine with the reverse() method that would be called by the permalink decorator, however, it results in: TypeError: reverse() keywords must be strings

    Read the article

  • Corner Cases, Unexpected and Unusual Matlab

    - by Mikhail
    Over the years, reading others code, I encountered and collected some examples of Matlab syntax which can be at first unusual and counterintuitive. Please, feel free to comment or complement this list. I verified it r2006a. set([], 'Background:Color','red') Matlab is very forgiving sometimes. In this case, setting properties to an array of objects works also with nonsense properties, at least when the array is empty. myArray([1,round(end/2)]) This use of end keyword may seem unclean but is sometimes very handy instead of using length(myArray). any([]) ~= all([]) Surprisigly any([]) returns false and all([]) returns true. And I always thought that all is stronger then any. EDIT: with not empty argument all() returns true for a subset of values for which any() returns true (e.g. truth table). This means that any() false implies all() false. This simple rule is being violated by Matlab with [] as argument. Loren also blogged about it. Select(Range(ExcelComObj)) Procedural style COM object method dispatch. Do not wonder that exist('Select') returns zero! [myString, myCell] Matlab makes in this case an implicit cast of string variable myString to cell type {myString}. It works, also if I would not expect it to do so. [double(1.8), uint8(123)] => 2 123 Another cast example. Everybody would probably expect uint8 value being cast to double but Mathworks have another opinion. a = 5; b = a(); It looks silly but you can call a variable with round brackets. Actually it makes sense because this way you can execute a function given its handle. a = {'aa', 'bb' 'cc', 'dd'}; Surprsisingly this code neither returns a vector nor rises an error but defins matrix, using just code layout. It is probably a relict from ancient times. set(hobj, {'BackgroundColor','ForegroundColor'},{'red','blue'}) This code does what you probably expect it to do. That function set accepts a struct as its second argument is a known fact and makes sense, and this sintax is just a cell2struct away. Equvalence rules are sometimes unexpected at first. For example 'A'==65 returns true (although for C-experts it is self-evident). About which further unexpected/unusual Matlab features are you aware?

    Read the article

  • how to write re-usable views in django?

    - by rz
    These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, Should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal?

    Read the article

  • Python: Can subclasses overload inherited methods?

    - by Rosarch
    I'm making a shopping cart app in Google App Engine. I have many classes that derive from a base handler: class BaseHandler(webapp.RequestHandler): def get(self, CSIN=None): self.body(CSIN) Does this mean that the body() method of every descendant class needs to have the same argument? This is cumbersome. Only one descendant actually uses that argument. And what about when I add new args? Do I need to go through and change every class? class Detail(BaseHandler): def body(self, CSIN): class MainPage(BaseHandler): def body(self, CSIN=None): #@UnusedVariable class Cart(BaseHandler): def body(self, CSIN): #@UnusedVariable

    Read the article

  • Binary comparison operators on generic types

    - by Brian Triplett
    I have a generic class that takes a type T. Within this class I have a method were I need to compare a type T to another type T such as: public class MyClass<T> { public T MaxValue { // Implimentation for MaxValue } public T MyMethod(T argument) { if(argument > this.MaxValue) { // Then do something } } } The comparison operation inside of MyMethod fails with Compiler Error CS0019. Is it possible to add a constraint to T to make this work? I tried adding a where T: IComparable<T> to the class definition to no avail.

    Read the article

  • Function pointer arrays in Fortran

    - by Eduardo Dobay
    I can create function pointers in Fortran 90, with code like real, external :: f and then use f as an argument to another function/subroutine. But what if I want an array of function pointers? In C I would just do double (*f[])(int); to create an array of functions returning double and taking an integer argument. I tried the most obvious, real, external, dimension(3) :: f but gfortran doesn't let me mix EXTERNAL and DIMENSION. Is there any way to do what I want? (The context for this is a program for solving a system of differential equations, so I could input the equations without having a million parameters in my subroutines.)

    Read the article

  • Django/Python best practice template_dict

    - by fredrik
    Hi, After just been coding for about 6-9 months. I probably changed my coding style a number of times after reading some code or read best practices. But one thing I haven't yet come a cross is a good why to populate the template_dict. As of now I pass the template_dict across a number of methods (that changes/modifies it) and returns is. The result is that every methods takes template_dict as first argument and the returns it and this in my eyes doesn't seems to be the best solution. An idea is to have a method that handles all the changes. But I'm curios if there's a best practice for this? Or is it "do what you feel like"-type of thing? The 2 things I think is pretty ugly is to send as an argument and return it in all methods. And the just the var name is written xxx number of times in the code :) ..fredrik

    Read the article

  • How to remove some of the TimeSeries titles in a AChartEngine Time Series View

    - by user1831310
    As a workaround of not being able to change colors of selected points in a series on an AChartEngine Time Chart, I was using an additional series for each point whose color has to be changed. I need to disable series titles for those additional series. Using empty string as the argument to the Time Series construtor: TimeSeries ts = TimeSeries(""); still results in the line-and-point symbol being placed with empty series title string under the X-axis labels for each such series. It would be a desirable feature for AChartEngine to remove both the line-and-point symbol and the series title string for a series created with a null argument to the TimeSeries construtor call: TimeSeries ts = TimeSeries(null); But this currently resulted in nullPointerException instead. Would the AChartEngine developers consider the above suggestion and until then, is there a way to remove some of the TimeSeries titles from a AChartEngine Time Series View? Best regards.

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >