Tutorial by Examples: di

@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToOne private Bar bar; } @Entity @Table(name="BAR") public class Bar { private UUID barId; //No corresponding mapping to Foo.class } Specifies a one-way relationship b...
Generic redirect to https: # Enable Rewrite engine RewriteEngine on # Check if URL does not contain https RewriteCond %{HTTPS} off [NC] # If condition is true, redirect to https RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L] Generic redirect to http: # Enable Rewrite engine Rewr...
An Observable can be thought of as just a stream of events. When you define an Observable, you have three listeners: onNext, onComplete and onError. onNext will be called every time the observable acquires a new value. onComplete will be called if the parent Observable notifies that it finished prod...
Changing the edit text's appearance when it's selected, pressed and not selected can be customised easily by adding creating a new style for your edit text like so <style name="EditTextTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorContr...
extension String { func matchesPattern(pattern: String) -> Bool { do { let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions(rawValue: 0)) let range: NSRange = NSMakeRange(...
Suppose you have a long list of elements and you are only interested in every other element of the list. Perhaps you only want to examine the first or last elements, or a specific range of entries in your list. Python has strong indexing built-in capabilities. Here are some examples of how to achie...
import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.sw...
CREATE CLUSTERED COLUMNSTORE INDEX enables you to organize a table in column format: DROP TABLE IF EXISTS Product GO CREATE TABLE Product ( Name nvarchar(50) NOT NULL, Color nvarchar(15), Size nvarchar(5) NULL, Price money NOT NULL, Quantity int ) GO CREATE CLUSTERED C...
Erlang on OpenBSD is currently broken on alpha, sparc and hppa architectures. Method 1 - Pre-built Binary Package OpenBSD let you choose desired version you want to install on your system: ###################################################################### # free-choice: ####################...
Consider the following partial example: import com.example.somelib.*; import com.acme.otherlib.*; public class Test { private Context x = new Context(); // from com.example.somelib ... } Suppose that when when you first developed the code against version 1.0 of somelib and versi...
In this iText 5 example, we will create a Hello World example in different languages, using different fonts: public void createPdf(String dest) throws DocumentException, IOException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(dest)); ...
In this iText 7 example, we will create a Hello World example in different languages, using different fonts: public void createPdf(String dest) throws IOException { PdfDocument pdf = new PdfDocument(new PdfWriter(dest)); try (Document document = new Document(pdf)) { PdfFont fon...
There are many ways to communicate with servers using Unity as the client (some methodologies are better than others depending on your purpose). First, one must determine the need of the server to be able to effectively send operations to and from the server. For this example, we will send a few pie...
Objective-C NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id item, NSDictionary *bindings) { return [item isKindOfClass:[UILabel class]]; }]; Swift let predicate = NSPredicate { (item, bindings) -> Bool...
Objective-C NSPredicate *predicate = [NSPredicate predicateWithFormat: @"self[SIZE] = %d", 5)]; Swift let predicate = NSPredicate(format: "self[SIZE] >= %d", 5) In this example, the predicate will match items that are arrays with length of at least 5.
An NSPredicate can use substitution variables to allow values to be bound on the fly. Objective-C NSPredicate *template = [NSPredicate predicateWithFormat: @"self BEGINSWITH $letter"]; NSDictionary *variables = @{ @"letter": @"r" }; NSPredicate *beginsWithR = [templ...
Objective-C NSArray *heroes = @[@"tracer", @"bastion", @"reaper", @"junkrat", @"roadhog"]; NSPredicate *template = [NSPredicate predicateWithFormat:@"self BEGINSWITH $letter"]; NSDictionary *beginsWithRVariables = @{ @"letter&qu...
You can bind event listeners to the EventSource object to listen to different events channels using the .addEventListener method. EventSource.addEventListener(name: String, callback: Function, [options]) name: The name related to the name of the channel the server is emitting events to. callb...
As seen in previous examples, basic use of this script is: python setup.py install But there is even more options, like installing the package and have the possibility to change the code and test it without having to re-install it. This is done using: python setup.py develop If you want to p...
GET your REST data and store in a PowerShell object: $Post = Invoke-RestMethod -Uri "http://jsonplaceholder.typicode.com/posts/1" Modify your data: $Post.title = "New Title" PUT the REST data back $Json = $Post | ConvertTo-Json Invoke-RestMethod -Method Put -Uri "h...

Page 101 of 164