Search Results

Search found 34207 results on 1369 pages for 'query output'.

Page 119/1369 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Change write-host output color based on foreach if elseif outcome in Powershell

    - by Emo
    I'm trying to change the color of write-host output based on the lastrunoutcome property of SQL Server jobs in Powershell....as in...if a job was successfull, the output of lastrunoutcome is "Success" in green....if failed, then "Failed" in red. I have the script working to get the desired job status...I just don't know how to change the colors. Here's what I have so far: # Check for failed SQL jobs on multiple servers [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null foreach ($svr in get-content "C:\serverlist2.txt") { $a = get-date $BegDate = (Get-Date $a.AddDays(-1) -f d) + " 12:00:00 AM" $BegDateTrans = [system.datetime]$BegDate write-host $svr $srv=New-Object "Microsoft.SqlServer.Management.Smo.Server" "$svr" $srv.jobserver.jobs | where-object {$_.lastrundate -ge $BegDateTrans -and $_.Name -notlike "????????-????-????-????-????????????"} | format-table name,lastrunoutcome,lastrundate -autosize foreach ($_.lastrunoutcome in $srv.jobserver.jobs) { if ($_.lastrunoutcome = 0) { -forgroundcolor red } else {} } } This seems to be the closest I've gotten...but it's giving me an error of ""LastRunOutcome" is a ReadOnly property." Any help would be greatly appreciated! Thanks! Emo

    Read the article

  • Delete temp file during finally vs delete output file during catch

    - by Russell
    This is in Java 6. I've seen more than once that people create temp files, do something, then rename it to the output file. Everything is wrapped in a try-finally block, where the temp file is deleted in finally in case something goes wrong in between. try { //do something with tempFile //do something with tempFile //do something with tempFile tempFile.renameTo(outputFile); } finally { if (tempFile.exists()) tempFile.delete() } I was wondering what are the benefits of doing that instead of doing something to the output file directly and delete it in case of exceptions. try { //do something with outputFile //do something with outputFile //do something with outputFile } catch (Exception e) { if (outputFile.exists()) outputFile.delete(); } My guess is that deleting temp files in finally benefits me when the try block can throw many kinds of exceptions. Is my guess right? What else?

    Read the article

  • Nested partial output caching in asp.net mvc 3

    - by Anwar Chandra
    Hi All, I am using Razor view engine in ASP.Net MVC 3 RC 2 this is part of my view city.cshtml (drastically simplified for the sake of simple example) <!-- in city.cshtml --> <div class="list"> @foreach(var product in SQL.GetProducts(Model.City) ) { <div class="product"> <div>@product.Name</div> <div class="category"> @foreach(var category in SQL.GetCategories(product.ID) ) { <a href="@category.Url">@category.Name</a> » } </div> </div> } </div> I want to cache this part of my output using OutputCache attribute. so I created an action ProductList with OutputCache attribute enabled <!-- in city.cshtml --> <div class="list"> @Html.Action("ProductList", new { City = Model.City }) </div> and I created the view in ProductList.cshtml as below <!-- in ProductList.cshtml --> @foreach(var product in Model.Products ) { <div class="product"> <div>@product.Name</div> <div class="category"> @foreach(var category in SQL.GetCategories(product.ID) ) { <a href="@category.Url">@category.Name</a> » } </div> </div> } but I still need to cache the category path output on each product. so I created an action CategoryPath with OutputCache attribute enabled <!-- in ProductList.cshtml --> @foreach(var product in Model.Products ){ <div class="product"> <div>@product.Name</div> <div class="category"> @Html.Action("CategoryPath", new { ProductID = product.ID }) </div> </div> } but apparently this is not allowed. I got this error.. OutputCacheAttribute is not allowed on child actions which are children of an already cached child action. I believe they have a good reason why they need to disallow this. but I really want this kind of nested Output Caching Please, any idea for a workaround?

    Read the article

  • Add a Carriage Return to the Output of an XSL Transformation

    - by dsrekab
    I am trying to use XSLT to convert an XML document to a text file and the text of the document looks fine. However, I need to add a carriage return after the end of each line (NOT A CRLF) and I seem to be failing in every attempt. I have tried adding just a CR at the end of the line like this: <xsl:text>&#xD;</xsl:text> I have tried changing my media-type to string, I have tried to add the disable-output-escaping attribute to the text element, but it always adds a CRLF. This is on a Windows OS and I know that Windows uses CRLF for a new line, but I would have thought you could override that if you said to specifically use only the CR or the LF (e.g. VB.net's VBCR or VBLF). Does anyone know if it is possible to only output a CR with XSLT? Thanks in advance.

    Read the article

  • msysGit: Why does git log output blank lines?

    - by Sam
    It appears to insert less blank lines the closer I type the command to the bottom of the terminal window. If I type it at the top of the terminal window, it inserts nearly a full window height of blank lines; if I type it at the very bottom, no blank lines are inserted. It seems like the pager program is pushing output to the bottom of the terminal window, but I want the output to be right below my command or at the top, like in Linux git. I can get expected behavior by using git --no-pager log, but what if I want to use a pager?

    Read the article

  • lexical analysis gives only one output?

    - by Caffè
    I tested this example(lexe.java), but it gave me only one output. I gave this text as a reader: public class LexeTest{ private int a = 14; } And the nextToken() function is : public Category nextToken () { if (inp.findWithinHorizon (tokenPat, 0) == null) return Category.EOF; else { lastLexeme = inp.match ().group (0); if (inp.match ().start (1) != -1) return nextToken (); else if (inp.match ().start (2) != -1) return Category.IDENT; else if (inp.match ().start (3) != -1) return Category.NUMERAL; Category result = tokenMap.get (lastLexeme); if (result == null) return Category.ERROR; else return result; } } Isdie the main method: System.out.println(lexeObject.nextToken()); output is : IDENT Why? but the textfile contains multiple keywords? Anyone know what's the problem?

    Read the article

  • Writing the output of IEnumerable<XElement> to a XML File

    - by Googler
    HI folks , This is my code to read two xml files and merge their elemnts. I want to write the output to an xml file. This is my code. IEnumerable<XElement> list0 = doc.Descendants(node1).Concat(doc2.Descendants(node2)); foreach (XElement el in list0) Console.WriteLine(el); Instead of writing to the console i need to write it to a xml file. Output is also in the xml format.How to achieve this. Can anyone pls give me a code or method to achiev this.

    Read the article

  • Output excel spreadsheets with or without Office PIA

    - by user144182
    I have a program that currently outputs Excel via SpreadsheetML files. I build these using streams. This is very space inefficient for Excel; the files can be 5 to 6 times as large as other Excel binary formats. I would like to output a binary excel format such as .xls or .xlsx, but I don't want to have the installation of the program depend on Office. Some users might have it installed, some might not. How can I handle this gracefully? Is it possible to not have an assembly as a dependency but based on the user enabling binary output still use the assembly?

    Read the article

  • Track status of Microsoft TTS output to wav file

    - by user325478
    I'm trying to track the status of my applications TTS output to a wav file. When speaking the text (to the speaker) the expected events (StartStream, Word, EndStream) are fired, however, no events are fired when outputing to a wave file. SpVoice vox = new SpVoice(); vox.Word += VoxWord; // Handle word processed event SpFileStream voxStream = new SpFileStream(); voxStream.Open(@"c:\test.wav", SpeechStreamFileMode.SSFMCreateForWrite, false); vox.AudioOutputStream = voxStream; vox.Speak("Hello World. Please track my status!", SpeechVoiceSpeakFlags.SVSFlagsAsync); Is it possible to asynchronously know the status of TTS output to wav?

    Read the article

  • Using GWT to output XML, JSON and regular HTML

    - by Artem
    Sorry, this is a very basic question, as we are just getting started with exploring GWT. We would like to know if it's easy and possible to get GWT to "output" XML, JSON and regular HTML. I would like to know this because ideally we would port parts of our backends over slowly, and it would be nice to drop in GWT in place of AJAX wherever we need it during the transition period. Places that we would like to be able to use: 1) We have a pure XML page that we return to our client (mobile) app and right now this is handled through Spring MVC with a nice template. What's the best replacement for this? 2) We have a regular AJAX page that makes async requests and expects replies in JSON. Can we easily replace this backend? 3) We have some regular webpages where we use templates to output them, and we would like to first switch them over in the simplest possible way, without converting them to the regular GWT UI framework. Thanks!

    Read the article

  • Working with multiple input and output files in Python

    - by Morlock
    I need to open multiple files (2 input and 2 output files), do complex manipulations on the lines from input files and then append results at the end of 2 output files. I am currently using the following approach: in_1 = open(input_1) in_2 = open(input_2) out_1 = open(output_1, "w") out_2 = open(output_2, "w") # Read one line from each 'in_' file # Do many operations on the DNA sequences included in the input files # Append one line to each 'out_' file in_1.close() in_2.close() out_1.close() out_2.close() The files are huge (each potentially approaching 1Go, that is why I am reading through these input files one at a time. I am guessing that this is not a very Pythonic way to do things. :) Would using the following form good? with open("file1") as f1: with open("file2") as f2: # etc. If yes, could I do it while avoiding the highly indented code that would result? Thanks for the insights!

    Read the article

  • command line tool text output

    - by Martin
    I have a small command line tool and after running it, I'd like to display the text output in a way that's easy for someone to copy/paste and save it or email it to someone else. Copy/pasting from a command prompt is not done in the standard way, so I don't want people to have to copy/paste from there. Saving the file to disk is possible, but the folder where the tool is located may not have access rights so the user would have to configure the output file location (this may be too tricky for some users). I was thinking of launching notepad with some text in it, generated from the command line tool. Is this possible? Any other suggestions?

    Read the article

  • Extracting numeric value from output of a uder defined aggregate in netezza using bash script

    - by Ankit
    I am executing a shell script to execute my user defined aggregate which is taking inputs yavg=nzsql -c 'select avg(x) from Input1' which is giving output like this AVG ---------- 2.000000 (1 row) I want to pass only the numeric(double) value which is 2.0000(where xavg is expected) from this to S4(x,y,$xavg,$yavg) where x and y are the whole column from table Input1, xavg=nzsql -c 'select avg(y) from Input1' Below is my InputTable.txt which is a text file from which I am popluating my "Input1" table in the shell script. 1 2 3 2 1 2 3 2 1 nzsql -c 'create table Input1(x integer, y integer, v integer)' nzload -t Input1 -df InputTable.txt nzsql -c 'select * from Input1 yavg=`nzsql -c 'select avg(x) from Input1'` xavg=`nzsql -c 'select avg(y) from Input1' nzsql -c 'select S4(x,y,$xavg,$yavg) from test' Below is the output : xavg := AVG ---------- 2.000000 (1 row) yavg := AVG ---------- 1.666667 (1 row) and i am passing this value to S4(x,y,$xavg,$yavg) which is a User defined aggregate

    Read the article

  • To capture Tv tuner/webcam output

    - by mawia
    Hi! all, We are developting a tool for live video streaming in which we want to broadcast the output of tv tuner on a network.Our project is at it's nascent stage.Our main concern at this moment is to how to capture the output of a tv tuner card.Plz guide us regarding this or provide a pointer where I can detail about the topic. All help will be highly appreciated. Thanks Mawia ps:project is for cross-platform but at the moment even if you tell me of any one platform it will be enough!

    Read the article

  • Regular expression help parsing SQLIO output

    - by jaspernygaard
    Hi I've been working on a regular expression to parse the output of a series of SQLIO runs. I've gotten pretty far, but not quite there yet. I'm seeking a 100% regex solution and no pre-manipulation of the input. Could anyone assist with a little guidance with the following regular expression: .*v(?<SQLIOVersion>\d\.\d).*\n.*\n(?<threads>\d*)\s.*for\s(?<Seconds>\d+).*\n.*using\s(?<clustersize>[0-9]*)KB.*\n.*\n.*size:\s(?<currentfilesize>\d+).*\n.*\n.*\n.*\n.*\s(?<IOs>\d*\.\d*).*\n.*\s(?<MBs>\d*\.\d*).*\n.*\n.*\s(?<MinLatency_ms>\d+).*\n.*\s(?<AvgLatency_ms>\d+).*\n.*\s(?<MaxLatency_ms>\d+).*\n.*\n.*\n\%\:..(?<ms>\d*\s+)* Here's a snippet of the output - note the headers, which change during the SQLIO batch run: File

    Read the article

  • ResGen.exe stucks when redirect output

    - by Darqer
    Hello I try to redirect standard output from ResGen.exe. I use following code ProcessStartInfo psi = new ProcessStartInfo( "resxGen.exe" ); psi.CreateNoWindow = true; psi.Arguments = sb.ToString(); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; Process p = Process.Start( psi ); p.WaitForExit(); StreamReader sr = p.StandardOutput; string message = p.StandardOutput.ReadToEnd(); It stuck on p.WaitForExit. When I turn off output stream redirection and do not read StandardOutput it works correctly. What do I do wrong ?

    Read the article

  • RoR: Output Hash, getting correct parameters?

    - by andrewliu
    I have output something like this: #<Hashie::Mash created_time="1366008641" from=#<Hashie::Mash full_name="Cor Valen" id="22340" username="_corin"> id="4344344286" text="Look Who It Is, My Brother, My Favorite Deputy"> This was an output if I did this: <%= media.caption %> I wanted to get the text part, and I did this: <%= media.caption.text %> gets me error: undefined method `text' for nil:NilClass <%= media.caption[:text] %> gets me error: undefined method `[]' for nil:NilClass I don't get it? Thanks

    Read the article

  • Get ANSI-colored output from external command

    - by German Rumm
    I am writing a small script for watchr that runs my PHP unit tests. Current script runs tests using system() and displays them colored. I am trying to add libnotify functionality, but for that I need to parse the output and match against regexp, so that notification will either display green or red. system() doesn't return output, %x does return, but puts p doesn't display colors, which I need to quickly see which test failed. One option would be to run tests twice - once for display in terminal window, and second time for checking which notification to show, but I would rather avoid it.

    Read the article

  • OpenOffice Calc Macro: Run shell command and return output as result of custom function

    - by Mark
    I would like to write a custom OpenOffice function that runs a shell command and puts the result into the cell from which it was invoked. I have a basic macro working, but I can't find a way to capture the command's output. Function MyTest( c1 ) MyTest = Shell("bash -c "" echo hello "" ") End Function The above always returns 0. Looking at the documentation of the Shell command, I don't think it actually returns STDOUT. How would I capture the output so that I can return it in my function? Thanks!

    Read the article

  • How do I output an individual character when using char *[] = "something"

    - by Matt
    I've been playing with pointers to better understand them and I came across something I think I should be able to do, but can't sort out how. The code below works fine - I can output "a", "dog", "socks", and "pants" - but what if I wanted to just output the 'o' from "socks"? How would I do that? char *mars[4] = { "a", "dog", "sock", "pants" }; for ( int counter = 0; counter < 4; counter++ ) { cout << mars[ counter ]; } Please forgive me if the question is answered somewhere - there are 30+ pages of C++ pointer related question, and I spent about 90 minutes looking through them, as well as reading various (very informative) articles, before deciding to ask.

    Read the article

  • Imagecache, Views, file renaming, and output directories

    - by Bruno
    I have been trying to figure this one out for awhile and just seem to be getting myself deeper into a rabbit hole.. I think it would be best if I would just explain what I am trying to accomplish and go from there.. Essentially what I would like to happen is a user would upload a photograph from the filefield sources on a content type, and then using views, it would output that different image through different imagecache actions.. The problem seems to be that the actual directories it is making is really cluttered and I would like it to be a little bit more organized due to some file renaming. Here is how I would like the process to happen: Upload image.jpg Imagecache resize 100x100 square and save file to same directory and name the file image-100.jpg Imagecache desaturate 100x100 square and save file to same directory and name the file image-d-100.jpg Currently it seems that every imagecache action will save that file in its own directory.. How can I specify a more customized output? Thanks, Anthony

    Read the article

  • Drupal - Use lightbox with Views (Rel attribute) - in output link

    - by kilrizzy
    In Drupal I have two image fields, one to act as a thumbnail and the other the image that will open when the thumbnail is clicked. The only way I could find to link the two was to use the option for "Output this field as a link" and link to the image field. This works, so when I click the thumbnail it opens the larger image however I would like to use lightbox2 for this task but in the "Output this field as a link" options there is no way to set the "rel" attribute. Is there a way to either set the rel attribute or invoke the lightbox by setting a class?

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >