Search Results

Search found 3773 results on 151 pages for 'args'.

Page 51/151 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • Why sockets does not die when server dies? Why socket dies when server is alive?

    - by Roman
    I try to play with sockets a bit. For that I wrote very simple "client" and "server" applications. Client: import java.net.*; public class client { public static void main(String[] args) throws Exception { InetAddress localhost = InetAddress.getLocalHost(); System.out.println("before"); Socket clientSideSocket = null; try { clientSideSocket = new Socket(localhost,12345,localhost,54321); } catch (ConnectException e) { System.out.println("Connection Refused"); } System.out.println("after"); if (clientSideSocket != null) { clientSideSocket.close(); } } } Server: import java.net.*; public class server { public static void main(String[] args) throws Exception { ServerSocket listener = new ServerSocket(12345); while (true) { Socket serverSideSocket = listener.accept(); System.out.println("A client-request is accepted."); } } } And I found a behavior that I cannot explain: I start a server, than I start a client. Connection is successfully established (client stops running and server is running). Then I close the server and start it again in a second. After that I start a client and it writes "Connection Refused". It seems to me that the server "remember" the old connection and does not want to open the second connection twice. But I do not understand how it is possible. Because I killed the previous server and started a new one! I do not start the server immediately after the previous one was killed (I wait like 20 seconds). In this case the server "forget" the socket from the previous server and accepts the request from the client. I start the server and then I start the client. Connection is established (server writes: "A client-request is accepted"). Then I wait a minute and start the client again. And server (which was running the whole time) accept the request again! Why? The server should not accept the request from the same client-IP and client-port but it does!

    Read the article

  • How can I specify a relative path in a Python logging config file?

    - by ClaudioA
    I've the following file to config logging: [loggers] keys=root [handlers] keys = root [formatters] keys = generic # Loggers [logger_root] level = DEBUG handlers = root # Handlers [handler_root] class = handlers.RotatingFileHandler args = ("test.log", "maxBytes=1*1024*1024", "backupCount=10") level = NOTSET formatter = generic # Formatters [formatter_generic] format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s datefmt = %Y-%m-%d %H:%M:%S In Development this works great, but when I deploy the application test.log is trying to be written in a path in which I don't have the necessary permission. So my question is, How can I do to specify a relative path in this configuration file.

    Read the article

  • Java NullPointerException. Why?

    - by user292844
    I am new to Java. I just read that class variables in Java have default value. I tried the following program. I was expecting to get the output as 0, which is the default value on an integer, but I get the NullPointerException. What am I missing? class Test{ static Integer iVar; public static void main(String...args) { System.out.println(iVar.intValue()); } }

    Read the article

  • ASP.NET Master Page + pageLoad() = kills jquery?

    - by Clay Angelly
    In my MasterPage, I have a ScriptManager that has a ScriptReference to my jquery.js file. This has always worked with no problems, all content pages that utilize jquery work fine. Recently, I added the following javascript script block at the end of my MasterPage: function pageLoad(sender, args) { } By simply adding the above pageLoad method, no jquery code is executed from any of my content pages. Why would just having a pageLoad in the Master Page have this effect? Thanks in advance for any insight.

    Read the article

  • can not run java program from command line which resides in package

    - by kshitij
    See following code with resides in fillowing directory mypack.pack1 package mypack.pack1; public class myclass { public static void main(String args[]) { System.out.println("KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"); } } See following screen shot. that is giving error. And i dont want to add anything in class path because i am in particular directory and it has to work. why it is not working.??????

    Read the article

  • C# Keyboard Input (Beginner Help)

    - by ThickBook
    I am trying to ask user "enter any key and when that key is pressed it shows that "You Pressed "Key". Can you help what's wrong in this code? This is what I have written using System; class Program { public static void Main(string[] args) { Console.Write("Enter any Key: "); char name = Console.Read(); Console.WriteLine("You pressed {0}", name); } }

    Read the article

  • Help with float numbers in Java

    - by Alvin
    Hi, Could anyone please me why the output of the following programme is not " different different"? public static void main(String[] args) { float f1=3.2f; float f2=6.5f; if(f1==3.2) System.out.println("same"); else System.out.println("different"); if(f2==6.5) System.out.println("same"); else System.out.println("different"); } o/p :different same

    Read the article

  • java.lang.UnsatisfiedLinkError

    - by Prashant
    HI ALL, I got an error java.lang.UnsatisfiedLinkError, I am not getting wat the problem is. public static void main(String[] args) { try { System.loadLibrary("pfcasyncmt"); }catch(){ } } ERROR- xception in thread "main" java.lang.UnsatisfiedLinkError: no pfcasyncmt in java.library.path

    Read the article

  • Any way to specify a non-positional parameter in a powershell script?

    - by Julian Birch
    I've got the following at the start of a script Param( [string]$command, [string]$version = "1.1.0" ) This is fine, only I need for $version to not be a positional parameter, so that if you type .\script.ps1 run argument Then $args should contain argument and $version should be 1.1.0. Is this even possible? I know I can do it with a c# cmdlet, but it would be massively more convenient if I could deliver this as a single script.

    Read the article

  • Weird behaviour of Calendar and DateFormat

    - by Nejc
    I encountered really strange behaviour when constructing a Calendar object and then formating it in a particular style. Let the code do the talking: public class Test { public static void main(String[] args) { SimpleDateFormat frmt = new SimpleDateFormat(); frmt.applyPattern("yyyy-MM-dd"); GregorianCalendar date = new GregorianCalendar(2012,1,1); System.out.println(frmt.format(date.getTime())); } } The output is: 2012-02-01 The expected output is of course: 2012-01-01 What am I doing wrong?

    Read the article

  • Why does my simple hello world console app use so much memory?

    - by CodingThunder
    Looking in Process Explorer it uses; Virtual Size: 550,000k , Working Set: 28000k Why does my simple hello world console app use so much memory? I take it the difference between the Working Set and Virtual Size means that difference will be paged to disk? /I am running 64 bit XP. Thanks class Program { static void Main(string[] args) { Console.WriteLine("Hello world"); Console.ReadLine(); } }

    Read the article

  • how to return 2 values from a java function?

    - by javaLearner.java
    Here is my code: // Function code public static int something(){ int number1 = 1; int number2 = 2; return number1, number2; } // Main class code public static void main(String[] args) { something(); System.out.println(number1 + number2); } Error: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - missing return statement at assignment.Main.something(Main.java:86) at assignment.Main.main(Main.java:53) Java Result: 1

    Read the article

  • Grails | Deployment | Include .dll in war

    - by WaZ
    I have a sqljdbc_auth.dll file which I want to include in my war in order to enable Windows Authentication. I tried the following code: grails.war.copyToWebApp = { args -> fileset(dir:"web-app") { include(name: "jdbc/**") } } Where jdbc is the folder which contains my sqljdbc_auth.dll file. However, it doesn't work. The war doesn't include the dll. Please let me know if I am missing anything here. Thanks.

    Read the article

  • Copy operation fails when running executable using shortcut.

    - by MiloDC
    I've coded a C# executable that uses xcopy (cmd.exe /Q /D /C xcopy [args]) to duplicate some files. If I run the .exe by double-clicking it, the xcopy operation works every time. If I run the .exe by double-clicking a shortcut to the .exe, the xcopy works only if the shortcut is in the same folder as the .exe. This makes absolutely no sense to me, I wouldn't even know where to begin to find the answer. So, you know, help.

    Read the article

  • vb.net how to start a folder monitor service at runtime and pass on the folder path to monitor?

    - by mazrabul
    hi, I have the following windows service file: Imports System.ServiceProcess Imports System.IO Public Class fswService Dim fsw As FileSystemWatcher Dim lf As StreamWriter Protected Overrides Sub OnStart(ByVal args As String()) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. lf = New StreamWriter(Application.StartupPath & "\fsw_lg.log") fsw = New FileSystemWatcher() fsw.Path = args(0) fsw.IncludeSubdirectories = True fsw.Filter = ".txt" fsw.EnableRaisingEvents = True AddHandler fsw.Created, New FileSystemEventHandler(AddressOf file_created) AddHandler fsw.Changed, New FileSystemEventHandler(AddressOf file_changed) AddHandler fsw.Deleted, New FileSystemEventHandler(AddressOf file_deleted) End Sub Public Sub file_created(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-created") End Sub Public Sub file_changed(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-changed") End Sub Public Sub file_deleted(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-deleted") End Sub Protected Overrides Sub OnStop() lf.Close() End Sub End Class i have the ServiceName set to fswService (same as class name). When I added an installer I also set the ServiceName for the ServiceInstaller1 as fswService. I want to start this service at runtime based on the user setting the path of the folder to be watched. To achieve this I have the following: Dim fsw_controller As New ServiceProcess.ServiceController fsw_controller.Start(fswService) 2 problems: first, intellisense error saying: 'fswService' is a type and cannot be used as an expression. second, I can not figure out a way to pass on to the service the path of the folder to watch (which is stored at My.Settings.userPath). I really thought this is how you start a service. Am I missing something? Your help is, as always, appreciated. Thanks

    Read the article

  • Converting Mod-rewrite rules which use %(QUERY_STRING) to NGINX rewrite format?

    - by HipHop-opatamus
    I've been stuck the last few days trying to convert the following Apache/Mod_Rewrite rewrite rule to NGINX format. Anyone know where I am going wrong? MOD_REWRITE: RewriteCond %{QUERY_STRING} topic=([0-9]+) RewriteRule /forum/index\.php /forum/vbseo301.php?action=thread&oldid=%1 [L] NGINX: location /forum/index.php { if ($args ~ "topic=([0-9]+)"){ rewrite ^/forum/index\.php?topic=(.+)$ /forum/vbseo301.php?action=thread&oldid=$1 last; } }

    Read the article

  • what would be the output?

    - by Abhishek Jain
    Please explain me below situation What would be the output? interface A{} class B implements A{} class C extends B{} Class D extends C{} class E extends D{ public static void main(String args[]){ C c = new C(); B b = c; A a = (E)c; A a = (B)c; C c = (C)(B)c; } }

    Read the article

  • How to use jaxb_commons plugins from maven

    - by user243155
    I'm trying to use a jaxb plugin to insert a interface into a choice element generating the classes from maven. The problem is that I can't seem to figure out how to do so from maven, the repository isn't clear from the documentation and the only example (bellow) doesn't work, it seems to ignore the plugin (maven reports no error about not finding it) or the plugin doesn't have all the adds-ons currently listed in the project documentation: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.6.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <generatePackage>br.com.wonder.nfe.xml</generatePackage> <args> <arg>-Xifins</arg> </args> <plugins> <plugin> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>basic</artifactId> <version>0.4.1.5</version> </plugin> </plugins> </configuration> </plugin> I have these in the root pom: <pluginRepositories> <pluginRepository> <id>maven2-repository.dev.java.net</id> <url>http://download.java.net/maven/2</url> </pluginRepository> <pluginRepository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 Repository (legacy)</name> <url>http://download.java.net/maven/1</url> <layout>legacy</layout> </pluginRepository> </pluginRepositories> Running that gives: Error while setting CmdLine options '[-Xifins, -episode, /home/administrador/JavaApp/wnfe3/wnfe-ejb/target/generated-sources/xjc/META-INF/sun-jaxb.episode]'! Embedded error: unrecognized parameter -Xifins

    Read the article

  • how to pass arguments to windows services in c#?

    - by eurekha_ananth
    I just want to know how to pass arguments to windows services . The problem is , i am developed a windows application and then called it from Onstart() method . Now , i want to call the particular function from another project . protected override void OnStart(string[] args) { Process.Start("C:\\Program Files\\macro.exe"); } I want to call a function inside the macro.exe project with arguments . Any suggestions

    Read the article

  • javascript accordian menu problem in worpress

    - by Praveen kalal
    hi all i am working on wordpress project there is i used accordion for right sidebar but all the link are over lapping each other in IE8 its working fine mozzila so plz help my code is var parentAccordion=new TINY.accordion.slider("parentAccordion"); parentAccordion.init("acc","h4",1,-1); var nestedAccordion=new TINY.accordion.slider("nestedAccordion"); nestedAccordion.init("nested","h4",1,-1,"acc-selected"); $args = array('parent'=>0,'hide_empty'=>0); $cats = get_categories($args); echo '<ul id="acc" class="acc">'; foreach($cats as $key => $val) { $args1=array( 'showposts' => 10, 'category__in' => array($val->term_id), 'caller_get_posts'=>1 ); $post=get_posts($args1); echo '<li><h4>'.$val->name.'</h4>'; echo '<div class="" style="opacity: 0; height: auto;">'; echo '<ul id="nested" class="acc">'; if(isset($post) && !empty($post)) { foreach($post as $key1 => $val1) { echo '<li class="cat-item"><a title='.$val1->post_title.' href='.$val1->guid.'>'.$val1->post_title.'</a>'; } } $subcats = get_categories(array('parent'=>$val->term_id,'hide_empty'=>0)); if(isset($subcats) && !empty($subcats)) { foreach($subcats as $k => $v) { echo '<li><h4 class="">'.$v->name.'</h4>'; $args2=array( 'showposts' => 10, 'category__in' => array($v->term_id), 'caller_get_posts'=>1 ); $post1=get_posts($args2); if(isset($post1) && !empty($post1)) { echo '<div class="" style="opacity: 1; height: auto;">'; echo '<ul class="children" style="padding-left:15px;">'; foreach($post1 as $key2 => $val2) { echo '<li><a title='.$val2->post_title.' href='.$val2->guid.'>'.$val2->post_title.'</a></li>'; } echo '</ul></div>'; } } } echo "</ul>"; echo "</li>"; } echo '</ul>'; ?> </div> so plz help me

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >