Posts

Showing posts from March, 2002

Animejs Cdn Code Example

Example: anime js link < script src = "https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity = "sha512-z4OUqw38qNLpn1libAN9BsoDx6nbNFio5lA6CuTp9NlK83b89hgyCVq+N5FdBJptINztxn1Z3SaKSKUS5UP60Q==" crossorigin = "anonymous" > < / script >

Array Concat Php Code Example

Example 1: php array_merge <?php $array1 = array("color" => "red", 2, 4); $array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4); $result = array_merge($array1, $array2); print_r($result); ?> Array ( [color] => green [0] => 2 [1] => 4 [2] => a [3] => b [shape] => trapezoid [4] => 4 ) Example 2: php combine arrays $output = array_merge($array1, $array2); Example 3: array merge in php /* Array merge is basically use to merge the two array data. */ <?php $a1=array("red","green"); $a2=array("blue","green","yellow"); print_r(array_merge($a1,$a2)); ?> /* Output: Array ( [0] => red [1] => green [2] => blue [3] => green [4] => yellow ) */ <?php $a1=array("a"=>"red","b"=>"green"); $a2=array("c&

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

1s Sleep Python Code Example

Example: delay time python import time time . sleep ( 5 ) # sleeps for 5 seconds

Android: How To Send Message Programmatically By Using WhatsApp, WeChat?

Answer : I got the Solution.. Here I am posting the answer so that it may help other people who may have same doubt.. For Share through any application... public void sendAppMsg(View view) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); String text = " message you want to share.."; // change with required application package intent.setPackage("PACKAGE NAME OF THE APPLICATION"); if (intent != null) { intent.putExtra(Intent.EXTRA_TEXT, text);// startActivity(Intent.createChooser(intent, text)); } else { Toast.makeText(this, "App not found", Toast.LENGTH_SHORT) .show(); } } Note : change *PACKAGE NAME OF THE APPLICATION as per your requirement like Example : USE //Whatsapp intent.setPackage("com.whatsapp");` //Linkedin intent.setPackage("com.linkedin.android"); //Twitter intent.setPackage(

Docker-compose Healthcheck Curl Container Code Example

Example: healthcheck docker compose healthcheck : test : [ "CMD" , "curl" , "-f" , "http://localhost" ] interval : 1 m30s timeout : 10 s retries : 3 start_period : 40 s

Colour Code For Light Grey Code Example

Example: light grey color code HTML / CSS Color Name Hex Code #RRGGBB Decimal Code (R,G,B) gainsboro #DCDCDC rgb(220,220,220) lightgray / lightgrey #D3D3D3 rgb(211,211,211) silver #C0C0C0 rgb(192,192,192) darkgray / darkgrey #A9A9A9 rgb(169,169,169)

Cheat Sheet Liquid Code Example

Example: liquid cheat sheet {% if additional_checkout_buttons %} < div class = " additional-checkout-buttons " > {{ content_for_additional_checkout_buttons }} </ div > {% endif %}

Cannot Start GlassFish 4.1 From Within Netbeans 8.0.1 Service Area

Image
Answer : I also had this problem, it is because there is an application LISTENING to 8080 port. To solve this problem I followed the below steps: Open cmd.exe then type netstat -aon | find ":8080" | find "LISTENING" You will see like this result TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1464 Copy PID "1464". Open Task Manager (Ctrl+Alt+del), go to the details tag, then find the program or service via PID that is listening to the port 8080 then STOP it or End process. Your description is a little bit strange because the GlassFish server can even start if port 1527 is occupied, because the Java Derby database is a separate java process. So one option could be to just ignore the message in case that the real GlassFish server is indeed starting correctly (NetBeans displays the output for the GlassFish server and the Derby server in different tabs). Nevertheless you can try to disable starting the registered Derby ser

How To Convert An Integer To A String In Arduino Code Example

Example: int to string arduino String stringOne = "Hello String" ; // using a constant String String stringOne = String ( 'a' ) ; // converting a constant char into a String String stringTwo = String ( "This is a string" ) ; // converting a constant string into a String object String stringOne = String ( stringTwo + " with more" ) ; // concatenating two strings String stringOne = String ( 13 ) ; // using a constant integer String stringOne = String ( analogRead ( 0 ) , DEC ) ; // using an int and a base String stringOne = String ( 45 , HEX ) ; // using an int and a base (hexadecimal) String stringOne = String ( 255 , BIN ) ; // using an int and a base (binary) String stringOne = String ( millis ( ) , DEC ) ; // using a long and a base String stringOne = String ( 5.698 , 3 ) ;

Apple - Change Default Shell From Bash To Zsh

Image
Answer : macOS Catalina and later (10.15+) Apple replaced bash with zsh as the default shell. See article. So no need to do anything. You can verify the default shell by typing echo $0 in the terminal. macOS Mojave and earlier (10.14-) See Apple Support page, Use zsh as the default shell on your Mac Surprisingly this doesn't work with the command line tools as one would expect. This needs to be done with the System Preferences app. The following steps work with multiple versions of Mac OS X through at least 10.11 (El Capitan). Open up the "User's & Groups" panel in the "System Preferences" app. Make sure the panel is unlocked (bottom left) Control click on your username (top left) and select "Advanced Options..." This is only available if you are an Administrator. 4. Change the "Login shell" value to /bin/zsh . 5. Press the OK button to save your change. You should be careful not to change any other f

Bungeecord 1.8 Maven Dependency Code Example

Example: bungeecord api maven < repositories > < repository > < id > bungeecord-repo </ id > < url > https://oss.sonatype.org/content/repositories/snapshots </ url > </ repository > </ repositories > < dependencies > < dependency > < groupId > net.md-5 </ groupId > < artifactId > bungeecord-api </ artifactId > < version > 1.16-R0.4-SNAPSHOT </ version > < type > jar </ type > < scope > provided </ scope > </ dependency > < dependency > < groupId > net.md-5 </ groupId > < artifactId > bungeecord-api </ artifactId > < version > 1.16-R0.4-SNAPSHOT </ version > < type > javadoc </ type > < scope &g

Array.prototype.fill() With Object Passes Reference And Not New Instance

Answer : You can first fill the array with any value (e.g. undefined ), and then you will be able to use map : var arr = new Array(2).fill().map(u => ({})); var arr = new Array(2).fill().map(Object); The accepted answer is good and would work in 90% of cases. But if you are making high-performance JS application, and if you work with big/huge arrays, Array.map(..) creates big overload in both - memory and processor use, as it creates a copy of an array. I recommend to use the classic for loop: a = new Array(ARRAY_SIZE); for (var i = 0; i < ARRAY_SIZE; i++) { a[i] = []; } I tested six alternatives and got this: Array.map() , as proposed above ( 11x times!!! slower): a = new Array(ARRAY_SIZE).fill().map(u => { return []; }); for loop , the best one ( fastest ): a = new Array(ARRAY_SIZE); for (var i = 0; i < ARRAY_SIZE; i++) { a[i] = []; } forEach ( 6x time slower): a = new Array(ARRAY_SIZE).fill(); a.forEach((val, i)

Android - Snackbar Vs Toast - Usage And Difference

Answer : If I don't require user interaction I would use a toast? You can still use Snackbar. It is not mandatory to have an action with Snackbar. What is meant by "system messaging"? Does that apply to displaying information when something important happened between my app and the Android system? I believe this means that Toasts are to be used if there are some messages pertaining to the system. Either android as a whole or some background service you may be running. E.g. Text-To-Speech is not installed. OR No Email client found. What I like is the swipe off screen feature - would that be a reason to start replacing toasts with Snackbar? (this is a bit opinion based question though) That is one reason. But there are several other plus points. For an example: Your toast remains on screen even when the activity is finished. Snackbar doesn't. There is less confusion if the toast does not popup (or keep popping up in case of multiple Toast creation in seq

Byref Argument Type Mismatch In Vba Code Example

Example: ByRef argument type mismatch ' If you don't specify a type for a variable, the variable receives the default ' type, Variant. This isn't always obvious. For example, the following code ' declares two variables, the first, "MyVar", is a Variant; the second, ' "AnotherVar", is an Integer. Sub main() Dim MyVar, AnotherVar As Integer ' MyVar->Variant, AnotherVar->Integer 'Dim MyVar As Integer, AnotherVar As Integer ' Both are declared integers MyVar = 3.1415 Call SomeSub((MyVar)) End Sub Sub SomeSub (MyNum As Integer) MyNum = MyNum + MyNum End Sub

Bash Variables In For Loop Range

Answer : Yes, that's because brace-expansion occurs before parameter expansion. Either use another shell like zsh or ksh93 or use an alternative syntax: Standard (POSIX) sh syntax i=1 while [ "$i" -le "$number" ]; do echo "$i" i=$(($i + 1)) done Ksh-style for ((...)) for ((i=1;i<=number;i++)); do echo "$i" done use eval (not recommended) eval ' for i in {1..'"$number"'}; do echo "$i" done ' use the GNU seq command on systems where it's available unset -v IFS # restore IFS to default for i in $(seq "$number"); do echo "$i" done (that one being less efficient as it forks and runs a new command and the shell has to reads its output from a pipe). Avoid loops in shells. Using loops in a shell script are often an indication that you're not doing it right. Most probably, your code can be written some other way. You don't even need a

Add Custom Name, Caption, Image, Description To New Facebook Share Dialog Or Custom Stories Not Taking Them From Og Meta

Answer : Update on 2019. This method is not working any more. New solution has not been find yet. :( Update on 27.06.2018. Old version of the code stopped working properly. The shared image was displayed as small image on the left, instead of as large full column image. The fix is to replace action_type: 'og.shares' with action_type: 'og.likes' . Use this code: FB.ui({ method: 'share_open_graph', action_type: 'og.likes', action_properties: JSON.stringify({ object: { 'og:url': url, 'og:title': title, 'og:description': des, 'og:image': img } }) }, function (response) { // Action after response }); This works with API version 2.9+ . Please note that using og.shares action_type , is not advised any more since it is not mentioned in the FB documentation and it doesn't properly display the large image. I now use og.likes . The

Youtube Mp3 Cc Code Example

Example: youtube to mp4 ytmp3 . cc is the best by far

Autohotkey Mute Mic Code Example

Example: autohotkey mute sound MuteSoundWithNotification: SoundGet, LevelM, Master If (LevelM > 0) { SoundBeep ,800, 100 Send {Volume_Mute} ; Mute sound ;SoundSet, Mute } Else { SoundSet, 10 ; restores to 10% volume SoundBeep ,800, 100 } return