Tutorial by Examples: c

public class PigeonholeSort { private static void SortPigeonhole(int[] input, int n) { int min = input[0], max = input[n]; for (int i = 1; i < n; i++) { if (input[i] < min) min = input[i]; if (input[i] > max) max = input[i]; ...
public class CatalanNumber { public static int Main(int number) { int result = 0; if (number <= 1) return 1; for (int i = 0; i < number; i++) { result += Main(i)*Main(number - i - 1); } return result; } }
Dynamic Time Warping(DTW) is an algorithm for measuring similarity between two temporal sequences which may vary in speed. For instance, similarities in walking could be detected using DTW, even if one person was walking faster than the other, or if there were accelerations and decelerations during ...
Few of the eclipse classic versions don't come pre-installed with marketplace, this maybe installed using the following steps: Goto Help → Install new Software Add new Repository(site specified below) General Purpose Tools → Marketplace Client Click Finish and you are done. Marketplace upda...
Launch standalone player activity Intent standAlonePlayerIntent = YouTubeStandalonePlayer.createVideoIntent((Activity) context, Config.YOUTUBE_API_KEY, // which you have created in step 3 videoId, // video which is to be played 100, //The time,...
public class CustomYouTubeActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener, YouTubePlayer.PlayerStateChangeListener { private YouTubePlayerView mPlayerView; private YouTubePlayer mYouTubePlayer; private String mVideoId = "B08iLAtS3AQ"; ...
task = Task.async(fn -> expensive_computation end) do_something_else result = Task.await(task)
crawled_site = ["http://www.google.com", "http://www.stackoverflow.com"] |> Enum.map(fn site -> Task.async(fn -> crawl(site) end) end) |> Enum.map(&Task.await/1)
One of the most interesting Number Patterns is Pascal's Triangle. The Name "Pascal's Triangle" named after Blaise Pascal, a famous French Mathematician and Philosopher. In Mathematics, Pascal's Triangle is a triangular array of binomial coefficients.The rows of Pascal's triangle are conve...
public class PascalsTriangle { static void PascalTriangle(int n) { for (int line = 1; line <= n; line++) { int c = 1; for (int i = 1; i <= line; i++) { Console.WriteLine(c); c = c * (line - i)...
Routes in Laravel are case-sensitive. It means that a route like Route::get('login', ...); will match a GET request to /login but will not match a GET request to /Login. In order to make your routes case-insensitive, you need to create a new validator class that will match requested URLs agains...
For full documentation, run the command: godoc -http=:<port-number> For a tour of Go (highly recommended for beginners in the language): go tool tour The two commands above will start web-servers with documentation similar to what is found online here and here respectively. For quick ...
// Assuming N/search is imported as `s` var mySalesOrderSearch = s.create({ type: 'salesorder' // Use the summary property of a Column to perform grouping/summarizing columns: [{ name: 'salesrep', summary: s.Summary.GROUP },{ name: 'internalid', ...
A DataGridView is a control in .NET UI design, which consists of rows and columns used to arrange data. Often there is need to depict data either from a spreadsheet or database on a UI design in an application. When this data is to be shown grouped by its properties, we choose a DataGridView. In C...
The most sensitive information of a WordPress install is stored in the wp-config.php file. If a hacker gets access to this file then they have total control of your website. By default wp-config.php is stored in the WordPress install folder. To make this file harder to steal you can move it out of ...
When you install WordPress to your server, the installation script will place a prefix in front of all the WordPress MySQL table names. This prefix is set to 'wp_' by default. The WordPress posts table will be called wp_posts for example. By changing the table prefix you can create some security by ...
In above examples you understand how to localize resources of application. Following example explain how to change the application locale within application, not from device. In order to change Application locale only, you can use below locale util. import android.app.Application; import android.c...
To draw a cuboid, you have to use the box() function by giving its dimensions as its parameters. size(200, 200, P3D); //Starting the P3D renderer translate(width/2, height/2); //Translating to the centre of the sketch rotateY(PI/4); //rotate so that... rotateX(PI/6); //... it will be easy to see...
If you have an attribute that needs to be saved and retrieved to database as an object, then specify the name of that attribute using the serialize method and it will be handled automatically. The attribute must be declared as a text field. In the model you must declare the type of the field (Hash...
Here's a program which might benefit from refactoring. It's a simple program using C++11 which is intended to calculate and print all prime numbers from 1 to 100 and is based on a program that was posted on CodeReview for review. #include <iostream> #include <vector> #include <cma...

Page 624 of 826