Posts

Showing posts from December, 2011

Copy / Paste Text Selections Between Tmux And The Clipboard

Answer : Use the following tmux.conf with copy-pipe in the new versions of tmux (1.8+): set -g mouse on # To copy: bind-key -n -t emacs-copy M-w copy-pipe "xclip -i -sel p -f | xclip -i -sel c " # To paste: bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer" prefix+[ into copy-mode select content with mouse(hold) M-w to copy that part into system clipboard C-y the paste it inside tmux, C-v to paste it inside other regular application like web browser. Please note that, with Tmux 2.4 (since this commit), the binding syntax has changed. I paraphrase this Github comment to summarise the change briefly: replace -t with -T replace vi-<name> with <name>-mode-vi prefix the command with send-keys -X I had: bind-key -n -t vi-copy Enter copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' bind-key -n -t vi-copy MouseDragEnd1Pane copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' which I needed to change to: bind-key -n -T

Css Rotate Animation Infinite Code Example

Example 1: how rotate infinity css @-webkit-keyframes rotating /* Safari and Chrome */ { from { -webkit-transform : rotate ( 0 deg ) ; -o-transform : rotate ( 0 deg ) ; transform : rotate ( 0 deg ) ; } to { -webkit-transform : rotate ( 360 deg ) ; -o-transform : rotate ( 360 deg ) ; transform : rotate ( 360 deg ) ; } } @keyframes rotating { from { -ms-transform : rotate ( 0 deg ) ; -moz-transform : rotate ( 0 deg ) ; -webkit-transform : rotate ( 0 deg ) ; -o-transform : rotate ( 0 deg ) ; transform : rotate ( 0 deg ) ; } to { -ms-transform : rotate ( 360 deg ) ; -moz-transform : rotate ( 360 deg ) ; -webkit-transform : rotate ( 360 deg ) ; -o-transform : rotate ( 360 deg ) ; transform : rotate ( 360 deg ) ; } } .rotating { -webkit-animation : rotating 2 s linear infinite ; -moz-animation : rotating 2 s linear infinite ; -ms-animation : rotating 2 s linear infinite ;

The Return 0 Statement In Main Function Indicate Code Example

Example: return 0; c++ // This example gives a reason why you should use using namespace std # include <iostream> using namespace std ; cout << "Hello " << endl ; /* this one is shorter*/ // without the using namespace std you will need to use this std :: cout << "Hello" << std :: cout << endl /* this one is longer and it requires shorter amount of time */

How To Concatenate Strings In Google Sheets Code Example

Example 1: google spreadsheets add two strings CONCAT ( "String1" , "String2" ) //or CONCATENATE ( "String1" , "String2" , "String3" ) //CONCATENATE allows more than 2 strings. Example 2: google sheets concatenate CONCATENATE ( "Welcome" , " " , "to" , " " , "Sheets!" ) CONCATENATE ( A1 , A2 , A3 ) CONCATENATE ( A2 : B7 )

Flexbox Vertical Align Center Code Example

Example 1: css flex vertical align /* Answer to: "css flex vertical align" */ .box { display : flex ; align-items : center ; /* Vertical */ justify-content : center ; /* Horizontal */ } .box div { width : 100 px ; height : 100 px ; } /* For more information go to: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Aligning_Items_in_a_Flex_Container */ Example 2: flexbox align center vertically .Aligner { display : flex ; align-items : center ; justify-content : center ; } .Aligner-item { max-width : 50 % ; } .Aligner-item--top { align-self : flex-start ; } .Aligner-item--bottom { align-self : flex-end ; } Example 3: flex align top css align-items: flex-start | flex-end | center | baseline | stretch .container { display : flex ; align-items : flex-start ; } Example 4: css vertical align with flexbox <div class= "align-vertically" > I am vertically centered! </div> /*Css */ .a

Access IP Camera In Python OpenCV

Image
Answer : An IP camera can be accessed in opencv by providing the streaming URL of the camera in the constructor of cv2.VideoCapture . Usually, RTSP or HTTP protocol is used by the camera to stream video. An example of IP camera streaming URL is as follows: rtsp://192.168.1.64/1 It can be opened with OpenCV like this: capture = cv2.VideoCapture('rtsp://192.168.1.64/1') Most of the IP cameras have a username and password to access the video. In such case, the credentials have to be provided in the streaming URL as follows: capture = cv2.VideoCapture('rtsp://username:password@192.168.1.64/1') This works with my IP camera: import cv2 #print("Before URL") cap = cv2.VideoCapture('rtsp://admin:123456@192.168.1.216/H264?ch=1&subtype=0') #print("After URL") while True: #print('About to start the Read command') ret, frame = cap.read() #print('About to show frame of Video.') cv2.imshow("C

Show 3 Dots Css Code Example

Example: three dots in css span { display : inline-block ; width : 180 px ; white-space : nowrap ; overflow : hidden !important ; text-overflow : ellipsis ; }

Bootstrap Wysihtml5 Set Value Not Working

Answer : You should be able to achieve the same using below $("#<%=txtDescrizioneBreveCategoria.ClientID%>").wysihtml5(); window.describeEditor = window.editor; And then later you should can use describeEditor.setValue(c.DescrizioneBreve, true) or use editorDescrizioneBreve.data("wysihtml5").editor.setValue(c.DescrizioneBreve, true); Where editorDescrizioneBreve is the object returned by $("#<%=txtDescrizioneBreveCategoria.ClientID%>").wysihtml5() PS: Solution based on https://github.com/jhollingworth/bootstrap-wysihtml5/issues/52 For me, this worked: $('.wysihtml5-sandbox').contents().find('body').html(descr) I have only one Wysihtml5 on my page, with multiple, you need to use more precise selector.

Custom Checkbox Bootstrap Code Example

Example 1: bootstrap checkbox <div> <div class= "row" > <div class= "form-check form-check-inline" > <input id= "checkbox2" type= "checkbox" > <label for= "checkbox2" >Checkbox not checked</label> </div> <div class= "form-check form-check-inline" > <input id= "checkbox3" type= "checkbox" checked= "checked" > <label for= "checkbox3" >Checkbox checked</label> </div> </div> </div> Example 2: bootstrap checkbox <!-- Checkbox & Label --> <div class= "form-check" > <input class= "form-check-input" type= "checkbox" value= "" id= "flexCheckDefault" > <label class= "form-check-label" for= "flexCheckDefault" > I want to receive news and updates about this produc

C Program To Generate Random Numbers Without Using Rand Code Example

Example 1: how to genrate a random number in C # include <time.h> # include <stdlib.h> srand ( time ( NULL ) ) ; // Initialization, should only be called once. int r = rand ( ) ; // Returns a pseudo-random integer between 0 and RAND_MAX. Example 2: how to genrate a random number in C srand ( time ( NULL ) ) ; int r = rand ( ) ;

Dropdown Button In Bootstrap 4 Code Example

Example 1: create a dropdown in html bootstrap <div class= "dropdown" > <button class= "btn btn-secondary dropdown-toggle" type= "button" id= "dropdownMenu2" data-toggle= "dropdown" aria-haspopup= "true" aria-expanded= "false" > Dropdown </button> <div class= "dropdown-menu" aria-labelledby= "dropdownMenu2" > <button class= "dropdown-item" type= "button" >Action</button> <button class= "dropdown-item" type= "button" >Another action</button> <button class= "dropdown-item" type= "button" >Something else here</button> </div> </div> Example 2: bootstrap 4 dropdown <div class= "dropdown" > <button class= "btn btn-secondary dropdown-toggle" type= "button" id= "dropdownMenuButton" data-

Pypi Tkinter Code Example

Example: python tkinter import tkinter as tk obj = tk . Tk ( ) # Creates a tkinter object label = tk . Label ( obj , text = "This is a text button" )

Can I Re-sign An .apk With A Different Certificate Than What It Came With?

Answer : try this 1) Change the extension of your .apk to .zip 2) Open and remove the folder META-INF 3) Change the extension to .apk 4) Use the jarsigner and zipalign with your new keystore. hope it helps If you are looking for a quick simple solution, you can use Google's apksigner command line tool which is available in revision 24.0.3 and higher. apksigner sign --ks release.jks application.apk You can find more information about apksigner tool, at the developer Android site. https://developer.android.com/studio/command-line/apksigner.html Or, alternatively, you may use an open-source apk-resigner script Open Source apk-resigner script https://github.com/onbiron/apk-resigner All you have to do is, download the script and just type: ./signapk.sh application.apk keystore key-pass alias zip -d my_application.apk META-INF/\* keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity

Activate Windows 10 Batch Code Example

Example 1: activate win 10 batch file @echo off title Activate Windows 10 ALL versions for FREE! WireDroid.com&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software(WireDroid.com)&echo ============================================================================&echo.&echo #Supported products:&echo - Windows 10 Home&echo - Windows 10 Home N&echo - Windows 10 Home Single Language&echo - Windows 10 Home Country Specific&echo - Windows 10 Professional&echo - Windows 10 Professional N&echo - Windows 10 Education N&echo - Windows 10 Education N&echo - Windows 10 Enterprise&echo - Windows 10 Enterprise N&echo - Windows 10 Enterprise LTSB&echo - Windows 10 Enterprise LTSB N&echo.&echo.&echo ============================================================================&echo Activating your Window

Angry Ip Scanner Mac Code Example

Example: Angry IP Scanner It's an IP Scanner to find open ports in the server and vulnerabelities

Android - Bought A New Battery, Do I Need To Calibrate It?

Answer : No Calibration of batteries (Li Ion or Li Po, used in almost all mobile devices) is a myth You can start using it straight away and charge as you normally did with earlier batteries This post will help you understand more: Looking for a consistent answer about battery calibration Using calibration apps doesn't really help as the battery files in system (to which these apps write) are renewed and previous data erased when you charge / reboot As explained in this article It [ Batterystats.bin file which stores calibration information ] has no impact on the current battery level shown to you. It has no impact on your battery life.......it is reset every time you unplug from power with a relatively full charge (thus why the battery usage UI data resets at that point)... Explanation in Italics mine from the same article Related Myth : Charging a new battery for X hours Charging a new battery for x hours before use is a " legacy hangover &quo

36 Inches In Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Allowed Symbols/characters In Minecraft Chat

Answer : Minecraft officially supports ASCII characters under 0x80. It can render more characters, but they do not render correctly. The supported characters are listed below. !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ã˜×ƒáíóúñѪº¿®¬½¼¡«» You can find this list together with more info about the possibilities( colors, and style) of the chat at the Chat article on the MinecraftCoalition wiki, if figuring out what these characters are is too much trouble. Minecraft chat now accepts 255 characters (a few still do not render correctly). Navigate to the Font section of the Wiki page and click expand to see the full list. The current answer by Krael is out of date and wrong: even the old version contained several characters outside of ASCII. ASCII does not contain accented characters. Instead, Minecraft used to support windows-1252. There are 256 code points in it, of which

ByRef Vs ByVal Clarification

Answer : I think you're confusing the concept of references vs. value types and ByVal vs. ByRef . Even though their names are a bit misleading, they are orthogonal issues. ByVal in VB.NET means that a copy of the provided value will be sent to the function. For value types ( Integer , Single , etc.) this will provide a shallow copy of the value. With larger types this can be inefficient. For reference types though ( String , class instances) a copy of the reference is passed. Because a copy is passed in mutations to the parameter via = it won't be visible to the calling function. ByRef in VB.NET means that a reference to the original value will be sent to the function (1). It's almost like the original value is being directly used within the function. Operations like = will affect the original value and be immediately visible in the calling function. Socket is a reference type (read class) and hence passing it with ByVal is cheap. Even though it does perform a

Don Apply Box Shadow Css On Bottom Border Code Example

Example 1: css box shadow not on bottom box-shadow : 0 px -8 px 10 px lightgrey ; Example 2: box bottom shadow css .box-bottom-shadow { -webkit-box-shadow : 0 8 px 6 px -6 px black ; -moz-box-shadow : 0 8 px 6 px -6 px black ; box-shadow : 0 8 px 6 px -6 px black ; }

How To Give Margin Top In Bootstrap 4 Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities , based on a 1 rem value default $spacer variable. Choose values for all viewports ( e.g. , .mr-3 for margin-right : 1 rem ) , or pick responsive variants to target specific viewports ( e.g. , .mr-md-3 for margin-right : 1 rem starting at the md breakpoint ) . <div class= "my-0 bg-warning" >Margin Y 0 </div> <div class= "my-1 bg-warning" >Margin Y 1 </div> <div class= "my-2 bg-warning" >Margin Y 2 </div> <div class= "my-3 bg-warning" >Margin Y 3 </div> <div class= "my-4 bg-warning" >Margin Y 4 </div> <div class= "my-5 bg-warning" >Margin Y 5 </div> <div class= "my-auto bg-warning" >Margin Y Auto</div> Examp

Design Patterns Interview Questions C# Code Example

Example: c# interview questions /* Answer to: "c# interview questions" */ /* A great place to find interview questions related to C# is here: https://www.guru99.com/c-sharp-interview-questions.html You can 52 common questions related to C# and an additional 20 if you go here: https://hackr.io/blog/c-sharp-interview-questions */

1 Year In Seconds Code Example

Example: A year is a few seconds 1 year = 365.2425 days = (365.2425 days) × (24 hours/day) × (3600 seconds/hour) = 31556952 seconds One Julian astronomical year, has 365.25 days: 1 year = 365.25 days = (365.25 days) × (24 hours/day) × (3600 seconds/hour) = 31557600 seconds One calendar common year has 365 days: 1 common year = 365 days = (365 days) × (24 hours/day) × (3600 seconds/hour) = 31536000 seconds One calendar leap year has 366 days (occures every 4 years): 1 leap year = 366 days = (366 days) × (24 hours/day) × (3600 seconds/hour) = 31622400 seconds

Add Space Between Paragraphs In Beamer

Answer : I had the same problem: blank lines in latex articles produces a clearly separated paragraph, but in Beamer, with the limited space and no indentation, the default new paragraph is does not strikingly separate the paragraphs. My hack solution was to append the following latex code to the end of the paragraph that should have the space. \\~\ For example, try inserting this into a Beamer latex file: \frame{ This is text that should have a blank line after it. \\~\\ Here is text following a blank line. } I've noticed this too when preparing slides. Rather than have two paragraphs and separate them with vertical space explicitly, I've often used one of the following workarounds: convert each of the paragraphs you want to split to a block-like environment such as theorem , question , answer , etc. That way (in my theme, at least) they get boxed and visually separated. if the two paragraphs are supporting material to the same point, use an itemize env