Posts

Showing posts from December, 2013

Brew Install Zlib-devel On Mac OS X Mavericks

Answer : Just run in the command line: xcode-select --install In OS X 10.9+, the command line developer tools are now installed on demand. So after running this also zlib and zlib-devel should be available (no need for brew install zlib...) For OS X Mojave sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / The reason is because Xcode Command Line tools no longer installs needed headers in /include. You have to run a separate command to install the needed headers. As noted here - https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug

For Loop In C Hackerrank Solution Code Example

Example: for loop in c++ hackerrank solution # include <bits/stdc++.h> using namespace std ; int main ( ) { int a , b ; string c [ ] = { "" , "one" , "two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" } ; cin >> a >> b ; for ( int i = a ; i <= b ; i ++ ) cout << ( ( i <= 9 ) ? c [ i ] : ( ( i % 2 == 0 ) ? "even" : "odd" ) ) << endl ; }

ABSPATH Or __FILE__?

Answer : I would personally prefer dirname() as it is always guaranteed to give me the correct result, while the ABSPATH method relies on a fixed theme path and theme name that can both change. By the way, you can use __DIR__ instead of dirname(__FILE__) . The path to the "wp-content" directory and its subdirectories can be different in a particular WordPress installation. Also, using the WordPress internal constants (such as ABSPATH ) is not recommended. See the Determining Plugin and Content Directories WordPress Codex article. Since PHP 4.0.2, symlinks are being resolved for the __FILE__ and __DIR__ magic constants, so take that into account. Bottom line : To determine the absolute path to a theme directory, I would suggest to use the get_template_directory() function which also applies filters and internally combines get_theme_root() and get_template() . For my own projects I would choose dirname(__FILE__) , also there is a new constant in PHP: __DIR__

Cron Expression For Every 30 Minutes Code Example

Example: crontab every 30 minutes in specific minute // every 30 minutes */30 * * * * // it depends on the crontab version you are using // example: every 30 minutes at number '5' // mode 1 5,35 * * * * // mode 2 5/30 * * * *

Cannot Open Large Concatenated Zip File With Unzip, Though It Opened Fine With Archive Utility, Get A Central Directory Error

Answer : Try zip -F science_team_meeting_archive.zip -O science_team_meeting_archive.fixed.zip If that doesn't work, you just need more 'F's zip -FF science_team_meeting_archive.zip -O science_team_meeting_archive.fixed.zip If either of these work, you then unzip normally with: unzip science_team_meeting_archive.fixed.zip For more info about this, use: man zip 7z x I had the same issue with unzip %x on Linux for a .zip file larger than 4GB, compounded with a only DEFLATED entries can have EXT descriptor error. The command 7z x resolved all my issues though. Be careful though, the command 7z x will extract all files with a path rooted in the current directory. The option -o allows to specify an output directory.

Create Meeting With Zoom Api Code Example

Example: create zoom meeting api // step 1: register the app https://marketplace.zoom.us/develop/apps/eXGot1_aRsu2PLPTpMEsEw/feature // enter develop -> build apps -> gen web with JWT (first options) Build an app that supports server-to-server integration with Zoom services without a need for user authorization. Generate your API Key & Secret. // step 2: follow this web https://artisansweb.net/how-to-create-a-meeting-on-zoom-using-zoom-api-and-php/

Convert Container Bootstrap To Container Mdl Code Example

Example: container class in bootstrap meaning it’s 100% wide all the time

How To Check If String Time Are Smaller In C++ Code Example

Example: compare string c++ int compare ( const string & str ) const ;

Addclass And Removeclass In Javascript Example

Example: javascript remoev css class //remove a css class from an element document . getElementById ( "myElementID" ) . classList . remove ( "class_name" ) ;

Access Data Attribute Jquery Code Example

Example 1: jquery get data attribute value /* html */ < a data - id = "123" > link < / a > /* js */ $ ( this ) . attr ( "data-id" ) // returns string "123" $ ( this ) . data ( "id" ) // returns number 123 (jQuery >= 1.4.3 only) Example 2: jquery data attribute /* html */ < a data - number = "123" > link < / a > /* js */ $ ( this ) . attr ( "data-number" ) // returns string "123" $ ( this ) . data ( "number" ) // returns number 123 (jQuery >= 1.4.3 only) Example 3: find element with data attribute jquery $ ( "ul" ) . find ( ` [ data - slide = '${current}' ] ` ) Example 4: jquery get data attribute < a data - id = "123" > link < / a > var id = $ ( this ) . data ( "id" ) ; // Will set id to 123 Example 5: jquery data attribute data attribute in jquery For setting attribute data to the element

Conda List Of Environments Code Example

Example 1: list conda environments conda info --envs conda env list Example 2: conda list environments conda info --envs Example 3: remove environment conda conda remove --name myenv --all Example 4: conda activate env conda activate myenv

Cannot Install Latest Nodejs Using Conda On Mac

Answer : Currently, the latest version nodejs 14.x requires icu>=65 which is not yet globally available across conda-forge packages. Therefore it can be installed into a new environment with conda create -n new_env_name -c conda-forge nodejs , but most likely will raise package conflicts in existing environments. conda install node-js -c conda-forge installing the very old version 6.13.1 seems to be a solver problem. conda install nodejs -c conda-forge --repodata-fn=repodata.json will install a more current version: nodejs-13.x. Alternative workaround is to use mamba as a conda replacement. Credits go to Wolf Vollprecht. Here's my workaround: I installed nodejs for Mac from the .pkg file from the offical site and then every time I update packages in my conda environments, I force remove the nodejs version conda installs with: conda uninstall --force nodejs and then go about using the environment as if it had nodejs installed. That way when any other package need

Can I Play Assassin's Creed 2 Or Use Ubisoft's Uplay Offline?

Answer : Ubisoft never removed the DRM, they just made it less harsh if you get disconnected. It's still just as harsh on not being able to play while not connected. All the updated did was basically, instead of quitting the game when you get disconnected, forcing you to restart from last checkpoint, it now pauses the game until you get connection back, which means you restart from the exact same point. If you quit instead of waiting to reconnect however, then you must restart from the previous checkpoint as before.

Fr Css Grid Code Example

Example 1: css grid .item-a { grid-area : header ; } .item-b { grid-area : main ; } .item-c { grid-area : sidebar ; } .item-d { grid-area : footer ; } .container { display : grid ; grid-template-columns : 50 px 50 px 50 px 50 px ; grid-template-rows : auto ; grid-template-areas : "header header header header" "main main . sidebar" "footer footer footer footer" ; } Example 2: what are the units used in css grid the units used in css grid are as follows : 1 ) fr : sets the column or row to a fraction of the available space. 2 ) auto : sets the column or row to the width or height of its content automatically. 3 ) % : sets the column or row to the percent width of its container.

AddEventListener Vs Onclick

Answer : Both are correct, but none of them are "best" per se, and there may be a reason the developer chose to use both approaches. Event Listeners (addEventListener and IE's attachEvent) Earlier versions of Internet Explorer implement javascript differently from pretty much every other browser. With versions less than 9, you use the attachEvent [doc] method, like this: element.attachEvent('onclick', function() { /* do stuff here*/ }); In most other browsers (including IE 9 and above), you use addEventListener [doc], like this: element.addEventListener('click', function() { /* do stuff here*/ }, false); Using this approach (DOM Level 2 events), you can attach a theoretically unlimited number of events to any single element. The only practical limitation is client-side memory and other performance concerns, which are different for each browser. The examples above represent using an anonymous function[doc]. You can also add an event liste