Search Results

Search found 4670 results on 187 pages for 'jvm arguments'.

Page 23/187 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • How to call functions inside a C dll which take pointers as arguments from C#

    - by AndrejaKo
    Hi people, this is my first post here! I'm trying to make a windows forms program using C# which will use a precompiled C library. It will access a smart card and provide output from it. For the library, I have a .dll, .lib and .h and no source. In the .h file there are several structs defined. Most interesting functions of the .dll expect pointers to allocated structs as arguments. I've been calling functions inside the .dll like this: For example function EID_API int WINAPI EidStartup(int nApiVersion); would be called like this [DllImport("CelikApi.dll")]//the name of the .dll public static extern int EidStartup(int nApiVersion); Now my problem is that I can't find equivalent of C's pointers which point to dynamically allocated structures in memory in C#, so I don't know what to pass as argument to functions which take C pointers. I don't have much experience in C#, but to me its use looked as the easiest way of making the program I need. I tried with C++, but Visual Studio 2010 doesn't have IntelliSense for C++/CLR. If you can point me to something better, feel free to do so.

    Read the article

  • Getting method arguments with Roslyn

    - by Kevin Burton
    I can get a list from the solution of all calls to a particuliar method using the following code: var createCommandList = new List<MethodSymbol>(); INamedTypeSymbol interfaceSymbol = (from p in solution.Projects select p.GetCompilation().GetTypeByMetadataName("BuySeasons.BsiServices.DataResource.IBsiDataConnection")).FirstOrDefault(); foreach (ISymbol symbol in interfaceSymbol.GetMembers("CreateCommand")) { if (symbol.Kind == CommonSymbolKind.Method && symbol is MethodSymbol) { createCommandList.Add(symbol as MethodSymbol); } } foreach (MethodSymbol methodSymbol in createCommandList) { foreach (ReferencedSymbol referenceSymbol in methodSymbol.FindReferences(solution)) { foreach (ReferenceLocation referenceLocation in from l in referenceSymbol.Locations orderby l.Document.FilePath select l) { if (referenceLocation.Location.GetLineSpan(false).StartLinePosition.Line == referenceLocation.Location.GetLineSpan(false).EndLinePosition.Line) { Debug.WriteLine(string.Format("{0} {1} at {2} {3}/{4} - {5}", methodSymbol.Name, "(" + string.Join(",", (from p in methodSymbol.Parameters select p.Type.Name + " " + p.Name).ToArray()) + ")", Path.GetFileName(referenceLocation.Location.GetLineSpan(false).Path), referenceLocation.Location.GetLineSpan(false).StartLinePosition.Line, referenceLocation.Location.GetLineSpan(false).StartLinePosition.Character, referenceLocation.Location.GetLineSpan(false).EndLinePosition.Character)); } else { throw new ApplicationException("Call spans multiple lines"); } } } } But this gives me a list of ReferencedSymbol's. Although this gives me the file and line number that the method is called from I would also like to get the specific arguments that the method is called with. How can I either convert what I have or get the same information with Roslyn? (notice the I first load the solution with the Solution.Load method and then loop through to find out where the method is defined/declared (createCommandList)). Thank you.

    Read the article

  • User defined literal arguments are not constexpr?

    - by Pubby
    I'm testing out user defined literals. I want to make _fac return the factorial of the number. Having it call a constexpr function works, however it doesn't let me do it with templates as the compiler complains that the arguments are not and cannot be constexpr. I'm confused by this - aren't literals constant expressions? The 5 in 5_fac is always a literal that can be evaluated during compile time, so why can't I use it as such? First method: constexpr int factorial_function(int x) { return (x > 0) ? x * factorial_function(x - 1) : 1; } constexpr int operator "" _fac(unsigned long long x) { return factorial_function(x); // this works } Second method: template <int N> struct factorial { static const unsigned int value = N * factorial<N - 1>::value; }; template <> struct factorial<0> { static const unsigned int value = 1; }; constexpr int operator "" _fac(unsigned long long x) { return factorial_template<x>::value; // doesn't work - x is not a constexpr }

    Read the article

  • Executing an exe with arguments using Powershell

    - by Chris Charge
    This is what I want to execute: c:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe /Setvar((POSTSTR $POSTSTR)(POSTEND $POSTEND)) /G:C:\viewpointfile.vpt /D:C:($BEGDATE to $TODDATE).xls This is what I have tried: $a = "/Setvar((POSTSTR $POSTSTR)(POSTEND $POSTEND))" $b = "/G:C:\viewpointfile.vpt" $c = "/D:C:($BEGDATE to $TODDATE).xls" $Viewpoint = "c:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe" &$Viewpoint $a $b $c When I execute this I receive an error stating: File C:\viewpointfile.vpt "/D:C:($BEGDATE to $TODDATE).xls" not found! I'm not sure where it gets the extra quotes from. If I run the command with just $a and $b it runs fine. Any help would be greatly appreciated. Thanks! :) Update manojlds suggested echoargs so here it the output from it: &./echoargs.exe $viewpoint $a $b $c Arg 0 is C:\Program Files (x86)\SEQUEL ViewPoint\viewpoint.exe Arg 1 is /Setvar((POSTSTR 20101123)(POSTEND 20111123)) Arg 2 is /G:C:\viewpointfile.vpt Arg 3 is /D:C:(2010-11-23 to 2011-11-23 PM).xls It appears that all the arguments are being passed properly. When I run this as a command in cmd.exe it executes perfectly. So something on Powershells end must be messing up the output. Is there any other way to go about executing this command using Powershell?

    Read the article

  • Using items in a list as arguments

    - by Travis Brown
    Suppose I have a function with the following type signature: g :: a -> a -> a -> b I also have a list of as—let's call it xs—that I know will contain at least three items. I'd like to apply g to the first three items of xs. I know I could define a combinator like the following: ($$$) :: (a -> a -> a -> b) -> [a] -> b f $$$ (x:y:z:_) = f x y z Then I could just use g $$$ xs. This makes $$$ a bit like uncurry, but for a function with three arguments of the same type and a list instead of a tuple. Is there a way to do this idiomatically using standard combinators? Or rather, what's the most idiomatic way to do this in Haskell? I thought trying pointfree on a non-infix version of $$$ might give me some idea of where to start, but the output was an abomination with 10 flips, a handful of heads and tails and aps, and 28 parentheses. (NB: I know this isn't a terribly Haskelly thing to do in the first place, but I've come across a couple of situations where it seems like a reasonable solution, especially when using Parsec. I'll certainly accept "don't ever do this in real code" if that's the best answer, but I'd prefer to see some clever trick involving the ((->) r) monad or whatever.)

    Read the article

  • C++ Template Class Constructor with Variable Arguments

    - by david
    Is it possible to create a template function that takes a variable number of arguments, for example, in this Vector< T, C class constructor: template < typename T, uint C > Vector< T, C >::Vector( T, ... ) { assert( C > 0 ); va_list arg_list; va_start( arg_list, C ); for( uint i = 0; i < C; i++ ) { m_data[ i ] = va_arg( arg_list, T ); } va_end( arg_list ); } This almost works, but if someone calls Vector< double, 3 ( 1, 1, 1 ), only the first argument has the correct value. I suspect that the first parameter is correct because it is cast to a double during the function call, and that the others are interpreted as ints and then the bits are stuffed into a double. Calling Vector< double, 3 ( 1.0, 1.0, 1.0 ) gives the desired results. Is there a preferred way to do something like this?

    Read the article

  • Pass arguments to a parameter class object

    - by David R
    This is undoubtedly a simple question. I used to do this before, but it's been around 10 years since I worked in C++ so I can't remember properly and I can't get a simple constructor call working. The idea is that instead of parsing the args in main, main would create an object specifically designed to parse the arguments and return them as required. So: Parameters params = new Parameters(argc, argv) then I can call things like params.getfile() Only problem is I'm getting a complier error in Visual Studio 2008 and I'm sure this is simple, but I think my mind is just too rusty. What I've got so far is really basic: In the main: #include "stdafx.h" #include "Parameters.h" int _tmain(int argc, _TCHAR* argv[]) { Parameters params = new Parameters(argc, argv); return 0; } Then in the Parameters header: #pragma once class Parameters { public: Parameters(int, _TCHAR*[]); ~Parameters(void); }; Finally in the Parameters class: include "Stdafx.h" #include "Parameters.h" Parameters::Parameters(int argc, _TCHAR* argv[]) { } Parameters::~Parameters(void) { } I would appreciate if anyone could see where my ageing mind has missed the really obvious. Thanks in advance.

    Read the article

  • Attempt to create nested for loops generating missing arguments error

    - by JerryK
    Am attempting to teach myself to program using Tcl. (I want to become more familiar with the language to understand someone else's code - SCID chess) The task i've set myself to motivate my learing of Tcl is to solve the 8 queens problem. My approach to creating a program is to sucessively 'prototype' a solution. So. I'm up to nesting a for loop holding the q pos on row 2 inside the for loop holding the q pos on row 1 Here is my code set allowd 1 set notallowd 0 for {set r1p 1} {$r1p <= 8} {incr r1p } { puts "1st row q placed at $r1p" ;# re-initialize r2 'free for q placemnt' array after every change of r1 q pos: for {set i 1 } {$i <= 8} {incr i} { set r2($i) $allowd } for { set r2($r1p) $notallowd ; set r2([eval $r1p-1]) $notallowd ; set r2([eval $r1p+1]) $notallowd ; set r2p 1} {$r2p <= 8} { incr r2p ;# end of 'next' arg of r2 forloop } ;# commnd arg of r2 forloop placed below: {puts "2nd row q placed at $r2p" } } My problem is that when i run the code the interpreter is aborting with the fatal error: "wrong #args should be for start test next command. I've gone over my code a few times and can't see that i've missed any of the for loop arguments.

    Read the article

  • How to determine number of function arguments dynamically

    - by Kam
    I have the following code: #include <iostream> #include <functional> class test { public: typedef std::function<bool(int)> Handler; void handler(Handler h){h(5);} }; class test2 { public: template< typename Ret2, typename Ret, typename Class, typename Param> inline Ret2 MemFn(Ret (Class::*f)(Param), int arg_num) { if (arg_num == 1) return std::bind(f, this, std::placeholders::_1); } bool f(int x){ std::cout << x << std::endl; return true;} }; int main() { test t; test2 t2; t.handler(t2.MemFn<test::Handler>(&test2::f, 1)); return 0; } It works as expected. I would like to be able to call this: t.handler(t2.MemFn<test::Handler>(&test2::f)); instead of t.handler(t2.MemFn<test::Handler>(&test2::f, 1)); Basically I need MemFn to determine in runtime what Handler expects as the number of arguments. Is that even possible?

    Read the article

  • Rails 3 upgrade will_pagination wrong number of arguments (2 for 1)

    - by user1452541
    I am in the process of upgrading my rails app from 2.3.5 to 3.2.5 on ruby 1.9.3. In the old app I was using the will_paginate plugin, which I have converted to a gem. Now after the upgrade I am getting the following error : wrong number of arguments (2 for 1) A few lines from application trace: Application Trace | Framework Trace | Full Trace will_paginate (3.0.3) lib/will_paginate/active_record.rb:124:in `paginate' app/models/activity.rb:28:in `dashboard_activities' app/controllers/dashboard_controller.rb:10:in `index' actionpack (3.2.5) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (3.2.5) l I believe the issue is in the old code in the activity Model where I am using pagination. Can anyone help? The code: def dashboard_activities(page, total_records, date_range1 = nil, date_range2 = nil ) unless date_range2.nil? x =[ "is_delete = false AND status = 'open' AND date(due_date) between ? and ?", date_range1, date_range2] else x =[ "is_delete = false AND status = 'open' AND date(due_date) = ? ", date_range1] end paginate(:all, :page =>page, :per_page =>total_records, :conditions => x, :order =>"due_date asc") end

    Read the article

  • Passing command line arguments in C#

    - by Mark
    Hi, I'm trying to pass command line arguments to C# application, but I have problem passing something like this: "C:\Documents and Settings\All Users\Start Menu\Programs\App name" even if I add " " to the argument? Any help?? Here is the code: public ObjectModel(String[] args) { if (args.Length == 0) return; //no command line arg. //System.Windows.Forms.MessageBox.Show(args.Length.ToString()); //System.Windows.Forms.MessageBox.Show(args[0]); //System.Windows.Forms.MessageBox.Show(args[1]); //System.Windows.Forms.MessageBox.Show(args[2]); //System.Windows.Forms.MessageBox.Show(args[3]); if (args.Length == 3) { try { RemoveInstalledFolder(args[0]); RemoveUserAccount(args[1]); RemoveShortCutFolder(args[2]); RemoveRegistryEntry(); } catch (Exception e) { } } } And here is what I'm passing: C:\WINDOWS\Uninstaller.exe "C:\Program Files\Application name\" "username" "C:\Documents and Settings\All Users\Start Menu\Programs\application name" The problem is: I can get the first and the second args correct, but the last one it gets like this: C:\Documents

    Read the article

  • Using Moq to Validate Separate Invocations with Distinct Arguments

    - by Thermite
    I'm trying to validate the values of arguments passed to subsequent mocked method invocations (of the same method), but cannot figure out a valid approach. A generic example follows: public class Foo { [Dependency] public Bar SomeBar { get; set; } public void SomeMethod() { this.SomeBar.SomeOtherMethod("baz"); this.SomeBar.SomeOtherMethod("bag"); } } public class Bar { public void SomeOtherMethod(string input) { } } public class MoqTest { [TestMethod] public void RunTest() { Mock<Bar> mock = new Mock<Bar>(); Foo f = new Foo(); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("baz"))); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("bag"))); // this of course overrides the first call f.SomeMethod(); mock.VerifyAll(); } } Using a Function in the Setup might be an option, but then it seems I'd be reduced to some sort of global variable to know which argument/iteration I'm verifying. Maybe I'm overlooking the obvious within the Moq framework?

    Read the article

  • Pointer argument to boost python

    - by piotr
    What's the best way to make a function that has pointer as argument work with boost python? I see there are many possibilities for return values in the docs, but I don't know how to do it with arguments. void Tesuto::testp(std::string* s) { if (!s) cout << " NULL s" << endl; else cout << s << endl; } >>> t.testp(None) NULL s >>> >>> s='test' >>> t.testp(s) Traceback (most recent call last): File "<stdin>", line 1, in <module> Boost.Python.ArgumentError: Python argument types in Tesuto.testp(Tesuto, str) did not match C++ signature: testp(Tesuto {lvalue}, std::string*) >>>

    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

  • How do I format positional argument help using Python's optparse?

    - by cdleary
    As mentioned in the docs the optparse.OptionParser uses an IndentedHelpFormatter to output the formatted option help, for which which I found some API documentation. I want to display a similarly formatted help text for the required, positional arguments in the usage text. Is there an adapter or a simple usage pattern that can be used for similar positional argument formatting? Clarification Preferably only using the stdlib. Optparse does great except for this one formatting nuance, which I feel like we should be able to fix without importing whole other packages. :-)

    Read the article

  • Passing multiple aruments to a UNIX shell script

    - by Waffles
    Hello all, I have the following (bash) shell script, that I would ideally use to kill multiple processes by name. #!/bin/bash kill `ps -A | grep $* | awk '{ print $1 }'` However, while this script works is one argument is passed: end chrome (the name of the script is end) it does not work if more than one argument is passed: $end chrome firefox grep: firefox: No such file or directory What is going on here? I thought the $* passes multiple arguments to the shell script in sequence. I'm not mistyping anything in my input - and I the programs I wan to kill (chrome and firefox) are open. Any help is appreciated.

    Read the article

  • Problem with variable argument function in C++

    - by Freezerburn
    I'm trying to create a variable length function (obviously, heh) in C++, and what I have right now works, but only for the first argument. If someone could please let me know how to get this working with all the arguments that are passed, I would really appreciate it. Code: void udStaticObject::accept( udObjectVisitor *visitor, ... ) { va_list marker; udObjectVisitor *i = visitor; va_start( marker, visitor ); while( 1 ) { i->visit_staticObject( this ); //the if here will always go to the break immediately, allowing only //one argument to be used if( ( i = va_arg( marker, udObjectVisitor* ) ) ) break; } va_end( marker ); } Based on my past posts, and any help posts I make in general, there is probably some information that I did not provide that you will need to know to help. I apologize in advance if I forgot anything, and please let me know what you need to know so I can provide the information.

    Read the article

  • Convert c++ argument to int

    - by happyCoding25
    Hello, I have a small c++ program that needs to get and argument and convert it to an int. Here is my code so far: #include <iostream> using namespace std; int main(int argc,int argvx[]) { int i=1; int answer = 23; int temp; // decode arguments if(argc < 2) { printf("You must provide at least one argument\n"); exit(0); } // Convert it to an int here }

    Read the article

  • how to debug VC++ program, input file not open while debuging

    - by zeedotcom
    i am using Visual studio 8. i pass command line argument to my program when i execute the program using exe file it works fine but when i use to debugg. it is unable to open the input file which i have given it in the form of command line argument. although i have given the command line argument in the Project-properties-debug-command line arguments.... e.g "program.exe" input_file output_file input file contains data which i have to use in the calculation if i am unable to debug it. how can i remove the errors in my program reply me thanks

    Read the article

  • Variable lenght arguments in log4cxx LOG4CXX_ macros

    - by Horacio
    I am using log4cxx in a big C++ project but I really don't like how log4cxx handles multiple variables when logging: LOG4CXX_DEBUG(logger, "test " << var1 << " and " << var3 " and .....) I prefer using printf like variable length arguments: LOG4CXX_DEBUG(logger, "test %d and %d", var1, var3) So I implemented this small wrapper on top of log4cxx #include <string.h> #include <stdio.h> #include <stdarg.h> #include <log4cxx/logger.h> #include "log4cxx/basicconfigurator.h" const char * log_format(const char *fmt, ...); #define MYLOG_TRACE(logger, fmt, ...) LOG4CXX_TRACE(logger, log_format(fmt, ## __VA_ARGS__)) #define MYLOG_DEBUG(logger, fmt, ...) LOG4CXX_DEBUG(logger, log_format(fmt, ## __VA_ARGS__)) #define MYLOG_INFO(logger, fmt, ...) LOG4CXX_INFO(logger, log_format(fmt, ## __VA_ARGS__)) #define MYLOG_WARN(logger, fmt, ...) LOG4CXX_WARN(logger, log_format(fmt, ## __VA_ARGS__)) #define MYLOG_ERROR(logger, fmt, ...) LOG4CXX_ERROR(logger, log_format(fmt, ## __VA_ARGS__)) #define MYLOG_FATAL(logger, fmt, ...) LOG4CXX_FATAL(logger, log_format(fmt, ## __VA_ARGS__)) static log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger()); int main(int argc, char **argv) { log4cxx::BasicConfigurator::configure(); MYLOG_INFO(logger, "Start "); MYLOG_WARN(logger, log_format("In running this in %d threads safe?", 1000)); MYLOG_INFO(logger, "End "); return 0; } const char *log_format(const char *fmt, ...) { va_list va; static char formatted[1024]; va_start(va, fmt); vsprintf(formatted, 1024, fmt, va); va_end(va); return formatted; } And this works perfectly but I know using that static variable (formatted) can become problematic if I start using threads and each thread logging to the same place. I am no expert in log4cxx so I was wondering if the LOG4CXX macros are handling concurrent thread access automatically? or do I have to implement some sort of locking around the log_format method? something that I wan't to avoid due to performance implications. Also I would like to ask why if I replace the vsprintf inside the log_format method with vsnprintf (that is more secure) then I get nothing printed? To compile and test this program (in Ubuntu) use : g++ -o loggertest loggertest.cpp -llog4cxx

    Read the article

  • Calling cdecl Functions That Have Different Number of Arguments

    - by KlaxSmashing
    I have functions that I wish to call based on some input. Each function has different number of arguments. In other words, if (strcmp(str, "funcA") == 0) funcA(a, b, c); else if (strcmp(str, "funcB") == 0) funcB(d); else if (strcmp(str, "funcC") == 0) funcC(f, g); This is a bit bulky and hard to maintain. Ideally, these are variadic functions (e.g., printf-style) and can use varargs. But they are not. So exploiting the cdecl calling convention, I am stuffing the stack via a struct full of parameters. I'm wondering if there's a better way to do it. Note that this is strictly for in-house (e.g., simple tools, unit tests, etc.) and will not be used for any production code that might be subjected to malicious attacks. Example: #include <stdio.h> typedef struct __params { unsigned char* a; unsigned char* b; unsigned char* c; } params; int funcA(int a, int b) { printf("a = %d, b = %d\n", a, b); return a; } int funcB(int a, int b, const char* c) { printf("a = %d, b = %d, c = %s\n", a, b, c); return b; } int funcC(int* a) { printf("a = %d\n", *a); *a *= 2; return 0; } typedef int (*f)(params); int main(int argc, char**argv) { int val; int tmp; params myParams; f myFuncA = (f)funcA; f myFuncB = (f)funcB; f myFuncC = (f)funcC; myParams.a = (unsigned char*)100; myParams.b = (unsigned char*)200; val = myFuncA(myParams); printf("val = %d\n", val); myParams.c = (unsigned char*)"This is a test"; val = myFuncB(myParams); printf("val = %d\n", val); tmp = 300; myParams.a = (unsigned char*)&tmp; val = myFuncC(myParams); printf("a = %d, val = %d\n", tmp, val); return 0; } Output: gcc -o func func.c ./func a = 100, b = 200 val = 100 a = 100, b = 200, c = This is a test val = 200 a = 300 a = 600, val = 0

    Read the article

  • Why does the the Java VM not recover after "Too many open files" errors?

    - by Michael
    In certain well-understood circumstances, our application will open too many sockets (database connections) and reach the maximum open files that the OS allows. We understand this; we are fixing the issue and also bumping up the limit. What we can't explain is why parts of our application don't recover even after the number of connections abates and we're well within the limit. In this case, it's an application running under Tomcat. When this happens, we first start seeing "Too many open files" errors: SEVERE: Socket accept failed java.net.SocketException: Too many open files at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:390) at java.net.ServerSocket.implAccept(ServerSocket.java:453) at java.net.ServerSocket.accept(ServerSocket.java:421) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310) at java.lang.Thread.run(Thread.java:619) Eventually, we start seeing NoClassDefFoundErrors inside an application thread that's trying to open HTTP connections: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/protocol/ControllerThreadSocketFactory at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:128) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1349) [...] Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 8 more When the errant connections go away, the server starts accepting connections again, and everything seems ok, but we're left with the latter error constantly being spewed to stderr. Although the application typically logs unloaded classes to stdout, I don't see any such logs just before, during or after the "Too many open files" errors. My initial theory was that the Hotspot JVM would unload seemingly unused classes when it encounters "Too many open files," but if so, it doesn't log the fact. I'd also expect it to recover if that were the case. Platform details: Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode) Apache Tomcat Version 6.0.18

    Read the article

  • Alternatives to Java for Android development?

    - by paul.meier
    Hey all, I've started developing Android apps a couple of months ago, and have a few under my belt. While I can tolerate Java enough to keep developing, I was wondering what success the community has had getting other languages to run. I've done some investigation as to how other JVM languages work, and it appears Dalvik messes them up pretty hard. Clojure seems unable to run, Scala seems to be one of the most successful. JRuby has also had some luck, but they caution against anything major. I've also checked out Scheme via Moby and Kawa, both of which seem to have some promise. What luck have any of you had? Languages I'm missing, misrepresenting? Any non-"Hello World" apps you've written in non-Java? Any snags in trying to get another language to run (e.g. "as long as you don't use continuations, you're fine in X Scheme"). Any particular snags in developing apps non-Java, once you get them to run? Thanks, hope you well ^_^

    Read the article

  • Why is the Clojure Hello World program so slow compared to Java and Python?

    - by viksit
    Hi all, I'm reading "Programming Clojure" and I was comparing some languages I use for some simple code. I noticed that the clojure implementations were the slowest in each case. For instance, Python - hello.py def hello_world(name): print "Hello, %s" % name hello_world("world") and result, $ time python hello.py Hello, world real 0m0.027s user 0m0.013s sys 0m0.014s Java - hello.java import java.io.*; public class hello { public static void hello_world(String name) { System.out.println("Hello, " + name); } public static void main(String[] args) { hello_world("world"); } } and result, $ time java hello Hello, world real 0m0.324s user 0m0.296s sys 0m0.065s and finally, Clojure - hellofun.clj (defn hello-world [username] (println (format "Hello, %s" username))) (hello-world "world") and results, $ time clj hellofun.clj Hello, world real 0m1.418s user 0m1.649s sys 0m0.154s Thats a whole, garangutan 1.4 seconds! Does anyone have pointers on what the cause of this could be? Is Clojure really that slow, or are there JVM tricks et al that need to be used in order to speed up execution? More importantly - isn't this huge difference in performance going to be an issue at some point? (I mean, lets say I was using Clojure for a production system - the gain I get in using lisp seems completely offset by the performance issues I can see here). The machine used here is a 2007 Macbook Pro running Snow Leopard, a 2.16Ghz Intel C2D and 2G DDR2 SDRAM. BTW, the clj script I'm using is from here and looks like, #!/bin/bash JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java CLJ_DIR=/opt/jars CLOJURE=$CLJ_DIR/clojure.jar CONTRIB=$CLJ_DIR/clojure-contrib.jar JLINE=$CLJ_DIR/jline-0.9.94.jar CP=$PWD:$CLOJURE:$JLINE:$CONTRIB # Add extra jars as specified by `.clojure` file if [ -f .clojure ] then CP=$CP:`cat .clojure` fi if [ -z "$1" ]; then $JAVA -server -cp $CP \ jline.ConsoleRunner clojure.lang.Repl else scriptname=$1 $JAVA -server -cp $CP clojure.main $scriptname -- $* fi

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >