Tutorial by Examples: n

To round out simple examples of CRUD operations, we present the following examples. Always use great care in deleting documents. (: When we know the URI, we can delete it very easily :) let $uri := "/stuff/mysimpledocument.xml" return xdmp:document-delete($uri) or simplified: xdmp:d...
Many modern Prolog systems are in continuous development and have added new features to address classic shortcomings of the language. Unfortunately, many Prolog textbooks and even teaching courses still introduce only the outdated prolog. This topic is intended to illustrate how modern Prolog has ov...
Traditionally Prolog performed arithmetic using the is and =:= operators. However, several current Prologs offer CLP(FD) (Constraint Logic Programming over Finite Domains) as a cleaner alternative for integer arithmetic. CLP(FD) is based on storing the constraints that apply to an integer value and ...
Some "classic" Prolog textbooks still use the confusing and error-prone failure-driven loop syntax where a fail construct is used to force backtracking to apply a goal to every value of a generator. For example, to print all numbers up to a given limit: fdl(X) :- between(1,X,Y), print(Y),...
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...
Try to run your code from the tool bar as shown below : In your code, if you have more than one function then, before running it you should mention the function you want to run with. For example : Alternatively, you can press ctrl + r from your keyboard to run the code. It will save the code f...
# 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 | ...
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...

Page 624 of 1088