Tutorial by Examples: c

The Hello Audio! of Java that plays a sound file from local or internet storage looks as follows. It works for uncompressed .wav files and should not be used for playing mp3 or compressed files. import java.io.*; import java.net.URL; import javax.sound.sampled.*; public class SoundClipTest { ...
from subprocess import check_call ok = check_call(['ffmpeg','-i','input.mp3','output.wav']) if ok: with open('output.wav', 'rb') as f: wav_file = f.read() note: http://superuser.com/questions/507386/why-would-i-choose-libav-over-ffmpeg-or-is-there-even-a-difference What are ...
Flask's built-in webserver is able to serve static assets, and this works fine for development. However, for production deployments that are using something like uWSGI or Gunicorn to serve the Flask application, the task of serving static files is one that is typically offloaded to the frontend webs...
# from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer # python2 from http.server import BaseHTTPRequestHandler, HTTPServer # python3 class HandleRequests(BaseHTTPRequestHandler): def _set_headers(self): self.send_response(200) self.send_header('Content-type', 'text...
double res[MAX]; int i; #pragma omp parallel { #pragma omp for for (i=0;i< MAX; i++) { res[i] = huge(); } } The for loop will be executed in parallel. huge() is some method which can take too long to get execute. OpenMP supports a shortcut to write the ab...
#include <omp.h> void main () { int i; double ZZ, func(), res=0.0; #pragma omp parallel for reduction(+:res) private(ZZ) for (i=0; i< 1000; i++){ ZZ = func(I); res = res + ZZ; } } In the last line: Actually added to a private ...
So the main goal of this function is to : Be standalone because it needs to be written in the main VbScript file and cannot be in an included file (because it defines the include function) Provide enough information if something goes wrong (ie. the file that was being included, the error that oc...
To include a file in another file, just use the one liner : IncludeFile "myOtherFile.vbs"
<p class="alert alert-success" *ngIf="names.length > 2">Currently there are more than 2 names!</p>
NgFor provides Some values that can be aliased to local variables index -(variable) position of the current item in the iterable starting at 0 first -(boolean) true if the current item is the first item in the iterable last -(boolean) true if the current item is the last item in the iterable ...
<?php if (!function_exists('document')) { function document($text = '') { return $text; } } Create a helpers.php file, let's assume for now it lives in app/Helpers/document.php. You can put many helpers in one file (this is how Laravel does it) or you can split them up b...
Now let's create a service provider. Let's put it under app/Providers: <?php namespace App\Providers; class HelpersServiceProvider extends ServiceProvider { public function register() { require_once __DIR__ . '/../Helpers/document.php'; } } The above service pr...
To generate schema, view, controller, migration file for the repository, default CRUD templates and test files for a model (like a scaffolding in Rails) one can use phoenix.gen.html mix task like this: mix phoenix.gen.html Book books title note:text pages:integer author_id:references:authors Wh...
Increment / Decrement A pointer can be incremented or decremented (prefix and postfix). Incrementing a pointer advances the pointer value to the element in the array one element past the currently pointed to element. Decrementing a pointer moves it to the previous element in the array. Pointer ari...
To enable SSH create a file called ssh in the /boot directory of your SD card. Identify the drive letter associated with your SD card. Open a command prompt (press Win+R on your keyboard to open the Run window. Then, type cmd) Enter the following at the command prompt (replacing Drive...
Go to File --> Settings --> click plugins in left hand pane --> Search for cucumber --> Install plugin
This is a quick guide to get Robot Framework 3.0 working on a Windows machine using Python 2.7.11 - It does not go into too much depth on the why and how, it simply gets you up and running. First things are first, let't go and install Python! Download Python 2.7.11 for Windows. (Windows x86-64 ...
At the end of the document add the following: \bibliographystyle{style} \bibliography{file location} Create a file with extension .bib and save the citation as follows: @inproceedings{citation_name, title={Paper Title}, author={List Authors}, pages={45--48}, year={2013}, organizat...
Template as below Scenario Outline: As a homemaker i want to buy and pay for the below product Given I purchase <a product> And I require a carry bag to take things to home When I pay bill using <payment method> to successfully checkout Then I should have a receipt Exam...
There are many ways of creating DataFrames. They can be created from local lists, distributed RDDs or reading from datasources. Using toDF By importing spark sql implicits, one can create a DataFrame from a local Seq, Array or RDD, as long as the contents are of a Product sub-type (tuples and ca...

Page 670 of 826