Posts

Showing posts from July, 2012

Strncat Function In C Code Example

Example: strncat c # include <stdio.h> # include <string.h> int main ( ) { char src [ 50 ] , dest [ 50 ] ; strcpy ( src , "This is source" ) ; strcpy ( dest , "This is destination" ) ; strncat ( dest , src , 15 ) ; printf ( "Final destination string : |%s|" , dest ) ; return ( 0 ) ; } output : Final destination string : | This is destinationThis is source |

Code With Mosh Courses Credentials Code Example

Example: coding with mosh Master the Coding Skills to Become an Engineer Companies LOVE to Hire Hi! His name is Mosh Hamedani. His life’s mission is to help novice and professional software engineers increase their skills, make more money and ultimately change their lives for the better.

Char Data Type In Php Code Example

Example: php data types <?php /* Variables can store data of different types, and different data types can do different things. PHP supports the following data types: 1) String 2) Integer 3) Float (floating point numbers - also called double) 4) Boolean 5) Array 6) Object 7) NULL 8) Resource */ // PHP String $x = "Hello world!" ; echo $x ; //PHP Integer $x = 5985 ; var_dump ( $x ) ; //PHP Float $x = 10.365 ; var_dump ( $x ) ; //PHP Boolean $x = true ; $y = false ; //PHP Array $cars = array ( "Volvo" , "BMW" , "Toyota" ) ; var_dump ( $cars ) ; //PHP Object class Car { function Car ( ) { $this -> model = "VW" ; } } // create an object $herbie = new Car ( ) ; // show object properties echo $herbie -> model ; //PHP NULL Value $x = "Hello world!" ; $x = null ; var_dump ( $x ) ; ?>

Bootstrap 3 Glyphicons CDN

Answer : With the recent release of bootstrap 3, and the glyphicons being merged back to the main Bootstrap repo, Bootstrap CDN is now serving the complete Bootstrap 3.0 css including Glyphicons . The Bootstrap css reference is all you need to include: Glyphicons and its dependencies are on relative paths on the CDN site and are referenced in bootstrap.min.css . In html: <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"> In css: @import url("//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"); Here is a working demo . Note that you have to use .glyphicon classes instead of .icon : Example: <span class="glyphicon glyphicon-heart"></span> Also note that you would still need to include bootstrap.min.js for usage of Bootstrap JavaScript components, see Bootstrap CDN for url. If you want to use the Glyphicons separately , you can do that by direct

Changing Overflow Icon In The Action Bar

Answer : You can with a style, but you have to add it to the main Theme declaration. <resources> <!-- Base application theme. --> <style name="Your.Theme" parent="@android:style/Theme.Holo"> <!-- Pointer to Overflow style ***MUST*** go here or it will not work --> <item name="android:actionOverflowButtonStyle">@style/OverFlow</item> </style> <!-- Styles --> <style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow"> <item name="android:src">@drawable/ic_action_overflow</item> </style> </resources> You also can change it dynamically, which I go into detail about here: Changing the Android Overflow menu icon programmatically For those who can't get it to work try this WITHOUT the "android:" namespace. <item name="actionOverflowButtonStyle">

Background-color Transparent Css Code Example

Example 1: css how to make background transparent /* Use RGBA */ background-color: rgba(255, 255, 0, 0.75); /* Transparent Yellow */ Example 2: background color css rgb body { background-color: rgb(255,255,255); } Example 3: css opacity example .opacity30 { opacity: 0.3; filter: alpha(opacity=30); /* For IE8 and earlier */ } Example 4: background color transparent div { background: transparent } Example 5: css transparent background color div { opacity:25% ; } Example 6: transparent background css div { width: 200px; height: 200px; display: block; position: relative; } div::after { content: ""; background: url(image.jpg); opacity: 0.5; top: 0; left: 0; bottom: 0; right: 0; position: absolute; z-index: -1; }

C# MongoDB Distinct Query Syntax

Answer : You could try the following approach: var filter = new BsonDocument(); var categoriesList = await blogContext.Articles.DistinctAsync<string>("categories", filter);

Latex Fontsize Code Example

Example 1: latex text size \Huge \huge \LARGE \Large \large \normalsize \small \footnotesize \scriptsize \tiny Example 2: latex font sizes \Huge \huge \LARGE \Large \large \ normalsize ( default ) \small \footnotesize \scriptsize \tiny Example 3: latex font sizes Change global font size : \documentclass [ 12 pt ] { report } Example 4: latex change size of text % Article \documentclass [ 9 pt ] { extarticle } % Report \documentclass [ 14 pt ] { extreport }

Android: Start The Circular Progress Bar From Top (270°)

Image
Answer : Try specifying rotation degrees to your progress items. <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/progress"> <rotate android:fromDegrees="270" android:toDegrees="270" android:pivotX="50%" android:pivotY="50%" > <shape android:innerRadiusRatio="2.5" android:shape="ring" android:thicknessRatio="25.0" > <gradient android:centerColor="@color/gray" android:endColor="@color/gray" android:startColor="@color/gray" android:type="sweep" /> </shape> </rotate>

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

Check If Php Array Has Key Code Example

Example: php key in array exists < ? php $search_array = array ( 'first' => null , 'second' => 4 ) ; // returns false isset ( $search_array [ 'first' ] ) ; // returns true array_key_exists ( 'first' , $search_array ) ; ? >

Switch Case Arduino Example

Example 1: swich case arduino // Arduino => c++ switch ( var ) { case 1 : //do something when var equals 1 break ; case 2 : //do something when var equals 2 break ; default : // if nothing else matches, do the default // default is optional break ; } Example 2: arduino switch case switch ( var ) { case label1 : // statements break ; case label2 : // statements break ; default : // statements break ; }

How To Create New Line In Gitlab Readme File Code Example

Example: Markdown new line Hello ( < -- two spaces ) World

Blender Subdivide Code Example

Example: subdivide shortcut blender Select all faces, right click, and select subdivide

Add Auto Increment Column To Existing Table Sql Server Code Example

Example: sql query to make a existing column auto increment Alter table table_name modify column_name datatype ( length ) AUTO_INCREMENT PRIMARY KEY

Can I Export A Variable To The Environment From A Bash Script Without Sourcing It?

Answer : Is there any way to access to the $VAR by just executing export.bash without sourcing it ? Quick answer: No. But there are several possible workarounds. The most obvious one, which you've already mentioned, is to use source or . to execute the script in the context of the calling shell: $ cat set-vars1.sh export FOO=BAR $ . set-vars1.sh $ echo $FOO BAR Another way is to have the script, rather than setting an environment variable, print commands that will set the environment variable: $ cat set-vars2.sh #!/bin/bash echo export FOO=BAR $ eval "$(./set-vars2.sh)" $ echo "$FOO" BAR A third approach is to have a script that sets your environment variable(s) internally and then invokes a specified command with that environment: $ cat set-vars3.sh #!/bin/bash export FOO=BAR exec "$@" $ ./set-vars3.sh printenv | grep FOO FOO=BAR This last approach can be quite useful, though it's inconvenient for interactive use sin

Add User To Docker Group Permanently Code Example

Example 1: docker post installation steps linux # Creates docker group sudo groupadd docker # Add your user to the docker group sudo usermod -aG docker $USER # Log out and log back in so that your group membership is re-evaluated # GNOME example gnome-session-quit Example 2: docker sudo how to add user FROM alpine:latest RUN apk --no-cache update \ && apk --no-cache add sudo copy run.sh /usr/local/ RUN addgroup -S cassandra && adduser -S cassandra -G cassandra RUN chown -R cassandra:cassandra /home/cassandra/ RUN echo 'cassandra ALL=(ALL) /bin/su' >> /etc/sudoers USER cassandra ENTRYPOINT [ "sh" , "/usr/local/run.sh" ]

60 Inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Colspan All Columns

Answer : Just use this: colspan="100%" It works on Firefox 3.6, IE 7 and Opera 11! (and I guess on others, I couldn't try) Warning: as mentioned in the comments below this is actually the same as colspan="100" . Hence, this solution will break for tables with css table-layout: fixed , or more than 100 columns. I have IE 7.0, Firefox 3.0 and Chrome 1.0 The colspan="0" attribute in a TD is NOT spanning across all TDs in any of the above browsers . Maybe not recommended as proper markup practice, but if you give a higher colspan value than the total possible no. of columns in other rows , then the TD would span all the columns. This does NOT work when the table-layout CSS property is set to fixed. Once again, this is not the perfect solution but seems to work in the above mentioned 3 browser versions when the table-layout CSS property is automatic . Hope this helps. If you want to make a 'title' cell that spans all columns, as h

Range Of Double In C C++ Code Example

Example 1: range of long long in c++ Long Data Type Size ( in bytes ) Range long int 4 - 2 , 147 , 483 , 648 to 2 , 147 , 483 , 647 unsigned long int 4 0 to 4 , 294 , 967 , 295 long long int 8 - ( 2 ^ 63 ) to ( 2 ^ 63 ) - 1 unsigned long long int 8 0 to 18 , 446 , 744 , 073 , 709 , 551 , 615 Example 2: data types in c++ int myNum = 5 ; // Integer (whole number) float myFloatNum = 5.99 ; // Floating point number double myDoubleNum = 9.98 ; // Floating point number char myLetter = 'D' ; // Character bool myBoolean = true ; // Boolean string myText = "Hello" ; // String

Bongdaplus Code Example

Example: bongdaplus < div class = " card card-custom " > < div class = " card-header " > < h3 class = " card-title " > Base Controls </ h3 > < div class = " card-toolbar " > < div class = " example-tools justify-content-center " > < span class = " example-toggle " data-toggle = " tooltip " title = " View code " > </ span > < span class = " example-copy " data-toggle = " tooltip " title = " Copy code " > </ span > </ div > </ div > </ div > <!--begin::Form--> < form > < div class = " card-body " > < div class = " form-group mb-8 " > < div class = " alert alert-custom alert-default " role = " alert " > < div class = " alert-icon " > < i

Adding Dictionaries Together, Python

Answer : If you're interested in creating a new dict without using intermediary storage: (this is faster, and in my opinion, cleaner than using dict.items()) dic2 = dict(dic0, **dic1) Or if you're happy to use one of the existing dicts: dic0.update(dic1) Here are quite a few ways to add dictionaries. You can use Python3's dictionary unpacking feature. ndic = {**dic0, **dic1} Or create a new dict by adding both items. ndic = dict(dic0.items() + dic1.items()) If your ok to modify dic0 dic0.update(dic1) If your NOT ok to modify dic0 ndic = dic0.copy() ndic.update(dic1) If all the keys in one dict are ensured to be strings ( dic1 in this case, of course args can be swapped) ndic = dict(dic0, **dic1) In some cases it may be handy to use dict comprehensions (Python 2.7 or newer), Especially if you want to filter out or transform some keys/values at the same time. ndic = {k: v for d in (dic0, dic1) for k, v in d.items()} >>> dic0 = {&#

Auto Create S3 Buckets On Localstack

Answer : A change that came in with this commit since version 0.10.0 . When a container is started for the first time, it will execute files with extensions .sh that are found in /docker-entrypoint-initaws.d . Files will be executed in alphabetical order. You can easily create aws resources on localstack using awslocal (or aws) cli tool in the initialization scripts. version: '3.7' services: localstack: image: localstack/localstack environment: - SERVICES=s3 ports: - "4572:4572" volumes: - ./aws:/docker-entrypoint-initaws.d With a script in directory ./aws/buckets.sh : #!/bin/bash set -x awslocal s3 mb s3://bucket set +x Note: the set [-/+] x is purely there to turn on and off outputting of the commands being executed. Will produce this output: ... localstack_1 | Starting mock S3 (http port 4572)... localstack_1 | Waiting for all LocalStack services to be ready localstack_1 | Ready. localstack_1 | /

Bold Text Html Wschool Code Example

Example: html bold <! --Emphasized bold text. It's for content that is of greater importance--> <strong>I'm a content</strong> <! --Bold text. It 's used to draw attention to text without indicating that it' s more important--> <b>I'm another content</b>

Access To Xmlhttprequest At Has Been Blocked By Cors Policy No 'access-control-allow-origin' Code Example

Example 1: has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT"); response.setHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers"); Example 2: javascript access to xmlhttprequest at from origin 'null' has been blocked by cors policy //Open the HTML file using live server, it will work

Can't Push Refs To Remote Try Running Pull First To Integrate Your Changes

Answer : You get this try running pull first to integrate your changes whenever your local branch and your remote branch are not on the same point, before your changes. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> Local_Commits Now clearly, there's a change D that you don't have integrated locally. So you need to rebase , then push, which will lead to the following. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> D -> Local_Commits To solve your issue, do the following git pull --rebase origin branchname git push origin branchname I was getting this message in my Azure DevOps Repos environment because the server had a branch policy on the master branch that requires pull request approval and I was trying to push to master directly. Even after pull and rebase the same message appears. I don't think VS Code really knows how to interpret this specific err