The where construct, available in Fortran90 onwards represents a masked do construct. The masking statement follows the same rules of the if statement, but is applied to all the elements of the given array. Using where allows operations to be carried out on an array (or multiple arrays of the same s...
Consider a structure of the following classes should be constructed in XAML an then read into a CLR object:
namespace CustomXaml
{
public class Test
{
public string Value { get; set; }
public List<TestChild> Children { get; set; } = new List<TestChild>(); ...
sed -i -e cmd file will modify file even if its permissions are set to read-only.
This command behaves similarly to
sed -e cmd file > tmp; mv -f tmp file
rather than
sed -e cmd file > tmp; cat tmp > file; rm tmp
The following example uses gnu sed:
$ echo 'Extremely important data' >...
You can use concatenation to join strings "end to end" while outputting them (with echo or print for example).
You can concatenate variables using a . (period/dot).
// String variable
$name = 'Joel';
// Concatenate multiple strings (3 in this example) into one and echo it once done.
...
AWS Lambda supports
Transparent scalability and availability
Developer friendly operations and no need to manage servers
Native integration to AWS services
No need to pay for idle time
RESTful integration
Monitoring the RESTful interface using AWS API gateway
This is one of the simplest lambda function. It is equivalent to Hello World program.
To create your first program follow the below mentioned steps.
Login to AWS Console
Click Lambda under compute
Click create a Lambda Function
Skip select blueprint section
In configure trigger click on the...
QObjects come with their own alternative lifetime concept compared to native C++'s raw,unique or shared pointers.
QObjects have the possibility to build an objecttree by declaring parent/child relationships.
The simplest way to declare this relationship is by passing the parent object in the const...
To get data from testcollection collection in testdb database where name=dev
import org.bson.Document;
import com.mongodb.BasicDBObject;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import c...
3D touch has been introduced with iPhone 6s Plus. There are two behaviors added with this new interface layer: Peek and Pop.
Peek and Pop in a nutshell
Peek - Press hard
Pop - Press really hard
Checking for 3D support
You should check if the device has a 3D touch support. You can do this by che...
Add the necessary dependencies to the project POM (mybatis, and mybatis-spring):
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>x.x.x</version>
</dependency>
<dependency>
<group...
wxPython Classic is a Python 2 build of the wxPython library. Generation of the python bindings require a large number of manual interventions and the documentation is simply the wxWidgets documentation which contains some annotations on wxPython mechanisms as such there is normally a delay of weeks...
The local configuration of sane is inside /etc/saned.d
/etc/sane.d/dll.conf
# /etc/sane.d/dll.conf - Configuration file for the SANE dynamic backend loader
#
# Backends can also be enabled by configuration snippets under
# /etc/sane.d/dll.d directory -- packages providing backends should drop...
As mentioned in the other example, you should use rebase instead of merge. But if you're working on a feature branch with your team then you'll run into the problem of pulling rewritten history. So the best way to work on a feature branch foo is to locally create tracking branch foo that you use onl...
To write a new .zip file:
System.IO.Compression
System.IO.Compression.FileSystem
using (FileStream zipToOpen = new FileStream(@"C:\temp", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
ZipArchiveEntry readmeEntry...
A ThreadPool is an ExecutorService that executes each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods.
Here is a basic code to initialize a new ThreadPool as a singleton to use in your app:
public final class ThreadPool {
priv...
A simple way to create a Hello World program:
import wx
app = wx.App(redirect=False)
frame = wx.Frame(parent=None, id=wx.ID_ANY, title='Hello World')
frame.Show()
app.MainLoop()
Output:
A more typical example would be to subclass wx.Frame:
import wx
class MyFrame(wx.Frame):
def...
The following example will return the byte[] data of a zipped file containing the files provided to it, without needing access to the file system.
public static byte[] ZipFiles(Dictionary<string, byte[]> files)
{
using (MemoryStream ms = new MemoryStream())
{
using (ZipArc...
First why we should use depedency injection in our code ? We want to decouple other components from other classes in our program. For example we have class AnimalController which have code like this :
public class AnimalController()
{
private SantaAndHisReindeer _SantaAndHisReindeer = new San...
autodie allows you to work with files without having to explicitly check for open/close failures.
Since Perl 5.10.1, the autodie pragma has been available in core Perl. When used, Perl will automatically check for errors when opening and closing files.
Here is an example in which all of the lines ...