output

How do I format the output array in CakePHP

Let's say I have an index action where I want to get a list of projects: $this->Project->find('all', array('order' => 'Project.modified DESC', 'conditions' => array('Project.user_id' => 1))); It works well and returns the following array: Array ( [0] => Array ( [Project] => Array ( [id] => 2 [title] => test project ) ) [1] => Array (...

Output JSTL escaped?

I am retrieving a value from our DB using JSTL. I am inserting it right into some javascript to use it as a variable. I need the output of the value the JSTL is holding to be escaped because if there are single or double quotes it breaks my script. The value is user specified. Example: Doing the following: <c:set var="myVar" value="Da...

Selenium SeleniumTestCase .checkForVerificationErrors method : output status before it fails

Hi I am testing a table on a webpage where i need to verify all values in table. For this i have written a for loop something like this for (row) { for (column) { SeleniumTestCase.verifyTrue( "expected".equals("obtained")); } SeleniumTestCase.checkForVerificationErrors(); } Here in the fifth line i am checking was th...

How to rollback lines from cout ?

Hi, I'm coding a task monitoring, which updates tasks' progress using cout. I'd like to display one task progress per line, therefore I have to rollback several lines of the console. I insist on "several" because '\b' does the job for one line, but does not erase '\n' between lines. I tried std::cout.seekp(std::cout.tellp() - str.leng...

Why does this code print the same thing twice?

I am trying to write some small timeout code: t = Thread.new { sleep 3 } # <- The thread that will do stuff. Thread.new { sleep 2; t.kill; p 'hi!' } # <- The thread that will kill it after two seconds. t.join If the first thread completes it's job within two seconds, it will stop, and the main thread will have nothing to do. This will...

Help understanding the C stdarg macros (va_start ...)

Hi all, recently i came across this function (used in a logger class). I understand what it does, but i do not know how: void Reporter::print( const char* szFormat, ...) { // note: m_out is a FILE* va_list args; va_start(args, szFormat); vfprintf( m_out, szFormat, args); va_end(args); } I read the reference, but s...

Why does fgets(STDIN, 1024) not work anymore?

Question 1 I used to use that line for my PHP parser file for a game server, but it does not work anymore. I know there is the fopen("php://stdin") thing but that's now 3 lines of code instead of just one, why would PHP do this? Question 2 Also, when I use that method I keep getting this output which is causing my script to not read t...

Xcode not showing console output; How do you flush the console?

I have a simple C++ program that uses cout and printf to log stuff and it is only showing at the end when the program is closed but if I'm stepping through the program using debug nothing is shown. Did anybody have this problem? This is probably a punishment for doing homework for someone else. :|. ...

Is it a bad practice to write HTML markup using only PHP echo statements?

There is a guy at work that pretty much writes all of his html markup by using echo statements. It looks really clean and I like it a lot, but I remember hearing it is a bad practice considering it becomes a little much when you have to write large quantities of markup. What is the best practice? ...

Redirect response output with VBScript in ASP classic

In a plain .asp file, any content outside of <% %> tags is sent directly to the output buffer. Additionally, an expression in <%= %> tags is evaluated and sent to the output buffer. I want to redirect it so that, in some context that I establish, the result of those two constructs is instead sent to a buffer that I control. If possible,...

Best way to have a formatted output with perl

I want to output strings into 8 columns, but I want to keep the spacing the same. I dont want to do it in HTML, but I am not sure how to do it normally. Example: Something Something Something Something Something Else Else Else Else Else Another Another Another Another ...

bash: output \n \t characters from mysql query

Hi there, I currently have $ echo "`echo "use joomla; describe jos_content" | mysql --batch -u root -ppassword`" and I would expect output that starts like this Field\tType\tNull\tKey\tDefault\tExtra\n but instead I get Field Type Null Key Default Extra I have tried all sorts of items at the moment. I could use mysql --h...

PHP output messages while script in process

For example i'm looping through a big file, and after counter reaches 1000 parsed strings i need to echo message, that 1000 string have been parsed and calculate % of overall completed strings. Is it possible to make something like that with output buffer? ...

Reading and Uploading files in java

How do I iterate through a directory to read *.csv files and upload them in my system in Java? Ignore the upload part of post. ...

Why does this PHP code just echo "Array" ?

Here is my code: if(isset($_POST['check']) AND $_POST['check'] == 'First') { $errormessage = array(); if(empty($_POST['full_name']) || strlen($_POST['full_name']) < 4) { $errormessage[] = "FEL - Vänligen ange fullständiga namn. Please enter atleast 3 or more characters for your name"; } if(!isEmail($_POST['usr_email'])) { $erro...

Nose: Capture script output as well as test output

If I put any print statements at the top of my module, not inside any class/function, nothing gets printed while running my test through nose. import os print 'hi' #---------------------------------------------------------------------- def make_shapes(canvas): """ Generates shapes. Needs a Canvas instance to add the shapes to ...

How do I test modules/scripts that output/modify files?

I have a couple of modules (DZP::Catalyst and DZP::OurPkgVersion) both of their purposes involve writing out files to the disk. I'm not sure how to test them, are there any good strategies for testing files written out to disk? any place I could go to read up on it? ...

log JSP output to file

I'm not a java guy and I got some JSP code from a friend for testing purposes. All succes/faliure information is being output to browser, but the problem is - I'm not the one who is making the request. So Is there any simple way to copy/redirect default output of the JSP to a file on server but still finish the request? ...

MYSQL STORED PROCEDURE with OUTFILE with no spaces in txt file

I would like to export a query result in a txt file, but with no field separators like this: field1field2field3field4 if I use the fields terminated by and optionally enclosed by and set them to '', I still get some kind of tabs between fields... How can I get the output right? thanks in advance... ...

c++ win32 output a text

im using visual studio c++ 2008 i created project that contents the full window code. i don't know how to output text to window. i mean i have full functional window with menu bar and under the menu bar there is the body im trying to ouput the text in the body but how? ...