Tutorial by Examples: al

If you get an error like this: Fatal error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\stack\index.php on line 7 Other variations include something along the lines of: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given... These errors mean that t...
This will only install PHP. If you wish to serve a PHP file to the web you will also need to install a web-server such as Apache, Nginx, or use PHP's built in web-server (php version 5.4+). If you are in a Ubuntu version below 16.04 and want to use PHP 7 anyway, you can add Ondrej's PPA repo...
My first Wicket setup, app showing Hello World on home screen: import org.apache.wicket.protocol.http.WebApplication; public class HelloWorldApplication extends WebApplication { public HelloWorldApplication() { } @Override public Class getHomePage() { retur...
There are two sorts of logical operators: those that accept and return vectors of any length (elementwise operators: !, |, &, xor()) and those that only evaluate the first element in each argument (&&, ||). The second sort is primarily used as the cond argument to the if function. Logic...
In [1]: ser = pd.Series(['lORem ipSuM', 'Dolor sit amet', 'Consectetur Adipiscing Elit']) Convert all to uppercase: In [2]: ser.str.upper() Out[2]: 0 LOREM IPSUM 1 DOLOR SIT AMET 2 CONSECTETUR ADIPISCING ELIT dtype: object All lowercase: In [3]: ser...
It's easier to implement some UDFs on the worksheet if full column references can be passed in as parameters. However, due to the explicit nature of coding, any loop involving these ranges may be processing hundreds of thousands of cells that are completely empty. This reduces your VBA project (and ...
In many languages, new instances of a class are created using a special new keyword. In Ruby, new is also used to create instances of a class, but it isn't a keyword; instead, it's a static/class method, no different from any other static/class method. The definition is roughly this: class MyClass ...
When should I use it When the code inside an inline listener is too big and your method / class becomes ugly and hard to read You want to perform same action in various elements (view) of your app To achieve this you need to create a class implementing one of the listeners in the View API. ...
There are two ways to setup the Apache Flex SDK. You can use the provided Apache Flex SDK Installer, an Adobe AIR application that automates the process (on Windows or OS X/macOS). Or you can install it manually which obviously requires a greater comfort with your platform but provides more flexibi...
Suppose we have the following XAML snippet: <ListBox x:Name="MyListBox" /> Then in the code-behind for this XAML file, we write the following in the constructor: MyListBox.ItemsSource = new[] { 1, 2, 3, 4, 5 }; Running the application, we get a list of numbers we enter...
:g/Hello/d Will delete every line containing the text "Hello". Important note: This is not the normal mode command d, this is the ex command :d. You can use the global command to apply normal mode keystrokes instead of ex commands by prepending normal or norm to the command. For exampl...
Modify your Gemfile to include the Devise gem: gem 'devise' Then update your gems with: $ bundle install Run the installers in your project: $ rails generate devise:install Then create your Devise model (e.g. User) with: $ rails generate devise User you'll need to set up the default ...
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController include OmniConcern %w[facebook twitter gplus linkedin].each do |meth| define_method(meth) do create end end end Note: In the part “%w[facebook twitter gplus linkedin]”, you should list ...
devise_for :users, controllers: {omniauth_callbacks: 'users/omniauth_callbacks'}
For Facebook config.omniauth :facebook, facebook_app_id, facebook_secret_key, :display => "popup", :scope => 'email,publish_actions', info_fields: 'email,name' For Twitter config.omniauth :twitter, twitter_app_id, twitter_secret_key, :display => "popup", :scope =&gt...
The System.Web.SessionState.HttpSessionState object provides a way to persist values between HTTP requests. In the example below, a user's preference for warnings is being saved in the session. Later on, while serving another request to the user, the application can read this preference from session...
When one wishes to convert a list to a vector or data.frame object empty elements are typically dropped. This can be problematic which a list is created of a desired length are created with some empty values (e.g. a list with n elements is created to be added to an m x n matrix, data.frame, or data...
returnType (^blockName)(parameterType1, parameterType2, ...) = ^returnType(argument1, argument2, ...) {...}; float (^square)(float) = ^(float x) {return x*x;}; square(5); // resolves to 25 square(-7); // resolves to 49 Here's an example with no return and no parameters: NSMutableDicti...
If you want to use RSpec for a Rails project, you should use the rspec-rails gem, which can generate helpers and spec files for you automatically (for example, when you create models, resources or scaffolds using rails generate). Add rspec-rails to both the :development and :test groups in the Gem...
There are times when an include file has to generate different output from the preprocessor depending on whether the compiler is a C compiler or a C++ compiler due to language differences. For example a function or other external is defined in a C source file but is used in a C++ source file. Since...

Page 101 of 269