Tutorial by Examples: f

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' &gt...
printf will output a formatted string using placeholders sprintf will return the formatted string $name = 'Jeff'; // The `%s` tells PHP to expect a string // ↓ `%s` is replaced by ↓ printf("Hello %s, How's it going?", $name); #> Hello Jeff, How's it going? // Ins...
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...
Hello everyone, This first article help some people to install bash on windows 10. In first step you need uninstall all antivirus that you have, for example, I use Avast, I needed to uninstall this to install the bash. If you use windows protection, unable this to forward.
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...
File.Move In order to move a file from one location to another, one simple line of code can achieve this: File.Move(@"C:\TemporaryFile.txt", @"C:\TemporaryFiles\TemporaryFile.txt"); However, there are many things that could go wrong with this simple operation. For instance, wh...
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...
// Main frame class declaration class CMainFrame : public CMDIFrameWndEx { DECLARE_DYNAMIC(CMainFrame) protected: // declare our pane CDockablePane m_wndPane; // .... other class memebers public: CMainFrame(); protected: afx_msg int OnCreate(LPCREATEST...
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...
Identify the local scanner By using lsusb, identify the productId (1909 here) : pi:# lsusb pi:# Bus 001 Device 005: ID 04a9:1909 Canon, Inc. CanoScan LiDE 110 With that productId, grep the correct configuration file (it depends of your scanner model, for me it is genesys.conf) : pi:# grep 190...
Because of how gerrit relies on change-ids, in order to resolve conflicts (pull changes to your topic branch) the best practice is to rebase topic branch onto master/other branch you want to push to. This way you preserve the change-id without having to ammend the merge commit. For example if you su...
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...
Some times application must have panes that docked not to the main frame, but to the child frame. Usually it's MDI application. In MFC Feature pack such child frame is inherited from CMDIChildWndEx class and as main frame (inherited from CMDIFrameWndEx) have all required code for such docking. But ...
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...
One of the features that we can use with Threadpools is the submit() method which allow us to know when the thread as finish his work. We can do this thanks to the Future object, which return us an object from the Callable that we can use to our own objetives. Here is an example about how to use th...
Another good practice to check when our threads have finished without block the thread waiting to recover the Future object from our Callable is to create our own implemetation for Runnables, using it together with the execute() method. In the next example, I show a custom class which implements Ru...
We use ExecutorService to assign threads from the internal thread pool or create them on-demand to perform tasks. Each ExecutorService has an ThreadFactory, but The ExecutorService will use always a default one if we don't set a custom one. Why we should do this? To set a more descriptive thread...

Page 308 of 457