Tutorial by Examples: di

On Julia, you can define more than one method for each function. Suppose we define three methods of the same function: foo(x) = 1 foo(x::Number) = 2 foo(x::Int) = 3 When deciding what method to use (called dispatch), Julia chooses the more specific method that matches the types of the argument...
You can list all files ignored by git in current directory with command: git status --ignored So if we have repository structure like this: .git .gitignore ./example_1 ./dir/example_2 ./example_2 ...and .gitignore file containing: example_2 ...than result of the command will be: $ g...
ORDER BY x ASC -- same as default ORDER BY x DESC -- highest to lowest ORDER BY lastname, firstname -- typical name sorting; using two columns ORDER BY submit_date DESC -- latest first ORDER BY submit_date DESC, id ASC -- latest first, but fully specifying order. ASC = ASCENDING, DESC ...
The following function reads an entire file into a new string and returns it: (defun read-file (infile) (with-open-file (instream infile :direction :input :if-does-not-exist nil) (when instream (let ((string (make-string (file-length instream)))) (read-sequence string instr...
To download NetBeans IDE just visit the NetBeans site and download the proper version of the IDE based on your OS, Architecture and technologies. You can select from the following technologies: Java SE. Supports all standard Java SE development features as well as support for NetBeans Platform ...
class ImageCreationExample { static Image createSampleImage() { // instantiate a new BufferedImage (subclass of Image) instance BufferedImage img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); //draw something on the image paintOnI...
public static void saveImage(String destination) throws IOException { // method implemented in "Creating a simple image Programmatically and displaying it" example BufferedImage img = createSampleImage(); // ImageIO provides several write methods with different outputs ...
To download a file from remote server to the local machine - type: scp tom@server2:$HOME/file.txt /local/machine/path/ This example shows how to download the file named file.txt from user tom's home directory to our local machine's current directory.
~$ ping -c 1 google.com # unmodified output PING google.com (16.58.209.174) 56(84) bytes of data. 64 bytes from wk-in-f100.1e100.net (16.58.209.174): icmp_seq=1 ttl=53 time=47.4 ms ~$ ping google.com | grep -o '^[0-9]\+[^()]\+' # modified output 64 bytes from wk-in-f100.1e100.net 64 bytes from...
String types like UnicodeString, AnsiString, WideString and UTF8String are stored in a memory using their respective encoding (see String Types for more details). Assigning one type of string into another may result in a conversion. Type string is designed to be encoding independent - you should nev...
A for loop iterates from the starting value down to the ending value inclusive, as a "count-down" example. program CountDown; {$APPTYPE CONSOLE} var i : Integer; begin for i := 10 downto 0 do WriteLn(i); end. Output: 10 9 8 7 6 5 4 3 2 1 0
Read, write and insert into internal tables with a header line: " Read from table with header (using a loop): LOOP AT i_compc_all. " Loop over table i_compc_all and assign header line CASE i_compc_all-ftype. " Read cell ftype from header line from table i_com...
In order to avoid a divide by zero with a numberSet (what you get after a reduction like avg()) you can short-circuit the logic: $five = min(q("sum:rate{counter,,1}:haproxy.frontend.hrsp{}{status_code=5xx}", "1h", "")) $two = avg(q("sum:rate{counter,,1}:haproxy.f...
With series operations, things are dropped from the left side if there is no corresponding timestamp/datapoint in the right side. You can mix this with the dropbool function to avoid divide by zero: $five = q("sum:rate{counter,,1}:haproxy.frontend.hrsp{}{status_code=5xx}", "1h",...
Steps#1-5 below allow any image or path-shape to be both moved anywhere on the canvas and rotated to any angle without changing any of the image/path-shape's original point coordinates. Move the canvas [0,0] origin to the shape's center point context.translate( shapeCenterX, shapeCenterY ); ...
Canvas apps often rely heavily on user interaction with the mouse, but when the window is resized, the mouse event coordinates that canvas relies on are likely changed because resizing causes the canvas to be offset in a different position relative to the window. Thus, responsive design requires tha...
ps aux | grep <search-term> shows processes matching search-term Example: root@server7:~# ps aux | grep nginx root 315 0.0 0.3 144392 1020 ? Ss May28 0:00 nginx: master process /usr/sbin/nginx www-data 5647 0.0 1.1 145124 3048 ? S Jul18 2:53 nginx: worke...
Traditionally in Prolog, "functions" (with one output and bound inputs) were written as regular predicates: mangle(X,Y) :- Y is (X*5)+2. This can create the difficulty that if a function-style predicate is called multiple times, it is necessary to "daisy chain" temporary vari...
int width = 256; //in pixels int height = 256; //in pixels BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR); //BufferedImage.TYPE_4BYTE_ABGR - store RGB color and visibility (alpha), see javadoc for more info Graphics g = image.createGraphics(); //draw w...
BufferedImage cat = ImageIO.read(new File("cat.jpg")); //read existing file //modify it Graphics g = cat.createGraphics(); g.setColor(Color.RED); g.drawString("Cat", 10, 10); g.dispose(); //now create a new image BufferedImage cats = new BufferedImage(256, 256, Buffere...

Page 96 of 164