Posts

Showing posts from May, 2002

CSS: How To Get Browser Scrollbar Width? (for :hover {overflow: Auto} Nice Margins)

Answer : All scrollbar can be different according to browser and OS so you must use javascript. I found a cool snippet here : http://davidwalsh.name/detect-scrollbar-width And that an exemple : http://jsfiddle.net/a1m6an3u/ The js code create a div .scrollbar-measure , look the size of the scrollbar and return it. It look like this : var scrollDiv = document.createElement("div"); scrollDiv.className = "scrollbar-measure"; document.body.appendChild(scrollDiv); // Get the scrollbar width var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; console.warn(scrollbarWidth); // Mac: 15 // Delete the DIV document.body.removeChild(scrollDiv); So I quickly added some jquery code but I think you can do it in only JS. Whilst tomtomtom's answer works fantastically, it requires an external CSS snippet that seems somewhat unnecessary, and Yurii's answer requires jQuery, which again seems sorta overkill for this. A slightly more up-to-date and self-contain

Add User To Channel Automatically When User Asks

Answer : The bot ability is limited. It can only send and receive messages in a chat conversation and collect some information about other chat participants. It can not start a new conversation or other client functionality. For automate your task, you should use telegram API. There are some clients such as telegram-cli that use the telegram api and have high level methods. Other clients: tgl (C) kotlogram (Java) telethon (Python) webogram (Web) MadelineProto (PHP) TLSharp (C#) pytg (Python wrapper for telegram-cli) You can invite other users to your channel using: channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates; You can invite several uses at a time, via a list (Vector) of InputUser. This seems consistent with Telegram Desktop and the mobile clients, which allows you to select multiple contacts and add them to your group. InputUser is of the form: inputUser#d8292816 user_id:int access_hash:long = InputUser;

Css ::selection Example

The ::selection CSS pseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text). ::selection { background-color : cyan ; } Allowable properties Only certain CSS properties can be used with ::selection : color background-color text-decoration and its associated properties text-shadow stroke-color , fill-color and stroke-width In particular, background-image is ignored. Syntax /* Legacy Firefox syntax (version 61 and below) */ : : -moz-selection : : selection Examples HTML This text has special styles when you highlight it. < p > Also try selecting text in this paragraph. </ p > CSS /* Make selected text gold on a red background */ ::selection { color : gold ; background-color : red ; } /* Make selected text in a paragraph white on a blue background */ p::selection { color : white ; background-color : blue ; } Result Accessibility concerns Don't ove

Createelement In Jquery Code Example

Example 1: jquery create html element var newDiv = $ ( '<div>My new div</div>' ) ; //create Div Element w/ jquery $ ( "#someOtherElement" ) . append ( newDiv ) ; //append new div somewhere Example 2: code for adding new elements in javascriipt js < html > < head > < title > t1 < / title > < script type = "text/javascript" > function addNode ( ) { var newP = document . createElement ( "p" ) ; var textNode = document . createTextNode ( " This is a new text node" ) ; newP . appendChild ( textNode ) ; document . getElementById ( "firstP" ) . appendChild ( newP ) ; } < / script > < / head > < body > < p id = "firstP" > firstP < p > < / body > < / html > Example 3: create an element jquery $ ( '<div>hello</div>' ) . appendTo ( '#parent' ) ;

Creating A BLOB From A Base64 String In JavaScript

Answer : The atob function will decode a Base64-encoded string into a new string with a character for each byte of the binary data. const byteCharacters = atob(b64Data); Each character's code point (charCode) will be the value of the byte. We can create an array of byte values by applying this using the .charCodeAt method for each character in the string. const byteNumbers = new Array(byteCharacters.length); for (let i = 0; i < byteCharacters.length; i++) { byteNumbers[i] = byteCharacters.charCodeAt(i); } You can convert this array of byte values into a real typed byte array by passing it to the Uint8Array constructor. const byteArray = new Uint8Array(byteNumbers); This in turn can be converted to a BLOB by wrapping it in an array and passing it to the Blob constructor. const blob = new Blob([byteArray], {type: contentType}); The code above works. However the performance can be improved a little by processing the byteCharacters in smaller slices, rather than all at o

Visaul Studi Code Code Example

Example 1: visual studio code May the . code be with you . . . Example 2: visual studio code VSCode is a great editor with plenty of extensions ! It's one of the most popular ones as well . Once installed , you might want to check out the various settings . Try installing a theme from the Extensions Marketplace , along with any others you might need , like Git tools , and language support extensions .

18 Minute Timer Code Example

Example: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds

Cp-algorithms.com Articulation Points Code Example

Example: cp algorithm articulation points int n ; // number of nodes vector < vector < int >> adj ; // adjacency list of graph vector < bool > visited ; vector < int > tin , low ; int timer ; void dfs ( int v , int p = - 1 ) { visited [ v ] = true ; tin [ v ] = low [ v ] = timer ++ ; int children = 0 ; for ( int to : adj [ v ] ) { if ( to == p ) continue ; if ( visited [ to ] ) { low [ v ] = min ( low [ v ] , tin [ to ] ) ; } else { dfs ( to , v ) ; low [ v ] = min ( low [ v ] , low [ to ] ) ; if ( low [ to ] >= tin [ v ] && p != - 1 ) IS_CUTPOINT ( v ) ; ++ children ; } } if ( p == - 1 && children > 1 ) IS_CUTPOINT ( v ) ; } void find_cutpoints ( ) { timer = 0 ; visited . assign ( n , false ) ; tin . assig

Hexadecimal Transparent Color Code Example

Example: hex color transparent background-color : #ffffff80 ; < --- 80 is 50 % opacity /*r g b a*/ # ff ff ff 80 ; Converted values : 100 % — FF 99 % — FC 98 % — FA 97 % — F7 96 % — F5 95 % — F2 94 % — F0 93 % — ED 92 % — EB 91 % — E8 90 % — E6 89 % — E3 88 % — E0 87 % — DE 86 % — DB 85 % — D9 84 % — D6 83 % — D4 82 % — D1 81 % — CF 80 % — CC 79 % — C9 78 % — C7 77 % — C4 76 % — C2 75 % — BF 74 % — BD 73 % — BA 72 % — B8 71 % — B5 70 % — B3 69 % — B0 68 % — AD 67 % — AB 66 % — A8 65 % — A6 64 % — A3 63 % — A1 62 % — 9 E 61 % — 9 C 60 % — 99 59 % — 96 58 % — 94 57 % — 91 56 % — 8 F 55 % — 8 C 54 % — 8 A 53 % — 87 52 % — 85 51 % — 82 50 % — 80 49 % — 7 D 48 % — 7 A 47 % — 78 46 % — 75 45 % — 73 44 % — 70 43 % — 6 E 42 % — 6 B 41 % — 69 40 % — 66 39 % — 63 38 % — 61 37 % — 5 E 36 % — 5 C 35 % — 59 34 % — 57 33 % — 54 32 % — 52 31 % — 4 F 30 % — 4 D 29 % — 4 A 28 % — 47 27 % — 45 26 % — 42 25 % — 40

Converting Two Columns Of A Data Frame To A Named Vector

Answer : Use the names function: whatyouwant <- as.character(dd$name) names(whatyouwant) <- dd$crit as.character is necessary, because data.frame and read.table turn characters into factors with default settings. If you want a one-liner: whatyouwant <- setNames(as.character(dd$name), dd$crit) You can also use deframe(x) from the tibble package for this. tibble::deframe() It converts the first column to names and second column to values. You can make a vector from dd$name , and add names using names() , but you can do it all in one step with structure() : whatiwant <- structure(as.character(dd$name), names = as.character(dd$crit))

Css Position Initial Code Example

Example: popsition relative css An element with position: relative; is positioned relative to its normal position. Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

Android -room Persistent Library - DAO Calls Are Async, Therefore How To Get Callback?

Answer : If you want to do your query synchronously and not receive notifications of updates on the dataset, just don't wrap you return value in a LiveData object. Check out the sample code from Google. Take a look at loadProductSync() here There is a way to turn off async and allow synchronous access. when building the database you can use :allowMainThreadQueries() and for in memory use: Room.inMemoryDatabaseBuilder() Although its not recommended. So in the end i can use a in memory database and main thread access if i wanted super fast access. i guess it depends how big my data is and in this case is very small. but if you did want to use a callback.... using rxJava here is one i made for a list of countries i wanted to store in a database: public Observable<CountryModel> queryCountryInfoFor(final String isoCode) { return Observable.fromCallable(new Callable<CountryModel>() { @Override public CountryModel call() throws Exception {

CSS @media Print Not Working At All

Answer : If you are using @media print, you need to add !important in your styles, or the page will use the element's inline styles that have higher priority. E.g. <div class="myelement1" style="display:block;">My div has an inline style.</div> In @media print, add !important and be a winner @media print { .myelement1, .myelement2 { display: none !important; } } First, I'd try adding a space after print. May not make a difference, but..... @media print { /*print css here*/ } Next, printing in browsers usually ignores background colors. Try using 'box-shadow'.... @media print { #bruikleenovereenkomst { width: 100%; height: 500px; box-shadow: inset 0 0 0 1000px #000; } } Smashing Magazine has some excellent pointers: http://www.smashingmagazine.com/2013/03/tips-and-tricks-for-print-style-sheets/ Note that they talk about printing from a Webkit browser (Chrome or Safari, for example), and a

Call Of Duty: Black Ops Cold War Full Torrent Torrent Oyun Code Example

Example: call of duty black ops cold war download pc torrent Call of Duty Black Ops Cold War TORRENT https://megaup.net/2VI6v/Call.of.Duty.Black.Ops.Cold.War.torrent https://gofile.io/?c=7GLhJO https://1fichier.com/?3wdqr2o7evrpm4pry6lb https://letsupload.io/26sqi https://mirrorace.org/m/31Sfs https://racaty.net/911gcx0cmnei https://uptobox.com/l18o6ltlv30q https://dropapk.to/wq8yxxdi9x5x https://www.sendspace.com/file/kgllfe https://www113.zippyshare.com/v/YNsHCiCk/file.html

Styling Scrollbars Css Code Example

Example 1: custom scrollbar body ::-webkit-scrollbar { width : 12 px ; /* width of the entire scrollbar */ } body ::-webkit-scrollbar-track { background : orange ; /* color of the tracking area */ } body ::-webkit-scrollbar-thumb { background-color : blue ; /* color of the scroll thumb */ border-radius : 20 px ; /* roundness of the scroll thumb */ border : 3 px solid orange ; /* creates padding around scroll thumb */ } Example 2: custom scrollbar ::-webkit-scrollbar { /* 1 */ } ::-webkit-scrollbar-button { /* 2 */ } ::-webkit-scrollbar-track { /* 3 */ } ::-webkit-scrollbar-track-piece { /* 4 */ } ::-webkit-scrollbar-thumb { /* 5 */ } ::-webkit-scrollbar-corner { /* 6 */ } ::-webkit-resizer { /* 7 */ } /* Different States */ : horizontal : vertical : decrement : increment : start : end : double-button : single-button : no-button : corner-present : window

Javascript Get Data Attribute Value Code Example

Example 1: js get data attribute var element = document. querySelector ( '.element' ) ; var dataAttribute = element. getAttribute ( 'data-name' ) ; // replace "data-name" with your data attribute name console. log ( dataAttribute ) ; Example 2: html javascript find data attribute //javascript get html data attribute <button data-id= "1" >Click</button> <button data-id= "2" >Click</button> <button data-id= "3" >Click</button> const btns=document. querySelectorAll ( 'button[data-id]' ) ; [...btns]. forEach ( btn => console. log ( btn. getAttribute ( 'data-id' ) ) ) Example 3: javascript get data-id attribute //get data-id attribute in plain Javascript var element = document. getElementById ( 'myDivID' ) ; var dataID = element. getAttribute ( 'data-id' ) ; //get data-id using jQuery var dataID = $ ( 'myDivID' ) . data ( 'data-id' ) ; Example

Css Margin Vs Padding Code Example

Example 1: css padding padding: 5px 10px 15px 20px; //top right bottom left padding: 10px 20px;//top & bottom then left & right padding-top: 5px; //just top padding padding-right: 10px; //just right padding padding-bottom: 15px; //just bottom padding padding-left: 20px; //just left padding Example 2: margin vs padding Margin is on the outside of block elements, padding is on the inside. Use margin to separate the block from things outside it Use padding to move the contents away from the edges of the block. Main differences: - Vertical margins of adjacent items will overlap, padding will not - Padding is included in the click region and background color/image, but not the margin Example 3: react native margin vs padding padding is the space between the content and the border, whereas margin is the space outside the border. Example 4: css padding vs margin /* Answer to: "css padding vs margin" */ /* Margin is outer space of an element, while padding is inner space

Bootstrap Table Responsive In Mobile View Code Example

Example 1: responsive table bootstrap 4 < div class = " table-responsive-sm " > < table class = " table " > ... </ table > </ div > Example 2: responsive bootstrap table < table class = " table " > < thead > < tr > < th scope = " col " > # </ th > < th scope = " col " > First </ th > < th scope = " col " > Last </ th > < th scope = " col " > Handle </ th > </ tr > </ thead > < tbody > < tr > < th scope = " row " > 1 </ th > < td > Mark </ td > < td > Otto </ td > < td > @mdo </ td > </ tr > < tr > < th scope = " row " > 2 </ th > < td > Jacob </ td > < td > Thorn

Css Disable Input Code Example

Example 1: disable form field with css <!DOCTYPE html > <html > <head > <title > Title of the document</title > <style > input [ name = name ] { pointer-events : none ; } </style> </head> <body> <input type= "text" name= "name" value= "w3docs" > </body> </html> Example 2: css disable input <input type="text" name="username" value="admin" tabindex="-1" > <style type="text/css" > input [ name = username ] { pointer-events : none ; } </style> Example 3: css disable input <input type="text" name="username" value="admin" > <style type="text/css" > input [ name = username ] { disabled : true ; /* Does not work */ } </style> Example 4: css disable input <input type="text" name="

CakePHP Log\Engine (namespace)

Classes summary ArrayLog Array logger. ConsoleLog Console logging. Writes logs to console output. BaseLog Base log engine class. SyslogLog Syslog stream for Logging. Writes logs to the system logger FileLog File Storage stream for Logging. Writes logs to different files based on the level of log it is.

Can I Delete A Git Commit But Keep The Changes?

Answer : It's as simple as this: git reset HEAD^ Note: some shells treat ^ as a special character (for example some Windows shells or ZSH with globbing enabled), so you may have to quote "HEAD^" in those cases. git reset without a --hard or --soft moves your HEAD to point to the specified commit, without changing any files. HEAD^ refers to the (first) parent commit of your current commit, which in your case is the commit before the temporary one. Note that another option is to carry on as normal, and then at the next commit point instead run: git commit --amend [-m … etc] which will instead edit the most recent commit, having the same effect as above. Note that this (as with nearly every git answer) can cause problems if you've already pushed the bad commit to a place where someone else may have pulled it from. Try to avoid that There are two ways of handling this. Which is easier depends on your situation Reset If the commit you want to

Coreference Resolution In Python Nltk Using Stanford CoreNLP

Image
Answer : As mentioned by @Igor You can try the python wrapper implemented in this GitHub repo: https://github.com/dasmith/stanford-corenlp-python This repo contains two main files: corenlp.py client.py Perform the following changes to get coreNLP working: In the corenlp.py, change the path of the corenlp folder. Set the path where your local machine contains the corenlp folder and add the path in line 144 of corenlp.py if not corenlp_path: corenlp_path = <path to the corenlp file> The jar file version number in "corenlp.py" is different. Set it according to the corenlp version that you have. Change it at line 135 of corenlp.py jars = ["stanford-corenlp-3.4.1.jar", "stanford-corenlp-3.4.1-models.jar", "joda-time.jar", "xom.jar", "jollyday.jar"] In this replace 3.4.1 with the jar version which you have downloaded. Run the command: python corenlp.py This

Bungeecord 1.15 Maven Code Example

Example: bungeecord api maven < repositories > < repository > < id > bungeecord-repo </ id > < url > https://oss.sonatype.org/content/repositories/snapshots </ url > </ repository > </ repositories > < dependencies > < dependency > < groupId > net.md-5 </ groupId > < artifactId > bungeecord-api </ artifactId > < version > 1.16-R0.4-SNAPSHOT </ version > < type > jar </ type > < scope > provided </ scope > </ dependency > < dependency > < groupId > net.md-5 </ groupId > < artifactId > bungeecord-api </ artifactId > < version > 1.16-R0.4-SNAPSHOT </ version > < type > javadoc </ type > < scope &g

Android Studio Table Layout Example

Example: table layout android studio < TableLayout android: id = " @+id/table " android: layout_width = " match_parent " android: layout_height = " wrap_content " android: layout_marginVertical = " 30dp " android: layout_marginHorizontal = " 10dp " android: background = " #f1f1f1 " android: collapseColumns = " 1,2 " > < TableRow > < TextView android: layout_width = " wrap_content " android: layout_height = " wrap_content " android: text = " Name " android: textStyle = " bold " android: layout_weight = " 1 " android: gravity = " center " /> < TextView android: layout_width = " wrap_content " a