Tutorial by Examples: c

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...
static void setupQualityHigh(Graphics2D g2d) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // many other RenderingHints KEY/VALUE pairs to specify } ...
We can just do simple replacement of separators from space to new line, as following example. echo $sentence | tr " " "\n" It'll split the value of the variable sentence and show it line by line respectively.
getfunc() { declare -f "$@" } function func(){ echo "I am a sample function" } funcd="$(getfunc func)" getfunc func # or echo "$funcd" Output: func () { echo "I am a sample function" }
Create a simple DataFrame. import numpy as np import pandas as pd # Set the seed so that the numbers can be reproduced. np.random.seed(0) df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) # Another way to set column names is "columns=['column_1_name','column_2_name','c...
To check which process running on port 8080 lsof -i :8080
To transfer a file securely to another machine - type: scp file1.txt tom@server2:$HOME This example presents transferring file1.txt from our host to server2's user tom's home directory.
scp can also be used to transfer multiple files from one server to another. Below is example of transferring all files from my_folder directory with extension .txt to server2. In Below example all files will be transferred to user tom home directory. scp /my_folder/*.txt tom@server2:$HOME
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.
ps -e | less ps -e shows all the processes, its output is connected to the input of more via |, less paginates the results.
~$ 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...
There is a mantra that some Java experts are wont to recite: "Exceptions should only be used for exceptional cases." (For example: http://programmers.stackexchange.com/questions/184654 ) The essence of this is that is it is a bad idea (in Java) to use exceptions and exception handli...
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...
Use same UIImage with multiple theme base app by just applying UIColor to UIImage instance as following. // *** Create an UIImage instance with RenderingMode AlwaysTemplate *** UIImage *imgMenu = [[UIImage imageNamed:@"iconMenu"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]...
$sku = 'some-sku'; $productId = Mage::getModel('catalog/product')->getIdBySku($sku); if($productId){ //sku exists }
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
Internal Table Declaration Based on Local Type Definition " Declaration of type TYPES: BEGIN OF ty_flightb, id TYPE fl_id, dat TYPE fl_date, seatno TYPE fl_seatno, firstname TYPE fl_fname, lastname TYPE fl_lname, fl...
Creating a WebM video from canvas frames and playing in canvas, or upload, or downloading. Example capture and play canvas name = "CanvasCapture"; // Placed into the Mux and Write Application Name fields of the WebM header quality = 0.7; // good quality 1 Best < 0.7 ok to poor fps =...
The ServiceLoader is a simple and easy to use built-in mechanism for dynamic loading of interface implementations. With the service loader - providing means for instantation (but not the wiring) - a simple dependency injection mechanism can be built in Java SE. With the ServiceLoader interface and ...
Alternate ways to install SymPy from conda. conda is the recommended way, but these are some alternate ways. Including: git, pip, etc.

Page 473 of 826