Posts

Showing posts from April, 2011

Android Min SDK Version Vs. Target SDK Version

Answer : The comment posted by the OP to the question (basically stating that the targetSDK doesn't affect the compiling of an app) is entirely wrong! Sorry to be blunt. In short, here is the purpose to declaring a different targetSDK from the minSDK: It means you are using features from a higher level SDK than your minimum, but you have ensured backwards compatibility . In other words, imagine that you want to use a feature that was only recently introduced, but that isn't critical to your application. You would then set the targetSDK to the version where this new feature was introduced and the minimum to something lower so that everyone could still use your app. To give an example, let's say you're writing an app that makes extensive use of gesture detection. However, every command that can be recognised by a gesture can also be done by a button or from the menu. In this case, gestures are a 'cool extra' but aren't required. Therefore you would set

Navbar Fixed-top After Scrolling Bootstrap 4 Code Example

Example: bootstrap navbar fixed top <section id= "headnev" class= "navbar navbar-fixed-top" >

C Split String By Space Into Array Code Example

Example 1: split string at space C char * string ; char * first ; char * second ; for ( int i = 0 ; i <= strlen ( string ) ; i ++ ) { if ( string [ i ] == ' ' ) { string [ i ] = '\0' ; first = string ; second = string + i + 1 ; break ; } } Example 2: arduino c string split by delimiter /* Original code on Stackoverflow https://stackoverflow.com/questions/29671455/how-to-split-a-string-using-a-specific-delimiter-in-arduino Example : String str = "1,2,3"; String part01 = getValue(str,';',0); // get 1 String part02 = getValue(str,';',1); // get 2 String part03 = getValue(str,';',2); // get 3 String part03 = getValue(str,';',4); // get empty string Documented by issa loubani, your average programmer :P */ // Happy coding O.O String getValue ( String data , char separator , int index ) { int found = 0 ; int strIndex [ ] = { 0 , - 1

Can I Specify A Numpy Dtype When Generating Random Values?

Answer : Q: is it possible to specify a dtype for random numbers when I create them. A: No it isn't. randn accepts the shape only as randn(d0, d1, ..., dn) Simply try this: x = np.random.randn(10, 10).astype('f') Or define a new function like np.random.randn2 = lambda *args, dtype=np.float64: np.random.randn(*args).astype(dtype) x = np.random.randn2(10, 10, dtype='f') If you have to use your code on the post, try this code instead x = np.zeros((10, 10), dtype='f') x[:] = np.random.randn(*x.shape) This assigns the results of randn to the memory allocated by np.zeros Let me begin by saying that numpy now supports dtypes for random integers. This enhancement can be tracked through Issue #6790 on numpy's github. But as of today, this facility is not available for the gaussian RNG . I needed this same facility so I wrote this patch for numpy, https://gist.github.com/se4u/e44f631b249e0be03c21c6c898059176 The patch only adds support for generati

2022-01-05T15:27:41.170Z - Current Time In Js Code Example

Example: how to print date like 10-may-2018 in javascript date . toString ( 'YYYY-MM-dd' ) ; 'Tue Feb 10 2015 15:42:50' var date = new Date ( '4-1-2015' ) ; date . getDay ( ) ; // returns 3 date . getYear ( ) ; // returns 115, no of years after 1900 date . getFullYear ( ) ; // returns 2015 date . getMonth ( ) ; // returns 3, starting 0 with jan date . getUTCDate ( ) ; // returns 31

Accessing Previous Theme Variables In CreateMuiTheme

Answer : You'd need to create an instance of the default theme and use it when defining your own: import { createMuiTheme } from 'material-ui/styles'; const defaultTheme = createMuiTheme(); const theme = createMuiTheme({ typography: { fontSize: defaultTheme.typography.fontSize + 2 } }); export default theme; You can also create your theme and then add on to it after theme is created. import { createMuiTheme } from 'material-ui/styles'; const theme = createMuiTheme(); theme.typography = { ...theme.typography, fontSize: theme.typography.fontSize + 2 } export default theme;

Create Array Variable In Javascript Code Example

Example 1: javascript array // create an array like so : var colors = [ "red" , "blue" , "green" ] ; // you can loop through an array like this : for ( var i = 0 ; i < colors . length ; i + + ) { console . log ( colors [ i ] ) ; } Example 2: javascript declare array var array = [ ] Example 3: what are the two ways to create an array in javascript examples? let scores = Array ( 10 ) ; Example 4: how to create array in javascript / * Array class is a global object that is used in the construction of arrays See - https : // developer . mozilla . org / en - US / docs / Web / JavaScript / Reference / Global_Objects / Array * / let array_1 = new Array ( 2 ) ; arr . push ( "James" ) ; arr . push ( "Fred" ) ; let array_2 = [ "James" , "Fred" ] ; Example 5: how i create array in javascript var fruits = [ 'Apple' , 'Banana' ] ; console . log ( fruits . length ) ; /

Ho Working To Import A Google Font Not Code Example

Example 1: css import google font not working Try to put your import on the top of your file , before any declaration. Example 2: fonts from google fonts do not work <!-- This is an easy thing you need to do --> <style> /* I chose Orbitron, you can change it */ body { font-family : 'Orbitron' , sans-serif ; /* this will change the font troughout the body, if you need help changing that, email me at ringgames04@gmail.com */ } @import url ( ' https : //fonts.googleapis.com/css2?family= Orbitron : wght @400 ; 669 &display=swap' ) ; </style> <div class= "example" >

Convert Char To String In Java Code Example

Example 1: convert char to string java char c = 'a' ; String s = Character . toString ( c ) ; //s == "a" Example 2: Convert char to string java // Convert char to string java public class CharToStringJava { public static void main ( String [ ] args ) { char ch = 'G' ; String str = Character . toString ( ch ) ; System . out . println ( "char to string is: " + str ) ; } } Example 3: java convert a string to char[] String string = "ABCDEF" ; char [ ] charsFromString = string . toCharArray ( ) ; // { 'A', 'B', 'C', 'D', 'E', 'F' } Example 4: string to char in java // getting single character from string.. String str = "abcd" ; char c = str . toChar ( 0 ) ; System . out . println ( "output is " + c ) ; // output is a Example 5: convert char to string char c = 'a' ; String s = Character . toString ( c ) ; Exampl

12 Cm X 10 Cm In Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

Javascript Style Display Block Code Example

Example 1: javascript display block document. getElementById ( "someElementId" ) .style.display = "block" ; Example 2: style display block js document. getElementById ( "myDIV" ) .style.display = "block" ;

Html Css Color Word Code Example

Example 1: html css text style on a word <p style= "font-size:14px; color:#538b01; font-weight:bold; font-style:italic;" > Enter the competition by <span style= "color: #ff0000" >January 30 , 2011 </span> and you could win up to $$$$ — including amazing <span style= "color: #0000a0" >summer</span> trips! </p> Example 2: html css text style on a word <html > <head > <style type="text/css" > p { font-size : 14 px ; color : #538b01 ; font-weight : bold ; font-style : italic ; } .date { color : #ff0000 ; } .season { /* OK, a bit contrived... */ color : #0000a0 ; } </style> </head> <body> <p> Enter the competition by <span class= "date" >January 30 , 2011 </span> and you could win up to $$$$ — including amazing

Configure Jest Global Tests Setup With .ts File (TypeScript)

Answer : I found a solution. My initial project structure was: . |--src | |--service.ts |--tests | |--service.test.ts |--dist |--tsconfig.json |--package.json Jest configuration in package.json: "jest": { "globals": { "ts-jest": { "tsConfigFile": "tsconfig.json" } }, "moduleFileExtensions": ["ts","js"], "transform": { "^.+\\.(ts|tsx)$": "./node_modules/ts-jest/preprocessor.js" }, "testMatch": [ "**/tests/**/*.test.(ts|js)" ], "testEnvironment": "node" } With this configuration ts-jest perform in memory transpiling of the .ts files. I have outDir option in compilerOptions of my tsconfig.json , but nothing is written in that outDir and because I cann't use transpiled jest-config.js Then I move tests folder in src and change Jest config . New structure of the project is: . |--src | |--servic

Angular FormatDate

function Formats a date according to locale rules. formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string Parameters value string | number | Date The date to format, as a Date, or a number (milliseconds since UTC epoch) or an ISO date-time string. format string The date-time components to include. See DatePipe for details. locale string A locale code for the locale format rules to use. timezone string The time zone. A time zone offset from GMT (such as '+0430' ), or a standard UTC/GMT or continental US time zone abbreviation. If not specified, uses host system settings. Optional. Default is undefined . Returns string : The formatted date string. See also DatePipe Internationalization (i18n) Guide

Rainbow Text Animation With Css Code Example

Example: rainbow text css #grad1 { height : 200 px ; background : red ; /* For browsers that do not support gradients */ background : -webkit-linear-gradient ( left , orange , yellow , green , cyan , blue , violet ) ; /* For Safari 5.1 to 6.0 */ background : -o-linear-gradient ( right , orange , yellow , green , cyan , blue , violet ) ; /* For Opera 11.1 to 12.0 */ background : -moz-linear-gradient ( right , orange , yellow , green , cyan , blue , violet ) ; /* For Firefox 3.6 to 15 */ background : linear-gradient ( to right , orange , yellow , green , cyan , blue , violet ) ; /* Standard syntax (must be last) */ }

Can't Update RubyGems

Answer : There is no need to take such drastic steps as completely rebuilding Ruby, reinstalling Rubygems from scratch or installing a version manager to solve this problem. There is simply a dependency cycle introduced by the release of hoe 2.3.0: rubygems-update 1.3.5 requires (among other things) hoe-seattlerb hoe-seattlerb requires hoe >= 2.3.0 hoe >= 2.3.0 requires rubygems >= 1.3.1 I wrote the blog post linked to by zipizap. To recap: If you've already tried to update, uninstall the latest rubygems-update first: sudo gem uninstall rubygems-update -v 1.3.5 Update to 1.3.0: sudo gem install rubygems-update -v 1.3.0 sudo update_rubygems Then update to latest: sudo gem update --system With the release of Rubygems 1.3.6, it looks like this problem may be gone. From the release notes: Development deps are no longer added to rubygems-update gem so older versions can update sucessfully. Oi - I feel your pain. I'll first ask the obvious;

Can't Import JSON In Excel 2016 Using "Get & Transform" Feature

Answer : I ran into the same situation, and then found a work around on the following page: https://techcommunity.microsoft.com/t5/Get-and-Transform-Data/Missing-JSON-option-at-Data-gt-New-query-gt-From-File/td-p/69747 In short, the steps are to: New Query -> From Other Sources -> From Web; Type in (or Copy-Paste) an url to you Json data and hit OK button; After Query Edit opens, right-click a document icon on a query dashboard and select JSON and your data is transformed to a table data format. Thanks to 'Good Boy' who provided the work around in the article mentioned. If the json file is on your computer, a file, you can enter ' file:\c:\filename.json ' in place of the web url. Don't include the '. The easiest way is to use the file browser and copy the path to the file and then add the file name at the end.

Nested Loop C Programming Code Example

Example: how to create a nested for loop in c //Nested for loop in C int main ( ) { for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < 4 ; j ++ ) { printf ( "%d, %d\n" , i , j ) ; } } return 0 ; } //Alternative approach to nested for loop int main ( ) { int i , j ; for ( i = 1 , j = 1 ; i < 10 || j < 10 ; i ++ , j ++ ) { printf ( "%d, %d\n" , i , j ) ; } return 0 ; }

Can JavaScript Break Anonimity Provided By Tor?

Image
Answer : tl;dr: Yes, JavaScript can break anonymity provided by Tor if there's a browser vulnerability involved, if you enable features that weren't designed anonymity in mind (like WebRTC or Geolocation API), or through giving out more information for browser fingerprinting . This particular site (https://pearsonpte.com/) uses the Geolocation API on line 31: navigator.geolocation.getCurrentPosition() . This doesn't use geolocation data for your IP address, but a location provider like GPS chip on your device. Usually the browser prompts you for a permission per site, but this can be allowed or denied globally. Allowing geolocation globally would be dangerous as it reveals your location in much more detail than your IP address. Configuring your browser to prevent everything that could reveal your identity takes a lot of effort and is likely to fail. Even if you have all the knowledge to disable everything necessary, the more you customize your settings the more uniqu

Html Css Background Image No Repeat Code Example

Example 1: How to make a backgroud image with no repeat in html .background { background-image : url ( 'name.jpeg' ) ; background-repeat : no-repeat ; background-size : 100 % ; } Example 2: how to make image not repeat on background .image { background-repeat : no-repeat ; }