According to the axe book (2nd edition), we can use to_s as follows.
class Song
def to_s
"Song"
end
end
song = Song.new()
song.to_s
But, it doesn't give me anything, in order to print something to the stdout, I should run
def to_s
p "Song"
end
Is there any change since the ruby 1.8.2 when the book was written f...
The p calls inspect, and puts/print calls to_s for representing its object.
If I run
class Graph
def initialize
@nodeArray = Array.new
@wireArray = Array.new
end
def to_s # called with print / puts
"Graph : #{@nodeArray.size}"
end
def inspect # called with p
"G"
end
end
if __FILE__ == $0
gr = Graph.new
...
I am trying to create an application to print documents over the web. I have created my document, and made a web page with a meta refresh tag, along the lines of this:
<meta http-equiv="refresh" content="3;http://example.com/download.epl2" />
I specify that the document has a content-type of application/x-epl2, and I have associated ...
Hi, When I learning to print array variables, I found the white space inserted when double quoter used. Snippet code as below. Could you please tell me why?
#!/usr/bin/perl -w
use strict;
use warnings;
my @str_array = ("Perl","array","tutorial");
my @int_array = (5,7,9,10);
print @str_array;
print "\n";
# added the double quotes
print...
can someone show me how to print the ListView contents with the ColumnHeaders, without the scrollbars? appreciate some sample codes, thanks.
...
Hi,
if for example i have :
#define PRINT(x) fprintf(stderr, x);
and in code i append it :
PRINT(("print this"))
output is :
[print this]
if i append it :
PRINT(("print %s", "this"))
output is :
[this]
could someone explain me why it receives just the "this" argument and not the whole string ?
...
Hi all,
I am facing some problem in print layout, below is the description of steps I followed and problem which I am facing:
I have taken a custom view over which there are NSTextViews, NSTableViews arranged one below other.
I am trying to calculate exact height of NSTextViews and NSTableViews depending upon content in them.
Dependi...
Hi,
I'm developing a printing service on android. I've already managed to handle PostScript and now I would like to know if there is someone out there how knows where to find information about how to write a converter that converts a jpg to a pcl file.
I'm aware of ImageMagic, GostScript etc. but I need to write one on my own.
Thanks,...
I'm trying to set up the print page for a document, using PageSetupDialog.
Before I open the dialog, the document is set correctly, page size and page source are set correctly too.
But when I return from the dialog after select a different paper size and paper source, the paper size is not correctly reflected, while the paper source is ...
Ok, I give up... what's the quickest way to print a hardcopy (paper) of my app running in the iPhone Simulator?
...
I am trying to print from an Adobe Air App that embeds an AJAX app.
The print function looks like this:
function printPage() {
asyncSetupForPrint(printCallback);
}
function asyncSetupForPrint(printCallback) {
synchronousMethods();
if (printCallback) printCallback();
}
function printCallback() {
var pjob = new window.runtime.f...
I'm using Graphics.ScaleTransform to stretch lines of text so they fit the width of the page, and then printing that page. However, this converts the print job to a bitmap - for a print with many pages this causes the size of the print job to rise to obscene proportions, and slows down printing immensely.
If I don't scale like this, the...
I wrote a library which creates a bitmap image from some user input. This bitmap is then printed using a zebra printer. The problem I am running into is everything is very faint and blurry on the image printed by the zebra printer but if I print the bitmap to a laser printer it looks perfectly normal. Has anyone run into this before a...
Hi,
I have been presented with a problem which requires me to print PDF files from a server as part of an ASP.NET web service.
The problem is further complicated by the fact that the PDF files I have to print can ONLY be printed using Adobe Reader (they were created using Adobe LiveCycle and have some strange protection in them).
This...
How can I determine if printer is connected?
Typically this application prints to the default printer but in some cases that printer may not be available. If so I don't want the job sent to it's queue but rather printed to another available printer.
I understand the PrinterSettings.InstalledPrinters property. Does PrintDocument.Printe...
I need to do some printing from my Java Swing application. I have tried to use Java Tutorials, but everything is very low level, and time-consuming. I have to specify the coordinates for every line that I want to print. It is also very lowlevel to use text, because I have to use FontMetrics and calculate what space all text fills up.
Is...
I'm using Visual Studio 2008, .net Framework 3.5 for a Windows forms client-server app that I'm working on. There is a weird bug when I run the program and try to print. The print dialog box opens, but I have to click the OK button twice for it to work. After the second click it works fine, no errors. When I put a breakpoint on: if (resu...
When writing a print stylesheet, is there a way to ensure that an image is always only on a single page, instead of spanning multiple pages. The images much smaller than the page, but based on the document flow, they end up at the bottom of the page and get split. An example of the behavior I'm seeing is below:
Page 1 | ...
Hi,
I need to do some printing using TPrinter. The problem is I can not, for various reasons, use Global object Printer.
I want to be able to create my instance of TPrinter and print using that one.
I tried with:
MyPrinter := TPrinter.Create;
MyPrinter.BeginDoc;
but this generates AV.
Any idea what does it take to print something...
Hello!
Many apps already in App Store has ability to print from iphone without installing any software on computer. Like for example Air-Sharing.
Do anyone have any idea how they're doing it, how they're able to detect from iphone all printers shared in the network and print with them directly from iphone ??
Any suggestions would be a...