Posts

Showing posts from November, 2006

Fitting Image Without Distortion Css Code Example

Example: css resize image without distortion .frame { height : 250 px ; background : transparent no-repeat center ; background-size : cover ; background-image : url ( 'http://i.imgur.com/lNB7QSt.jpg' ) }

Could Not Connect To Websocket Endpoint Ws. Please Check If The Endpoint Url Is Correct. Code Example

Example: could not connect to websocket endpoint ws://localhost:4000/graphql. please check if the endpoint url is correct. The it turns out that Firefox has issues with websockets (see this bug report that has been re-appeared even after the supposed fix). In Firefox it works directly after starting a novel browser but after some hot reloading it stops working. The following helps out with starting out fresh but not with the reloading issue: const wsLink = new WebSocketLink({ uri: SUBSCRIPTION_URI, options: { reconnect: true, timeout: 20000, lazy: true, }, }); window.addEventListener('beforeunload', () => { // @ts-ignore - the function is private in typescript wsLink.subscriptionClient.close(); }); I think the bug is related to this SO-question: "websocket was interrupted while page is loading" on Firefox for Socket.io If you want to test different solutions I've created an example repo: https://github.com/gforge/subscription_example th

Android - Can I Run A Webserver On An Android Device?

Answer : Absolutely! You can either: download a ready made one - like kWS - Android Web Server or write your own - here's some code to integrate in to your project or just use as is. The book Pro Android Python with SL4A comes with some free downloadable source code, you can find it on that official site. In the source code samples there are examples of basic httpserver, and basic ftpserver. Both of those will work on Android devices, I imagine it is also possible to make a more advanced webserver using python, or perhaps even re-purpose one that is already in existence. There are actually several apps on the Google Play Store. A few of them even have PHP. My personal favorite is Servers Ultimate.

How To Align Image In Center In Html Code Example

Example 1: css center image .center { display : block ; margin-left : auto ; margin-right : auto ; } Example 2: html center image /* It's better practice to do this in CSS, not HTML. So here is the CSS code! */ img { display : block ; margin-left : auto ; margin-right : auto ; } Example 3: center an image .someclass { display : block ; margin-left : auto ; margin-right : auto ; } Example 4: html css center image <div style= "text-align: center;" > <img scr= 'img/example.jpg' > </div> Example 5: center image html .centered { position : fixed ; top : 50 % ; left : 50 % ; transform : translate ( -50 % , -50 % ) ; -webkit-transform : translate ( -50 % , -50 % ) ; -moz-transform : translate ( -50 % , -50 % ) ; -o-transform : translate ( -50 % , -50 % ) ; -ms-transform : translate ( -50 % , -50 % ) ; font-size : 20 px ; background-color : cyan ; border : darkgreen 5 px solid

How To Write Media Query For Ipad In Landscape Code Example

Example: all ipad Resolutio css @media all and ( device-width : 768 px ) and ( device-height : 1024 px ) and ( orientation : portrait ) { .ipad-portrait { color : red ; } /* your css rules for ipad portrait */ } @media all and ( device-width : 1024 px ) and ( device-height : 768 px ) and ( orientation : landscape ) { .ipad-landscape { color : blue ; } /* your css rules for ipad landscape */ }

Rotate Background Image In Css Code Example

Example: rotate background image css .theWholeElement { transform : rotate ( 30 deg ) ; } .justTheBackground { position : relative ; overflow : hidden ; } .justTheBackground ::before { content : "" ; position : absolute ; width : 200 % ; height : 200 % ; top : -50 % ; left : -50 % ; z-index : -1 ; background : url ( background.png ) 0 0 repeat ; transform : rotate ( 30 deg ) ; }

Adding An External Directory To Tomcat Classpath

Answer : Just specify it in shared.loader or common.loader property of /conf/catalina.properties . See also question: Can I create a custom classpath on a per application basis in Tomcat Tomcat 7 Context hold Loader element. According to docs deployment descriptor (what in <Context> tag) can be placed in: $CATALINA_BASE/conf/server.xml - bad - require server restarts in order to reread config $CATALINA_BASE/conf/context.xml - bad - shared across all applications $CATALINA_BASE/work/$APP.war:/META-INF/context.xml - bad - require repackaging in order to change config $CATALINA_BASE/work/[enginename]/[hostname]/$APP/META-INF/context.xml - nice , but see last option!! $CATALINA_BASE/webapps/$APP/META-INF/context.xml - nice , but see last option!! $CATALINA_BASE/conf/[enginename]/[hostname]/$APP.xml - best - completely out of application and automatically scanned for changes!!! Here my config which demonstrate how to use development version of project files

Transform Skew Css Support Code Example

Example 1: css transform transform : matrix ( 1 , 2 , 3 , 4 , 5 , 6 ) ; transform : matrix3d ( 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ) ; transform : translate ( 120 px , 50 % ) ; transform : scale ( 2 , 0.5 ) ; transform : rotate ( 0.5 turn ) ; transform : skew ( 30 deg , 20 deg ) ; transform : scale ( 0.5 ) translate ( -100 % , -100 % ) ; transform : perspective ( 17 px ) ; Example 2: css scale transform : scale ( sx , sy ) ;

Find Find Method In Python Code Example

Example: find in python def find_all_indexes ( input_str , search_str ) : l1 = [ ] length = len ( input_str ) index = 0 while index < length : i = input_str . find ( search_str , index ) if i == - 1 : return l1 l1 . append ( i ) index = i + 1 return l1 s = 'abaacdaa12aa2' print ( find_all_indexes ( s , 'a' ) ) print ( find_all_indexes ( s , 'aa' ) )

Android > Chrome Chromecast Icon Over Html5 Video Position

Answer : There is another options to disable casting button, this option actually disables the button instead of hiding it. <video disableRemotePlayback src="..."> https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/disableRemotePlayback https://developers.google.com/web/updates/2015/11/presentation-api After searching the Chromium source code, I figured out how to do it: video::-internal-media-controls-overlay-cast-button { display: none; } Example: http://jsfiddle.net/f1quhd2L/8/

Full Screen Background Image Css Code Example

Example 1: set background image full screen css #mainBackground { width : 100 % ; height : 100 % ; max-height : 100 % ; margin : 0 ; padding : 0 ; background-image : url ( "https://images.unsplash.com/photo-1487058792275-0ad4aaf24ca7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" ) ; background-size : 100 % 100 % ; background-repeat : no-repeat ; } html , body { height : 100 % ; margin : 0 ; padding : 0 ; } Example 2: css background image cover center html { background : url ( images/bg.jpg ) no-repeat center center fixed ; -webkit-background-size : cover ; -moz-background-size : cover ; -o-background-size : cover ; background-size : cover ; } Example 3: how to cover full image in css body { background-position : center ; background-repeat : no-repeat ; background-size : cover ; } Example 4: background image css fill screen .Background { b

Div Circle Shape Css Code Example

Example 1: css circle #circle { width : 100 px ; height : 100 px ; background : red ; border-radius : 50 % } Example 2: making a circle css #circle { width : 100 px ; height : 100 px ; background : red ; border-radius : 50 % }

Angular 9 Tutorialspoint Code Example

Example 1: Angular 9 tutorial < div class = "calculator" > < input type = "text" class = "calculator-screen" value = "0" disabled / > < div class = "calculator-keys" > < button type = "button" class = "operator" value = "+" > + < / button > < button type = "button" class = "operator" value = "-" > - < / button > < button type = "button" class = "operator" value = "*" > × < / button > < button type = "button" class = "operator" value = "/" > ÷ < / button > < button type = "button" value = "7" > 7 < / button > < button type = "button" value = "8" > 8 < / button > < button type = "button" value = "9" > 9 < / b

Overlapping Content W3school Code Example

Example: css overlay #hero { background-image : url ( ) ; background-size : cover ; background-position : top center ; position : relative ; } #hero ::after { content : '' ; position : absolute ; left : 0 ; top : 0 ; height : 100 % ; width : 100 % ; background-color : black ; opacity : 0.7 ; }

Python Gcd Of Three Numbers Code Example

Example: python code for gcd of two numbers # Function to find HCF the Using Euclidian algorithm def compute_hcf ( x , y ) : while ( y ) : x , y = y , x % y return x hcf = compute_hcf ( 300 , 400 ) print ( "The HCF is" , hcf )

How To Bold Text In Latex Code Example

Example 1: latex italic text \textit { text } Example 2: latex bold text \textbf { text } Example 3: bold text latex \textbf { accident } Example 4: bold italic text in latex \textit { \textbf { text } } Example 5: bold italic text in latex \documentclass { article } \makeatletter \DeclareRobustCommand\bfseriesitshape { % \ not @math@alphabet\itshapebfseries\relax \fontseries\bfdefault \fontshape\itdefault \selectfont } \makeatother \DeclareTextFontCommand { \textbfit } { \bfseriesitshape } \begin { document } \scshape % now the current font shape is small caps \textit { \textbf { f } } f \textbf { \textit { f } } f % % causes LaTeX Font Warning { \fontseries\bfdefault\textit { f } f } \textbfit { f } f \end { document }

Creating A New User And Password With Ansible

Answer : I may be too late to reply this but recently I figured out that jinja2 filters have the capability to handle the generation of encrypted passwords. In my main.yml I'm generating the encrypted password as: - name: Creating user "{{ uusername }}" with admin access user: name: {{ uusername }} password: {{ upassword | password_hash('sha512') }} groups: admin append=yes when: assigned_role == "yes" - name: Creating users "{{ uusername }}" without admin access user: name: {{ uusername }} password: {{ upassword | password_hash('sha512') }} when: assigned_role == "no" - name: Expiring password for user "{{ uusername }}" shell: chage -d 0 "{{ uusername }}" "uusername " and "upassword " are passed as --extra-vars to the playbook and notice I have used jinja2 filter here to encrypt the passed password. I have added below tutorial related to this to my

Can I Use Multiple URLs In The URL Field Of KeePass?

Image
Answer : You can create a copy of a password entry: And then only use references for username and password in the new entry: Then, adjust the URL in the new entry. The answer from Oliver Salzburg is very good. Complementing it, if you already have an entry and want to link another entry, go to the entry, properties, then tools, insert field reference and link to the type you need. See an example here: Switch to KeePassXC. As of the 2.5.0 release, this now works as you would expect.

Roblox Lua New Position Out Of Cframe Code Example

Example: Cframe guide -- //Normal CFrame CFrame . new ( 0 , 0 , 0 ) -- //Quaternion CFrame CFrame . new ( 5 , 5 , 5 , 0 , 0 , 0 , 0 ) W , X , Y , Z

Parseint Js Code Example

Example 1: intval js parseInt ( value ) ; let string = "321" console . log ( string ) ; // "321" <= string let number = parseInt ( string ) ; console . log ( number ) // 321 <=int Example 2: Javascript string to int var myInt = parseInt ( "10.256" ) ; //10 var myFloat = parseFloat ( "10.256" ) ; //10.256 Example 3: parseint javascript var myInt = parseInt ( "10.256" ) ; //10 var myFloat = parseFloat ( "10.256" ) ; //10.256 Example 4: string to int javascript var text = '42px' ; var integer = parseInt ( text , 10 ) ; // returns 42 let myNumber = Number ( "5.25" ) ; //5.25 Example 5: string to int javascript var text = '42px' ; var integer = parseInt ( text , 10 ) ; // returns 42 Example 6: parseint js parseInt ( " 0xF" , 16 ) ; parseInt ( " F" , 16 ) ; parseInt ( "17" , 8 ) ; parseInt ( 021 , 8 ) ; parseInt ( &qu

Mdm Text Wrap Css Code Example

Example 1: css wordwrap .ow { overflow-wrap : break-word ; word-wrap : break-word ; hyphens : auto ; white-space : normal ; //this is the one that gets you all the time } Example 2: how to wrap text in div css .example { overflow-wrap : break-word ; }

Text Color Gradient Generator Code Example

Example 1: text color as gradient css .gradient-text { background-color : #f3ec78 ; background-image : linear-gradient ( 45 deg , #f3ec78 , #af4261 ) ; background-size : 100 % ; -webkit-background-clip : text ; -moz-background-clip : text ; -webkit-text-fill-color : transparent ; -moz-text-fill-color : transparent ; } Example 2: gradient text h1 { font-size : 72 px ; background : -webkit-linear-gradient ( #eee , #333 ) ; -webkit-background-clip : text ; -webkit-text-fill-color : transparent ; } Example 3: color gradient generator /* "element" bieng the target class item to style */ .element { background : rgb ( 2 , 0 , 36 ) !important ; background : linear-gradient ( 331 deg , rgba ( 2 , 0 , 36 , 1 ) 0 % , rgba ( 139 , 88 , 94 , 1 ) 0 % , rgba ( 53 , 101 , 125 , 1 ) 14 % , rgba ( 40 , 127 , 156 , 1 ) 29 % , rgba ( 0 , 212 , 255 , 1 ) 100 % ) !important ; padding-bottom : 4 % ; } Example 4: Grad

Can Std::transform Be Replaced By Std::accumulate?

Answer : Those two algorithms have completely different purpose. std::accumulate is known as fold in functional programming world, and it's purpose is iterate over elements of a sequence and apply two-argument folding operation to those elements, with one argument being result of previous fold and other being element of the sequence. It naturally returns the a single result - a fold of all elements of a sequence into one value. On the other hand, std::transform copies values from one sequence to another, applying a unary operation to each element. It returns an iterator to the end of sequence. The fact that you can supply any code as the fold operation allows us to use std::accumulate as a generic loop replacement, including an option to copy values into some other container, but that it is ill-advised, as the whole reason for introducing those (rather simple) algorithms was to make programs more explicit. Making one algo to perform the task which is normally associat

Automapper Documentation Code Example

Example: c# mapper.map var config = new MapperConfiguration ( cfg => { cfg . CreateMap < AuthorModel , AuthorDTO > ( ) ; } ) ; IMapper iMapper = config . CreateMapper ( ) ; var source = new AuthorModel ( ) ; source . Id = 1 ; source . FirstName = "Joydip" ; source . LastName = "Kanjilal" ; source . Address = "India" ; var destination = iMapper . Map < AuthorModel , AuthorDTO > ( source ) ; Console . WriteLine ( "Author Name: " + destination . FirstName + " " + destination . LastName ) ;

Tan Color Hex Code Example

Example: hex color code for tan /* Hex Color Code For Tan */ #D2B48C

Cookie Clicker Addons Code Example

Example 1: cookie clicker #Hacks: # Type these in your console which you can open by # pressing STRG + SHIFT + J (Chrome) or STRG + SHIFT + K (Firefox) # changes the amount of cookies Game.cookies = amount in int # unlimted cookies Game.cookies = Infinity # If you want to get out of Infinity cookies Game.cookiesd = 0 # set up the CookiesPerSecond Rate by the number you want Game.cookiesPS= amount in int # clicks on cookie forever without moving your mouse in the highest speed var autoclicker = setInterval(function() { Game.ClickCookie(); }, 10); # stoping autoclicker clearInterval(autoClicker) # clicks on golden cookie without moving your mouse setInterval(Game.goldenCookie.click, 500) # Get the achievement you want by changing it to the achievement name you want # Game.Win(‚ACHIEVEMENT‘) Example 2: cookie clicker edit : getting out of infinity cookies doesnt work lol

Can EXE Generated By Cx_freeze Be Completely Decompiled Back To Readable Python Code?

Image
Answer : In general - no. CX Freeze and py2exe store the PYC version of your code, the bytecode compiled from the PY files. Currently, if I am not mistaken, there are no working viable PYC decompilers. Some give you a more-or-less readable byte code with annotations, but none will give you the actual Python source code. So in that regard - no, it cannot be decompiled. You can also consider going the full native way and use Shed Skin It seems that the current accepted answer is no longer true. Here is how to recover the original source code from a project frozen with cx_freeze . Note: it is done here on a "Hello world" project, but, using the same method, I've been able to decompile a 1000+ lines-of-code source code from a project of mine frozen with cx_freeze , and recover nearly the original source code! 1) Use cx_freeze Create a test.py file containing import time print('hello') time.sleep(2) print('world') Then create the executable with cxf

Angular Router Link Open New Tab To Url Code Example

Example: javascript open link in new tab function NewTab() { window.open( "https://www.yourURL.com", "_blank"); }

Add Item Object Collection Laravel Code Example

Example: add to collection laravel $item = collect ( ) ; $item - > push ( $product ) ;

Line Html Separator Code Example

Example 1: horizontal line html <!-- code --> <hr> <!-- code --> Example 2: which is right or in html <hr> <!-- it represents a horizontal line break , in HTML4.0 we use <hr> , in XHTML1.0 we use <hr/> , in HTML5 ( which is the current version of HTML ) we can use both <hr> and <hr/> --> Example 3: hr tag html <hr> <!-- A horizontal line -->