Tutorial by Examples

Creating the event object Swift var event = EKEvent(eventStore: eventStore) Objective-C EKEvent *event = [EKEvent initWithEventStore:eventStore]; Setting related calendar, title and dates Swift event.calendar = calendar event.title = "Event Title" event.startDate = startDate /...
In Symfony, the built-in ChoiceType (and EntityType or DocumentType extending it), basicaly work with a constant choice list. If you want to make it work with ajax calls, you have to change them to accept any sumitted extra choices. How to start with an empty choice list ? When you build your...
This is an example to show how to change the allowed choices on a subCategory select field depending on the value of the category select field. To do that you have to make your subCategory choices dynamical for both client and server side. 1. Make the form dynamic on the client side for display / ...
In Ruby, there is always an implicit receiver for all method calls. The language keeps a reference to the current implicit receiver stored in the variable self. Certain language keywords like class and module will change what self points to. Understanding these behaviors is very helpful in mastering...
When you define a class or module, the implicit receiver becomes a reference to the class itself. For example: puts "I am #{self}" class Example puts "I am #{self}" end Executing the above code will print: "I am main" "I am Example"
Most Ruby code utilizes the implicit receiver, so programmers who are new to Ruby are often confused about when to use self. The practical answer is that self is used in two major ways: 1. To change the receiver. Ordinarily the behavior of def inside a class or module is to create instance methods...
Qt provides a deployment tool for Windows: windeployqt. The tool inspects a Qt application executable for its dependecies to Qt modules and creates a deployment directory with the necessary Qt files to run the inspected executable. A possible script may look like: set PATH=%PATH%;<qt_install_pre...
Setup variables JUSERID=$[ ( $RANDOM % 100 ) + 1 ] JUSERNAME="admin" JUSEREMAIL="[email protected]" JUSERPASS="qweasd" DB="joomla_3" DBUSER="jdbuser" DBPASS="dbupass" DBPREFIX="prfx_" JOOMLAVERSION="3.6.2" ...
BEGIN TRY -- start error handling BEGIN TRANSACTION; -- from here on transactions (modifictions) are not final -- start your statement(s) select 42/0 as ANSWER -- simple SQL Query with an error -- end your statement(s) COMMIT TRANSACTION; -- finalize all transa...
Sometimes we have another editor somewhere else instead of TinyMCE (Wordpress Default Editor). That happen when we are creating our own Theme, Plugin or something specific; and we need to write and manipulate a type of post and save it into our WP Database. So, if you are on that situation, you can...
$basic_post_args = array( 'post_title' => 'My Basic Post', 'post_content' => 'This is a basic content', 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array(8, 59) ); wp_insert_post( $basic_post_args );
$basic_page_args = array( 'post_title' => 'My Basic Page', 'post_content' => 'This is a basic content', 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => 1 ); wp_insert_post( $basic_page_args );
The first thing we need is to tell karma to use Webpack to read our tests, under a configuration we set for the webpack engine. Here, I am using babel because I write my code in ES6, you can change that for other flavors, such as Typescript. Or I use Pug (formerly Jade) templates, you don't have to....
This returns the currently active spreadsheet, or null if there is none. var currentSheet = SpreadsheetApp.getActive(); var url = currentSheet.getUrl(); Logger.log( url );
Getting a reference to the main bundle using Cocoa. To get the main bundle in Cocoa application, call the mainBundle class method of the NSBundle class. NSBundle *mainBundle; // Get the main bundle for the app; mainBundle = [NSBundle mainBundle]; Getting a reference to ...
Locating a Cocoa bundle using its path To obtain the bundle at a specific path using Cocoa, call the bundleWithPath: class method of the NSBundle NSBundle *myBundle; // obtain a reference to a loadable bundle myBundle = [NSBundle bundleWithPath:@"/Library/MyBundle.bundle...
sudo docker stats $(sudo docker inspect -f "{{ .Name }}" $(sudo docker ps -q)) Shows live CPU usage of all running containers.
Before reading and writing text files you should know what encoding to use. See the Perl Unicode Documentation for more details on encoding. Here we show the setting of UTF-8 as the default encoding and decoding for the function open. This is done by using the open pragma near the top of your code (...
HTML Import caching will sometimes mean that changes made to HTML files that get imported do not get reflected upon browser refresh. Take the following import as an example: <link rel="import" href="./my-element.html"> If a change is done to my-element.html after previo...
The NodeIterator interface provides methods for iterating over nodes in a DOM tree. Given a document like this one: <html> <body> <section class="main"> <ul> <li>List Item</li> <li>List Item</li> <li>Li...

Page 814 of 1336