Posts

Showing posts from July, 2008

Css Text Border Outline Code Example

Example 1: css text outline /* You have 2 options The first is experimental */ /* text-stroke */ #example { font-size : 1 em ; -webkit-text-stroke : 1 px #000000 ; } /* Use 4 shadows Probably best to use this until the above is standardised */ #example { font-size : 1 em ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } Example 2: text border css h1 { -webkit-text-stroke : 1 px black ; }

Css Width To Fit Content Code Example

Example 1: css width fit to content width : fit-content ; Example 2: css div width fit content display : inline-block ;

Can An Interface Extend Multiple Interfaces In Java?

Answer : Yes, you can do it. An interface can extend multiple interfaces, as shown here: interface Maininterface extends inter1, inter2, inter3 { // methods } A single class can also implement multiple interfaces. What if two interfaces have a method defining the same name and signature? There is a tricky point: interface A { void test(); } interface B { void test(); } class C implements A, B { @Override public void test() { } } Then single implementation works for both :). Read my complete post here: http://codeinventions.blogspot.com/2014/07/can-interface-extend-multiple.html An interface can extend multiple interfaces . A class can implement multiple interfaces . However, a class can only extend a single class . Careful how you use the words extends and implements when talking about interface and class . Can an interface extend multiple interfaces in java? Answer is: Yes. According to JLS An interface ma

Can I Calculate And Use Element Height With SASS \ Compass

Answer : You seem to have got the XY problem. You have a task to solve, and instead of asking us about the task, you ask about a solution that you tried and already found inappropriate. Why do you want to apply the top property equal to half of element's height and negated? Because you want to move an absolutely positioned element half its height up . This is the original task. There's a simple solution to achieve that, and SASS is not even necessary! (Actually, as long as you don't know element's height, SASS can't provide more help than CSS.) We'll need an extra wrapper: <div class=container> <div class=elements-wrapper> <div class=element> </div> </div> </div> To push the element up for 50% of its height, do two simple steps: 1) Push its wrapper up fully out of the container: .elements-wrapper { position: absolute; bottom: 100%; } 2) Now pull the element down for 50% of its height: .ele

Can I Fully Prevent SQL Injection By PDO Prepared Statement Without Bind_param?

Answer : You're doing it right. The bound parameters are the one declared in a "prepared statement" using ?. Then they are bound using execute() with their value as a parameter to be bound to the statement. The protection comes from using bound parameters, not from using prepared statement Means it is not enough just to use prepare() but keep all variables in the query like this: $sql = $db->prepare("SELECT * FROM employees WHERE name ='$name'"); $sql->execute(); $rows = $sql->fetchAll(); Someone who said that meant "although technically you are using a prepared statement, you aren't binding variables to it". So it makes the query vulnerable all the same. To be protected, you have to substitute all variables in the query with placeholders, and then bind them: $sql = $db->prepare("SELECT * FROM employees WHERE name = ?"); $sql->bindParam(1, $name); $sql->execute(); $rows = $sql->fetchAll();

Can You "compile" PHP Code And Upload A Binary-ish File, Which Will Just Be Run By The Byte Code Interpreter?

Answer : After this question was asked, Facebook launched HipHop for PHP which is probably the best-tested PHP compiler to date (seeing as it ran one of the world’s 10 biggest websites). However, Facebook discontinued it in favour of HHVM, which is a virtual machine, not a compiler. Beyond that, googling PHP compiler turns up a number of 3rd party solutions. PeachPie PeachPie GitHub compiles PHP to .NET and .NET Core can be compiled into self-contained binary file runs on Mac, Linux, Windows, Windows Core, ARM, ... Phalanger GitHub (download), Wikipedia compiles to .NET (CIL) looks discontinued from July 2017 and doesn't seem to support PHP 7. phc compiles to native binaries not very active now (February 2014) – last version in 2011, last change in summer 2013 Roadsend PHP Compiler GitHub, GitHub of a rewrite free, open source implementation of PHP with compiler compiles to native binaries (Windows, Linux) discontinued since 2010 till contribut

New Instagram Gradient Color Code Css Code Example

Example: linear gradient instagram background : #f09433 ; background : -moz-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : -webkit-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; filter : progid : DXImageTransform.Microsoft. gradient ( startColorstr= '#f09433' , endColorstr= '#bc1888' , GradientType= 1 ) ;

Pick Random Color Css Code Example

Example 1: random color in javascript var randomColor = Math. floor ( Math. random ( ) * 16777215 ) . toString ( 16 ) ; Example 2: random color generator css,javascript,html //Javascript function randomColor ( ) { var color = "#" ; var randomHex = "123456ABCDEF" ; for ( var i = 0 ; i< 6 ;i + + ) { color+= randomHex[Math. floor ( Math. random ( ) * 16 ) ] } return color ; } var mytimer ; function setColor ( ) { $ ( "body" ) . css ( "background-color" , randomColor ) ; } var mytimer = setInterval ( setColor , .8000 ) ; // html !DOCTYPE html> <html> <head> <title>Page Title</title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" ></script> </head> <body> //include javascript file. </body> </html>

Create Queue Table Laravel Code Example

Example 1: how to automatically run queue in laravel for queues with no queue name i.e. queue name = default php artisan queue:work or php artisan queue:listen for jobs with a queue name. Let's assume i have a queue with name = sendemail php artisan queue:listen --queue=sendemail note: queue:work will only work for jobs entries currently in jobs table in database and stop. queue:listen will go on processing queues continously, both for current and new entries. Example 2: start laravel queue php artisan queue:work --queue=high,default

Css Linear Gradient Generator Code Example

Example 1: css gradient Here a codePen with cool gradient animations : https : //codepen.io/DevLorenzo/pen/ExgpvJM Example 2: css gradient generator /* 5 Best CSS Gradient Generator Links */ https : //cssgradient.io/ https : //www.colorzilla.com/gradient-editor/ https : //www.css-gradient.com/ https : //mycolor.space/gradient https : //uigradients.com/#Orca Example 3: css gradient generator /*CSS Gradient Generator*/ https : //cssgradient.io/ /*Example*/ .My-Class { background : linear-gradient ( to right , blue /*Color1*/ , dodgerblue /*Color1*/ ) ; } Example 4: 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 % ; } Exa

Angular 5 Scroll To Top On Every Route Click

Answer : There are some solutions, make sure to check them all :) The router outlet will emit the activate event any time a new component is being instantiated, so we could use (activate) to scroll (for example) to the top: app.component.html <router-outlet (activate)="onActivate($event)" ></router-outlet> app.component.ts onActivate(event) { window.scroll(0,0); //or document.body.scrollTop = 0; //or document.querySelector('body').scrollTo(0,0) ... } Use, for exemple, this solution for a smooth scroll: onActivate(event) { let scrollToTop = window.setInterval(() => { let pos = window.pageYOffset; if (pos > 0) { window.scrollTo(0, pos - 20); // how far to scroll on each step } else { window.clearInterval(scrollToTop); } }, 16); } If you wish to be selective, say not every component should trigger the scrolling, you can

Apple - Can You Force A Mobile Site On Your IPhone To Show Full Desktop View?

Image
Answer : I don't think you can do this in Safari on the iPhone but you could use a 3rd party browser app. Many of those will let you set the browser agent. One browser I know does this is 'Atomic Web Browser'. This may not work in all cases as some websites may use other ways of determining which content to show, for example, some will detect the screen dimensions. I've tried this on my iPhone with Atomic Web Browser. Within the browser, I went to settings, 'Identify browser as' and selected 'Safari Desktop'. Then I went to nascar.com and tapped on the nascar logo. It showed me the desktop version of the page. I checked in mobile safari and doing the same indeed took me to a mobile version. An additional recommendation: the free Puffin browser in the App Store displays full websites. Google Chrome for iPhone is my daily driver for Stackexchange and it works wonderfully well both in desktop and mobile modes. Tap the menu button Reqest Desk

Css Checkbox Size Code Example

Example 1: css resize checkbox input [ type = checkbox ] { transform : scale ( 1.5 ) ; } Example 2: input checkbox size css input [ type = checkbox ] { transform : scale ( 1.5 ) ; } < label > < input type = "checkbox" > Test < / label > Example 3: css percent scale checkbox // to scale checkboxes with the rest of the page use this: //Note, use width percent, height auto and the scale command inside another div as a ref < div style = "width:100%; height:auto;" > < input type = "checkbox" style = "width:20%; height:auto; transform: scale(2.5);" > < / div > Example 4: update checkbox size css input . /*checkbox class name*/ { width : /*preferred width*/ ; height : /*preferred height*/ ; }

@ConfigurationProperties Spring Boot Configuration Annotation Processor Not Found In Classpath

Answer : I had the same problem. I use idea 2017.2 and gradle 4.1, and some blog said you should add: dependencies { optional "org.springframework.boot:spring-boot-configuration-processor" } But I changed it to this: dependencies { compile "org.springframework.boot:spring-boot-configuration-processor" } And the warning is gone. According to the Spring Boot docs, the correct configuration since Gradle 4.6 is dependencies { annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-configuration-processor' // ... } IntelliJ IDEA supports annotationProcessor scope since build 193.3382 (2019.3). Don't forget to enable annotation processing in IntelliJ IDEA settings. It happens to me for two reasons in IDEA: Double check if your setting is picked (enabled) in IDEA: Preferences->Annotation Processors->Enable annotation processing. After update your Idea, check your plugins and update them. It happens that plugin

Resize Image With Html Code Example

Example: resize image html <!-- Resize image using html When we add any image in 'src' attribute of 'img' tag then image appears with original size on webpage and if we want to resize the image we have to add extra attribute i.e. height and width to img tag to resize the image --> Simple img tag <img src= "image_path" alt= "Image Sample" > With height and width attribute <img src= "image_path" width= "200" height= "40" alt= "Image Sample" > <!-- I hope it will help you. Namaste Stay Home Stay Safe -->

Convert String Elements To Array Java Code Example

Example: how to convert string to array in java How to convert string to array import java . util . * ; public class GFG { public static void main ( String args [ ] ) { String str = "GeeksForGeeks" ; // Creating array and Storing the array // returned by toCharArray() char [ ] ch = str . toCharArray ( ) ; // Printing array for ( char c : ch ) { System . out . println ( c ) ; } } }

Convert Map To JSON Object In Javascript

Answer : Given in MDN, fromEntries() is available since Node v12: const map1 = new Map([ ['foo', 'bar'], ['baz', 42] ]); const obj = Object.fromEntries(map1); // { foo: 'bar', baz: 42 } For converting object back to map: const map2 = new Map(Object.entries(obj)); // Map(2) { 'foo' => 'bar', 'baz' => 42 } I hope this function is self-explanatory enough. This is what I used to do the job. /* * Turn the map<String, Object> to an Object so it can be converted to JSON */ function mapToObj(inputMap) { let obj = {}; inputMap.forEach(function(value, key){ obj[key] = value }); return obj; } JSON.stringify(returnedObject) You could loop over the map and over the keys and assign the value function createPaths(aliases, propName, path) { aliases.set(propName, path); } var map = new Map(), object = {}; createPaths(map, 'paths.aliases.server.entry', 'src/test'); createPaths(ma

2d Movement Unity Code Example

Example: how to make 2d movement in unity using System . Collections ; using System . Collections . Generic ; using UnityEngine ; public class movement2D : MonoBehaviour { Rigidbody2D body ; float horizontal ; float vertical ; public float runSpeed = 10.0f ; // Start is called before the first frame update void Start ( ) { body = GetComponent < Rigidbody2D > ( ) ; } // Update is called once per frame void Update ( ) { horizontal = Input . GetAxisRaw ( "Horizontal" ) ; vertical = Input . GetAxisRaw ( "Vertical" ) ; } private void FixedUpdate ( ) { body . velocity = new Vector2 ( horizontal * runSpeed , vertical * runSpeed ) ; } }

How To Open Visual Studio Code From Terminal Mac Code Example

Example 1: open visual studio code from terminal mac #Add Bash alias in .bash_profile ? $ alias code= "open -a /Applications/Visual\ Studio\ Code.app" #Open Visual Studio Code by command $ code . Example 2: install code command on mac Open VCode press CMD + SHIFT + P type 'shell command' select 'Install code command in path' navigate to any project from the terminal and type 'code .' Example 3: open vscode from terminal mac open Visual Studio Code press Cmd+shift+p search for ``Shell command : install 'code' command in PATH.`` and click it works in terminal #Open Visual Studio Code by command $ code . Example 4: install code . path in mac cat << EOF >> ~/.zshrc # Add Visual Studio Code ( code ) export PATH= "/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH" EOF

Createwindowex Example

Example: c++ create window HWND hwnd = CreateWindowEx ( 0 , // Optional window styles. CLASS_NAME , // Window class L "Learn to Program Windows" , // Window text WS_OVERLAPPEDWINDOW , // Window style // Size and position CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , NULL , // Parent window NULL , // Menu hInstance , // Instance handle NULL // Additional application data ) ; if ( hwnd == NULL ) { return 0 ; }

Css Make Bold Font Code Example

Example 1: css bold text .text { font-weight : bold ; } Example 2: css bold text we can set text bold using css property named 'font-weight' Syntax: selector { font-weight : bold ; }

Add Extra Fields Using JMS Serializer Bundle

Answer : I've found the solution by myself, to add a custom field after the serialization has been done we've to create a listener class like this: <?php namespace Acme\DemoBundle\Listener; use JMS\DiExtraBundle\Annotation\Service; use JMS\DiExtraBundle\Annotation\Tag; use JMS\DiExtraBundle\Annotation\Inject; use JMS\DiExtraBundle\Annotation\InjectParams; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Acme\DemoBundle\Entity\Team; use JMS\Serializer\Handler\SubscribingHandlerInterface; use JMS\Serializer\EventDispatcher\EventSubscriberInterface; use JMS\Serializer\EventDispatcher\PreSerializeEvent; use JMS\Serializer\EventDispatcher\ObjectEvent; use JMS\Serializer\GraphNavigator; use JMS\Serializer\JsonSerializationVisitor; /** * Add data after serialization * * @Service("acme.listener.serializationlistener") * @Tag("jms_serializer.event_subscriber") */ class SerializationListener implements EventSubscriberInterface { /**