Tutorial by Examples: df

The simple and most obvious way to use recursion to get the Nth term of the Fibonnaci sequence is this int get_term_fib(int n) { if (n == 0) return 0; if (n == 1) return 1; return get_term_fib(n - 1) + get_term_fib(n - 2); } However, this algorithm does not scale for higher ...
Files: To determine if a file exists, simply pass the filename to the Dir$ function and test to see if it returns a result. Note that Dir$ supports wild-cards, so to test for a specific file, the passed pathName should to be tested to ensure that it does not contain them. The sample below raises an...
Consider the following list comprehension Python 2.x2.7 i = 0 a = [i for i in range(3)] print(i) # Outputs 2 This occurs only in Python 2 due to the fact that the list comprehension “leaks” the loop control variable into the surrounding scope (source). This behavior can lead to hard-to-find...
Initialize serial device import serial #Serial takes two parameters: serial device and baudrate ser = serial.Serial('/dev/ttyUSB0', 9600) to read single byte from serial device data = ser.read() to read given number of bytes from the serial device data = ser.read(size=5) to read one li...
Suppose that we have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: When using iText 5, we'd use the following code: public void createPdf(String dest) throws DocumentException, IOException { Document document = new Document(); PdfWriter....
Suppose that you have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: When using iText 7, we'd need the following code: public void createPdf(String dest) throws IOException { PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); Document...
Suppose that we have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: When using iText 5, you'd need code like this: public void createPdf(String dest) throws DocumentException, IOException { Document document = new Document(); PdfWriter wr...
Suppose that you have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: When using iText 7, you'd need code like this: public void createPdf(String dest) throws IOException { PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); Document do...
Suppose that we have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: Note the blue border that is added to the titles, and the page number at the bottom of each page. In iText 5, these elements are added using page events: class MyPageEvents extends ...
Suppose that you have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: Note the page numbers at the bottom of each page. These are added using an IEventHandler implementation: protected class Footer implements IEventHandler { @Override pub...
Suppose that you have the following text file: jekyll_hyde.txt How do we convert it to a PDF that looks like this: Note that this is very similar to what we had before, but the border of the titles now has rounded corners. We created a custom ParagraphRenderer to achieve this, and we created a T...
Use the following commands to create bookmarks and access bookmarks from within Emacs. Let us say that you are editing a file called foobar.org and suppose that you visit this file frequently to edit / view contents. It would be convenient to access this file with couple of key strokes rather than...
I.Overview A significant difference between MongoDB & RDBMS is MongoDB has many kinds of operators. One of them is update operator, which is used in update statements. II.What happen if we don't use update operators? Suppose we have a student collection to store student information(Table view...
perl -Mojo -E 'p("http://localhost:3000" => form => {Input_Type => "XML", Input_File => {file => "d:/xml/test.xml"}})' File d:/xml/test.xml will be uploaded to server which listen connections on localhost:3000 (Source) In this example: -Mmodule execu...
In all examples: clk is the clock, d is the input, q is the output, srst is an active high synchronous reset, srstn is an active low synchronous reset, arst is an active high asynchronous reset, arstn is an active low asynchronous reset, sset is an active high synchronous set, ssetn is an...
<?php get_template_part( 'foo','bar' ); ?> Includes ../wp-content/themes/your-theme-slug/foo-bar.php
<?php get_template_part( 'dir/foo', 'bar' ); ?> Includes ../wp-content/themes/your-theme-slug/dir/foo-bar.php
Suppose you have the table T1 and it has relation with many tables and its primary key constraint name is "pk_t1" you want to disable these foreign keys you can use: Begin For I in (select table_name, constraint_name from user_constraint t where r_constraint_name='pk_t1') loop E...
To find a file in the Hadoop Distributed file system: hdfs dfs -ls -R / | grep [search_term] In the above command, -ls is for listing files -R is for recursive(iterate through sub directories) / means from the root directory | to pipe the output of first command to the second grep command t...
private static final String TAG = "IntentBitmapFetch"; private static final String COLON_SEPARATOR = ":"; private static final String IMAGE = "image"; @Nullable public Bitmap getBitmap(@NonNull Uri bitmapUri, int maxDimen) { InputStream is = context.getConten...

Page 13 of 21