Search Results

Search found 674 results on 27 pages for 'arg'.

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

  • javamail smtp issue

    - by lepricon123
    I am using spring to send mail and for some reason its stripping the from email address. I ma sending the complete address form the sender to the mails server. Following is the log 10.105.21.299, taq02, 5/4/2010, 14:50:32, SMTPSVC1, taser10, 10.100.20.106, 2250, 11, 199, 250, 0, EHLO, -, taq02, 10.105.21.299, taq02, 5/4/2010, 14:50:32, SMTPSVC1, taser10, 10.100.20.106, 0, 14, 34, 250, 0, MAIL, -, FROM:<{}>, 10.105.21.299, taq02, 5/4/2010, 14:50:32, SMTPSVC1, taser10, 10.100.20.106, 0, 32, 35, 250, 0, RCPT, -, TO:<[email protected]>, 10.105.21.299, taq02, 5/4/2010, 14:50:32, SMTPSVC1, taser10, 10.100.20.106, 0, 681, 130, 250, 0, DATA, -, <27317520.11273009832239.JavaMail.root@taq02>, 10.105.21.299, taq02, 5/4/2010, 14:50:32, SMTPSVC1, taser10, 10.100.20.106, 0, 4, 78, 240, 2265, QUIT, -, taq02, 148.142.126.203, OutboundConnectionResponse, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1110, 0, 95, 0, 0, -, -, 220 *******************************************************************************************, 148.142.126.203, OutboundConnectionCommand, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1110, 0, 4, 0, 0, EHLO, -, TASER10.ccdomain.com, 148.142.126.203, OutboundConnectionResponse, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1188, 0, 65, 0, 0, -, -, 250-acsinet11.emailserver.com Hello [4.79.35.186], pleased to meet you, 148.142.126.203, OutboundConnectionCommand, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1188, 0, 4, 0, 0, MAIL, -, FROM:<{}@TASER10> SIZE=945, 148.142.126.203, OutboundConnectionResponse, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1328, 0, 34, 0, 0, -, -, 250 2.1.0 <{}@TASER10>... Sender ok, 148.142.126.203, OutboundConnectionCommand, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1328, 0, 4, 0, 0, RCPT, -, TO:<[email protected]>, 148.142.126.203, OutboundConnectionResponse, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1375, 0, 87, 0, 0, -, -, 553 5.1.8 <[email protected]>... Domain of sender address {}@TASER10 does not exist, 148.142.126.203, OutboundConnectionCommand, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1375, 0, 4, 0, 0, RSET, -, -, 148.142.126.203, OutboundConnectionResponse, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1407, 0, 21, 0, 0, -, -, 250 2.0.0 Reset state, 148.142.126.203, OutboundConnectionCommand, 5/4/2010, 14:50:33, SMTPSVC1, TASER10, -, 1422, 0, 4, 0, 0, RSET, -, -, The mail server is taser10 and the sender is on taq02 erver as follows http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" <bean id="smtpAuthenticator" class="SmtpAuthenticator"> <constructor-arg value="[email protected]" /> <constructor-arg value="password" /> </bean> <bean id="mailSession" class="javax.mail.Session" factory-method="getInstance"> <constructor-arg> <props> <prop key="mail.smtp.auth">false</prop> <prop key="mail.smtp.socketFactory.port">465</prop> <prop key="mail.smtp.socketFactory.class"> javax.net.ssl.SSLSocketFactory</prop> <prop key="mail.smtp.socketFactory.fallback"> false </prop> </props> </constructor-arg> <constructor-arg ref="smtpAuthenticator" /> </bean> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value="10.100.20.106" /> </bean> <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage"> <property name="from" value="[email protected]" /> <property name="subject" value="Subject AB"/> </bean>

    Read the article

  • C socket: problem with connect() and/or accept() between clients. 111: Connection refused

    - by Fantastic Fourier
    Hello ladies and gents, I'm having a bit of problem with accept(). I have a multiple clients and one server. The clients can connect and communicate just fine with server. But at one point, I need some clients to be directly connected to each other and I'm having a bit of difficulty there. The clients have bunch of threads going on, where one of them is handle_connection() and it has a while(1), looping forever to listen() and accept() whatever incoming connections. Whenever a client tries to connect() to other client, connect() returns an error, 111: Connection Refused. I know I have the right IP address and right port (I have specified a port just for between-client connections). The client that is waiting for connection doesn't notice anything, no new connection, nada. I copied some parts of the code, in hopes that someone can point out what I'm doing wrong. Thanks for any inputs! This is all client side code. void * handle_connections(void * arg) is a thread that loops forever to accept() any incoming connections. My server has a very similar thang going on and it works very well. (not sure why it doesn't work here..) This is the part of client that is waiting for a new incoming connection. int handle_request(void * arg, struct message * msg) is called at one point during program and tries to connect to a client that is specified in struct message * msg which includes struct sockaddr_in with IP address and port number and whatever. #define SERVER_PORT 10000 #define CLIENT_PORT 3456 #define MAX_CONNECTION 20 #define MAX_MSG 50 void * handle_connections(void * arg) { struct fd_info * info; struct sockaddr_in client_address; struct timeval timeout; fd_set readset, copyset; bzero((char * ) &client_address, sizeof(client_address)); // copy zeroes into string client_address.sin_family = AF_INET; client_address.sin_addr.s_addr = htonl(INADDR_ANY); client_address.sin_port = htons(CLIENT_PORT); sockfd = socket(AF_INET, SOCK_STREAM, 0); rv = listen(sockfd,MAX_CONNECTION); while(1) { new_sockfd = accept(sockfd, (struct sockaddr *) &client_address, &client_addr_len); //blocks if (new_sockfd < 0) { printf("C: ERROR accept() %i: %s \n", errno, strerror(errno)); sleep(2); } else { printf("C: accepted\n"); FD_SET(new_sockfd, &readset); // sets bit for new_sockfd to list of sockets to watch out for if (maxfd < new_sockfd) maxfd = new_sockfd; if (minfd > new_sockfd) minfd = new_sockfd; } //end if else (new_sockfd) } // end of the forever while loop } int handle_request(void * arg, struct message * msg) { char * cname, gname, payload; char * command[3]; int i, rv, sockfd, client_addr_len; struct sockaddr_in client_address; struct fd_info * info; info = (struct fd_info *) arg; sockfd = info->sock_fd; sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd == -1) { printf("HR: ERROR socket() %i: %s \n", errno, strerror(errno)); break; } else if (sockfd > 0) { printf("HR: new socks is %i \n", sockfd); printf("HR: sin_family is %i: %i\n", msg->peer.client_address.sin_family, msg->peer.client_address.sin_port); //************************************************************* //this is the part that returns error 111: Connection refused!!! //************************************************************* rv = connect(sockfd, (struct sockaddr *) &msg->peer.client_address, sizeof(struct sockaddr)); if (rv == -1) { printf("HR: ERROR: connect() %i: %s \n", errno, strerror(errno)); printf("HR: at %li \n", msg->peer.client_address.sin_addr.s_addr); break; } else if (rv > 0) { info->max_fd = sockfd; printf("HR: connected successfully!! \n"); } } }

    Read the article

  • Apache2 Modpython : IOError: Write failed, client closed connection.

    - by llazzaro
    This is the error : [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] mod_python (pid=9528, interpreter='realpage.com', phase='PythonHandler', handler='django.core.handlers.modpython'): Application error [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] ServerName: 'realpage.dom' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] DocumentRoot: '/htdocs' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] URI: '/' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] Location: '/' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XX.248.60] Directory: None [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] Filename: '/htdocs' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] PathInfo: '/' [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] Traceback (most recent call last): [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent) [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg) [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target\n result = object(arg) [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 228, in handler\n return ModPythonHandler()(req) [Mon Mar 01 12:19:50 2010] [error] [client XXX.XXX.248.60] File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py", line 220, in call\n req.write(chunk) [Mon Mar 01 12:19:50 2010] [error] [client XXX.XX.248.60] IOError: Write failed, client closed connection. Please! I am sure you need more information in order to find the bug, please tell me what and how to get it. The error is throwing every time!

    Read the article

  • Users using Perl script to bypass Squid Proxy

    - by mk22
    The users on our network have been using a perl script to bypass our Squid proxy restrictions. Is there any way we can block this script from working?? #!/usr/bin/perl ######################################################################## # (c) 2008 Indika Bandara Udagedara # [email protected] # http://indikabandara19.blogspot.com # # ---------- # LICENCE # ---------- # This work is protected under GNU GPL # It simply says # " you are hereby granted to do whatever you want with this # except claiming you wrote this." # # # ---------- # README # ---------- # A simple tool to download via http proxies which enforce a download # size limit. Requires curl. # This is NOT a hack. This uses the absolutely legal HTTP/1.1 spec # Tested only for squid-2.6. Only squids will work with this(i think) # Please read the verbose README provided kindly by Rahadian Pratama # if u r on cygwin and think this documentation is not enough :) # # The newest version of pget is available at # http://indikabandara.no-ip.com/~indika/pget # # ---------- # USAGE # ---------- # + Edit below configurations(mainly proxy) # + First run with -i <file> giving a sample file of same type that # you are going to download. Doing this once is enough. # eg. to download '.tar' files first run with # pget -i my.tar ('my.tar' should be a real file) # + Run with # pget -g <URL> # # ######################################################################## ######################################################################## # CONFIGURATIONS - CHANGE THESE FREELY ######################################################################## # *magic* file # pls set absolute path if in cygwin my $_extFile = "./pget.ext" ; # download in chunks of below size my $_chunkSize = 1024*1024; # in Bytes # the proxy that troubles you my $_proxy = "192.168.0.2:3128"; # proxy URL:port my $_proxy_auth = "user:pass"; # proxy user:pass # whereis curl # pls set absolute path if in cygwin my $_curl = "/usr/bin/curl"; ######################################################################## # EDIT BELOW ONLY IF YOU KNOW WHAT YOU ARE DOING ######################################################################## use warnings; my $_version = "0.1.0"; PrintBanner(); if (@ARGV == 0) { PrintHelp(); exit; } PrimaryValidations(); my $val; while(scalar(@ARGV)) { my $arg = shift(@ARGV); if($arg eq '-h') { PrintHelp(); } elsif($arg eq '-i') { $val = shift(@ARGV); if (!defined($val)) { printf("-i option requires a filename\n"); exit; } Init($val); } elsif($arg eq '-g') { $val = shift(@ARGV); if (!defined($val)) { printf("-g option requires a URL\n"); exit; } GetURL($val); } elsif($arg eq '-c') { $val = shift(@ARGV); if (!defined($val)) { printf("-c option requires a URL\n"); exit; } ContinueURL($val); } else { printf ("Unknown option %s\n", $arg); PrintHelp(); } } sub GetURL { my ($URL) = @_; chomp($URL); my $fileName = GetFileName($URL); my %mapExt; my $first; my $readLen; my $ext = GetExt($fileName); ReadMap($_extFile, \%mapExt); if ( exists($mapExt{$ext})) { $first = $mapExt{$ext}; GetFile($URL, $first, $fileName, 0); } else { die "Unknown ext in $fileName. Rerun with -i <fileName>"; } } sub ContinueURL { my ($URL) = @_; chomp($URL); my $fileName = GetFileName($URL); my $fileSize = 0; $fileSize = -s $fileName; printf("Size = %d\n", $fileSize); my $first = -1; if ( $fileSize > 0 ) { $fileSize -= 1; GetFile($URL, $first, $fileName, $fileSize); } else { GetURL($URL); } } sub Init { my ($fileName) = @_; my ($key, $value); my %mapExt; my $ext = GetExt($fileName); if ( $ext eq "") { die "Cannot get ext of \'$fileName\'"; } ReadMap($_extFile, \%mapExt); my $b = GetFirst($fileName); $mapExt{$ext} = $b; WriteMap($_extFile, \%mapExt); print "I handle\n"; while ( ($key, $value) = each(%mapExt) ) { print "\t$key -> $value\n"; } } sub GetExt { my ($name) = @_; my @x = split(/\./, $name); my $ext = ""; if (@x != 1) { $ext = pop @x; } return $ext; } sub ReadMap { my($fileName, $mapRef) = @_; my $f; my @arr; open($f, '<', $fileName) or die "Couldn't open $fileName"; my %map = %{$mapRef}; while (<$f>) { my $line = $_; chomp($line); @arr = split(/[ \t]+/, $line, 2); $mapRef->{ $arr[0]} = $arr[1]; } printf("known ext\n"); while (($key, $value) = each(%$mapRef)) { print("$key, $value\n"); } close($f); } sub WriteMap { my ($fileName, $mapRef) = @_; my $f; my @arr; open($f, '>', $fileName) or die "Couldn't open $fileName"; my ($k, $v); while( ($k, $v) = each(%{$mapRef})) { print $f "$k" . "\t$v\n"; } close($f); } sub PrintHelp { print "usage: -h Print this help -i <filename> Initialize for this filetype -g <URL> Get this URL\n -c <URL> Continue this URL\n" } sub GetFirst { my ($fileName) = @_; my $f; open($f, "<$fileName") or die "Couldn't open $fileName"; my $buffer = ""; my $first = -1; binmode($f); sysread($f, $buffer, 1, 0); close($f); $first = ord($buffer); return $first; } sub GetFirstFromMap { } sub GetFileName { my ($URL) = @_; my @x = split(/\//, $URL); my $fileName = pop @x; return $fileName; } sub GetChunk { my ($URL, $file, $offset, $readLen) = @_; my $end = $offset + $_chunkSize - 1; my $curlCmd = "$_curl -x $_proxy -u $_proxy_auth -r $offset-$end -# \"$URL\""; print "$curlCmd\n"; my $buff = `$curlCmd`; ${$readLen} = syswrite($file, $buff, length($buff)); } sub GetFile { my ($URL, $first, $outFile, $fileSize) = @_; my $readLen = 0; my $start = $fileSize + 1; my $file; open($file, "+>>$outFile") or die "Couldn't open $outFile to write"; if ($fileSize <= 0) { my $uc = pack("C", $first); syswrite ($file, $uc, 1); } do { GetChunk($URL, $file, $start ,\$readLen); $start = $start + $_chunkSize; $fileSize += $readLen; }while ($readLen == $_chunkSize); printf("Downloaded %s(%d bytes).\n", $outFile, $fileSize); close($file); } sub PrintBanner { printf ("pget version %s\n", $_version); printf ("There is absolutely NO WARRANTY for pget.\n"); printf ("Use at your own risk. You have been warned.\n\n"); } sub PrimaryValidations { unless( -e "$_curl") { printf("ERROR:curl is not at %s. Pls install or provide correct path.\n", $_curl); exit; } unless( -e "$_extFile") { printf("extFile is not at %s. Creating one\n", $_extFile); `touch $_extFile`; } if ( $_chunkSize <= 0) { printf ("Invalid chunk size. Using 1Mb as default.\n"); $_chunkSize = 1024*1024; } }

    Read the article

  • Running a Java program with a .dll from Adobe AIR's native process

    - by Donny
    I would like to be able to operate a scanner from my AIR application. Since there's no support for this natively, I'm trying to use the NativeProcess class to start a jar file that can run the scanner. The Java code is using the JTwain library to operate the scanner. The Java application runs fine by itself, and the AIR application can start and communicate with the Java application. The problem seems to be that any time I attempt to use a function from JTwain (which relies on the JTwain.dll), the application dies IF AIR STARTED IT. I'm not sure if there's some limit about referencing dll files from the native process or what. I've included my code below Java code- while(true) { try { System.out.println("Start"); text = in.readLine(); Source source = SourceManager.instance().getCurrentSource(); System.out.println("Java says: "+ text); } catch (IOException e) { System.err.println("Exception while reading the input. " + e); } catch (Exception e) { System.out.println("Other exception occured: " + e.toString()); } finally { } } } Air application- import mx.events.FlexEvent; private var nativeProcess:NativeProcess; private var npInfo:NativeProcessStartupInfo; private var processBuffer:ByteArray; private var bLength:int = 0; protected function windowedapplication1_applicationCompleteHandler(event:FlexEvent):void { var arg:Vector.<String> = new Vector.<String>; arg.push("-jar"); arg.push(File.applicationDirectory.resolvePath("Hello2.jar").nativePath); processBuffer = new ByteArray; npInfo = new NativeProcessStartupInfo; npInfo.executable = new File("C:/Program Files/Java/jre6/bin/javaw.exe"); npInfo.arguments = arg; nativeProcess = new NativeProcess; nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onStandardOutputData); nativeProcess.start(npInfo); } private function onStandardOutputData(e:ProgressEvent):void { tArea.text += nativeProcess.standardOutput.readUTFBytes(nativeProcess.standardOutput.bytesAvailable); } protected function button1_clickHandler(event:MouseEvent):void { tArea.text += 'AIR app: '+tInput.text + '\n'; nativeProcess.standardInput.writeMultiByte(tInput.text + "\n", 'utf-8'); tInput.text = ''; } protected function windowedapplication1_closeHandler(event:Event):void { nativeProcess.closeInput(); } ]]> </fx:Script> <s:Button label="Send" x="221" y="11" click="button1_clickHandler(event)"/> <s:TextInput id="tInput" x="10" y="10" width="203"/> <s:TextArea id="tArea" x="10" width="282" height="88" top="40"/> I would love some explanation about why this is dying. I've done enough testing that I know absolutely that the line that kills it is the SourceManager.instance().getCurrentSource(). I would love any suggestions. Thanks.

    Read the article

  • Reading a child process's /proc/pid/mem file from the parent

    - by Amittai Aviram
    In the program below, I am trying to cause the following to happen: Process A assigns a value to a stack variable a. Process A (parent) creates process B (child) with PID child_pid. Process B calls function func1, passing a pointer to a. Process B changes the value of variable a through the pointer. Process B opens its /proc/self/mem file, seeks to the page containing a, and prints the new value of a. Process A (at the same time) opens /proc/child_pid/mem, seeks to the right page, and prints the new value of a. The problem is that, in step 6, the parent only sees the old value of a in /proc/child_pid/mem, while the child can indeed see the new value in its /proc/self/mem. Why is this the case? Is there any way that I can get the parent to to see the child's changes to its address space through the /proc filesystem? #include <fcntl.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include <unistd.h> #define PAGE_SIZE 0x1000 #define LOG_PAGE_SIZE 0xc #define PAGE_ROUND_DOWN(v) ((v) & (~(PAGE_SIZE - 1))) #define PAGE_ROUND_UP(v) (((v) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1))) #define OFFSET_IN_PAGE(v) ((v) & (PAGE_SIZE - 1)) # if defined ARCH && ARCH == 32 #define BP "ebp" #define SP "esp" #else #define BP "rbp" #define SP "rsp" #endif typedef struct arg_t { int a; } arg_t; void func1(void * data) { arg_t * arg_ptr = (arg_t *)data; printf("func1: old value: %d\n", arg_ptr->a); arg_ptr->a = 53; printf("func1: address: %p\n", &arg_ptr->a); printf("func1: new value: %d\n", arg_ptr->a); } void expore_proc_mem(void (*fn)(void *), void * data) { off_t frame_pointer, stack_start; char buffer[PAGE_SIZE]; const char * path = "/proc/self/mem"; int child_pid, status; int parent_to_child[2]; int child_to_parent[2]; arg_t * arg_ptr; off_t child_offset; asm volatile ("mov %%"BP", %0" : "=m" (frame_pointer)); stack_start = PAGE_ROUND_DOWN(frame_pointer); printf("Stack_start: %lx\n", (unsigned long)stack_start); arg_ptr = (arg_t *)data; child_offset = OFFSET_IN_PAGE((off_t)&arg_ptr->a); printf("Address of arg_ptr->a: %p\n", &arg_ptr->a); pipe(parent_to_child); pipe(child_to_parent); bool msg; int child_mem_fd; char child_path[0x20]; child_pid = fork(); if (child_pid == -1) { perror("fork"); exit(EXIT_FAILURE); } if (!child_pid) { close(child_to_parent[0]); close(parent_to_child[1]); printf("CHILD (pid %d, parent pid %d).\n", getpid(), getppid()); fn(data); msg = true; write(child_to_parent[1], &msg, 1); child_mem_fd = open("/proc/self/mem", O_RDONLY); if (child_mem_fd == -1) { perror("open (child)"); exit(EXIT_FAILURE); } printf("CHILD: child_mem_fd: %d\n", child_mem_fd); if (lseek(child_mem_fd, stack_start, SEEK_SET) == (off_t)-1) { perror("lseek"); exit(EXIT_FAILURE); } if (read(child_mem_fd, buffer, sizeof(buffer)) != sizeof(buffer)) { perror("read"); exit(EXIT_FAILURE); } printf("CHILD: new value %d\n", *(int *)(buffer + child_offset)); read(parent_to_child[0], &msg, 1); exit(EXIT_SUCCESS); } else { printf("PARENT (pid %d, child pid %d)\n", getpid(), child_pid); printf("PARENT: child_offset: %lx\n", child_offset); read(child_to_parent[0], &msg, 1); printf("PARENT: message from child: %d\n", msg); snprintf(child_path, 0x20, "/proc/%d/mem", child_pid); printf("PARENT: child_path: %s\n", child_path); child_mem_fd = open(path, O_RDONLY); if (child_mem_fd == -1) { perror("open (child)"); exit(EXIT_FAILURE); } printf("PARENT: child_mem_fd: %d\n", child_mem_fd); if (lseek(child_mem_fd, stack_start, SEEK_SET) == (off_t)-1) { perror("lseek"); exit(EXIT_FAILURE); } if (read(child_mem_fd, buffer, sizeof(buffer)) != sizeof(buffer)) { perror("read"); exit(EXIT_FAILURE); } printf("PARENT: new value %d\n", *(int *)(buffer + child_offset)); close(child_mem_fd); printf("ENDING CHILD PROCESS.\n"); write(parent_to_child[1], &msg, 1); if (waitpid(child_pid, &status, 0) == -1) { perror("waitpid"); exit(EXIT_FAILURE); } } } int main(void) { arg_t arg; arg.a = 42; printf("In main: address of arg.a: %p\n", &arg.a); explore_proc_mem(&func1, &arg.a); return EXIT_SUCCESS; } This program produces the output below. Notice that the value of a (boldfaced) differs between parent's and child's reading of the /proc/child_pid/mem file. In main: address of arg.a: 0x7ffffe1964f0 Stack_start: 7ffffe196000 Address of arg_ptr-a: 0x7ffffe1964f0 PARENT (pid 20376, child pid 20377) PARENT: child_offset: 4f0 CHILD (pid 20377, parent pid 20376). func1: old value: 42 func1: address: 0x7ffffe1964f0 func1: new value: 53 PARENT: message from child: 1 CHILD: child_mem_fd: 4 PARENT: child_path: /proc/20377/mem CHILD: new value 53 PARENT: child_mem_fd: 7 PARENT: new value 42 ENDING CHILD PROCESS.

    Read the article

  • How to remove adornments like [exec] when using groovy's AntBuilder

    - by Miguel Pardal
    Hi! I'm using Groovy's AntBuilder to execute Ant tasks: def ant = new AntBuilder() ant.sequential { ant.exec(executable: "cmd", dir: "..", resultproperty: "exec-ret-code") { arg(value: "/c") arg(line: "dir") } } The output lines are prefixed by: [exec] Using Ant on the command line, this is turned off by "emacs mode" ant -emacs ... Is there a way to switch to emacs mode using AntBuilder?

    Read the article

  • help for gdb's stepi command

    - by programmer
    I need to trace all instrutions of a program using gdb. After every execution of a instruction, I want gdb invokes a specified function. Is it a possiable work? How to achieve this? I searched internet and found "stepi arg" command in gdb could step arg instructions. But how to find total number of instructions? After every instruction, how to make gdb to invoke my function automately?

    Read the article

  • how to find if groovy args contains a particular string

    - by groovynoob
    println args println args.size() println args.each{arg-> println arg} println args.class if (args.contains("Hello")) println "Found Hello" when ran give following error: [hello, somethingelse] 2 hello somethingelse [hello, somethingelse] class [Ljava.lang.String; Caught: groovy.lang.MissingMethodException: No signature of method: [Ljava.lang. String;.contains() is applicable for argument types: (java.lang.String) values: [Hello] why can I not do contains?

    Read the article

  • ruby - can't modify frozen string (TypeError)

    - by Straff
    Got ... '[]=': can't modify frozen string (TypeError) when trying to modify what I thought was a copy of ARGV[0]. Same results for each of arg = ARGV[ 0 ] arg_cloned = ARGV[ 0 ].clone arg_to_s = ARGV[ 0 ].to_s arg[ 'x' ] = 'y' arg_cloned[ 'x' ] = 'y' arg_to_s[ 'x' ] = 'y'

    Read the article

  • [Embedded Python] Invoking a method on an object

    - by jmucchiello
    Given a PyObject* pointing to a python object, how do I invoke one of the object methods? The documentation never gives an example of this: PyObject* obj = .... PyObject* args = Py_BuildValue("(s)", "An arg"); PyObject* method = PyWHATGOESHERE(obj, "foo"); PyObject* ret = PyWHATGOESHERE(obj, method, args); if (!ret) { // check error... } This would be the equivalent of >>> ret = obj.foo("An arg")

    Read the article

  • function_exists php

    - by user527800
    Hi all I'm trying to write a function that could receive it's second arg a name of a function. In order to validate function's name (that will be used in an eval statement) I use function_exists such as: if(function_exists($type)){ $toEval= $type.'(\''.$file.'\');'; }else{ But if the arg sent is include or require (with 'once' variations) this code fails (function_exists returns false). How could this be fixed? Thanks, Alex

    Read the article

  • Quartz.Net Windows Service Configure Logging

    - by Tarun Arora
    In this blog post I’ll be covering, Logging for Quartz.Net Windows Service 01 – Why doesn’t Quartz.Net Windows Service log by default 02 – Configuring Quartz.Net windows service for logging to eventlog, file, console, etc 03 – Results: Logging in action If you are new to Quartz.Net I would recommend going through, A brief Introduction to Quartz.net Walkthrough of Installing & Testing Quartz.Net as a Windows Service Writing & Scheduling your First HelloWorld job with Quartz.Net   01 – Why doesn’t Quartz.Net Windows Service log by default If you are trying to figure out why… The Quartz.Net windows service isn’t logging The Quartz.Net windows service isn’t writing anything to the event log The Quartz.Net windows service isn’t writing anything to a file How do I configure Quartz.Net windows service to use log4Net How do I change the level of logging for Quartz.Net Look no further, This blog post should help you answer these questions. Quartz.NET uses the Common.Logging framework for all of its logging needs. If you navigate to the directory where Quartz.Net Windows Service is installed (I have the service installed in C:\Program Files (x86)\Quartz.net, you can find out the location by looking at the properties of the service) and open ‘Quartz.Server.exe.config’ you’ll see that the Quartz.Net is already set up for logging to ConsoleAppender and EventLogAppender, but only ‘ConsoleAppender’ is set up as active. So, unless you have the console associated to the Quartz.Net service you won’t be able to see any logging. <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <root> <level value="INFO" /> <appender-ref ref="ConsoleAppender" /> <!-- uncomment to enable event log appending --> <!-- <appender-ref ref="EventLogAppender" /> --> </root> </log4net> Problem: In the configuration above Quartz.Net Windows Service only has ConsoleAppender active. So, no logging will be done to EventLog. More over the RollingFileAppender isn’t setup at all. So, Quartz.Net will not log to an application trace log file. 02 – Configuring Quartz.Net windows service for logging to eventlog, file, console, etc Let’s change this behaviour by changing the config file… In the below config file, I have added the RollingFileAppender. This will configure Quartz.Net service to write to a log file. (<appender name="GeneralLog" type="log4net.Appender.RollingFileAppender">) I have specified the location for the log file (<arg key="configFile" value="Trace/application.log.txt"/>) I have enabled the EventLogAppender and RollingFileAppender to be written to by Quartz. Net windows service Changed the default level of logging from ‘Info’ to ‘All’. This means all activity performed by Quartz.Net Windows service will be logged. You might want to tune this back to ‘Debug’ or ‘Info’ later as logging ‘All’ will produce too much data to the logs. (<level value="ALL"/>) Since I have changed the logging level to ‘All’, I have added applicationSetting to remove logging log4Net internal debugging. (<add key="log4net.Internal.Debug" value="false"/>) <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net"> <arg key="configType" value="INLINE" /> <arg key="configFile" value="Trace/application.log.txt"/> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> <appSettings> <add key="log4net.Internal.Debug" value="false"/> </appSettings> <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <appender name="GeneralLog" type="log4net.Appender.RollingFileAppender"> <file value="Trace/application.log.txt"/> <appendToFile value="true"/> <maximumFileSize value="1024KB"/> <rollingStyle value="Size"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d{HH:mm:ss} [%t] %-5p %c - %m%n"/> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="ConsoleAppender" /> <appender-ref ref="EventLogAppender" /> <appender-ref ref="GeneralLog"/> </root> </log4net> </configuration>   Note – Please ensure you restart the Quartz.Net Windows service for the config changes to be picked up by the service   03 – Results: Logging in action Once you start the Quartz.Net Windows Service up, the logging should be initiated to write all activities in the Console, EventLog and File… See screen shots below… Figure – Quartz.Net Windows Service logging all activity to the event log Figure – Quartz.Net Windows Service logging all activity to the application log file Where is the output from log4Net ConsoleAppender? As a default behaviour, the console isn't available in windows services, web services, windows forms. The output will simply be dismissed. Unless you are running the process interactively. Which you can do by firing up Quartz.Server.exe –i to see the output   This was fourth in the series of posts on enterprise scheduling using Quartz.net, in the next post I’ll be covering troubleshooting why a scheduled task hasn’t fired on Quartz.net windows service. All Quartz.Net specific blog posts can listed here. Thank you for taking the time out and reading this blog post. If you enjoyed the post, remember to subscribe to http://feeds.feedburner.com/TarunArora. Stay tuned!

    Read the article

  • Nashorn, the rhino in the room

    - by costlow
    Nashorn is a new runtime within JDK 8 that allows developers to run code written in JavaScript and call back and forth with Java. One advantage to the Nashorn scripting engine is that is allows for quick prototyping of functionality or basic shell scripts that use Java libraries. The previous JavaScript runtime, named Rhino, was introduced in JDK 6 (released 2006, end of public updates Feb 2013). Keeping tradition amongst the global developer community, "Nashorn" is the German word for rhino. The Java platform and runtime is an intentional home to many languages beyond the Java language itself. OpenJDK’s Da Vinci Machine helps coordinate work amongst language developers and tool designers and has helped different languages by introducing the Invoke Dynamic instruction in Java 7 (2011), which resulted in two major benefits: speeding up execution of dynamic code, and providing the groundwork for Java 8’s lambda executions. Many of these improvements are discussed at the JVM Language Summit, where language and tool designers get together to discuss experiences and issues related to building these complex components. There are a number of benefits to running JavaScript applications on JDK 8’s Nashorn technology beyond writing scripts quickly: Interoperability with Java and JavaScript libraries. Scripts do not need to be compiled. Fast execution and multi-threading of JavaScript running in Java’s JRE. The ability to remotely debug applications using an IDE like NetBeans, Eclipse, or IntelliJ (instructions on the Nashorn blog). Automatic integration with Java monitoring tools, such as performance, health, and SIEM. In the remainder of this blog post, I will explain how to use Nashorn and the benefit from those features. Nashorn execution environment The Nashorn scripting engine is included in all versions of Java SE 8, both the JDK and the JRE. Unlike Java code, scripts written in nashorn are interpreted and do not need to be compiled before execution. Developers and users can access it in two ways: Users running JavaScript applications can call the binary directly:jre8/bin/jjs This mechanism can also be used in shell scripts by specifying a shebang like #!/usr/bin/jjs Developers can use the API and obtain a ScriptEngine through:ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); When using a ScriptEngine, please understand that they execute code. Avoid running untrusted scripts or passing in untrusted/unvalidated inputs. During compilation, consider isolating access to the ScriptEngine and using Type Annotations to only allow @Untainted String arguments. One noteworthy difference between JavaScript executed in or outside of a web browser is that certain objects will not be available. For example when run outside a browser, there is no access to a document object or DOM tree. Other than that, all syntax, semantics, and capabilities are present. Examples of Java and JavaScript The Nashorn script engine allows developers of all experience levels the ability to write and run code that takes advantage of both languages. The specific dialect is ECMAScript 5.1 as identified by the User Guide and its standards definition through ECMA international. In addition to the example below, Benjamin Winterberg has a very well written Java 8 Nashorn Tutorial that provides a large number of code samples in both languages. Basic Operations A basic Hello World application written to run on Nashorn would look like this: #!/usr/bin/jjs print("Hello World"); The first line is a standard script indication, so that Linux or Unix systems can run the script through Nashorn. On Windows where scripts are not as common, you would run the script like: jjs helloWorld.js. Receiving Arguments In order to receive program arguments your jjs invocation needs to use the -scripting flag and a double-dash to separate which arguments are for jjs and which are for the script itself:jjs -scripting print.js -- "This will print" #!/usr/bin/jjs var whatYouSaid = $ARG.length==0 ? "You did not say anything" : $ARG[0] print(whatYouSaid); Interoperability with Java libraries (including 3rd party dependencies) Another goal of Nashorn was to allow for quick scriptable prototypes, allowing access into Java types and any libraries. Resources operate in the context of the script (either in-line with the script or as separate threads) so if you open network sockets and your script terminates, those sockets will be released and available for your next run. Your code can access Java types the same as regular Java classes. The “import statements” are written somewhat differently to accommodate for language. There is a choice of two styles: For standard classes, just name the class: var ServerSocket = java.net.ServerSocket For arrays or other items, use Java.type: var ByteArray = Java.type("byte[]")You could technically do this for all. The same technique will allow your script to use Java types from any library or 3rd party component and quickly prototype items. Building a user interface One major difference between JavaScript inside and outside of a web browser is the availability of a DOM object for rendering views. When run outside of the browser, JavaScript has full control to construct the entire user interface with pre-fabricated UI controls, charts, or components. The example below is a variation from the Nashorn and JavaFX guide to show how items work together. Nashorn has a -fx flag to make the user interface components available. With the example script below, just specify: jjs -fx -scripting fx.js -- "My title" #!/usr/bin/jjs -fx var Button = javafx.scene.control.Button; var StackPane = javafx.scene.layout.StackPane; var Scene = javafx.scene.Scene; var clickCounter=0; $STAGE.title = $ARG.length>0 ? $ARG[0] : "You didn't provide a title"; var button = new Button(); button.text = "Say 'Hello World'"; button.onAction = myFunctionForButtonClicking; var root = new StackPane(); root.children.add(button); $STAGE.scene = new Scene(root, 300, 250); $STAGE.show(); function myFunctionForButtonClicking(){   var text = "Click Counter: " + clickCounter;   button.setText(text);   clickCounter++;   print(text); } For a more advanced post on using Nashorn to build a high-performing UI, see JavaFX with Nashorn Canvas example. Interoperable with frameworks like Node, Backbone, or Facebook React The major benefit of any language is the interoperability gained by people and systems that can read, write, and use it for interactions. Because Nashorn is built for the ECMAScript specification, developers familiar with JavaScript frameworks can write their code and then have system administrators deploy and monitor the applications the same as any other Java application. A number of projects are also running Node applications on Nashorn through Project Avatar and the supported modules. In addition to the previously mentioned Nashorn tutorial, Benjamin has also written a post about Using Backbone.js with Nashorn. To show the multi-language power of the Java Runtime, there is another interesting example that unites Facebook React and Clojure on JDK 8’s Nashorn. Summary Nashorn provides a simple and fast way of executing JavaScript applications and bridging between the best of each language. By making the full range of Java libraries to JavaScript applications, and the quick prototyping style of JavaScript to Java applications, developers are free to work as they see fit. Software Architects and System Administrators can take advantage of one runtime and leverage any work that they have done to tune, monitor, and certify their systems. Additional information is available within: The Nashorn Users’ Guide Java Magazine’s article "Next Generation JavaScript Engine for the JVM." The Nashorn team’s primary blog or a very helpful collection of Nashorn links.

    Read the article

  • QFileDialog filter from mime-types

    - by Mathias
    I want the filter in a QFileDialog to match all audio file types supported by Phonon on the platform in question. 1 - However I am not able to find a way in Qt to use mime types in a filter. How can I do that? 2 - Or how can I find the corresponding file extensions for the mimetypes manually? The solution should be Qt based, or at least be cross platform and supported everywhere Qt is. Following is a short code describing my problem: #include <QApplication> #include <QFileDialog> #include <QStringList> #include <phonon/backendcapabilities.h> QString mime_to_ext(QString mime) { // WHAT TO REALLY DO ?? // NEEDLESS TO SAY; THIS IS WRONG... return mime.split("/").back().split('-').back(); } int main(int argc, char **argv) { QApplication app(argc, argv); QStringList p_audio_exts; QStringList p_mime_types = Phonon::BackendCapabilities::availableMimeTypes(); for(QStringList::iterator i = p_mime_types.begin(), ie = p_mime_types.end(); i != ie; i++) { if((*i).startsWith("audio")) p_audio_exts << mime_to_ext(*i); } QString filter = QString("All Files(*)"); if(!p_audio_exts.isEmpty()) { QString p_audio_filter = QString("Audio Files (*.%1)").arg(p_audio_exts.join(" *.")); filter = QString("%1;;%2").arg(p_audio_filter).arg(filter); } QFileDialog dialog(NULL, "Open Audio File", QString::null, filter); dialog.exec(); }

    Read the article

  • Jelly script to reset the issue resolution in JIRA

    - by edlftt
    I am trying to run a jelly script in JIRA to set the resolution to null for all my issues. The following script runs without errors and returns this: <JiraJelly xmlns:jira='jelly:com.atlassian.jira.jelly.JiraTagLib' xmlns:log='jelly:log' xmlns:core='jelly:core' xmlns:jx='jelly:xml' xmlns:util='jelly:util'>org.ofbiz.core.entity.GenericValue.NULL_VALUEorg.ofbiz.core.entity.GenericValue.NULL_VALUEorg.ofbiz.core.entity.GenericValue.NULL_VALUE.... </JiraJelly> Here is the script. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:util="jelly:util" xmlns:core="jelly:core" xmlns:jx="jelly:xml" xmlns:log="jelly:log"> <jira:RunSearchRequest var="issues" /> <core:forEach var="genericIssue" items="${issues}"> <core:invokeStatic className="com.atlassian.jira.issue.IssueImpl" method="getIssueObject" var="issue"> <core:arg type="org.ofbiz.core.entity.GenericValue" value="${genericIssue}"/> </core:invokeStatic> <core:invoke on="${issue}" method="setResolution"> <core:arg type="org.ofbiz.core.entity.GenericValue">org.ofbiz.core.entity.GenericValue.NULL_VALUE</core:arg> </core:invoke> </core:forEach> </JiraJelly> Does any one have any idea why this isn't working or have any ideas on how I might set the resolution to nothing? Thank you!!

    Read the article

  • Amazon Elastic MapReduce: Exception from FileSystem

    - by S.N
    Hi, I run my application using ruby client: ruby elastic-mapreduce -j j-20PEKMT9BRSUC --jar s3n://sakae55/lib/edu.cit.som.jar --main-class edu.cit.som.hadoop.SOMDriver --arg s3n://sakae55/repository/input/ecoli/ --arg s3n://sakae55/repository/output/ecoli/pl/ --arg s3n://sakae55/repository/data/ecoli/som.txt Then, I am seeing the following error: java.lang.IllegalArgumentException: This file system object (file:///) does not support access to the request path 'hdfs://i -10-195-207-230.ec2.internal:9000/mnt/var/lib/hadoop/tmp/mapred/system/job_201004221221_0017/job.jar' You possibly called Fi eSystem.get(conf) when you should of called FileSystem.get(uri, conf) to obtain a file system supporting your path. at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:320) at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:52) at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:416) at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:259) at org.apache.hadoop.fs.FileSystem.isDirectory(FileSystem.java:676) at org.apache.hadoop.fs.FileUtil.copy(FileUtil.java:200) at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1184) at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1160) at org.apache.hadoop.fs.FileSystem.copyFromLocalFile(FileSystem.java:1132) at org.apache.hadoop.mapred.JobClient.configureCommandLineOptions(JobClient.java:662) at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:729) at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1026) at edu.cit.som.hadoop.SOMDriver.runIteration(SOMDriver.java:106) at edu.cit.som.hadoop.SOMDriver.train(SOMDriver.java:69) at edu.cit.som.hadoop.SOMDriver.run(SOMDriver.java:52) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79) at edu.cit.som.hadoop.SOMDriver.main(SOMDriver.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.hadoop.util.RunJar.main(RunJar.java:155) at org.apache.hadoop.mapred.JobShell.run(JobShell.java:54) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79) at org.apache.hadoop.mapred.JobShell.main(JobShell.java:68) I am not sure why the error references to "file:///" even though all the arguments I pass do not use the schema.

    Read the article

  • SUA + Visual Studio + pthreads

    - by vasek7
    Hi, I cannot compile this code under SUA: #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> void * thread_function(void *arg) { printf("thread_function started. Arg was %s\n", (char *)arg); // pause for 3 seconds sleep(3); // exit and return a message to another thread // that may be waiting for us to finish pthread_exit ("thread one all done"); } int main() { int res; pthread_t a_thread; void *thread_result; // create a thread that starts to run ‘thread_function’ pthread_create (&a_thread, NULL, thread_function, (void*)"thread one"); printf("Waiting for thread to finish...\n"); // now wait for new thread to finish // and get any returned message in ‘thread_result’ pthread_join(a_thread, &thread_result); printf("Thread joined, it returned %s\n", (char *)thread_result); exit(0); } I'm running on Windows 7 Ultimate x64 with Visual Studio 2008 and 2010 and I have installed: Windows Subsystem for UNIX Utilities and SDK for Subsystem for UNIX-based Applications in Microsoft Windows 7 and Windows Server 2008 R2 Include directories property of Visual Studio project is set to "C:\Windows\SUA\usr\include" What I have to configure in order to compile and run (and possibly debug) pthreads programs in Visual Studio 2010 (or 2008)?

    Read the article

  • Rhino Mocks - Fluent Mocking - Expect.Call question

    - by Ben Cawley
    Hi, I'm trying to use the fluent mocking style of Rhino.Mocks and have the following code that works on a mock IDictionary object called 'factories': With.Mocks(_Repository).Expecting(() => { Expect.Call(() => factories.ContainsKey(Arg<String>.Is.Anything)); LastCall.Return(false); Expect.Call(() => factories.Add(Arg<String>.Is.Anything, Arg<Object>.Is.Anything)); }).Verify(() => { _Service = new ObjectRequestService(factories); _Service.RegisterObjectFactory(Valid_Factory_Key, factory); }); Now, the only way I have been able to set the return value of the ContainsKey call is to use LastCall.Return(true) on the following line. I'm sure I'm mixing styles here as Expect.Call() has a .Return(Expect.Action) method but I can't figure out how I am suppose to use it correctly to return a boolean value? Can anyone help out? Hope the question is clear enough - let me know if anyone needs more info! Cheers, Ben

    Read the article

  • mod_python req.subprocess_env not "seeing" PythonOptions

    - by Brandon
    I'm having trouble getting an environmental variable out of apache config. (don't ask why it's being done this way, I didn't originally code it) This is what I have in the apache config. <Location "/var/www"> SetHandler python-program PythonHandler mod_python.publisher PythonOption MYSQL_PWD ########### PythonDebug On </Location> This is the problem code... #this is the problem code in question. def index(req): req.add_common_vars() os.environ["MYSQL_PWD"] = req.subprocess_env["MYSQL_PWD"] req.content_type = "text/html" statText = getStatText() here is the traceback I'm getting from executing this. Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg) File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", line 213, in handler published = publish_object(req, object) File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", line 425, in publish_object return publish_object(req,util.apply_fs_data(object, req.form, req=req)) File "/usr/lib/python2.5/site-packages/mod_python/util.py", line 554, in apply_fs_data return object(**args) File "/var/www/admin/Stat.py", line 299, in index os.environ["MYSQL_PWD"] = req.subprocess_env["MYSQL_PWD"] KeyError: 'MYSQL_PWD'

    Read the article

  • Update C# Chart using BackgroundWorker

    - by Mark
    I am currently trying to update a chart which is on my form to the background worker using: bwCharter.RunWorkerAsync(chart1); Which runs: private void bcCharter_DoWork(object sender, DoWorkEventArgs e) { System.Windows.Forms.DataVisualization.Charting.Chart chart = null; // Convert e.Argument to chart //.. // Converted.. chart.Series.Clear(); e.Result=chart; setChart(c.chart); } private void setChart(System.Windows.Forms.DataVisualization.Charting.Chart arg) { if (chart1.InvokeRequired) { chart1.Invoke(new MethodInvoker(delegate { setChart(arg); })); return; } chart1 = arg; } However, at the point of clearing the series, an exception is thrown. Basically, I want to do a whole lot more processing after clearing the series, which slows the GUI down completely - so wanted this in another thread. I thought that by passing it as an argument, I should be safe, but apparently not! Interestingly, the chart is on a tab page. I can run this over and over if the tabpage is in the background, but if I run this, look at the chart, hide it again, and re-run, it throws the exception. Obviously, it throws if the chart is in the foreground as well. Can anyone suggest what I can do differently? Thanks!

    Read the article

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