Exemplo n.º 1
0
 public static void dumpHeader(PrintStream @out)
 {
     @out.println("<html><head>");
     @out.println("    <title> Sphinx-4 Configuration</title");
     @out.println("</head>");
     @out.println("<body>");
 }
Exemplo n.º 2
0
 private static void outputLicenseHeader(PrintStream ps)
 {
     String[] lines =
     {
         "Licensed to the Apache Software Foundation (ASF) under one or more",
         "contributor license agreements.  See the NOTICE file distributed with",
         "this work for Additional information regarding copyright ownership.",
         "The ASF licenses this file to You under the Apache License, Version 2.0",
         "(the \"License\"); you may not use this file except in compliance with",
         "the License.  You may obtain a copy of the License at",
         "",
         "    http://www.apache.org/licenses/LICENSE-2.0",
         "",
         "Unless required by applicable law or agreed to in writing, software",
         "distributed under the License is distributed on an \"AS IS\" BASIS,",
         "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
         "See the License for the specific language governing permissions and",
         "limitations under the License.",
     };
     for (int i = 0; i < lines.Length; i++)
     {
         ps.print("# ");
         ps.println(lines[i]);
     }
     ps.println();
 }
Exemplo n.º 3
0
        public virtual Optional <JmxDump> getJMXDump(long pid)
        {
            try
            {
                LocalVirtualMachine vm = LocalVirtualMachine.From(pid);
                @out.println("Attached to running process with process id " + pid);
                try
                {
                    JmxDump jmxDump = JmxDump.ConnectTo(vm.JmxAddress);
                    jmxDump.AttachSystemProperties(vm.SystemProperties);
                    @out.println("Connected to JMX endpoint");
                    return(jmxDump);
                }
                catch (IOException e)
                {
                    PrintError("Unable to communicate with JMX endpoint. Reason: " + e.Message, e);
                }
            }
            catch (java.lang.NoClassDefFoundError e)
            {
                PrintError("Unable to attach to process. Reason: JDK is not available, please point " + "environment variable JAVA_HOME to a valid JDK location.", e);
            }
            catch (IOException e)
            {
                PrintError("Unable to connect to process with process id " + pid + ". Reason: " + e.Message, e);
            }

            return(null);
        }
Exemplo n.º 4
0
    public virtual void printStack()
    {
        while (stack.Count > 0)
        {
            var x = stack.Pop();

            if (x is Algebraic)
            {
                var vname = "ans";

                env.putValue(vname, x);

                if ((( Algebraic )x).Name != null)
                {
                    vname = (( Algebraic )x).Name;
                }

                if (ps != null)
                {
                    var s = vname + " = ";

                    ps.print(s);

                    (( Algebraic )x).Print(ps);

                    ps.println("");
                }
            }
            else if (x is string)
            {
                ps.println(( string )x);
            }
        }
    }
Exemplo n.º 5
0
        public static void dumpComponentAsGDL(ConfigurationManager cm, PrintStream @out, string name)
        {
            @out.println(new StringBuilder().append("node: {title: \"").append(name).append("\" color: ").append(GDLDumper.getColor(cm, name)).append('}').toString());
            PropertySheet propertySheet        = cm.getPropertySheet(name);
            Collection    registeredProperties = propertySheet.getRegisteredProperties();
            Iterator      iterator             = registeredProperties.iterator();

            while (iterator.hasNext())
            {
                string       text = (string)iterator.next();
                PropertyType type = propertySheet.getType(text);
                object       raw  = propertySheet.getRaw(text);
                if (raw != null)
                {
                    if (type == PropertyType.__COMPONENT)
                    {
                        @out.println(new StringBuilder().append("edge: {source: \"").append(name).append("\" target: \"").append(raw).append("\"}").toString());
                    }
                    else if (type == PropertyType.__COMPONENT_LIST)
                    {
                        List     list      = (List)raw;
                        Iterator iterator2 = list.iterator();
                        while (iterator2.hasNext())
                        {
                            object obj = iterator2.next();
                            @out.println(new StringBuilder().append("edge: {source: \"").append(name).append("\" target: \"").append(obj).append("\"}").toString());
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
 protected internal void Print(PrintStream @out, Exception exception, string linePrefix)
 {
     if (exception != null)
     {
         @out.println(", exception:");
         MemoryStream buf  = new MemoryStream();
         PrintStream  sbuf = new PrintStream(buf);
         exception.printStackTrace(sbuf);
         sbuf.flush();
         StreamReader reader = new StreamReader(new StringReader(buf.ToString()));
         try
         {
             string line = reader.ReadLine();
             while (!string.ReferenceEquals(line, null))
             {
                 @out.print(linePrefix);
                 @out.print('\t');
                 @out.println(line);
                 line = reader.ReadLine();
             }
             @out.print(linePrefix);
         }
         catch (IOException e)
         {
             throw new Exception(e);
         }
     }
 }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("ResultOfMethodCallIgnored") @Test public void begin_and_execute_periodic_commit_that_fails() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BeginAndExecutePeriodicCommitThatFails()
        {
            File file = File.createTempFile("begin_and_execute_periodic_commit_that_fails", ".csv").AbsoluteFile;

            try
            {
                PrintStream @out = new PrintStream(new FileStream(file, FileMode.Create, FileAccess.Write));
                @out.println("1");
                @out.println("2");
                @out.println("0");
                @out.println("3");
                @out.close();

                string url   = file.toURI().toURL().ToString().Replace("\\", "\\\\");
                string query = "USING PERIODIC COMMIT 1 LOAD CSV FROM \\\"" + url + "\\\" AS line CREATE ({name: 1/toInt(line[0])});";

                // begin and execute and commit
                HTTP.RawPayload payload  = quotedJson("{ 'statements': [ { 'statement': '" + query + "' } ] }");
                HTTP.Response   response = POST(TxCommitUri(), payload);

                assertThat(response.Status(), equalTo(200));
                assertThat(response, hasErrors(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.ArithmeticError));

                JsonNode message = response.Get("errors").get(0).get("message");
                assertTrue("Expected LOAD CSV line number information", message.ToString().Contains("on line 3. Possibly the last row committed during import is line 2. " + "Note that this information might not be accurate."));
            }
            finally
            {
                file.delete();
            }
        }
Exemplo n.º 8
0
            public override void Run(StoreAccess store, PrintStream @out)
            {
                RecordStore <NodeRecord> nodeStore = store.NodeStore;
                NodeRecord node = nodeStore.GetRecord(Id, nodeStore.NewRecord(), NORMAL);

                if (node.Dense)
                {
                    RecordStore <RelationshipGroupRecord> relationshipGroupStore = store.RelationshipGroupStore;
                    RelationshipGroupRecord group = relationshipGroupStore.NewRecord();
                    relationshipGroupStore.GetRecord(node.NextRel, group, NORMAL);
                    do
                    {
                        @out.println("group " + group);
                        @out.println("out:");
                        PrintRelChain(store, @out, group.FirstOut);
                        @out.println("in:");
                        PrintRelChain(store, @out, group.FirstIn);
                        @out.println("loop:");
                        PrintRelChain(store, @out, group.FirstLoop);
                        group = group.Next != -1 ? relationshipGroupStore.GetRecord(group.Next, group, NORMAL) : null;
                    } while (group != null);
                }
                else
                {
                    PrintRelChain(store, @out, node.NextRel);
                }
            }
Exemplo n.º 9
0
 internal static void show(int level, BufferN b)
 {
     for (int i = 0; i < level; i++)
     {
         outt.print("  ");
     }
     outt.println(toString(b) + " " + Integer.toHexString(b.GetHashCode()));
 }
Exemplo n.º 10
0
 public override void TreeState(Pair <TreeState, TreeState> statePair)
 {
     if (_printState)
     {
         @out.println("StateA: " + statePair.Left);
         @out.println("StateB: " + statePair.Right);
     }
 }
Exemplo n.º 11
0
        private void PrintThroughputReports(PrintStream @out)
        {
            @out.println("Throughput reports (tx/s):");

            foreach (KeyValuePair <string, double> entry in _reports.SetOfKeyValuePairs())
            {
                @out.println("\t" + entry.Key + "  " + entry.Value);
            }

            @out.println();
        }
Exemplo n.º 12
0
        public virtual void printStats(PrintStream @out)
        {
            @out.println("Number of keys = " + Convert.ToString(length));
            @out.println("Node count = " + Convert.ToString(freenode));
            // System.out.println("Array length = " + Integer.toString(eq.length));
            @out.println("Key Array length = " + Convert.ToString(kv.length()));

            /*
             * for(int i=0; i<kv.length(); i++) if ( kv.get(i) != 0 )
             * System.out.print(kv.get(i)); else System.out.println("");
             * System.out.println("Keys:"); for(Enumeration enum = keys();
             * enum.hasMoreElements(); ) System.out.println(enum.nextElement());
             */
        }
Exemplo n.º 13
0
            internal virtual void AssertClosed()
            {
                if (!C.Closed)
                {
                    MemoryStream @out        = new MemoryStream();
                    PrintStream  printStream = new PrintStream(@out);

                    foreach (StackTraceElement traceElement in StackTrace)
                    {
                        printStream.println("\tat " + traceElement);
                    }
                    printStream.println();
                    throw new System.InvalidOperationException(format("Closeable %s was not closed!\n%s", C, @out.ToString()));
                }
            }
 public virtual void setInputStream(InputStream @is, bool bigEndian)
 {
     this.bigEndian = bigEndian;
     if (this.binary)
     {
         this.binaryStream = new DataInputStream(new BufferedInputStream(@is));
         if (bigEndian)
         {
             this.numPoints = this.binaryStream.readInt();
             [email protected]("BigEndian");
         }
         else
         {
             this.numPoints = Utilities.readLittleEndianInt(this.binaryStream);
             [email protected]("LittleEndian");
         }
         PrintStream   @out          = java.lang.System.@out;
         StringBuilder stringBuilder = new StringBuilder().append("Frames: ");
         int           num           = this.numPoints;
         int           num2          = this.cepstrumLength;
         @out.println(stringBuilder.append((num2 != -1) ? (num / num2) : (-num)).toString());
     }
     else
     {
         this.est       = new ExtendedStreamTokenizer(@is, false);
         this.numPoints = this.est.getInt("num_frames");
         this.est.expectString("frames");
     }
     this.curPoint          = -1;
     this.firstSampleNumber = 0L;
 }
Exemplo n.º 15
0
 public override void Run(StoreAccess store, PrintStream @out)
 {
     foreach (NamedToken token in (( RelationshipTypeTokenStore )store.RelationshipTypeTokenStore).Tokens)
     {
         @out.println(token);
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Implements print. </summary>
        private static int print(Lua L)
        {
            int    n        = L.Top;
            object tostring = L.getGlobal("tostring");

            for (int i = 1; i <= n; ++i)
            {
                L.push(tostring);
                L.pushValue(i);
                L.call(1, 1);
                string s = L.toString(L.value(-1));
                if (s == null)
                {
                    return(L.error("'tostring' must return a string to 'print'"));
                }
                if (i > 1)
                {
                    OUT.print('\t');
                }
                OUT.print(s);
                L.pop(1);
            }
            OUT.println();
            return(0);
        }
Exemplo n.º 17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void run(org.neo4j.helpers.Args args, java.io.PrintStream out) throws Exception
		 protected internal override void Run( Args args, PrintStream @out )
		 {
			  DependencyResolver dependencyResolver = _to.get().DependencyResolver;
			  TransactionIdStore txIdStore = dependencyResolver.ResolveDependency( typeof( TransactionIdStore ) );
			  Config config = dependencyResolver.ResolveDependency( typeof( Config ) );
			  long fromTx = txIdStore.LastCommittedTransaction.transactionId();
			  long toTx;
			  if ( args.Orphans().Count == 0 )
			  {
					throw new System.ArgumentException( "No tx specified" );
			  }

			  string whereTo = args.Orphans()[0];
			  if ( whereTo.Equals( "next" ) )
			  {
					toTx = fromTx + 1;
			  }
			  else if ( whereTo.Equals( "last" ) )
			  {
					toTx = long.MaxValue;
			  }
			  else
			  {
					toTx = long.Parse( whereTo );
			  }

			  long lastApplied = ApplyTransactions( _from, _to.get(), config, fromTx, toTx, @out );
			  @out.println( "Applied transactions up to and including " + lastApplied );
		 }
Exemplo n.º 18
0
 public override void Run(StoreAccess store, PrintStream @out)
 {
     foreach (NamedToken token in (( PropertyKeyTokenStore )store.PropertyKeyTokenStore).Tokens)
     {
         @out.println(token);
     }
 }
Exemplo n.º 19
0
 public override void Println(string line)
 {
     for (int i = 0; i < _indentation; i++)
     {
         @out.print("    ");
     }
     @out.println(line);
 }
Exemplo n.º 20
0
 private void PrintError(string message, Exception e)
 {
     _err.println(message);
     if (_verbose && e != null)
     {
         e.printStackTrace(_err);
     }
 }
Exemplo n.º 21
0
 public IEnumerable <Relationship> expand(Path path, BranchState state)
 {
     if (_pred(path, state))
     {
         @out.println(Paths.pathToString(path, _descriptor));
     }
     return(_source.expand(path, state));
 }
Exemplo n.º 22
0
            internal static string BuildMessage(Deque <StackTraceElement[]> openCloseTraces)
            {
                if (openCloseTraces.Empty)
                {
                    return(StringUtils.EMPTY);
                }
                int    separatorLength = 80;
                string paddingString   = "=";

                MemoryStream @out        = new MemoryStream();
                PrintStream  printStream = new PrintStream(@out);

                printStream.println();
                printStream.println("Last " + STATEMENT_TRACK_HISTORY_MAX_SIZE + " statements open/close stack traces are:");
                int element = 0;

                foreach (StackTraceElement[] traceElements in openCloseTraces)
                {
                    printStream.println(StringUtils.center("*StackTrace " + element + "*", separatorLength, paddingString));
                    foreach (StackTraceElement traceElement in traceElements)
                    {
                        printStream.println("\tat " + traceElement);
                    }
                    printStream.println(StringUtils.center("", separatorLength, paddingString));
                    printStream.println();
                    element++;
                }
                printStream.println("All statement open/close stack traces printed.");
                return(@out.ToString());
            }
Exemplo n.º 23
0
 public override void PrintProfile(PrintStream @out, string profileTitle)
 {
     @out.println("### " + profileTitle);
     if (_underSampling.get() > 0)
     {
         long allSamplesTotal = _samples.reduceToLong(long.MaxValue, (thread, sample) => sample.get(), 0, (a, b) => a + b);
         @out.println("Info: Did not achieve target sampling frequency. " + _underSampling + " of " + allSamplesTotal + " samples were delayed.");
     }
     foreach (KeyValuePair <Thread, Sample> entry in _samples.SetOfKeyValuePairs())
     {
         Thread thread     = entry.Key;
         Sample rootSample = entry.Value;
         rootSample.IntoOrdered();
         @out.println("Profile (" + rootSample.get() + " samples) " + thread.Name);
         double total = rootSample.get();
         PrintSampleTree(@out, total, rootSample.OrderedChildren, 2);
     }
 }
        private void createInputFile(File file, string text, string text2)
        {
            File             file2            = new File(file, text);
            FileOutputStream fileOutputStream = new FileOutputStream(file2);
            PrintStream      printStream      = new PrintStream(fileOutputStream);

            printStream.println(text2);
            printStream.close();
        }
Exemplo n.º 25
0
 private void Serialize(PrintStream @out, Header header)
 {
     _deserialization.clear();
     foreach (Header.Entry entry in header.Entries())
     {
         _deserialization.handle(entry, entry.ToString());
     }
     @out.println(_deserialization.materialize());
 }
Exemplo n.º 26
0
 protected internal override void startDumpNode(PrintStream @out, SearchState state, int level)
 {
     if (!this.skipHMMs || !(state is HMMSearchState))
     {
         string color = this.getColor(state);
         string text  = "box";
         @out.println(new StringBuilder().append("    node: {title: ").append(this.qs(this.getUniqueName(state))).append(" label: ").append(this.qs(state.toPrettyString())).append(" color: ").append(color).append(" shape: ").append(text).append(" vertical_order: ").append(level).append('}').toString());
     }
 }
Exemplo n.º 27
0
        internal static void dumpNodeInfo()
        {
            PrintStream   @out          = java.lang.System.@out;
            StringBuilder stringBuilder = new StringBuilder().append("Nodes: ").append(Node.nodeCount).append(" successors ").append(Node.successorCount).append(" avg ");
            int           num           = Node.successorCount;
            int           num2          = Node.nodeCount;

            @out.println(stringBuilder.append((num2 != -1) ? (num / num2) : (-num)).toString());
        }
Exemplo n.º 28
0
 public virtual void Print(PrintStream @out)
 {
     foreach (LogCall call in _logCalls)
     {
         @out.println(call.ToLogLikeString());
         if (call.Throwable != null)
         {
             call.Throwable.printStackTrace(@out);
         }
     }
 }
Exemplo n.º 29
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void dump() throws java.io.IOException
        internal virtual void Dump()
        {
            SimpleStorage <MemberId> memberIdStorage = new SimpleFileStorage <MemberId>(_fs, _clusterStateDirectory, CORE_MEMBER_ID_NAME, new MemberId.Marshal(), NullLogProvider.Instance);

            if (memberIdStorage.Exists())
            {
                MemberId memberId = memberIdStorage.ReadState();
                @out.println(CORE_MEMBER_ID_NAME + ": " + memberId);
            }

            DumpState(LAST_FLUSHED_NAME, new LongIndexMarshal());
            DumpState(LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new MemberId.Marshal()));
            DumpState(ID_ALLOCATION_NAME, new IdAllocationState.Marshal());
            DumpState(SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new MemberId.Marshal()));

            /* raft state */
            DumpState(RAFT_MEMBERSHIP_NAME, new RaftMembershipState.Marshal());
            DumpState(RAFT_TERM_NAME, new TermState.Marshal());
            DumpState(RAFT_VOTE_NAME, new VoteState.Marshal(new MemberId.Marshal()));
        }
Exemplo n.º 30
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int dump(String filenameOrDirectory, java.io.PrintStream out) throws java.io.IOException, DamagedLogStorageException, DisposedException
        private int Dump(string filenameOrDirectory, PrintStream @out)
        {
            LogProvider logProvider = NullLogProvider.Instance;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int[] logsFound = {0};
            int[]            logsFound        = new int[] { 0 };
            FileNames        fileNames        = new FileNames(new File(filenameOrDirectory));
            ReaderPool       readerPool       = new ReaderPool(0, logProvider, fileNames, _fileSystem, Clocks.systemClock());
            RecoveryProtocol recoveryProtocol = new RecoveryProtocol(_fileSystem, fileNames, readerPool, _marshal, logProvider);
            Segments         segments         = recoveryProtocol.Run().Segments;

            segments.Visit(segment =>
            {
                logsFound[0]++;
                @out.println("=== " + segment.Filename + " ===");
                SegmentHeader header = segment.header();
                @out.println(header.ToString());
                try
                {
                    using (IOCursor <EntryRecord> cursor = segment.getCursor(header.PrevIndex() + 1))
                    {
                        while (cursor.next())
                        {
                            @out.println(cursor.get().ToString());
                        }
                    }
                }
                catch (Exception e) when(e is DisposedException || e is IOException)
                {
                    e.printStackTrace();
                    Environment.Exit(-1);
                    return(true);
                }
                return(false);
            });

            return(logsFound[0]);
        }
        private static void ProcessFile(File effDocFile, File outFile)
        {
            if (!effDocFile.exists())
            {
                throw new RuntimeException("file '" + effDocFile.GetAbsolutePath() + "' does not exist");
            }
            OutputStream os;
            try
            {
                os = new FileOutputStream(outFile);
            }
            catch (FileNotFoundException e)
            {
                throw new RuntimeException(e);
            }
            os = new SimpleAsciiOutputStream(os);
            PrintStream ps;
            try
            {
                ps = new PrintStream(os, true, "UTF-8");
            }
            catch (UnsupportedEncodingException e)
            {
                throw new RuntimeException(e);
            }

            outputLicenseHeader(ps);
            Type genClass = typeof(ExcelFileFormatDocFunctionExtractor);
            ps.println("# Created by (" + genClass.Name + ")");
            // identify the source file
            ps.print("# from source file '" + SOURCE_DOC_FILE_NAME + "'");
            ps.println(" (size=" + effDocFile.Length + ", md5=" + GetFileMD5(effDocFile) + ")");
            ps.println("#");
            ps.println("#Columns: (index, name, minParams, maxParams, returnClass, paramClasses, isVolatile, hasFootnote )");
            ps.println("");
            try
            {
                ZipFile zf = new ZipFile(effDocFile);
                InputStream is1 = zf.GetInputStream(zf.GetEntry("content.xml"));
                extractFunctionData(new FunctionDataCollector(ps), is1);
                zf.Close();
            }
            catch (ZipException e)
            {
                throw new RuntimeException(e);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
            ps.Close();

            String canonicalOutputFileName;
            try
            {
                canonicalOutputFileName = outFile.GetCanonicalPath();
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
            Console.WriteLine("Successfully output to '" + canonicalOutputFileName + "'");
        }
 private static void outputLicenseHeader(PrintStream ps)
 {
     String[] lines = {
     "Licensed to the Apache Software Foundation (ASF) under one or more",
     "contributor license agreements.  See the NOTICE file distributed with",
     "this work for Additional information regarding copyright ownership.",
     "The ASF licenses this file to You under the Apache License, Version 2.0",
     "(the \"License\"); you may not use this file except in compliance with",
     "the License.  You may obtain a copy of the License at",
     "",
     "    http://www.apache.org/licenses/LICENSE-2.0",
     "",
     "Unless required by applicable law or agreed to in writing, software",
     "distributed under the License is distributed on an \"AS IS\" BASIS,",
     "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
     "See the License for the specific language governing permissions and",
     "limitations under the License.",
     };
     for (int i = 0; i < lines.Length; i++)
     {
         ps.print("# ");
         ps.println(lines[i]);
     }
     ps.println();
 }
Exemplo n.º 33
0
 public override void printStats(PrintStream @out)
 {
     @out.println("Value space size = " + Convert.ToString(vspace.length()));
     base.printStats(@out);
 }