Rectangle 27 5

You can use patterns in AWK this way:

awk 'NR == 62 || NR == 152 || NR == 153 || NR % (62+217) == 0 || NR % (152+217) == 0 || NR % (153+217) == 0 {print $0;}' test.txt

Thanks for your pointers. I am able to print line #62, #152,#153 but having problem in printing its next iteration which is #62+217, #152+217, #152+217, and so on. Tried awk '(NR == 62 || NR == 152 || NR == 153) && (((NR-62) % 217==0) || ((NR-152) % 217 ==0)|| ((NR-153) % 217==0)) {print $0;}' test.txt It does not work well too. Will continue to investigate

I used your idea and did manipulation. The below is what I wanted. Thanks! You are an angel. awk '(NR - 62) % 217 == 0 || (NR - 152) % 217 == 0 || (NR - 153) % 217 ==0 {print $0;}' file.txt

awk - Printing Selected Lines in Large File - Stack Overflow

awk
Rectangle 27 1

awk 'NR==1 || !(NR%2){ print $1,$2,$4 }' OFS='\t' file
Name    Sub percentage
A   AB  50
b   AB  50
c   AB  50
d   AB  50

awk formatting - use awk for printing selected rows - Stack Overflow

awk awk-formatting
Rectangle 27 1

awk '(NR == 1) || ((NR % 2) == 0) {print $1" "$2" "$4}' inputFile

This will print columns one, two and four but only if the record number is one or even. The results are:

Name Sub percentage
A AB 50
b AB 50
c AB 50
d AB 50

If you want it nicely formatted, you can use printf instead:

awk '(NR == 1) || ((NR % 2) == 0) {printf "%-10s %-10s %10s\n", $1, $2, $4}' inputFile

Name       Sub        percentage
A          AB                 50
b          AB                 50
c          AB                 50
d          AB                 50

Thanks a lot, I have got this done with above solutions

awk formatting - use awk for printing selected rows - Stack Overflow

awk awk-formatting
Rectangle 27 1

I tried the above however, I am getting error: Index exceeds matrix dimensions. Error in untitled2 (line 12) C2 = C(rows);

string - Matlab - printing selected lines from a text file in new text...

string matlab text printf
Rectangle 27 0

Thanks Diodeus, that's what I thought was going to be the answer. I am currently using print style sheets, was just hoping that I could use one for with background color printing and one without. Guess not.

printing - can javascript "detect" browser print settings (specificall...

javascript printing
Rectangle 27 0

Likely your MyItem class has already the toString() overridden which returns the txt and you were plain printing selected as follows to determine the selected values:

System.out.println(selected);
selected
MyItem
for (MyItem myItem : selected) {
    System.out.println(myItem);
}

You'll see that it fails with ClassCastException, because it's actually a String. So yes, you still need a converter here.

Damn, you're right :) I was actually printing with an EL in the view (refreshed with an f:ajax), the MyItem has toString overriden by standard Eclipse toString-generation. When I tried the foreach you mentioned it is really throwing ClassCastExceptions! Question comes how could a List<String> be passed to a List<MyItem> parameter, but as I understand it's about generics here - the MyItem type parameter gets lost and that's why JSF is able to pass there anything (i.e. String). THANKS!

That's answered in the "see also" link. JSF/EL isn't at all aware about the generic type of the List because that's by design completely lost during runtime. All JSF/EL knows is that it's a List and since there's no converter, it just adds unmodified/unconverted String submitted values to the List.

jsf - f:selectItems and POJOs - once more - Stack Overflow

jsf
Rectangle 27 0

You could provide the selected text value next to the dropdown and hide it via CSS. Then use a print stylesheet to show the text and hide the dropdown when printing.

css - How can I style an html select box to omit drop down arrow for p...

css
Rectangle 27 0

6.2.1. Printing selected fields

The print command in awk outputs selected data from the input file.

When awk reads a line of a file, it divides the line in fields based on the specified input field separator, FS, which is an awk variable (see Section 6.3.2). This variable is predefined to be one or more spaces or tabs.

The variables $1, $2, $3, ..., $N hold the values of the first, second, third until the last field of an input line. The variable $0 (zero) holds the value of the entire line. This is depicted in the image below, where we see six colums in the output of the df command:

Figure 6-1. Fields in awk

In the output of ls -l, there are 9 columns. The print statement uses these fields as follows:

kelly@octarine ~/test> ls -l | awk '{ print $5 $9 }'
160orig
121script.sed
120temp_file
126test
120twolines
441txt2html.sh

kelly@octarine ~/test>

This command printed the fifth column of a long file listing, which contains the file size, and the last column, the name of the file. This output is not very readable unless you use the official way of referring to columns, which is to separate the ones that you want to print with a comma. In that case, the default output separater character, usually a space, will be put in between each output field.

Local configuration

 

Note that the configuration of the output of the ls -l command might be different on your system. Display of time and date is dependent on your locale setting.

Rectangle 27 0

6.2.1. Printing selected fields

The print command in awk outputs selected data from the input file.

When awk reads a line of a file, it divides the line in fields based on the specified input field separator, FS, which is an awk variable (see Section 6.3.2). This variable is predefined to be one or more spaces or tabs.

The variables $1, $2, $3, ..., $N hold the values of the first, second, third until the last field of an input line. The variable $0 (zero) holds the value of the entire line. This is depicted in the image below, where we see six colums in the output of the df command:

Figure 6-1. Fields in awk

In the output of ls -l, there are 9 columns. The print statement uses these fields as follows:

kelly@octarine ~/test> ls -l | awk '{ print $5 $9 }'
160orig
121script.sed
120temp_file
126test
120twolines
441txt2html.sh

kelly@octarine ~/test>

This command printed the fifth column of a long file listing, which contains the file size, and the last column, the name of the file. This output is not very readable unless you use the official way of referring to columns, which is to separate the ones that you want to print with a comma. In that case, the default output separater character, usually a space, will be put in between each output field.

Local configuration

 

Note that the configuration of the output of the ls -l command might be different on your system. Display of time and date is dependent on your locale setting.

Rectangle 27 0

I suggest that you have a read of the Serialization (C# and Visual Basic) page from MSDN. In .NET, you can make practically any class serializable simply, using the SerializableAttribute Class like this:

[Serializable] // <--- This is all you need
public class YourClass
{
    ...
}

You can find several code examples describing how to save a serialized class in the Basic Serialization page on MSDN... from this linked page:

MyObject obj = new MyObject();
obj.n1 = 1;
obj.n2 = 24;
obj.str = "Some String";
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, 
    FileShare.None);
formatter.Serialize(stream, obj);
stream.Close();

Sheridan, thanks for your comments but it is not that trivial. For example, I don't have any control over PrintQueue class. It does not even have an parameter less constructor,which is essential for de-serialization purposes.

It is that trivial. Create a wrapper class that exposes the properties from your PrintQueue class. Add your parameter-less constructor into that class instead... there's always a way.

PrintQueue is a complex object with tons of properties, IMHO it will be not be an efficient way to try re-creating it using my own wrapper. Found the approach of sending PrintTicket with printer name much straightforward. Thanks for the idea anyway. Whats with the philosophy :) ?

c# - Printing - Need to transfer selected printer settings - Stack Ove...

c# wpf printing
Rectangle 27 0

The reason the preview doesn't match up to the paper is because you haven't selected a printer yet. Every printer is a bit different for things like unprintable areas, forced margins, etc. It's been a while since I've done winforms printing, but I do recall that the passed graphics object has a way to account for that.

c# - Why isn't the PrintPreview exactly the same as the paper print? -...

c# winforms printing
Rectangle 27 0

I have a customer with what sounds like the same (or at least a similar) problem. The line of code where we get the "Printer selected is not valid" message is slightly different (in the quick reports library), but it is similarly a call to GetDeviceCaps.

While we have yet to find a real solution, we have found a workaround. If the user visits the "Printer Setup" dialog before attempting to print the report, the error does not appear.

Have you had a look at these sites that I have found with some help from Google:

Neither of your links work anymore.

delphi - "Operation not supported" and "Printer selected is not valid"...

delphi printing
Rectangle 27 0

procedure InvalidatePrinter;
var
  dev,
  driv,
  port: array[0..80] of Char;
  deviceMode: THandle;
begin
  Printer.GetPrinter(dev, driv, port, deviceMode);
  Printer.SetPrinter(dev, driv, port, 0)
end;

This was in Delphi 7. I used it to reset the printer information forcing the RTL to retrieve it again from Windows. IIRC I did that because I had found out that the information Delphi kept was getting corrupted for some reason unknown to me. Perhaps the RTL code works differently on your Delphi version, but if I were you I would enable debug dcus and debug into the RTL to see what's going on there.

delphi - "Operation not supported" and "Printer selected is not valid"...

delphi printing
Rectangle 27 0

This is purely anecdotal but it just might be relevant.

I have just been chasing down a 'Printer selected is not valid' error message in a Delphi 5 application.

The software was creating a virtual printer in order to generate .pdf files. I found that the 'old' printer was being stored by its index which was an unreliable means of returning to it after the pdf operation had finished.

By changing the logic so that the old printer was restored by name I believe I was able to resolve my problem. (We go into test in a few days)

By the way - QuickReports was involved.

delphi - "Operation not supported" and "Printer selected is not valid"...

delphi printing
Rectangle 27 0

$s= mysql_query("SELECT project.client_id, client_name, client.client_id FROM client,project where project.client_id=client.client_id AND project_id='$editId'");

you are trying to get two client ids project.client_id and client.client_id, in such cases you should give aliases like project.client_id as project_client_id and client.client_id as client_client_id, then use that value to compare in while loop.

Note use whichever client id you want either project_client_id or client_client_id.

html - Printing a selected value in the drop down list using php? - St...

php html
Rectangle 27 0

This behaviour is to be expected. When you print self.fn in initUI the user hasn't selected a file yet. When you print in onOpen the user has selected a file, so it displays properly. self.fn does get set properly, you are just printing it too early.

If you want to display an image, do so once the user selects a file.

def onOpen(self):
    ftypes = [('Image Files', '*.tif *.jpg *.png')]
    dlg = tkFileDialog.Open(self, filetypes = ftypes)
    filename = dlg.show()
    self.fn = filename
    if self.fn: # If a file was selected
        # Display image in label / call display function

thanks for the answer. I'll need the displayed image in other callbacks too. How can i do this?

tkinter - Error returning filename read by tkFileDialog from menu call...

python tkinter
Rectangle 27 0

Delaying the execution of the code after window.print() fixed the issue.

setTimeout()
setTimeout(function () {
            $("#cpdDivFPrt").remove();
        }, 500);

jquery - Issue while printing selected elements - Stack Overflow

jquery html
Rectangle 27 0

PrinterSettings ps = new PrinterSettings();
var maxResolution = ps.PrinterResolutions.OfType<PrinterResolution>()
                                         .OrderByDescending(r => r.X)
                                         .ThenByDescending(r => r.Y)
                                         .First();
MessageBox.Show(String.Format("{0}x{1}", maxResolution.X, maxResolution.Y));

shows me an error Error 4 'System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection' does not contain a definition for 'OrderByDescending' and no extension method 'OrderByDescending' accepting a first argument of type 'System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection' could be found (are you missing a using directive or an assembly reference?

@Dhaval ensure that you have directive using System.Linq;

IEnumerable
PrinterResolutions

printing - C# code to get maximum dpi of installed or selected printer...

c# printing dpi
Rectangle 27 0

You are actively loading Books from the database, so AREL tries to map your select statement to the model. In this case, it maps the date to the borrow_date attribute and converts it into a Date object. The original formatting you selected is then no longer relevant as it was parsed to an object which has its own rules for printing the date.

Your second select works since there probably is no attribute of that name on your Book model, so it cannot be mapped to a specific type, so plain String is used.

You could simply add a function like formatted_borrow_date to your model or use a helper to have it format the borrow_date using ruby methods to avoid the hardcoded SQL and date formatting.

Thank you so much. It helps a lot. I know I should not hardcode date format, but i get error when i query date type data from ORACLE database. The error say "OCIError: ORA-01805: possible error in date/time operation". So i am forced to convert date to hardcode string.

Seems like a strange error when just selecting some rows. You should definitely try to fix it to avoid the same problems with other models. Just be aware that your date format is ambiguous and you are lucky that Ruby does the correct parsing. The Euro-style switches day and month, so 08/03/2014 could as well be March 8th. While the format %Y/%m/%d is technically also ambiguous, it is more or less regarded as the most recognized standard since Y/d/m is hardly in use. stackoverflow.com/questions/14755425/

mysql - when i was using find_by_sql alias, i got confused - Stack Ove...

mysql ruby-on-rails alias
Rectangle 27 0

I believe what you are asking is that it will will print "dog in":

names = ['dog', 'house', 'in', 'is', 'the']
print (names [0], names[2])

python - printing selected values from a list on one line - Stack Over...

python list python-3.x printing line