Posts

Showing posts from January, 2018

'adb' Is Not Recognized As An Internal Or External Command, Operable Program Or Batch File. Phonesploit Code Example

Example: adb is not recognized set PATH : C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools

"Build Periodically" With A Multi-branch Pipeline In Jenkins

Answer : If you use a declarative style Pipeline and only want to trigger the build on a specific branch you can do something like this: String cron_string = BRANCH_NAME == "master" ? "@hourly" : "" pipeline { agent none triggers { cron(cron_string) } stages { // do something } } Found on Jenkins Jira If you are using a declarative style Jenkinsfile then you use the triggers directive. pipeline { agent any triggers { cron('H 4/* 0 0 1-5') } stages { stage('Example') { steps { echo 'Hello World' } } } } I was able to find an example illustrating this an discarding old builds, which is also something I wanted. Jenkinsfile in jenkins-infra/jenkins.io: properties( [ [ $class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '10'] ],

Array To String Conversion In Php 7 Code Example

Example 1: Notice: Array to string conversion php // Use json_encode to collapse the array to json string: $stuff = array ( 1 , 2 , 3 ) ; print json_encode ( $stuff ) ; //Prints [1,2,3] Example 2: Notice: Array to string conversion php $stuff = array ( 1 , 2 , 3 ) ; print_r ( $stuff ) ; $stuff = array ( 3 , 4 , 5 ) ; var_dump ( $stuff ) ; Example 3: Convert an Array to a String in PHP phpCopy <?php $array = [ "Lili" , "Rose" , "Jasmine" , "Daisy" ] ; $JsonObject = json_encode ( $array ) ; echo "The array is converted to the Json string." ; echo "\n" ; echo "The Json string is $JsonObject " ; ?> Example 4: array to string conversion in php function subArraysToString ( $ar , $sep = ', ' ) { $str = '' ; foreach ( $ar as $val ) { $str .= implode ( $sep , $val ) ; $str .= $sep ; // add separator betwe

Can You Use Es6 Import Alias Syntax For React Components?

Answer : Your syntax is valid. JSX is syntax sugar for React.createElement(type) so as long as type is a valid React type, it can be used in JSX "tags". If Button is null, your import is not correct. Maybe Button is a default export from component-library. Try: import {default as StyledButton} from "component-library"; The other possibility is your library is using commonjs exports i.e. module.exports = foo . In this case you can import like this: import * as componentLibrary from "component-library"; Update Since this is a popular answer, here a few more tidbits: export default Button -> import Button from './button' const Button = require('./button').default export const Button -> import { Button } from './button' const { Button } = require('./button') export { Button }

Change Kendo Grid Datasource Use JS

Answer : I think you should first create a new DataSource (see https://demos.telerik.com/kendo-ui/datasource/remote-data-binding for remote data) var dataSource = new kendo.data.DataSource({ data: [ { name: "John Doe", age: 33 } ] }); And then append it to the grid by using the setDataSource method (https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/setdatasource) var grid = $("#grid").data("kendoGrid"); grid.setDataSource(dataSource); Since you want to change the action for your read then you can just do that. According to this question you could just set the dataSource Read url and refresh your grid data with something like that: var grid = $("#grid").data("kendoGrid"); grid.dataSource.transport.options.read.url = "newUrlPath"; grid.dataSource.read(); grid.refresh(); If you don't actually want to change your dataSource but your data and possibly get your list of items from some aj

Array.groupBy In TypeScript

Answer : You can use the following code to group stuff using Typescript. const groupBy = <T, K extends keyof any>(list: T[], getKey: (item: T) => K) => list.reduce((previous, currentItem) => { const group = getKey(currentItem); if (!previous[group]) previous[group] = []; previous[group].push(currentItem); return previous; }, {} as Record<K, T[]>); So, if you have the following structure and array: type Person = { name: string; age: number; }; const people: Person[] = [ { name: "Kevin R", age: 25, }, { name: "Susan S", age: 18, }, { name: "Julia J", age: 18, }, { name: "Sarah C", age: 25, }, ]; You can invoke it like: const results = groupBy(people, i => i.name); Which in this case, will give you an object with string keys, and Person[] values. There are a few key concepts here: 1- You can use function to get the key, this way you can use TS

Any Open-source Admin UI For Quartz.NET

Answer : Check out this blog. He describes a few that worked for him and few others he investigated. Once you know how to use the Quartz API (Example 12 - Client really helped me), it's not too difficult to extract whatever information you want. I recently published new alternative web UI for Quartz.NET. You can manage jobs, triggers, calendars and most of the API which IScheduler provide. It is pluggable into existing OWIN and ASP.NET Core application or it creates embedded web server on it own. You can put strongly typed values to JobDataMap or edit existing JobDataMap of job or trigger. https://github.com/jlucansky/Quartzmin Check out this other question: Combining Quartz.Net with UI. QuartzNetWebConsole and crystal-quartz seem to be more active projects. Both are open-source and have NuGet packages available.

Android TranslationY With Animation Code Example

Example: android translate animation values public TranslateAnimation (float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)

AspenTech InfoPlus 21 - How To Connect And Query Data

Image
Answer : InfoPlus21 is process historian containing list of templates of different tag structure e.g. IP_AnalogDef, IP_DescreteDef, IP_TextDef etc. Based on process tags from DCS/OPC/Any other historian, the IP21 records are created and each record acts as a table in historian. ANS1: Aspentech software is only windows based compatibility however IP21 aspenONE Process Explorer is web based and therefore you can access it over any operating system using host url. ANS2: you can try SELECT statement to get data from IP21 Historian using it's end-user component SQLPlus or on excel add-ins. e.g. SELECT NAME, IP_DESCRIPTION, IP_PLANT_AREA, IP_ENG_UNITS FROM IP_ANALOGDEF RESULTS: I hope this help you understand better. Otherwise you need to first learn the structure of your IP21 historian tags to build the query e.g. If it has customized structure, then you have to build your own. Welcome in industrial-IT ! For these technology, the best option is the 'AspenTech

Clip Path Generator Code Example

Example: clip path css clip-path: ellipse(20px 20px at 20% 20%); clip-path: circle(20px at 20% 20%);

How To Check Exact Match In Regex Code Example

Example 1: regex match exact string you want to achieve a case insensitive match for the word "rocket" surrounded by non-alphanumeric characters. A regex that would work would be: \ W* (( ? i ) rocket ( ? - i )) \ W* Example 2: regex exact match use ^ and $ to match the start and end of your string ^matchmeexactly$

A Command To Get The Sync Status Of A Dropbox File

Answer : Use filestatus : dropbox filestatus /path/to/file For more help see: dropbox help

Chemistry - Bond Angles In NH3 And NCl3

Answer : Solution 1: As Tan Yong Boon stated, it is Bent’s Rule with which we can explain the lower bond angle of \ce N F 3 \ce{NF3} \ce NF 3 when compared to \ce N H 3 \ce{NH3} \ce N H 3 . The rule as stated by Henry Bent: Atomic s character concentrates in orbitals directed towards electropositive substituents. Fluorine is more electronegative that hydrogen, and the \ce N − F \ce{N−F} \ce N − F bond would have greater p character than the \ce N − H \ce{N−H} \ce N − H bond. And more s character leads to large bond angles. Thus, the bond angle is greater in \ce N H 3 \ce{NH3} \ce N H 3 than in \ce N F 3 \ce{NF3} \ce NF 3 . Now, consider \ce N C l 3 \ce{NCl3} \ce NCl 3 . Clearly, \ce C l \ce{Cl} \ce Cl atom islarger in size than the central atom, nitrogen. Hence the higher bond angle here is due to the steric crowding caused by \ce C l \ce{Cl} \ce Cl atoms.(More pronounced than the electrongativity of \ce C l \ce{Cl} \ce Cl atom). They repel eachother and hence b

AES Encryption Error: The Input Data Is Not A Complete Block?

Answer : StreamWriter writes UTF8 text characters to a stream. You're writing plaintext.ToString() as text for the ciphertext. This returns "System.Byte[]" , which does not translate into 16 bytes of UTF8. I believe the problem to be padding mode. Unless your text to be encrypted is for sure divisible by BlockSize (in bits, or BlockSize / 8 in bytes), you should specify a PaddingMode other than None. see the post here for example code I changed the function to this: public static byte[] Encrypt(byte[] plaintext, byte[] key) { using (var aes = Aes.Create()) { aes.BlockSize = 128; aes.Mode = CipherMode.ECB; aes.Padding = PaddingMode.None; var encryptor = aes.CreateEncryptor(key, new byte[16]); using(var target = new MemoryStream()) using (var cs = new CryptoStream(target, encryptor, CryptoStreamMode.Write)) { cs.Write(plaintext, 0, plaintext.Length); return target.ToArray

Antd Grid Code Example

Example 1: responsive grid using antd import 'antd/dist/antd.css'; import { Row, Col } from 'antd'; < Row > < Col xs = {24} xl = {8} > One of three columns </ Col > < Col xs = {24} xl = {8} > One of three columns </ Col > < Col xs = {24} xl = {8} > One of three columns </ Col > </ Row > Example 2: antd grid { xs: '480px', sm: '768px', md: '992px', lg: '1200px', xl: '1600px', }

Como Convertir String A Int En Javascript Code Example

Example 1: how to convert string to int js let string = "1" ; let num = parseInt ( string ) ; //num will equal 1 as a int Example 2: string to int javascript var text = '42px' ; var integer = parseInt ( text , 10 ) ; // returns 42

Audio Play From Javascript Code Example

Example 1: play audio in javascript var audio = new Audio ( 'audio_file.mp3' ) ; audio . play ( ) ; Example 2: play audio javascript var bMusic = new Audio ( 'welcome1.mp3' ) bMusic . play ( ) Example 3: javascript play audio //play audio with from html audio element: document . getElementById ( 'myAudioTagID' ) . play ( ) ; //play audio with out html audio tag var myAudio = new Audio ( 'my_great_song.mp3' ) ; myAudio . play ( ) ; Example 4: javascript play audio //play audio with from html audio element: document . getElementById ( 'myAudioTagID' ) . play ( ) ; //play audio with out html audio tag var myAudio = new Audio ( 'my_great_song.mp3' ) ; myAudio . play ( ) ;