Tutorial by Examples

Using YAML: # app/config/routing.yml blog_show: path: /blog/{slug} defaults: { _controller: AppBundle:Blog:show } Using Annotations: // src/AppBundle/Controller/BlogController.php namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use S...
If you want to have a placeholder that may be omitted, you can give it a default value: Using YAML: # app/config/routing.yml blog_list: path: /blog/{page} defaults: { _controller: AppBundle:Blog:list, page: 1 } requirements: page: '\d+' Using Annotations: // src/...
// src/AppBundle/Controller/HelloWorldController.php namespace AppBundle\Controller; use Symfony\Component\HttpFoundation\Response; class HelloWorldController { public function helloWorldAction() { return new Response( '<html><body>Hello World!<...
Most of the time, you will want to render HTML responses from a template instead of hard-coding the HTML in your controller. Also, your templates will not be static but will contain placeholders for application data. By default Symfony comes with Twig, a powerful templating language. In order to us...
Sometimes you want to return a 404 (Not Found) response, because the requested resource does not exist. Symfony allows you to do so by throwing a NotFoundHttpException. The Symfony base Controller exposes a createNotFoundException method which creates the exception for you: public function indexAc...
If you need to access the Request object (for instance to read the query parameters, to read an HTTP header or to process an uploaded file), you can receive the request as a method argument by adding a type-hinted argument: use Symfony\Component\HttpFoundation\Request; public function indexActio...
The first think you need to do is to download tweets. You need to Setup your tweeter account. Much Information can be found in Internet on how to do it. The following two links were useful for my Setup (last checked in May 2017) In particular I found the following two links useful (last checked in ...
Now we need to access the text of the tweets. So we do it in this way (we also need to clean up the tweets from special characters that for now we don't need, like emoticons with the sapply function.) coffee_tweets = sapply(c_tweets, function(t) t$getText()) coffee_tweets <- sapply(coffee_t...
Whenever we create a new project in Xcode for our new app, it gives us various in-built classes, targets, tests, plist file, etc. Similarly it also gives us as Assets.xcassets file, which manages all the image assets in our project. This is how this file looks like in file navigator: If we clic...
It's really easy to define the functions. Function GetAreaOfARectangle(ByVal Edge1 As Integer, ByVal Edge2 As Integer) As Integer Return Edge1 * Edge2 End Function Dim Area As Integer = GetAreaOfARectangle(5, 8) Console.Writeline(Area) 'Output: 40
Function Age(ByVal YourAge As Integer) As String Select Case YourAge Case Is < 18 Return("You are younger than 18! You are teen!") Case 18 to 64 Return("You are older than 18 but younger than 65! You are adult!") Cas...
libavformat usually takes in a file name and reads media directly from the filesystem. If you want to read from memory (such as streams), do the following: // Define your buffer size const int FILESTREAMBUFFERSZ = 8192; // A IStream - you choose where it comes from IStream* fileStreamData; ...
Opening a media file from the local file system. AVFormatContext *formatContext; // Open the file if(avformat_open_file(&formatContext, "path/to/file.ogg", NULL, NULL) < 0){ // Error opening file } // Do something with the file // Free resources avformat_close_inpu...
Formats contain one or more encoded and muxed streams. We usually read these in chunks, which are often called frames (though in certain cases, FFmpeg refers exclusively to decoded, raw media chunks as frames, and encoded chunks as packets, which may be confusing). To read a single frame from a form...
The API call avio_alloc_context, which sets up a custom IO context, takes in a pointer to a Read function. If you are reading from an IStream, you can use the following: /** * Reads from an IStream into FFmpeg. * * @param ptr A pointer to the user-defined IO data structure. * @param b...
The API call avio_alloc_context, which sets up a custom IO context, takes in a pointer to a Seek function. If you are reading from an IStream, you can use the following: /** * Seeks to a given position on an IStream. * * @param ptr A pointer to the user-defined IO data structure. * @pa...
Media stream containers usually have a several streams, such as a video stream and an audio stream. For example, you can get the audio stream using the following: // A Format Context - see Reading Data for more info AVFormatContext *formatContext; // Inspect packets of stream to determine prope...
Once you have a stream Format Context and its respective Codec, you can open it for decoding using the following code: // The format context and codec, given - see Find a stream for how to get these AVFormatContext *formatContext; AVCodec* codec; int streamIndex; // Get the codec context AVC...
Given a codec context and encoded packets from a media stream, you can start decoding media into raw frames. To decode a single frame, you can use the following code: // A codec context, and some encoded data packet from a stream/file, given. AVCodecContext *codecContext; // See Open a codec cont...
Circle.yml machine: python: # Python version to use - Selenium requires python 3.0 and above version: pypy-3.6.0 dependencies: pre: # Install pip packages - pip install selenium - pip install unittest test: override: # Bash command to run main....

Page 1265 of 1336