Tutorial by Examples

# Like any other ruby code, require gtk3 after installing from "gem install gtk3" require 'gtk3' # Like in Rails, you import working functions from a higher class, in this case the GTK Window class RubyApp < Gtk::Window # Calling the original method from GTK Window and redefinin...
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...
BufferedImage image = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); //you don't have to use the Graphics object, you can read and set pixel color individually for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { int alpha = 255; //don't forget this, or ...
Let's say you want to test method which throws an exception class Car { /** * @throws \Exception */ public function drive() { throw new \Exception('Useful message', 1); } } You can do that by enclosing the method call into a try/catch block and making a...
A very simple applet draws a rectangle and prints a string something on the screen. public class MyApplet extends JApplet{ private String str = "StackOverflow"; @Override public void init() { setBackground(Color.gray); } @Override public void de...
Applets could easily be used to create a GUI. They act like a Container and have an add() method that takes any awt or swing component. public class MyGUIApplet extends JApplet{ private JPanel panel; private JButton button; private JComboBox<String> cmbBox; private JText...
You can use the method getAppletContext() to get an AppletContext object that allows you to request the browser to open a link. For this you use the method showDocument(). Its second parameter tells the browser to use a new window _blank or the one that shows the applet _self. public class MyLinkAp...
Java applets are able to load different resources. But since they are running in the web browser of the client you need to make sure that these resources are accessible. Applets are not able to access client resources as the local file system. If you want to load resources from the same URL the App...
Common Lisp does not have interfaces in the sense that some languages (e.g., Java) do, and there is less need for that type of interface given that Common Lisp supports multiple inheritance and generic functions. However, the same type of patterns can be realized easily using mixin classes. This e...
Let's say we have a table team_person as below: +======+===========+ | team | person | +======+===========+ | A | John | +------+-----------+ | B | Smith | +------+-----------+ | A | Walter | +------+-----------+ | A | Louis | +------+-----------+ | C | ...
Determine if an object has (or contains) a key. If the key to search for is expressed as a path (with dot notation) it will traverse nested object structures to determine if the key exists. var obj = { a: 2, b: 3, c: { dd:40, ee:{ fff:500 } } }; var res1 = _.ha...
The unreal mode exploits two facts on how both Intel and AMD processors load and save the information to describe a segment. The processor caches the descriptor information fetched during a move in a selector register in protected mode. These information are stored in an architectural invisibl...
RENAME TABLE t TO t_old, t_copy TO t; No other sessions can access the tables involved while RENAME TABLE executes, so the rename operation is not subject to concurrency problems. Atomic Rename is especially for completely reloading a table without waiting for DELETE and load to finish: CREATE ...
A VIEW acts very much like a table. Although you can UPDATE a table, you may or may not be able to update a view into that table. In general, if the SELECT in the view is complex enough to require a temp table, then UPDATE is not allowed. Things like GROUP BY, UNION, HAVING, DISTINCT, and some su...
To install the software: After the download completes, run the installer. For Windows, the installer executable file has the .exe extension. Double-click the installer file to run it. For Linux platforms, the installer file has the .sh extension. For these platforms, you need to make ...
To install the software: After the download completes, run the installer. The installer file has the .dmg extension. On the panel that opens double-click the package icon. The package has the .pkg extension. The installation wizard starts. Click Continue when the "This package will run a p...
To run the software: After the download of the platform-independent ZIP file completes, extract it to any folder on your system. Run the executable file located in the netbeans/bin directory. Accept the License Agreement. Click Next. The NetBeans IDE installation starts. Note: If a compatib...
PHP 5.4+ comes with a built-in development server. It can be used to run applications without having to install a production HTTP server such as nginx or Apache. The built-in server is only designed to be used for development and testing purposes. It can be started by using the -S flag: php -S &lt...
The ROLLUP operator is useful in generating reports that contain subtotals and totals. CUBE generates a result set that shows aggregates for all combinations of values in the selected columns. ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected col...

Page 768 of 1336