add

Add Color to a Column in Powershell Results

﹥>﹥吖頭↗ 提交于 2019-11-29 17:05:41
How can I add a different color to the Name Column. If it's possible will it keep the color if I export it to a txt file? $time = (Get-Date).AddYears(-2) Get-ChildItem -Recurse | `Where-Object {$_.LastWriteTime -lt $time} | ft -Wrap Directory,Name,LastWriteTime | Out-File spacetest.txt Thanks Take a look at (Get-Host).UI.RawUI.ForegroundColor. And no, you can not save color to a text file. You can save color into XML file, HTML file or use Excel or Word Automation to create appropriate files that do support color. Communary.ConsoleExtensions [link] might help you Invoke-ColorizedFileListing C:

Java: Adding fields and methods to existing Class?

≯℡__Kan透↙ 提交于 2019-11-29 16:02:41
问题 Is there, in Java, a way to add some fields and methods to an existing class? What I want is that I have a class imported to my code, and I need to add some fields, derived from the existing fields, and their returning methods. Is there any way to do this? 回答1: You can create a class that extends the one you wish to add functionality to: public class sub extends Original{ ... } To access any of the private variables in the superclass, if there aren't getter methods, you can change them from

Insert page into existing PDF using itextsharp

强颜欢笑 提交于 2019-11-29 13:54:55
We are using itextsharp to create a single PDF from multiple PDF files. How do I insert a new page into a PDF file that has multiple pages already in the file? When I use add page it is overwriting the existing pages and only saves the 1 page that was selected. Here is the code that I am using to add the page to the existing PDF: PdfReader reader = new PdfReader(sourcePdfPath); Document document = new Document(reader.GetPageSizeWithRotation(1)); PdfCopy pdfCopy = new PdfCopy(document, new System.IO.FileStream(outputPdfPath, System.IO.FileMode.Create)); MemoryStream memoryStream = new

c# sharpziplib adding file to existing archive

扶醉桌前 提交于 2019-11-29 13:50:45
am trying to add a file to an existing archive using the following code. When run no errors or exceptions are shown but no files are added to the archive either. Any ideas why? using (FileStream fileStream = File.Open(archivePath, FileMode.Open, FileAccess.ReadWrite)) using (ZipOutputStream zipToWrite = new ZipOutputStream(fileStream)) { zipToWrite.SetLevel(9); using (FileStream newFileStream = File.OpenRead(sourceFiles[0])) { byte[] byteBuffer = new byte[newFileStream.Length - 1]; newFileStream.Read(byteBuffer, 0, byteBuffer.Length); ZipEntry entry = new ZipEntry(sourceFiles[0]); zipToWrite

JList add/remove Item

北慕城南 提交于 2019-11-29 13:36:46
Hi I have to pick an element from a JList to another, removing it from the first The method I've created inserts only one element, overwriting the last one and doesn't remove the selected item from the first JList Here's the code: First list private javax.swing.JList listaRosa; Populated by this method: private void visualizzaRosaButtonvisualizzaRosa(java.awt.event.ActionEvent evt) { // TODO add your handling code here: visualizzaSquadraSelezionata(); String fileSquadra; fileSquadra = squadraDaVisualizzare.getText(); DefaultListModel listModel = new DefaultListModel(); try { FileInputStream

java.lang.Number doesn't implement “+” or any other operators?

自闭症网瘾萝莉.ら 提交于 2019-11-29 10:21:01
I'm creating a class which is supposed to be able to be used with an array of any type of number (float, int, etc), so here is one method I have: // T extends Number public synchronized T[] average() { Number[] ret = new Number[queue[0].length]; for (int i = 0; i < ret.length; ++i) { for (int j = 0; j < size; ++j) { ret[i] += queue[j][i]; // WTF ERROR?! } ret[i] /= size; // WTF ERROR?! } return (T[])ret; } Except this won't compile because "Number" doesn't implement the "+=" or "/=" operators. Event worse, java's Number class doesn't implement even the most basic operators like "+" or "-"! How

Oracle SQL - Add Primary Key to table

柔情痞子 提交于 2019-11-29 09:29:03
I have some columns with no primary key and want to add a primary key column . NAME Age ------------- Peter 45 Bob 25 John 56 Peter 45 Some collegues suggest to add a PK with a sequences and triggers : Add a auto increment primary key to existing table in oracle This is nice, but my customers use a Database User with no rights to add sequences or triggers . I want to prevent to contact dozens of DBA administrators to alter user rights or to run my scripts. This is my suggestion to add a PK with only an update statement: (I need help in Step 2) Step 1: Create the ID column ( I have DB rights

Java '+' operator between Arithmetic Add & String concatenation? [duplicate]

依然范特西╮ 提交于 2019-11-29 09:27:58
This question already has an answer here: Java printing a string containing multiple integers 7 answers As we know Java '+' operator is used for both Arithmetic Add String concatenation Need to know exactly expected behavior and applied rule when i used both together When i try following java code System.out.println("3" + 3 + 3); // print 333 String concatenation ONLY System.out.println(3 + "3" + 3); // print 333 String concatenation OLNY System.out.println(3 + 3 + "3"); // print 63 Arithmetic Add & String concatenation This is basic operator precedence, combined with String concatenation vs

sum of columns in a 2 dimensional array

旧时模样 提交于 2019-11-29 08:05:42
static double [][] initialArray = {{7.432, 8.541, 23.398, 3.981}, {721.859, 6.9211, 29.7505, 53.6483}, {87.901, 455.72, 91.567, 57.988}}; public double[] columnSum(double [][] array){ int index = 0; double temp[] = new double[array[index].length]; for (int i = 0; i < array[i].length; i++){ double sum = 0; for (int j = 0; j < array.length; j++){ sum += array[j][i]; } temp[index] = sum; System.out.println("Index is: " + index + " Sum is: "+sum); index++; } return temp; } public static void main(String[] args) { arrayq test = new arrayq(); test.columnSum(initialArray); } I want to get the sum of

jquery add remove class

痴心易碎 提交于 2019-11-29 08:03:59
问题 I have 4 anchors, I want to add a class of current to an anchor as it is clicked and remove the class from the other 3 at the same time. Here's my code. what am I doing wrong? if ($("ul#thumb a").hasClass("current") { $("ul#thumb a").removeClass("current"); $(this).addClass("current"); }); and my html looks like this: <ul id="thumbs"> <li> <!-- intro page navi button --> <a id="t0" class="active" name="t0">The Company</a> <ul class="navi"> <li><a style="display:none"></a></li> <li><a id="t1"