id
stringlengths
32
32
text
stringlengths
0
895k
name
stringlengths
0
33k
domain
stringlengths
5
44
bucket
stringclasses
19 values
answers
list
c1175b593392679519020c3dbdec01a5
I’m developing an app, it works “when I take 2 photos with continuously, the camera will close” so I launch the camera with “MediaStore.IntentActionStillImageCamera” and it can take photo continuously. and with Fileobserver, I can count How many photos was took. The last is I have to close the camera automatically with no action when the condition is true. but, I tried the process. kill, activity.finishactivity…. all failed. How can I close the camera app automatically? in Android 9.0 –code modified —- all code is in Xamarin.Forms in Application.Android `public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { internal static MainActivity Instance { get; private set; } protected override void OnCreate(Bundle savedInstanceState) { Instance = this; global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new App()); } }` //OtherClass.cs ( i launch camera app with intent ) `public void TakePictureAsync() { Intent intent = new Intent(MediaStore.IntentActionStillImageCamera); MainActivity.Instance.StartActivityForResult(intent, 0); }` //OtherClass.cs ( close activity ) `public void ExitActivity() { MainActivity.Instance.FinishActivity(0); }`
How to Close activity ( Still\_Image\_Camera intent ) in Xamarin.Forms? =======================================================================
programmertricks.com
2020.50
[ { "text": "\nTry to use 2 alternatives way:\n\n\nSet finish(); with use of current context \n\nSet setResult(Activity.RESULT.CANCELLED);\n\n\n", "name": "", "is_accepted": false } ]
7f33aac1964ca63bf9cdd148a3ab6b06
I’m trying to encrypt a password using passowrd\_hash() by passing in the hash method as a string: `$password = '121[Dating site fоr sеx with girls in Саnadа: https://v.ht/U6n2m](https://www.programmertricks.com/profile/dating-site-f%D0%BEr-s%D0%B5x-with-girls-in-%D1%81/)'; $hash_method = 'PASSWORD_BCRYPT'; $password_encrypted = password_hash($password, $hash_method);` However, this results in a warning: Warning: password\_hash() expects parameter 2 to be an integer, string given How can I pass a string value to password\_hash()?
How to use variable into password\_hash second argument =======================================================
programmertricks.com
2020.50
[ { "text": "\nYou can use the constant() function.\n\n\npassword\\_hash($password, constant($hash\\_method)); \n\nconstant() takes in a string as an argument and returns the value of the constant of the same name. It should be used together with defined() to make sure that such constant exists and you don’t get a warning.\n\n\nFor example:\n\n\n$algorithm\\_value = defined($hash\\_method) ? constant($hash\\_method) : PASSWORD\\_DEFAULT; \n\n$password\\_encrypted = password\\_hash($password, $algorithm\\_value);\n\n\n", "name": "", "is_accepted": false } ]
279b2fcd36f39879f417bc84991663b7
What is the difference between ‘function() {}’ and ‘function functionName() {}’?
What is the difference between ‘function() {}’ and ‘function functionName() {}’? ================================================================================
programmertricks.com
2021.21
[ { "text": "\nTake a look here: [http://longgoldenears.blogspot.com/2007/09/triple-equals-in-javascript.html](https://longgoldenears.blogspot.com/2007/09/triple-equals-in-javascript.html)\n\n\nThe 3 equal signs mean “equality without type coercion”. Using the triple equals, the values must be equal in type as well.\n\n\n0 == false // true \n\n0 === false // false, because they are of a different type \n\n1 == “1” // true, automatic type conversion for value only \n\n1 === “1” // false, because they are of a different type \n\nnull == undefined // true \n\nnull === undefined // false \n\n‘0’ == false // true \n\n‘0’ === false // false\n\n\n", "name": "", "is_accepted": false } ]
02b68cc0ea2ebe3d5f7b6a95b90e2ce7
I would like to change an existing PrestaShop module without copying it and creating a new one. I know that it is possible to override .tpl files in PrestaShop, but is it possible to do the same thing with PHP classes? For instance, I would like to change the block cart so that it can be hooked on top. Since the original version doesn’t have that hook I need to change install() function! I can`t change the original source (it would be a bad idea isn’t it…) file I need to override install() function by inheriting block cart module. Is it possible to do so and where I can find an example?
Prestashop – override function in existing prestashop module? =============================================================
programmertricks.com
2020.16
[ { "text": "\n\nlike this, you can override any module don’t forget to delete cache/class\\_index.php for the override to work 🙂\n\n\n", "name": "", "is_accepted": false } ]
e6a48efc6b4c3afb80631abc22151750
How do I hide Account Fund Top-up in my account through WooCommerce (Customer) Role?
How do I hide Account Fund Top-up in my account through WooCommerce (Customer) Role? ====================================================================================
programmertricks.com
2020.16
[ { "text": "\nAn easy way to disable/hide the topup form is by copying the “Account Funds” template (myaccount/account-funds.php) from the plugin folder to your theme folder — i.e. copy this file:\n\n\nwp-content/plugins/woocommerce-account-funds/templates/myaccount/account-funds.php \n\nto:\n\n\nwp-content/themes/your-theme/woocommerce/myaccount/account-funds.php \n\nAnd then find and change the following:\n\n\n \n\nto:\n\n\n \n\nSee full code here. (for “WooCommerce Account Funds” version 2.1.16)\n\n\nYou could also instead edit the topup form template itself (myaccount/topup-form.php) like this.\n\n\nAnd I’d also add this to the theme functions file:\n\n\n`// If the user is a \"customer\", bypass the action which handles top-ups. \n\nadd_action( 'wp', function(){ \n\nif ( isset( $_POST['wc_account_funds_topup'] ) && current_user_can( 'customer' ) ) { \n\nunset( $_POST['wc_account_funds_topup'] ); \n\n} \n\n}, 0 );`\n\n\n", "name": "", "is_accepted": false }, { "text": "\nI have a Woocommerce subscription site so most of my customers roles are Subscriber. Now I want to offer some free mini-trials with a bit of credit to potential customers who would be a Customer role as we haven’t reached them signing up for a subscription yet.\n\n\nThe problem is the Account Funds (plugin: WooCommerce Account Funds by WooCommerce) shows in their “My Account” area allowing them to deposit say $10 if they wanted and bypass a subscription. How can I hide this from their view via perhaps a Woocommerce Hook?\n\n\nBelow is the source code for that relates to ‘My-Account’ for the paid Account Funds plugin, taken from /includes/class-wc-account-funds-my-account.php\n\n\nversion, ‘2.6’, ‘init\\_query\\_vars(); \n\n}\n\n\n /** \n\n* Init query vars by loading options. \n\n* \n\n* @since 2.0.12 \n\n*/ \n\npublic function init\\_query\\_vars() { \n\n$this->query\\_vars = array( \n\n‘account-funds’ => get\\_option( ‘woocommerce\\_myaccount\\_account\\_funds\\_endpoint’, ‘account-funds’ ), \n\n); \n\n}\n\n\n /** \n\n* Adds endpoint breadcrumb when viewing account funds. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param array $crumbs already assembled breadcrumb data \n\n* @return array $crumbs if we’re on a account funds page, then augmented breadcrumb data \n\n*/ \n\npublic function add\\_breadcrumb( $crumbs ) { \n\nforeach ( $this->query\\_vars as $key => $query\\_var ) { \n\nif ( $this->is\\_query( $query\\_var ) ) { \n\n$crumbs[] = array( $this->get\\_endpoint\\_title( $key ) ); \n\n} \n\n}\n\n\n return $crumbs; \n\n}\n\n\n /** \n\n* Check if the current query is for a type we want to override. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param string $query\\_var the string for a query to check for \n\n* @return bool \n\n*/ \n\nprotected function is\\_query( $query\\_var ) { \n\nglobal $wp;\n\n\n $is\\_af\\_query = false; \n\nif ( is\\_main\\_query() && is\\_page() && isset( $wp->query\\_vars[ $query\\_var ] ) ) { \n\n$is\\_af\\_query = true; \n\n}\n\n\n return $is\\_af\\_query; \n\n}\n\n\n /** \n\n* Get endpoint title. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param string $endpoint Endpoint name \n\n* @return string Endpoint title \n\n*/ \n\npublic function get\\_endpoint\\_title( $endpoint ) { \n\n$title = ”; \n\nif ( ‘account-funds’ === $endpoint ) { \n\n$title = \\_\\_( ‘Account Funds’, ‘woocommerce-account-funds’ ); \n\n}\n\n\n return $title; \n\n}\n\n\n /** \n\n* Changes page title on account funds page. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param string $title original title \n\n* @return string changed title \n\n*/ \n\npublic function change\\_endpoint\\_title( $title ) { \n\nif ( in\\_the\\_loop() ) { \n\nforeach ( $this->query\\_vars as $key => $query\\_var ) { \n\nif ( $this->is\\_query( $query\\_var ) ) { \n\n$title = $this->get\\_endpoint\\_title( $key ); \n\n} \n\n} \n\n} \n\nreturn $title; \n\n}\n\n\n /** \n\n* Insert the new endpoint into the My Account menu. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param array $items \n\n* @return array \n\n*/ \n\npublic function add\\_menu\\_items( $menu\\_items ) { \n\n// Try insert after orders. \n\nif ( isset( $menu\\_items[‘orders’] ) ) { \n\n$new\\_menu\\_items = array(); \n\nforeach ( $menu\\_items as $key => $menu ) { \n\n$new\\_menu\\_items[ $key ] = $menu; \n\nif ( ‘orders’ === $key ) { \n\n$new\\_menu\\_items[‘account-funds’] = \\_\\_( ‘Account Funds’, ‘woocommerce-account-funds’ ); \n\n} \n\n} \n\n$menu\\_items = $new\\_menu\\_items; \n\n} else { \n\n$menu\\_items[‘account-funds’] = \\_\\_( ‘Account Funds’, ‘woocommerce-account-funds’ ); \n\n}\n\n\n return $menu\\_items; \n\n}\n\n\n /** \n\n* Endpoint HTML content. \n\n* \n\n* @since 2.0.12 \n\n*/ \n\npublic function endpoint\\_content() { \n\n$topup = ”; \n\n$products = ”; \n\nif ( ‘yes’ === get\\_option( ‘account\\_funds\\_enable\\_topup’ ) ) { \n\n$topup = $this->get\\_my\\_account\\_topup(); \n\n} else { \n\n$products = $this->get\\_my\\_account\\_products(); \n\n}\n\n\n $recent\\_deposits = $this->get\\_my\\_account\\_orders();\n\n\n $vars = array( \n\n‘funds’ => WC\\_Account\\_Funds::get\\_account\\_funds(), \n\n‘topup’ => $topup, \n\n‘products’ => $products, \n\n‘recent\\_deposits’ => $recent\\_deposits, \n\n);\n\n\n wc\\_get\\_template( ‘myaccount/account-funds.php’, $vars, ”, plugin\\_dir\\_path( WC\\_ACCOUNT\\_FUNDS\\_FILE ) . ‘templates/’ ); \n\n}\n\n\n /** \n\n* Fix for endpoints on the homepage \n\n* \n\n* Based on WC\\_Query->pre\\_get\\_posts(), but only applies the fix for endpoints on the homepage from it \n\n* instead of duplicating all the code to handle the main product query. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @param mixed $q query object \n\n*/ \n\npublic function pre\\_get\\_posts( $q ) { \n\n// We only want to affect the main query \n\nif ( ! $q->is\\_main\\_query() ) { \n\nreturn; \n\n}\n\n\n if ( $q->is\\_home() && ‘page’ === get\\_option( ‘show\\_on\\_front’ ) && absint( get\\_option( ‘page\\_on\\_front’ ) ) !== absint( $q->get( ‘page\\_id’ ) ) ) { \n\n$\\_query = wp\\_parse\\_args( $q->query ); \n\nif ( ! empty( $\\_query ) && array\\_intersect( array\\_keys( $\\_query ), array\\_keys( $this->query\\_vars ) ) ) { \n\n$q->is\\_page = true; \n\n$q->is\\_home = false; \n\n$q->is\\_singular = true; \n\n$q->set( ‘page\\_id’, (int) get\\_option( ‘page\\_on\\_front’ ) ); \n\nadd\\_filter( ‘redirect\\_canonical’, ‘\\_\\_return\\_false’ ); \n\n} \n\n} \n\n} \n\n/** \n\n* Handle top-ups \n\n*/ \n\npublic function topup\\_handler() { \n\nif ( isset( $\\_POST[‘wc\\_account\\_funds\\_topup’] ) && isset( $\\_POST[‘\\_wpnonce’] ) && wp\\_verify\\_nonce( $\\_POST[‘\\_wpnonce’], ‘account-funds-topup’ ) ) { \n\n$min = max( 0, get\\_option( ‘account\\_funds\\_min\\_topup’ ) ); \n\n$max = get\\_option( ‘account\\_funds\\_max\\_topup’ ); \n\n$topup\\_amount = wc\\_clean( $\\_POST[‘topup\\_amount’] );\n\n\n if ( $topup\\_amount $max ) { \n\nwc\\_add\\_notice( sprintf( \\_\\_( ‘The maximum amount that can be topped up is %s’, ‘woocommerce-account-funds’ ), wc\\_price( $max ) ), ‘error’ ); \n\nreturn; \n\n}\n\n\n WC()->cart->add\\_to\\_cart( wc\\_get\\_page\\_id( ‘myaccount’ ), true, ”, ”, array( ‘top\\_up\\_amount’ => $topup\\_amount ) );\n\n\n if ( ‘yes’ === get\\_option( ‘woocommerce\\_cart\\_redirect\\_after\\_add’ ) ) { \n\nwp\\_redirect( get\\_permalink( wc\\_get\\_page\\_id( ‘cart’ ) ) ); \n\n} \n\n} \n\n}\n\n\n /** \n\n* Show funds on account page \n\n*/ \n\npublic function my\\_account() { \n\n$funds = WC\\_Account\\_Funds::get\\_account\\_funds();\n\n\n echo ”. \\_\\_( ‘Account Funds’, ‘woocommerce-account-funds’ ) .”; \n\necho ”. sprintf( \\_\\_( ‘You currently have **%s** worth of funds in your account.’, ‘woocommerce-account-funds’ ), $funds ) . ”;\n\n\n if ( ‘yes’ === get\\_option( ‘account\\_funds\\_enable\\_topup’ ) ) { \n\n$this->my\\_account\\_topup(); \n\n} else { \n\n$this->my\\_account\\_products(); \n\n}\n\n\n $this->my\\_account\\_orders(); \n\n}\n\n\n /** \n\n* Get HTML string for topup form in my account. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @return string HTML string \n\n*/ \n\npublic function get\\_my\\_account\\_topup() { \n\nob\\_start(); \n\n$this->my\\_account\\_topup(); \n\nreturn ob\\_get\\_clean(); \n\n}\n\n\n /** \n\n* Show top up form \n\n*/ \n\npublic function my\\_account\\_topup() { \n\n$min\\_topup = get\\_option( ‘account\\_funds\\_min\\_topup’ ); \n\n$max\\_topup = get\\_option( ‘account\\_funds\\_max\\_topup’ ); \n\n$items\\_in\\_cart = $this->\\_get\\_topup\\_items\\_in\\_cart(); \n\n$topup\\_in\\_cart = array\\_shift( $items\\_in\\_cart ); \n\nif ( ! empty( $max\\_topup ) && ! empty( $topup\\_in\\_cart ) ) { \n\nprintf( \n\n‘<%s> %s’, \n\nwc\\_get\\_page\\_permalink( ‘cart’ ), \n\n\\_\\_( ‘View Cart’, ‘woocommerce-account-funds’ ), \n\nsprintf( \\_\\_( ‘You have “%s” in your cart.’, ‘woocommerce-account-funds’ ), $topup\\_in\\_cart[‘data’]->get\\_title() ) \n\n); \n\nreturn; \n\n}\n\n\n $vars = array( \n\n‘min\\_topup’ => $min\\_topup, \n\n‘max\\_topup’ => $max\\_topup, \n\n);\n\n\n wc\\_get\\_template( ‘myaccount/topup-form.php’, $vars, ”, plugin\\_dir\\_path( WC\\_ACCOUNT\\_FUNDS\\_FILE ) . ‘templates/’ ); \n\n}\n\n\n /** \n\n* Get topup items in cart. \n\n* \n\n* @since 2.0.6 \n\n* \n\n* @return array \n\n*/ \n\nprivate function \\_get\\_topup\\_items\\_in\\_cart() { \n\n$topup\\_items = array();\n\n\n if ( WC()->cart instanceof WC\\_Cart && ! WC()->cart->is\\_empty() ) { \n\n$topup\\_items = array\\_filter( WC()->cart->get\\_cart(), array( $this, ‘filter\\_topup\\_items’ ) ); \n\n}\n\n\n return $topup\\_items; \n\n}\n\n\n /** \n\n* Cart items filter callback to filter topup product. \n\n* \n\n* @since 2.0.6 \n\n* \n\n* @return bool Returns true if item is topup product \n\n*/ \n\npublic function filter\\_topup\\_items( $item ) { \n\nif ( isset( $item[‘data’] ) && is\\_callable( array( $item[‘data’], ‘get\\_type’ ) ) ) { \n\nreturn ( ‘topup’ === $item[‘data’]->get\\_type() ); \n\n}\n\n\n return false; \n\n}\n\n\n /** \n\n* Show top up products \n\n*/ \n\nprivate function my\\_account\\_products() { \n\n$product\\_ids = get\\_posts( array( \n\n‘post\\_type’ => ‘product’, \n\n‘tax\\_query’ => array( \n\narray( \n\n‘taxonomy’ => ‘product\\_type’, \n\n‘field’ => ‘slug’, \n\n‘terms’ => ‘deposit’, \n\n) \n\n), \n\n‘fields’ => ‘ids’ \n\n) ); \n\nif ( $product\\_ids ) { \n\necho do\\_shortcode( ‘[products ids=”‘ . implode( ‘,’, $product\\_ids ) . ‘”]’ ); \n\n} \n\n}\n\n\n /** \n\n* Get HTML string of deposit products in my account page. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @return string HTML string \n\n*/ \n\nprivate function get\\_my\\_account\\_products() { \n\nob\\_start(); \n\n$this->my\\_account\\_products(); \n\nreturn ob\\_get\\_clean(); \n\n}\n\n\n /** \n\n* Show deposits \n\n*/ \n\nprivate function my\\_account\\_orders() { \n\n$deposits = get\\_posts( array( \n\n‘numberposts’ => 10, \n\n‘meta\\_key’ => ‘\\_customer\\_user’, \n\n‘meta\\_value’ => get\\_current\\_user\\_id(), \n\n‘post\\_type’ => ‘shop\\_order’, \n\n‘post\\_status’ => array( ‘wc-completed’, ‘wc-processing’, ‘wc-on-hold’ ), \n\n‘meta\\_query’ => array( \n\narray( \n\n‘key’ => ‘\\_funds\\_deposited’, \n\n‘value’ => ‘1’, \n\n) \n\n) \n\n) );\n\n\n if ( $deposits ) { \n\n$vars = array( \n\n‘deposits’ => $deposits, \n\n); \n\nwc\\_get\\_template( ‘myaccount/recent-deposits.php’, $vars, ”, plugin\\_dir\\_path( WC\\_ACCOUNT\\_FUNDS\\_FILE ) . ‘templates/’ ); \n\n} \n\n}\n\n\n /** \n\n* Get HTML string of recent deposits. \n\n* \n\n* @since 2.0.12 \n\n* \n\n* @return string HTML string \n\n*/ \n\nprivate function get\\_my\\_account\\_orders() { \n\nob\\_start(); \n\n$this->my\\_account\\_orders(); \n\nreturn ob\\_get\\_clean(); \n\n} \n\n}\n\n\nnew WC\\_Account\\_Funds\\_My\\_Account();\n\n\n", "name": "", "is_accepted": false } ]
fccfd4a91b6d72e39050840c793ce0b8
Difference between private, public and protected?
Difference between private, public and protected? =================================================
programmertricks.com
2021.17
[ { "text": "\n\n```\n\n______________________________________________________________\n| │ Class │ Package │ Subclass │ Subclass │ World |\n| │ │ │(same pkg)│(diff pkg)│ |\n|───────────┼───────┼─────────┼──────────┼──────────┼────────|\n|public │ + │ + │ + │ + │ + | \n|───────────┼───────┼─────────┼──────────┼──────────┼────────|\n|protected │ + │ + │ + │ + │ | \n|───────────┼───────┼─────────┼──────────┼──────────┼────────|\n|no modifier│ + │ + │ + │ │ | \n|───────────┼───────┼─────────┼──────────┼──────────┼────────|\n|private │ + │ │ │ │ |\n|___________|_______|_________|__________|__________|________|\n + : accessible blank : not accessible\n\n```\n\n", "name": "", "is_accepted": false } ]
41e10740edabf0baf59128f4580aef73
Find a particular word from the given string in PHP
Find a particular word from the given string in PHP ===================================================
programmertricks.com
2020.16
[ { "text": "\nYou can use the strpos() function which is used to find the occurrence of one string inside another one: \n\n `$i = 'how's you doing?'; \n\nif (strpos($i, 'you') !== false) { \n\necho 'true'; \n\n}` \n\nAfter all that you can understand below how it has been done.\n\n\nNote: !== false is deliberate; strpos() returns either the offset at which the needle string begins in the haystack string, however the boolean false if the needle isn’t found. Similarly 0 is a valid offset and 0 is “false”, we can’t use simpler constructs like !strpos($i, ‘you’).\n\n\n", "name": "", "is_accepted": true } ]
5a721a8ea9c8958875bf8890f28ef587
Datatable sorting with all things excluding with Dates. Only sort with date(days) without considering their months. I have dates in (DD-MM-YYYY) formats which was coming dynamically from database. But some of the dates were coming between another month also. I have used Jquery (jquery-3.3.1.js) and Datatable (datatables\_1.10.19.js) ``` $(document).ready(function (){ var rows_selected = []; var bookid_value = []; var table = $('#example').DataTable({ "language": { "search": ' ', "searchPlaceholder": "Search", }, lengthChange: false, "scrollY": "1000px", "scrollCollapse": true, "paging": false, 'columnDefs': [{ 'targets': 1, 'searchable': true, 'orderable': false, 'width': '1%', 'bSort': true, "type": 'date' }], 'order': [[1, 'asc']], 'rowCallback': function(row, data, dataIndex){ var rowId = data[0]; if($.inArray(rowId, rows_selected) !== -1){ $(row).find('input[type="checkbox"]').prop('checked', true); $(row).addClass('selected'); } } }); }); ``` Output : (After Sorting) ``` 31-08-2019 31-07-2019 31-08-2019 25-07-2019 31-08-2019 08-07-2019 31-08-2019 04-07-2019 31-08-2019 10-07-2019 10-07-2019 13-07-2019 15-07-2019 31-08-2019 31-08-2019 ```
Jquery Datatable – Date sorting not working with months (Months with respect to dates) ======================================================================================
programmertricks.com
2021.17
[ { "text": "\n\n```\n$(document).ready(function (){\n var rows\\_selected = [];\n var bookid\\_value = [];\n\n $.fn.dataTable.moment('DD-MM-YYYY');\n var table = $('#example').DataTable({\n \"language\": {\n \"search\": ' ',\n \"searchPlaceholder\": \"Search\",\n },\n lengthChange: false,\n \"scrollY\": \"1000px\",\n \"scrollCollapse\": true,\n \"paging\": false,\n 'columnDefs': [{\n 'targets': 1,\n 'searchable': true,\n 'orderable': false,\n 'width': '1%',\n 'bSort': true,\n \"type\": 'date'\n }],\n 'order': [[1, 'asc']],\n 'rowCallback': function(row, data, dataIndex){\n var rowId = data[0];\n if($.inArray(rowId, rows\\_selected) !== -1){\n $(row).find('input[type=\"checkbox\"]').prop('checked', true);\n $(row).addClass('selected');\n }\n }\n });\n});\n```\n\n", "name": "", "is_accepted": false } ]
b5e93f5a36f6ee1c1e8a7bbab0d48e1a
I have a list of multiple items. We need to create a loop that finds an item from the list and prints it out. If the item was not found prints out only once that it hasn’t been found. `for x in range(len(regs)): rex = regs[x] if re.match(rex,hostname): print (dev[x],'Regex matched') break else: print('wrong format')` currently, prints out the wrong format “DeviceX Regex matched”
Using for loop iteration with If statement ==========================================
programmertricks.com
2020.34
[ { "text": "\nHeⅼlo, I think your site might be haνing browser compatibility iѕsues. \n\nWhen I look at your ƅlog in Ie, it lⲟoks fine but when opening in Internet Explorer, \n\nit has some overlapping. I just wanted to give y᧐u a \n\nquick headѕ up! Ⲟther then that, wonderful blog!\n\n\n", "name": "", "is_accepted": false }, { "text": "\nA simple way to fix this is to use a flag, like so:\n\n\nvalue\\_found = False \n\n\nfor x in range(len(regs)): \n\nrex = regs[x] \n\nif re.match(rex,hostname): \n\nprint (dev[x],’Regex matched’) \n\nvalue\\_found = True \n\nbreak\n\n\nif not value\\_found: \n\nprint(‘wrong\\_format’)\n\n\n", "name": "", "is_accepted": false } ]
8a97c4a61c82c5eb46cc360111baddf6
I have a dynamically generating page that changes content dependent on whether the user is logged in or not. As such, there are **some elements I would like to hide based on the text in the body** of the webpage. Example HTML: ``` <div class="button-wrapper"> <a class="button-1" href="/upload" id="button-pop"> <span class="button-text">Upload New Product</span> </a> </div> <div class="wv-signupnotice"> <h3>Sign up to start learning</h3> Help children in rural communities </div> ``` So I want to **hide the class** `.button-wrapper` if the text “rural communities” is found on the webpage, or similarly, if class `.wv-signupnotice` is present. Here’s the Javascript I tried to no avail: ``` let divs = document.getElementsByClassName('button-wrapper'); for (let x = 0; x < divs.length; x++) { let div = divs[x]; let content = div.innerHTML.trim(); if (content == 'rural communities') { div.style.display = 'none'; } } ``` Many thanks in advance for your help!
Using Javascript to hide element class based on body text =========================================================
programmertricks.com
2020.16
[ { "text": "\nFollows the code which will hide this div if there is any other div with wv-signupnotice present on the document. Hope it helps.\n\n\nlet divs = document.getElementsByClassName(‘button-wrapper’);\n\n\n`$(document).ready(function() { \n\nif($('div').hasClass(\"wv-signupnotice\")) \n\ndivs[0].style.display=\"none\"; \n\n});`\n\n\n`[Upload New Product](/upload)\n\n\n### Sign up to start learning` `Help children in rural communities`\n\n\n", "name": "", "is_accepted": false } ]
611972dfd448a9d627a286c068ea2093
I use the flag –experimental-modules when running my node application in order to use ES6 modules. However, when I use this flag the metavariable \_\_dirname is not available. Is there an alternative way to get the same string that is stored in \_\_dirname that is compatible with this model?
Alternative for \_\_dirname in node when using the –experimental-modules flag =============================================================================
programmertricks.com
2020.45
[ { "text": "\n`// expose.js \n\nmodule.exports = {__dirname};` \n\n `// use.mjs \n\nimport expose from './expose.js'; \n\nconst {__dirname} = expose;`\n\n\n", "name": "", "is_accepted": false }, { "text": "\nAs of Node.js 10.12, there’s an alternative that doesn’t require creating multiple files and handles special characters in filenames across platforms:\n\n\n `import { dirname } from 'path'; \n\nimport { fileURLToPath } from 'url';`\n\n`const __dirname = dirname(fileURLToPath(import.meta.url));`\n\n\n", "name": "", "is_accepted": false } ]
c4a3be7de292cd55576243c707827475
I’m passing an object through ajax to a PHP file for processing like this: ``` var Obj = {id:1, name:"John", value:12.1}; $.ajax({ url : "myfile.php", type : 'POST', data : Obj, success : function(data) { console.log(data); }); ``` My issue is when I receive the parameters on my $\_POST variable everything is a string like id => “1” or value => “12.1”. I would like these to be kept like an Int and a Float for example without additional conversions on the PHP side. Is there an easy way to maintain the variable types?
How to keep variable types inside object posted through ajax? =============================================================
programmertricks.com
2020.16
[ { "text": "\nYou need to convert the values on PHP because PHP receives values as a string :\n\n\n$data = $\\_POST[‘data’] ; \n\n\n$int = (int)$data[‘id’]; // or intval($data[‘id’]) \n\n$float = (float)$data[‘value’]; // or floatval($data[‘value’])\n\n\n", "name": "", "is_accepted": false } ]
7a45b7233c2c6c148e7b5d395ea0ad1f
I’m developing a new site that has been related to the jewelry industry which deals with gold and silver. I wanna set the pricing of the product based on its weight(in terms of grams mostly). Since the price of gold is changing daily, it has been to reflect on the product pricing. So I like to add a master control to update the price of gold and silver in terms of grams on a daily basis and it should make the product price changes automatically. Are there any plugins there to customize it or code to enable this function..?
Is it possible to set pricing for Products based on weight on Woocommerce? ==========================================================================
programmertricks.com
2020.34
[ { "text": "\nFor a change in the price of products on the gold price base you need to do customize code. But using PW WooCommerce Bulk Edit plugin you are able to increase/decrease all product price with a specific amount. Try this plugin if it helps you.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nYou can add this to functions.php\n\n\ndefine (‘GOLD\\_PRICE’, ‘2.00’); // Define the factor you wish to multiply with \n\nadd\\_filter( ‘woocommerce\\_product\\_get\\_regular\\_price’, ‘calculate\\_price\\_by\\_weight’, 10, 2 ); \n\nfunction calculate\\_price\\_by\\_weight($price, $product){ \n\n$weight = $product->get\\_weight(); \n\nif ($weight > 0){ \n\n$price = GOLD\\_PRICE * $weight / 100; // Do whatever calculation you need here \n\n} \n\nreturn $price; \n\n}\n\n\n", "name": "", "is_accepted": false } ]
b94a3eb3eb91266e661f118b31c0e032
[disabled]=”test!= false” // this makes the button disable but still if I click the buttons takes me to the page normally [disabled]=”!test” // doesn’t work ng-disabled=”!test”// doesn’t work . Anybody who has an idea what am I missing, thank you?
Angular make button not clickable? ==================================
programmertricks.com
2020.45
[ { "text": "\nThe problem here isn’t the [disabled], your first use of it is fine. The problem is that the router link doesn’t care about the disabled attribute.\n\n\n Write review\n\n\n Write review\n\n\n", "name": "", "is_accepted": false }, { "text": "\n `@Component({ \n\nselector: 'app-primary-button', \n\ntemplate: ` \n\nMy real button` \n\n` `}) \n\nexport class PrimaryButton { \n\n/** \n\n* Provide an input for the property \n\n* and use it in the template \n\n*/ \n\n@Input() disabled = false; \n\n}`\n\n\nThen you’l be able to use your custom button as \n\n\n", "name": "", "is_accepted": false } ]
480c90e5d7769138f597ea67f4c4437f
I am trying to send files to my API and want to do it one by one when multiple files are selected and use two different Post calls ``` $(function () { var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; var status = $('#status'); $('#btnUploadFile').on('click', function () { $("#btnUploadFile").attr("disabled", true); var files = $("#fileUpload").get(0).files; var input = document.getElementById('fileUpload'); for (var i = 0; i < input.files.length; ++i) { var file = input.files[i]; first(9, file.name, (file.size / 1000), file.name.split('.')[1], function (versionID) { $.when(second(versionID, files[i])).done(function(){ status.html('Uploading ' + i + ' of ' + input.files.length)}); }); }; }); }); ``` ``` function first(libid, filename, filesize, fileextension, callback) { var form = new FormData(); form.append("LibId", libid); form.append("FileName", filename); form.append("FileSize", filesize); form.append("FileExtension", fileextension); var settings = { "async": false, "crossDomain": true, "url": "URL", "method": "POST", "processData": false, "contentType": false, "mimeType": "multipart/form-data", "data": form } $.ajax(settings).done(function (response) { callback(response); }); }; ``` ``` function second(versionId, fileData) { var data = new FormData(); data.append('UploadedFiles', fileData); var bar = $('.progress-bar'); var percent = $('.progress-bar'); $.ajax({ async: true, crossDomain: true, url: "URL" + Math.floor(versionId).toString(), method: "POST", processData: false, contentType: false, mimeType: "multipart/form-data", data: data, xhr: function () { var xhr = $.ajaxSettings.xhr(); xhr.onprogress = function e() { // For downloads if (e.lengthComputable) { console.log(e.loaded / e.total); } }; xhr.upload.onprogress = function (e) { // For uploads if (e.lengthComputable) { var percentVal = parseInt((e.loaded / e.total * 100), 10); console.log("Loaded " + parseInt((e.loaded / e.total * 100), 10) + "%"); var percentValue = percentVal + '%'; bar.width(percentValue); percent.html(percentValue); } }; return xhr; } }).done(function (response) { percent.html("Completed"); }).fail(function (e) { console.log("failed"); }); }; ``` In `click` event I get the files and loop through them then pass the file data to `First()` function call to get back the Unique Id (`VersionID`) and pass that `VersionID` when making the second call to `second()` function. ``` The issue is $.when(second(versionID, files[i])).done.... does not seem to wait before continuing the loop. ``` **Current Behaviour:** > It waits for the `First()` function to finish and then triggers > `Sencond()` function but does not wait for `Second()` function before > starting the new `First()` function. > > **Expected Behaviour** > Wait for the `First()` function to fully finish and then wait for the > `Second()` function to fully complete also before looping back to next > file and call `First()` function again. > > The other thing I am using `async: false` in `First()` function and `async: true` in `Second()` function as if I don’t use `async: true` in `Second()` function, I cant get file upload progress. Is it possible to wait for `second()` function to finish before continuing the loop while using AJAX `async: true`?
Unable to wait for multiple AJAX calls to finish ================================================
programmertricks.com
2020.16
[ { "text": "\nYou have two problems.\n\n\nFirst, when it needs to be passed one or more than able objects, but you are passing undefined. the second has no return statement. There’s no point in using when though because you aren’t running multiple functions in parallel.\n\n\nThe second problem is that while when won’t call the done callback until everything you pass to it is done … the for loop will not wait for the when to complete.\n\n\nThere are two approaches you can do to solve this problem:\n\n\nRemove the for loop \n\nKeep var i \n\nHave first increment i \n\nCall first recursively from second (until i is input.files.length) \n\nUse async / await to manage the promises returned from $.ajax (which will let you keep the loop). \n\nThe latter approach will require the use of a transpiler like Babel if you want to support older browsers.\n\n\n", "name": "", "is_accepted": false } ]
e6c21e02ff481914d803682eda398601
My problem is I cannot import files outside of the demo app Here is the structure I have |– Components/ | |– libs | |– node\_modules | |– index.js | |– package.json | |– demo/ | | |– node\_modules | | |– App.js | | |– package.json Inside of demo/App.js, I am trying to import one of my components from the upper directory but with no luck. All the components are exported in ./index.js Inside of App.js, I tried : import {MyComponent} from ‘Components’, import {MyComponent} from ‘../index’, or import {MyComponent} from ‘../../Components/’ but none seem to work. I got the following type of error Directory /Users/Manda/web/my projects/Components/index doesn’t exist What Am I doing wrong?
React-Native import files outside of main directory ===================================================
programmertricks.com
2020.45
[ { "text": "\nYou can create a rn-cli.config.js file in demo folder and add the following code: \n\n `var path = require(\"path\"); \n\nvar config = { \n\nwatchFolders: [ \n\npath.resolve(__dirname,\"../\"), \n\n] \n\n} \n\nmodule.exports = config;`\n\n\n", "name": "", "is_accepted": false } ]
bcbea6bb894e23dbb03b928be529091d
I am using TSQL and want to select data from a table of Persons based on their StatusID field, and if all the person’s Discharge Dates are prior to today. A person can have multiple discharge dates. I am trying to use a subquery with ALL to check if all their discharge dates are prior to today but it isn’t working. What am I doing wrong? Or is there a better way than SQL ALL? Here is code sample I tried: `select distinct per.PersonNo from PersonInfo per, Cases cas left join Cases cas on per.PersonNo = cas.PersonNo where (per.StatusID = 3012 and per.PersonNo = ALL (SELECT cas.PersonNo FROM Cases cas WHERE cas.DischargeDate < getdate() ))` I know some of my test data has the right StatusID and all their discharge dates are prior to today, and they are not getting selected but they should be. My query returns no results.
Why is my SQL ALL operator returning no results? ================================================
programmertricks.com
2020.29
[ { "text": "\nIf you want people without discharge dates equal today (or in the future?) then you can state it using not exists:\n\n\nselect distinct P.PersonNo \n\nfrom PersonInfo as P left outer join \n\nCases as C on C.PersonNo = P.PersonNo \n\nwhere P.StatusId = 3012 and \n\nnot exists ( select 42 from Cases as IC where IC.PersonNo = P.PersonNo and IC.DischargeDate >= Cast( GetDate( ) as Date ) );\n\n\nNote that different aliases are used for the two references to the Cases table and the subquery is correlated with the outer query (IC.PersonNo = P.PersonNo).\n\n\nThe cast is used to eliminate the time from GetDate. That avoids problems with DischargeDate if it happens to be a DateTime rather than Date. Tip: Sharing the DDL for the tables and supplying sample data and desired results help us help you.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nselect distinct P.PersonNo \n\nfrom PersonInfo as P left outer join \n\nCases as C on C.PersonNo = P.PersonNo \n\nwhere P.StatusId = 3012 and \n\nnot exists ( select 42 from Cases as IC where IC.PersonNo = P.PersonNo and IC.DischargeDate >= Cast( GetDate( ) as Date ) );\n\n\nNote that different aliases are used for the two references to the Cases table and the subquery is correlated with the outer query (IC.PersonNo = P.PersonNo).\n\n\nThe cast is used to eliminate the time from GetDate. That avoids problems with DischargeDate if it happens to be a DateTime rather than Date. Tip: Sharing the DDL for the tables and supplying sample data and desired results help us help you.\n\n\n", "name": "", "is_accepted": false } ]
37abd6f1169af2a6d2756f0a83d60abb
I have a CakePHP website with its own login system using the Auth component. A user has logged in and is navigating the website. At one point, he can click a link that opens an external PHP file. The “tricky” thing (for me) is to only show the contents of that PHP file if the user is logged in (to prevent someone without an account accessing those contents). I can’t use Auth there because I’m “outside” Cake… I don’t know if maybe using $\_SESSION, but I don’t know how… Is this even possible? Does anybody have any ideas?
Access cakephp session (auth) from outside cakephp ==================================================
programmertricks.com
2020.40
[ { "text": "\nI’ll add you furthermore may ought to set session name to “CAKEPHP” using\n\n\nsession\\_name(‘CAKEPHP’)\n\n\njust before your external app session\\_start() otherwise you’ll not apply Kashif Khan instructed resolution 🙂\n\n\n", "name": "", "is_accepted": false }, { "text": "\nYes, you can access the CakePHP SESSION outside CakePHP folder. try this session variable\n\n\n$\\_SESSION[‘Auth’] \n\nif it exists then check for the user here\n\n\n$\\_SESSION[‘Auth’][‘User’]\n\n\n", "name": "", "is_accepted": false } ]
b16da38e2e752aef0e3f4d545dbb219e
How can we post content in PHP by using file\_get\_contents?
How can we post content in PHP by using file\_get\_contents? ============================================================
programmertricks.com
2020.50
[ { "text": "\nI’m using PHP’s function file\\_get\\_contents() to fetch contents of a URL and then I process headers through the variable $http\\_response\\_header.\n\n\nNow the problem is that some of the URLs need some data to be posted to the URL (for example, login pages).\n\n\nHow do I do that?\n\n\nI realize using stream\\_context I may be able to do that but I am not entirely clear.\n\n\nThanks.\n\n\n", "name": "", "is_accepted": false } ]
dc7007022132f42d9630a42cc42eb459
I’m trying to make a fragment with a listview inside is where I will put some data from API. I know how to do it when I use activity. I’ve created a base adapter and in my fragment, I have something like this: `Transactions_weekly transactions;` `@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_weekly_datas, container, false);` `listView = (ListView) view.findViewById(R.id.weekly_data_list);` `Intent intent = getIntent(); transactions = (Transactions_weekly) intent.getSerializableExtra("transactions"); Transaction_Weekly_Adapter adapter = new Transaction_Weekly_Adapter(this, transactions); ArrayAdapter arrayAdapter = new ArrayAdapter<>( Objects.requireNonNull(getActivity()), android.R.layout.simple_list_item_1, Collections.singletonList(transactions)); listView.setAdapter(arrayAdapter);` `return view; }` The problem is in these two lines: Intent intent = getIntent();saying cannot resolve method getIntent() and Transaction\_Weekly\_Adapter adapter = new Transaction\_Weekly\_Adapter(this, transactions); Any help is appreciated!
How to put a ListView inside a Fragment? ========================================
programmertricks.com
2019.47
[ { "text": " `1- getActivity().getIntent();`\n\n `2- Transaction_Weekly_Adapter adapter = new Transaction_Weekly_Adapter(getActivity(), transactions);` \n\nI hope this will help you 🙂\n\n", "name": "", "is_accepted": false } ]
108b7ce9fcdc4327a4ab18a5501e6062
I have installed WordPress inside one folder called blog. when we open the blog, the blog links are broken 404-page error. How do I fix this issue, if it is installed on root directory it will work, but this time it is a directory, Is there any way to fix this issue.
WordPress Permalink issue on subdirectory WordPress ===================================================
programmertricks.com
2019.51
[ { "text": "First, ensure your server support rewrite\\_ module\n\n1.Login your WordPress dashboard \n 2. Click Settings \n 3.click Permalinks and change your permalink then click save.\n\n", "name": "", "is_accepted": false } ]
fc318aeacf13bb35bf51a89f58af65a6
I need to subtract two dates, under the format Y-M-D hh:mm: ss, but I keep failing to get the result even though I found many solutions close to my quest. This is what I got so far : `import pandas as pd` `df = pd.read_excel('file.xlsx',header=0) df['Time'] = pd.to_datetime(df['Time']) df['Time']` `import datetime as dt` `df['Time'] = df['Time'].apply(lambda x: dt.datetime.strftime(x, '%Y-%m-%d %H:%M:%S')) df['Time'] #print(df['Time']) s1 = df['Time'].head(1) print(s1) s2=df.iloc[-1,2] print(s2)` `format = '%Y-%m-%d %H:%M:%S' startDateTime = dt.datetime.strptime(s1, format) endDateTime = dt.datetime.strptime(s2, format)` `diff = endDateTime - startDateTime` Can you please help me overcome this problem. Thank you!
How can I calculate the difference between two dates format Y/M/D h:m:s.ns? ===========================================================================
programmertricks.com
2020.05
[ { "text": "\n`df['Time'] = pd.to_datetime(df['Time'])` \n\n `startDateTime= df['Time'].iloc[0] \n\nprint(startDateTime)` \n\n `#if 3rd column is filled by datetimes \n\nendDateTime=df.iloc[-1,2] \n\nprint(endDateTime)`\n\n\n", "name": "", "is_accepted": false } ]
15a1ab43a37f8b2cbb7e1a243cb1d7fd
I have a 3D array (a is a numpy array of the shape of (512, 512, 133)) which contains non zero values in a certain area. I would like to calculate the volume of non zero area in this 3D numpy array. If I know the pixel spacing (0.7609, 0.7609, 0.5132), how the actual volume can be found in python?
Volume calculation of 3D numpy array in python? ===============================================
programmertricks.com
2020.45
[ { "text": "\n `import numpy as np \n\nunits = np.count_nonzero([[[ 0., 0.], \n\n[ 2., 0.], \n\n[ 0., 3.]], \n\n[[ 0., 0.], \n\n[ 0., 5.], \n\n[ 7., 0.]]])` \n\nIf you know the spacing s between two pixels the volume of a pixel is calculated as the volume of a square (pixel volume) times the amount of pixels you previously determined.\n\n\n `volume = units * pow(s, 3)`\n\n\n", "name": "", "is_accepted": false } ]
d058e16b36f2e403e1ce9a8501d6c565
How to search number of days between two dates?
How to search number of days between two dates? ===============================================
programmertricks.com
2020.50
[ { "text": "\nIf you’re using PHP 5.3 >, this is by far the most accurate way of calculating the difference: \n\n `$earlier = new DateTime(\"2010-07-06\"); \n\n$later = new DateTime(\"2010-07-09\"); \n\n$diff = $later->diff($earlier)->format(\"%a\");`\n\n\n", "name": "", "is_accepted": false } ]
9a0d4b2e76de9e64b2315afd3f7f54f1
I need the variable ‘gv’ to have the value of a button, i did this with this.value and it worked as alerts give the right values. but once i gave that variable to the speed parameter of an animation, it didn’t work. i tried giving the variable right at the animation, but that didn’t work either. i also tried to give the animation random value’s to see if it was effected, and it was. but the variable doesn’t do anything at all. ``` $(document).ready(function() { $("button").click(function() { var GV = this.value; $("#ball").animate({ bottom: "0px" }, GV); }) }); ``` ``` butt on ``` i expect the animation to pull the div to the bottom at the speed of 18999 milliseconds, but it pulls at 800 milliseconds
Why does not the animation speed parameter take my variable jQuery ==================================================================
programmertricks.com
2020.40
[ { "text": "\n`this.value` is a string. According to [JQuery Docs](https://api.jquery.com/animate/) the strings allowed for `animate()` method parameters are ‘fast’ or ‘slow’. Any other string will be disregarded and the default speed will be used. Use `parseInt($(this).val())` to get the integer value of the button element:\n\n\n\n```\nvar GV = parseInt($(this).val());\n```\n\n", "name": "", "is_accepted": false } ]
dada3c164a3f070269aaa8a791ee126c
How can the default favicon be changed in CakePHP?
CakePHP favicon ===============
programmertricks.com
2020.05
[ { "text": "\nSimply replace the favicon inside app/webroot with your own *.ico favicon. And you’re done! If your favicon won’t show after you did as above, Re-refresh your browser Or, simply clear web history.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nSimply replace the file app/webroot/favicon.ico with your own version.\n\n\n", "name": "", "is_accepted": false } ]
d5fe805ff779df5e1710efbffa65ceb4
How to insert multiple rows through php array in mysql?
How to insert multiple rows through php array in mysql? =======================================================
programmertricks.com
2020.50
[ { "text": "\nMultiple insert/ batch insert is now supported by codeigniter. I had same problem. Though it is very late for answering question, it will help somebody. That’s why answering this question. \n\n `$data = array( \n\narray( \n\n'title' => 'My title' , \n\n'name' => 'My Name' , \n\n'date' => 'My date' \n\n), \n\narray( \n\n'title' => 'Another title' , \n\n'name' => 'Another Name' , \n\n'date' => 'Another date' \n\n) \n\n); \n\n$this->db->insert_batch('mytable', $data);`\n\n`// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')`\n\n\n", "name": "", "is_accepted": false } ]
d04817d183d4747b11fb76ffdfd456df
Yesterday, my application was working fine. When I started my PC today and after the start Magento I got this error message. Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. How do I resolve this?
Service Temporarily Unavailable Magento? ========================================
programmertricks.com
2020.05
[ { "text": "\nSimply delete the maintenance.flag file in the root folder and then delete the files of the cache folder and session folder inside the var/ folder.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nCheck if there is a file called maintenance.flag and if so delete it.\n\n\nMagento 1.x : maintenance.flag file is in : magento root directory\n\n\nMagento 2.x : maintenance.flag file is in : var folder\n\n\nWhen Magento is performing certain tasks it temporarily creates this file. Magento checks for its existence and if it’s there will send users to the page you described.\n\n\n", "name": "", "is_accepted": false } ]
acb76f1a1cc278cfc8296f7318ef6bf3
`#include` `int main(){ int a[1] = {1}; int b = 6; printf("%dn", a[-1]); printf("%dn", b); //printf("%dn", (a-1 == &b)); return 0; }` It doesn’t work properly Could anyone explain the code for me?
What is the problem of the following code in c ==============================================
programmertricks.com
2020.45
[ { "text": "\nInvalid Index for an array, I think you meant print a[1] printf(“%d\\n”, a[-1])\n\n\n", "name": "", "is_accepted": false }, { "text": "\nThe a[-1] is undefined memory space.\n\n\n", "name": "", "is_accepted": false } ]
e5f35d84c2d92a317947d6dbf32d708b
I am trying to screenshot the view of a div which contains fullcalendar, but unable to do so. I have tried following code: ``` function screenshot() { alert('zz'); html2canvas(document.querySelector('#calendar')).then(function (canvas) { document.body.appendChild(canvas); console.log(canvas.toDataURL()); }); } ``` ``` Whenever I click on screenshot, I want to capture image of div#calendar and need to console the url so that I can use this image later as thumbnail when I share this page link later in social media. ```
HTML2Canvas not working need to console image url =================================================
programmertricks.com
2020.16
[ { "text": "\nYou can use\n\n\n\n```\nfunction screenshot() {\n console.log(html2canvas(document.querySelector('#calendar')))\n html2canvas(document.querySelector('#calendar'), {\n onrendered: function (canvas) {\n var image = canvas.toDataURL(\"image/png\");\n console.log(\"image => \", image); //image in base64\n var pHtml = \"<img src=\" + image + \" />\";\n $(\"#parent\").append(pHtml); //you can append image tag anywhere\n }\n });\n}\n```\n\n", "name": "", "is_accepted": false } ]
ccf804343e06ac15f4891dc09bcd101f
I have developed a project with CakePHP-1.3.10. Now I want to upgrade it to CakePHP-1.3.11. What’s the easiest process to upgrade from CakePHP-1.3.10 to CakePHP-1.3.11?
CakePHP question: How can i upgrade a cakephp project from cakephp-1.3.10 to cakephp-1.3.11? ============================================================================================
programmertricks.com
2020.45
[ { "text": "\ndownload the cake zip, unpack, delete the app folder, put your app folder in.\n\n\n", "name": "", "is_accepted": false } ]
faeb1fc61f0bb8bf56b97930946d908f
I have an SSAS cube that imports a view of data from a source system. Each time this process imports the full view, however, I want to improve performance by only processing the rows that are new or have changed since the last process. Can anyone advise the best way of doing this? The view has an ID column, along with a created date and a modified date if this helps?
SSAS Tabular – Only process data where row is new or modified =============================================================
programmertricks.com
2020.05
[ { "text": "\nSelect * from table where id, \n\nmodified\\_date IN (select id, \n\nmax(modified\\_date) from \n\ntable group by id) or created\\_date IS \n\nNULL;\n\n\n", "name": "", "is_accepted": false } ]
03b655f4088a0eb7849fce47c7baa6ba
How to transpose multidimensional arrays in PHP?
How to transpose multidimensional arrays in PHP? ================================================
programmertricks.com
2020.45
[ { "text": "\n `function transpose($array) { \n\narray_unshift($array, null); \n\nreturn call_user_func_array('array_map', $array); \n\n} \n\nOr if you're using PHP 5.6 or later:`\n\n`function transpose($array) { \n\nreturn array_map(null, ...$array); \n\n}`\n\n\n", "name": "", "is_accepted": false } ]
b18d8a31fc73b380e015f24bf69b2d1a
I have installed WordPress inside one folder called blog. when we open the blog, the blog links are broken 404-page error. How do I fix this issue, if it is installed on root directory it will work, but this time it is a directory, Is there any way to fix this issue.
WordPress Permalink issue on subdirectory WordPress ===================================================
programmertricks.com
2020.05
[ { "text": "\nFirst, ensure your server support rewrite\\_ module\n\n\n1.Login your WordPress dashboard \n\n2. Click Settings \n\n3.click Permalinks and change your permalink then click save.\n\n\n", "name": "", "is_accepted": false } ]
6313aff55f05d1567318734c424e214f
How can we remove calling in foreach loop in Java?
How can we remove calling in foreach loop in Java? ==================================================
programmertricks.com
2021.21
[ { "text": "\nThis question already has an answer here:\n\n\nIterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop 23 answers \n\nIn Java, is it legal to call remove on a collection when iterating through the collection using a foreach loop? For instance:\n\n\nList names = …. \n\nfor (String name : names) { \n\n// Do something \n\nnames.remove(name). \n\n} \n\nAs an addendum, is it legal to remove items that have not been iterated over yet? For instance,\n\n\n//Assume that the names list as duplicate entries \n\nList names = …. \n\nfor (String name : names) { \n\n// Do something \n\nwhile (names.remove(name)); \n\n}\n\n\n", "name": "", "is_accepted": false } ]
2dfdf5d6bee9abf6b9602d27aa0c19a9
I have a table with birthdates and I want to select all the birthdays that will come in the next 30 days. `SELECT * from dbo.EMPLOYEES WHERE DATE <= DATEADD(day, +30,GETDATE()) and DATE >= getdate() order by "DATE"`
How to select birthdays in the next 30 Days? ============================================
programmertricks.com
2020.05
[ { "text": "\ntry this one!\n\n\n `SELECT * from dbo.EMPLOYEES \n\nWHERE month(DATE)>= month(GETDATE()) \n\nand day(DATE) >= day (getdate()) and day(DATE) < = day( getdate()) + 30 \n\norder by \"DATE\"`\n\n\n", "name": "", "is_accepted": false } ]
7c081ba171c94f660bd54351e708a12a
I’m trying to get one by one of array `json_encode` to jquery but it’s always getting error *undefined* no one work, any suggestion to my code. `$response = array( 'antrian' => true, 'message' => 'Success print recipt' );` echo json\_encode($response); `$.ajax({ url: urlPrintQueue, method: "POST", data: {id: id}, dataType: 'json', success: function(result) { console.log(result[0]); // antrian console.log(result[1]); // message } });`
How to get one value from json\_encode php to ajax? ===================================================
programmertricks.com
2020.45
[ { "text": "\nYou’re running an associative array through json\\_encode().\n\n\nIf you passed a standard numeric array to json\\_encode(), your result in JS would be an array. When you pass an associative array, however, the result is going to be an object instead.\n\n\nInstead of: \n\n `success: function(result) { \n\nconsole.log(result[0]); // antrian \n\nconsole.log(result[1]); // message \n\n}` \n\nYou need to use: \n\n `success: function(result) { \n\nconsole.log(result.antrian); // antrian \n\nconsole.log(result.message); // message \n\n}`\n\n\n", "name": "", "is_accepted": false } ]
2a241700cc550f9a226c5c6df44482d4
I want to add PHP phone number validation in an open cart code sample is given below `if(!filter_var($customer_email, FILTER_VALIDATE_EMAIL)) { $errors[$pos++] = 'Email is not valid.'; }` `if($customer_mobile=='') { $errors[$pos++] = 'Please enter your Mobile.'; } /*elseif (strlen($customer_mobile) < 11 || !is_numeric($this->request->post['cell_number'])){ $errors[$pos++] = 'Mobile number should be 7 digits.'; }*/`
Validation Opencart ===================
programmertricks.com
2020.05
[ { "text": "\nWell, you have 2 options, validate or filter. Because phone numbers are different in length and characters, what I would suggest is that you just filter\n\n\nFILTER\\_SANITIZE\\_NUMBER\\_INT \n\nRemove all characters except digits, plus and minus sign.\n\n\n", "name": "", "is_accepted": false } ]
d76bc027a5f017cfabb23e4e0754f1cf
I am using CodeIgniter, I am getting dynamically select boxes. From the second select box, the user can select the status and according to the status input field will display. Check this below screenshot, If the user clicked on `Add More` then below select box will display. [![enter image description here](https://i.stack.imgur.com/KOGEs.png)](https://i.stack.imgur.com/KOGEs.png) Now from the second select box, I choose `Status one` so according to the selected value, remark input field displayed. Check below screenshot. [![enter image description here](https://i.stack.imgur.com/zl9RD.png)](https://i.stack.imgur.com/zl9RD.png) If the user wants more fields for ID 2 then the user will click on `add Bank`. For example, I clicked two times and I chose a status. so It will display like this. because Each row has one status field. [![enter image description here](https://i.stack.imgur.com/IlJ23.png)](https://i.stack.imgur.com/IlJ23.png) There is no issue in UI till now, Now I am submitting the data into the database. But when I am submitting the data into the database then I am getting the error `Message: Uninitialized string offset: 0` and sometimes `Message: Uninitialized string offset: 1`. The issue I am getting on the second dropdown because according to selected value input field displaying and If I choose `Status one` then remark field is getting the value but date and remark and amt and reason are showing `offset: 1` error for the first row. You can find my HTML here: <https://jsfiddle.net/7vthpbmc/> I am using below logic. My controller code is   ``` public function insertProcess() { $order = $this->input->post('pp\_order[]'); $partner = $this->input->post('parner[]'); $status = $this->input->post('pp\_fileStatus[]'); //$status output Array ( [0] => 1 [1] => 2 [2] => 3 ) //it will increase and some time it will be duplicate foreach ($status as $key) { if (($key == 1)) { $remark = $this->input->post('remark[]'); } else { $remark=""; } if(($key == 2)){ $reasonDate = $this->input->post('reasonDate[]'); $message = $this->input->post('message[]'); } else { $reasonDate=""; $message=""; } if(($key == 3)){ $reasonAmt = $this->input->post('reasonAmt[]'); $reason = $this->input->post('reason[]'); } else { $reasonAmt=""; $reason=""; } } $order\_length = sizeof($order); for ($j=0; $j < $order\_length ; $j++) { $data['row'] = array( 'order' => $order[$j], 'partner' => $partner[$j], 'status' => $status[$j], 'remark'=>$remark[$j], 'reasonDate'=>$reasonDate[$j], 'message'=>$message[$j], 'reasonAmt'=>$reasonAmt[$j], 'reason'=>$reason[$j] ); print\_r($data); $save = array( 'b\_orderno' =>$data['row']['order'], 'b\_partner' => $data['row']['partner'], 'b\_filestatus' => $data['row']['status'], 'b\_remark' => $data['row']['remark'], 'b\_date' => $data['row']['reasonDate'], 'b\_amt' => $data['row']['reasonAmt'], 'b\_reason' => $data['row']['reason'] ); $afterxss=$this->security->xss\_clean($save); if ($afterxss) { $this->db->insert('tbl\_bankdata',$afterxss); $response['error'] = "true"; $response['msg'] = "Process Partner added successfully"; } else { $response['error'] = "false"; $response['msg'] = "Sometning wrong! please check the internet connection and try again"; } } echo json\_encode($response); } ```
Message: Uninitialized string offset: 0 while inserting dynamic input field data ================================================================================
programmertricks.com
2020.34
[ { "text": "\nThis error would occur if any of the following variables were actually strings or null instead of arrays, in which case accessing them with an array syntax `$var[$i]` would be like trying to access a specific character in a string:\n\n\n\n```\n$catagory\n$task\n$fullText\n$dueDate\n$empId\n```\n\n \n\n\n", "name": "", "is_accepted": false } ]
41a3e13361fcd7e8f971ef6ba7528a22
Using the CakePHP, I try to install 3.0-beta2 using composer but I come up with this error: `cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system`
CakePHP 3.0 installation: intl extension missing from system ============================================================
programmertricks.com
2020.05
[ { "text": "\nI faced the same issue in ubuntu 12.04\n\n\nInstalled: sudo apt-get install php5-intl\n\n\nRestarted the Apache: sudo service apache2 restart\n\n\n", "name": "", "is_accepted": false } ]
9d581c181363f569a75f109d7a3557c4
For the CakePHP application, I created the MySQL database. Which tool to be used to create an ER Diagram of a database? Fields and relations between tables are made in a way CakePHP likes. Thank you in advance!
Generate ER Diagram from existing MySQL database, created for CakePHP =====================================================================
programmertricks.com
2019.51
[ { "text": "Try MySQL Workbench. It packs in very nice data modeling tools. Check out their screenshots for EER diagrams (Enhanced Entity Relationships, which are a notch up ER diagrams).\n\nThis isn’t CakePHP specific, but you can modify the options so that the foreign keys and join tables follow the conventions that CakePHP uses. This would simplify your data modeling process once you’ve put the rules in place.\n\n", "name": "", "is_accepted": false } ]
875cf2373d634840b1d8cfff5f12fe3f
I am adding a QapTcha pluggin into my website, I am using jquery.ui.touch-punch.min.js. However, when I zoom into a page from a mobile site and I drag my slider left, it moves out of the bar, which it isn’t supposed to do. I have attached pictures to give an idea of whats going on. [![As you can see when the page is loaded the scroll bar that says "Scroll right" is situated perfectly in the bar and it doesnt move off it onto the left](https://i.stack.imgur.com/jMPNk.png)](https://i.stack.imgur.com/jMPNk.png) [![When you swipe right it still works fine stays in the bar](https://i.stack.imgur.com/3PItf.png)](https://i.stack.imgur.com/3PItf.png) [![the problem occurs when you zoom into the page and you swipe the scroll bar it moves left out of the page](https://i.stack.imgur.com/oT5dj.png)](https://i.stack.imgur.com/oT5dj.png) The problem occurs when you zoom into the page and you swipe the scroll bar it moves left out of the page as you can see in the 3rd image. This is my code: ``` Slider.draggable({ containment: bgSlider, axis: 'x', stop: function (event, ui) { if (ui.position.left > 123) { Slider.draggable('disable').css('cursor', 'default'); inputQapTcha.val(""); TxtStatus.css({ color: '#307F1F' }).text(opts.txtUnlock); Icons.css('background-position', '-16px 0'); //form.find('input[type='submit']').removeAttr('disabled'); $(opts.buttonLock).removeAttr('disabled'); ///Show a fornm if ($(opts.buttonLock).attr("show")) { $($(opts.buttonLock).attr("show")).css("display", "block"); $("#QapTcha").fadeOut(500); } else if (opts.buttonLock == 'input[name="SendMail"]') { $(opts.buttonLock).bind("click", function () { AuroraJS.Modules.SendMail(this); }); } else if (opts.buttonFunc != "") { $(opts.buttonLock).bind("click", function () { opts.buttonFunc(); }); } } } }); ``` How I can prevent it from moving out of the bar when the page is zoomed into?
Slider to stop moving out of the screen when the page is zoomed in mobile sites ===============================================================================
programmertricks.com
2021.17
[ { "text": "\nA link to a working example of the issue would help in resolving the issue.\n\n\nFrom as far I can see, the only thing I could think of is that something might go wrong with positioning. You could try resolving this by adding `position: relative;` to the slider container.\n\n\n", "name": "", "is_accepted": false } ]
ae6c257e91de884130e6592a4cb49643
I want to install CakePHP 3 in an old-fashioned upload-unzip-run way. The archive I’ve downloaded from CakePHP/CakePHP/tags does not contain the default folders like webroot, Model, etc., which means it’s not complete. The official documentation does not cover this. Here’s a relevant Github issue I found, but the person ends up still using Composer. There’s also CakePHP/app and it seems to include those missing files, but it’s not mentioned in CakePHP/CakePHP’s composer.json, and even if I download it I’ve no idea how to merge the packages. Please help!
Installing CakePHP 3 manually, without composer ===============================================
programmertricks.com
2020.05
[ { "text": "\nYou can install CakePhp 3 without Composer.\n\n\nYou need minimum requirements to install CakePHP 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).\n\n\nYou can download CakePhp 3 boilerplate from GitHub.\n\n\nRequirements\n\n\nServer\n\n\nHTTP Server. For example Apache. Having mod\\_rewrite is preferred, but by no means required. \n\nPHP 5.4.16 or greater. \n\nmbstring extension \n\nintl extension \n\nDatabase :\n\n\nMySQL (5.1.10 or greater) \n\nPostgreSQL \n\nMicrosoft SQL Server (2008 or higher) \n\nSQLite 3 \n\nAll built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.\n\n\n", "name": "", "is_accepted": false } ]
ad314c7d69134db76a4b387dccb22e30
I have an array of collections like below : `array:9 [▼ 0 => Collection {#990 ▶} 1 => Collection {#1109 ▶} 2 => Collection {#1221 ▶} 3 => Collection {#1331 ▶} 4 => Collection {#1442 ▶} 5 => Collection {#1554 ▶} 6 => Collection {#1664 ▶} 7 => Collection {#1775 ▶} 8 => Collection {#1887 ▶} ]` I want to make this a single collection and make each collection as 1 item of that collection now what i tried is collect($f) but i get the result as below : `Collection {#1443 ▼ #items: array:9 [▼ 0 => Collection {#990 ▶} 1 => Collection {#1109 ▶} 2 => Collection {#1221 ▶} 3 => Collection {#1331 ▶} 4 => Collection {#1442 ▶} 5 => Collection {#1554 ▶} 6 => Collection {#1664 ▶} 7 => Collection {#1775 ▶} 8 => Collection {#1887 ▶} ] }` now i want to know how can i make this 1 collection and make all those 8 collection as items of that collection like below : `Collection {#990 ▼ #items: array:1 [▼ 0 => RoomPricingHistory {#971 ▶} 1 => RoomPricingHistory {#971 ▶} 2 => RoomPricingHistory {#971 ▶} 3 => RoomPricingHistory {#971 ▶} 4 => RoomPricingHistory {#971 ▶} ] }`
how to change the format of a array to collection as each item in laravel =========================================================================
programmertricks.com
2020.40
[ { "text": "\nI’m not sure if this is what you’re after.\n\n\nFirst, using artisan I’ll make a collection of collections. Each collection has a single element array [1] \n\n$ php artisan tinker \n\n>>> $a = collect(1) \n\n=> Illuminate\\Support\\Collection {#3205 \n\nall: [ \n\n1, \n\n], \n\n} \n\n>>> collect(array($a,$a,$a,$a,$a,$a,$a)) \n\n=> Illuminate\\Support\\Collection {#3218 \n\nall: [ \n\nIlluminate\\Support\\Collection {#3205 \n\nall: [ \n\n1, \n\n], \n\n}, \n\nIlluminate\\Support\\Collection {#3205}, \n\nIlluminate\\Support\\Collection {#3205}, \n\nIlluminate\\Support\\Collection {#3205}, \n\nIlluminate\\Support\\Collection {#3205}, \n\nIlluminate\\Support\\Collection {#3205}, \n\nIlluminate\\Support\\Collection {#3205}, \n\n], \n\n}\n\n\n", "name": "", "is_accepted": false }, { "text": "\nOnce you have a collection of collections, you can use flatten to get all elements of the underlying collections in the parent collection.\n\n\ncollect($f)->flatten(1);\n\n\n", "name": "", "is_accepted": false } ]
03f447eaa047a01c41e925aec89882a9
I would like to add to the user profile the time from registration to the current day in the format: With us: 7 years 3 months 2 weeks 6 days OR With us: 1 year 1 month 1 week 1 day I bit helped this post Count days from registration date to today, but their countdown goes only in days.
WordPress: count time from registration date to today =====================================================
programmertricks.com
2020.05
[ { "text": "\nYou can use strtotime(get\\_userdata(get\\_current\\_user\\_id( ))->user\\_registered)) to get register date, After you compare with time() to get number year, month, day.\n\n\n", "name": "", "is_accepted": false } ]
8cf8a157d24c04e0d57e511305ee7013
I have a problem with LazyInitializationException and I don’t know how to fix it. I get the following exception: Exception in thread “main” org.hibernate.LazyInitializationException: could not initialize proxy – no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215) at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190) at sei.persistence.wf.entities.Element\_$$\_jvstc68\_47.getNote(Element\_$$\_jvstc68\_47.java) at JSON\_to\_XML.createBpmnRepresantation(JSON\_to\_XML.java:139) at JSON\_to\_XML.main(JSON\_to\_XML.java:84) when I try to call from main the following lines: `Model subProcessModel = getModelByModelGroup(1112); System.out.println(subProcessModel.getElement().getNote());` I implemented the getModelByModelGroup(int modelgroupid) method firstly like this : `public static Model getModelByModelGroup(int modelGroupId, boolean openTransaction) {` `Session session = SessionFactoryHelper.getSessionFactory().getCurrentSession(); Transaction tx = null;` `if (openTransaction) { tx = session.getTransaction(); }` `String responseMessage = "";` `try { if (openTransaction) { tx.begin(); } Query query = session.createQuery("from Model where modelGroup.id = :modelGroupId"); query.setParameter("modelGroupId", modelGroupId);` `List modelList = (List)query.list(); Model model = null;` `for (Model m : modelList) { if (m.getModelType().getId() == 3) { model = m; break; } }` `if (model == null) { Object[] arrModels = modelList.toArray(); if (arrModels.length == 0) { throw new Exception("Non esiste "); }` `model = (Model)arrModels[0]; }` `if (openTransaction) { tx.commit(); }` `return model;` `} catch(Exception ex) { if (openTransaction) { tx.rollback(); } ex.printStackTrace(); if (responseMessage.compareTo("") == 0) { responseMessage = "Error" + ex.getMessage(); } return null; } }` Anybody here to help me with this problem, please?
LazyInitializationException – could not initialize proxy – no Session? ======================================================================
programmertricks.com
2020.45
[ { "text": "\nIf you using Spring mark the class as @Transactional, then Spring will handle session management. \n\n `@Transactional \n\npublic class MyClass { \n\n... \n\n}`\n\n\nBy using @Transactional, many important aspects such as transaction propagation are handled automatically. In this case, if another transactional method is called the method will have the option of joining the ongoing transaction avoiding the “no session” exception.\n\n\n", "name": "", "is_accepted": false } ]
fb7d9f92a6a26b11a71df91609ee36ca
How to grab href attribute of an element?
How to grab href attribute of an element? =========================================
programmertricks.com
2021.21
[ { "text": "\nTrying to find the links on a page.\n\n\nmy regex is:\n\n\n`/]*href=(\"'??)([^\"' >]*?)[^>]*>(.*)/`\n\n\nbut seems to fail at\n\n\n`[what?](that \"this\")` \n\n\nHow would I change my regex to deal with href not placed first in the a (anchor) tag?\n\n\n", "name": "", "is_accepted": false } ]
0bf8945d0dfda9be595a59a40cad5e18
I have a problem with an order by in oracle query. `select KEY, B, C, (select D from TABLE1 a where a.KEY = b.KEY and a.DATE< b.DATE order BY a.DATE and rownum =1 ) FROMSTATUS from TABLE2 b` I knew the “order by” is not working in the subquery. I modify my query as: `select KEY, B, C, (select * from (select D from TABLE1 a where a.KEY = b.KEY and a.DATE< b.DATE order by DATE) where rownum = 1) FROM STATUS from TABLE2 b` But in this way, the B.KEY and B.DATE has not resolved by oracle I need to select only a 1 value from TABLE2 and the value is the first previous a.DATE `TABLE1 KEY DATE A B C 1 01/31/2000 1 2 3 2 02/25/2000 X Y Z` `TABLE2 KEY DATE D 1 01/30/2000 1 1 01/27/2000 2 1 01/25/2000 2 2 02/20/2000 4 2 02/13/2000 1` I want this result: `TABLE1.KEY TABLE1.DATE TABLE1.A TABLE1.B TABLE1.C TABLE2.DATE TABLE2.D 1 01/31/2000 1 2 3 01/30/2000 1 2 02/25/2000 X Y Z 02/20/2000 4`
Order by in subquery and alias ==============================
programmertricks.com
2020.16
[ { "text": "\nIn Oracle you can use KEEP LAST for this:\n\n\nselect \n\nkey, \n\nb, \n\nc, \n\n( \n\nselect max(d) keep (dense\\_rank last order by t2.date) \n\nfrom table2 t2 \n\nwhere t2.key = t1.key and t2.date < t1.date \n\n) as fromstatus \n\nfrom table1 t1; \n\nAs of Oracle 12c you can also use FETCH FIRST ROW:\n\n\nselect \n\nkey, \n\nb, \n\nc, \n\n( \n\nselect d \n\nfrom table2 t2 \n\nwhere t2.key = t1.key and t2.date < t1.date \n\norder by t2.date desc \n\nfetch first row only \n\n) as fromstatus \n\nfrom table1 t1; \n\nor, moving the subquery to the FROM clause:\n\n\nselect \n\nt1.key, \n\nt1.b, \n\nt1.c, \n\nfirst\\_t2.d as fromstatus \n\nfrom table1 t1 \n\nouter apply \n\n( \n\nselect d \n\nfrom table2 t2 \n\nwhere t2.key = t1.key and t2.date < t1.date \n\norder by t2.date desc \n\nfetch first row only \n\n) first\\_t2;\n\n\n", "name": "", "is_accepted": false }, { "text": "\nrow\\_number() after union will get your output.\n\n\nselect tFinal.DATE, tFinal.KEY \n\nfrom (select row\\_number() over (partition by KEY order by t1.T, t1.DATE desc) as rn, t1.DATE, t1.KEY \n\nfrom \n\n(select DATE, KEY, ‘t1’ as T from TABLE1 \n\nunion all \n\nselect DATE, KEY, ‘t2’ as T from TABLE2) t1) tFinal \n\nWhere rn = 2\n\n\n", "name": "", "is_accepted": false } ]
fb1cd00241ce9995f721551281161bc0
Which is better PHP inputs sanitizing function?
Which is better PHP inputs sanitizing function? ===============================================
programmertricks.com
2020.50
[ { "text": "\nNobody here understands the way mysql\\_real\\_escape\\_string works. This function do not filter or “sanitize” anything. \n\nSo, you cannot use this function as some universal filter that will save you from injection. \n\nYou can use it only when you understand how in works and where it applicable.\n\n\nI have the answer to the very similar question I wrote already: In PHP when submitting strings to the database should I take care of illegal characters using htmlspecialchars() or use a regular expression? \n\nPlease click for the full explanation for the database side safety.\n\n\nAs for the htmlentities – Charles is right telling you to separate these functions. \n\nJust imagine you are going to insert a data, generated by admin, who is allowed to post HTML. your function will spoil it.\n\n\nThough I’d advise against htmlentities. This function become obsoleted long time ago. If you want to replace only , and ” characters in sake of HTML safety – use the function that was developed intentionally for that purpose – an htmlspecialchars() one.\n\n\n", "name": "", "is_accepted": false } ]
dad3a9884b080e777e11f6c71e8a7b93
I’ve been a keen fan and user of CakePHP for about 2.5 years now, but the main bugbear that most fellow developers level at the framework is that it’s slow, and the dispatch cycle takes too long to make it a viable solution for production environments. Please! share your tips, tricks, and also hacks for speeding up CakePHP performance.
Speeding up CakePHP ===================
programmertricks.com
2020.05
[ { "text": "\nBoth for CakePHP and other things, just get a more powerful server, more GHz and RAM. Prices get cheaper every year. Although if you are on a VPS, I understand things can be tight.\n\n\nAnd sometimes new hardware is cheaper than paying for someone to optimize the code…\n\n\n", "name": "", "is_accepted": false } ]
0e6b88442840cd9f0fd6bba68276f1c5
I want to get the next element from a spliterator, not just “perform action” on the next element. For example by implementing the following method. `T getnext(Spliterator s) {` `}` All search results I found just said that tryAdvance() was like a combination of an iterator hasNext() and next(), except that is a BIG LIE because I can’t get the next element, just “perform the action on next element”.
How to return the next element from a spliterator in java? ==========================================================
programmertricks.com
2020.45
[ { "text": "\n`public static T getNext(Spliterator spliterator) { \n\nList result = new ArrayList(1);` \n\n `if (spliterator.tryAdvance(result::add)) { \n\nreturn result.get(0); \n\n} else { \n\nreturn null; \n\n} \n\n}`\n\n\n", "name": "", "is_accepted": false } ]
956d832274bfa6433b991ec2f391d3ce
I would like to be able to add an item to the list, and view it when I reload the page. I am not sure how to go about doing this. I do not need it stored in a database or anything, I would just like it to be there on screen until I manually delete the list item. Is this possible? I believe this would be kept on sharepoint, and used with multiple users adding and editing the content, but when I get to that step, I may need additional help with that as well, if that makes any difference to the current question of keeping the LI information. ``` $("ul").on("click", "li", function(){ $(this).toggleClass("completed"); }); $("ul").on("click", "span", function(event){ $(this).parent().fadeOut(500,function(){ $(this).remove(); }); event.stopPropagation(); }); $("input[type='text']").keypress(function(event){ if(event.which === 13){ var name = $('#name').val(); $('#name').val(""); var number = $('#number').val(); $('#number').val(""); var exception = $('#exception').val(); $('#exception').val(""); var date = $('#date').val(); $('#date').val(""); $("ul").append(" - " + name + " | " + number + " | " + exception + " | " + date + " ") } }); $(".fa-plus").click(function(){ $("input[type='text']").fadeToggle(); }); ``` ``` body { font-family: Roboto; background: -webkit-linear-gradient(90deg, #2BC0E4 10%, #EAECC6 90%); /* Chrome 10+, Saf5.1+ */ background: -moz-linear-gradient(90deg, #2BC0E4 10%, #EAECC6 90%); /* FF3.6+ */ background: -ms-linear-gradient(90deg, #2BC0E4 10%, #EAECC6 90%); /* IE10 */ background: -o-linear-gradient(90deg, #2BC0E4 10%, #EAECC6 90%); /* Opera 11.10+ */ background: linear-gradient(90deg, #2BC0E4 10%, #EAECC6 90%); /* W3C */ } ul { list-style: none; margin: 0; padding: 0; } h1 { background: #2980b9; color: white; margin: 0; padding: 10px 20px; text-transform: uppercase; font-size: 24px; font-weight: normal; } .fa-plus { float: right; } li { background: #fff; height: 40px; line-height: 40px; color: #666; } li:nth-child(2n){ background: #f7f7f7; } span { background: #e74c3c; height: 40px; margin-right: 20px; text-align: center; color: white; width: 0; display: inline-block; transition: 0.2s linear; opacity: 0; } li:hover span { width: 40px; opacity: 1.0; } input { font-size: 18px; color: #2980b9; background-color: #f7f7f7; width: 100%; padding: 13px 13px 13px 20px; box-sizing: border-box; border: 3px solid rgba(0,0,0,0); } input:focus{ background: #fff; border: 3px solid #2980b9; outline: none; } #container { width: 360px; margin: 100px auto; background: #f7f7f7; box-shadow: 0 0 3px rgba(0,0,0, 0.1); } .completed { color: gray; text-decoration: line-through; } ``` ``` Exceptions 2223A Exceptions ================ * #303974 | R. Roberts | SN | 6/25 - 6/27 * #303354 | B. Smith | SN | 6/15 & 6/27 * #328937 | K. Stull | NO | 6/26 ```
Can I refresh this page without losing the LI content? ======================================================
programmertricks.com
2020.50
[ { "text": "\nChange \n\n`$(\"ul\").append(\"`\n\n", "name": "", "is_accepted": false } ]
899f4387e72d1a32689239102468b011
I have a situation and unfortunately not sure how to sort it out in a proper way. I have below script `$validator = Validator::make( $request->all(), [ 'game_id' => 'required|integer' ], $messages );` `if ($validator->fails()) { $response = $validator->messages(); }else{ $response = $gameService->setStatus($request); }` Now each game has a different type, I wanted to add validation on behalf of a type. For example, if a game is Task-Based then I would add validation for a time which would be mandatory only for Task-based game otherwise it would be an option for other types. I have three types of games 1 – level\_based 2 – task\_based 3 – time\_based In the type table, each game has a type. So is there any way to add validation? I want to do it, inside the validation function. Thank you so much.
How to deal with conditioned based validation in laravel? =========================================================
programmertricks.com
2020.40
[ { "text": "\nI have a situation and unfortunately not sure how to sort it out in a proper way. I have below script\n\n\n$validator = Validator::make( \n\n$request->all(), \n\n[ \n\n‘game\\_id’ => ‘required|integer’ \n\n], \n\n$messages \n\n);\n\n\nif ($validator->fails()) { \n\n$response = $validator->messages(); \n\n}else{ \n\n$response = $gameService->setStatus($request); \n\n} \n\nNow each game has a different type, I wanted to add validation on behalf of a type. For example, if a game is Task-Based then I would add validation for the time which would be mandatory only for Task-based game otherwise it would be an option for other types.\n\n\nI have three types of games\n\n\n1 – level\\_based 2 – task\\_based 3 – time\\_based\n\n\nIn the type table, each game has a type.\n\n\nSo is there any way to add validation? I want to do it, inside the validation function.\n\n\nThank you so much.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nI would go with the required\\_if validation rule.\n\n\nSo in your case, will send two fields, the type can be a hidden field, for example, then on the game\\_id you will add\n\n\n‘game\\_id’ => ‘required\\_if:type,1’ \n\nand so on.. And of course you can customize the error messages.\n\n\n", "name": "", "is_accepted": false } ]
22bd05e7d6587cd8f0862f6ab596a88d
I am using CAKEPHP3, and not find how to change (reconfigure) pagination limit globally , example, from 20 to 30. Let me know if anyone help me.
Defining global conditions in Model ===================================
programmertricks.com
2020.45
[ { "text": "\nLooking at the code for CakePHP3 Paginator component, it looks like you can set a global limit in a controller (best place would be your AppController) with the following syntax: \n\n`... \n\npublic $paginate=array(); \n\n... \n\npublic function beforeFilter() { \n\nparent::beforeFilter(); \n\n$this->paginate['limit'] = 15; \n\n}`\n\n\n", "name": "", "is_accepted": false } ]
e15a84be4b3089d5c1167ec2c470e737
I’d like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu title. I’d also like to lose the little arrows next to the menu titles.
How to make Twitter Bootstrap menu dropdown on hover rather than click? =======================================================================
programmertricks.com
2021.04
[ { "text": "\nTo get the menu to automatically drop on hover then this can achieved using basic CSS. You need to work out the selector to the hidden menu option and then set it to display as block when the appropriate li tag is hovered over. Taking the example from the twitter bootstrap page, the selector would be as follows:\n\n\n `ul.nav li.dropdown:hover > ul.dropdown-menu { \n\ndisplay: block; \n\n}`\n\n\nHowever, if you are using Bootstrap’s responsive features, you will not want this functionality on a collapsed navbar (on smaller screens). To avoid this, wrap the code above in a media query:\n\n\n `@media (min-width: 979px) { \n\nul.nav li.dropdown:hover > ul.dropdown-menu { \n\ndisplay: block; \n\n} \n\n}`\n\n\n", "name": "", "is_accepted": false } ]
9b166ce0595b65478292b0071236c49f
I am doing a redirect using the below code. The issue is that when the redirect code is executed, it loads the current page again and then eventually redirects to the new page. I don’t want it to reload the current page and to redirect automatically to the new page. Thanks I have written code for the redirect and debugged the code. `function util_redirect ($page) { ob_start(); header("Location: " . $page,true); ob_end_flush(); die(); }`
PHP Redirect loads current page ===============================
programmertricks.com
2020.05
[ { "text": "\nYou could use javascript to go to your URL with new tab.\n\n\necho ‘window.open(“your url”, “\\_blank”);’;\n\n\n", "name": "", "is_accepted": false } ]
d3e958cc1d58adce6788c30823af0043
 Use of the symbol ‘@’ in php?
 Use of the symbol ‘@’ in php? ==============================
programmertricks.com
2020.05
[ { "text": "\nThe @ symbol is the error control operator (aka the “silence” or “shut-up” operator). It makes PHP suppress any error messages (notice, warning, fatal, etc) generated by the associated expression. It works just like a unary operator, for example, it has a precedence and associativity. Below are some examples:\n\n\n@echo 1 / 0; \n\n// generates “Parse error: syntax error, unexpected T\\_ECHO” since \n\n// echo is not an expression\n\n\necho @(1 / 0); \n\n// suppressed “Warning: Division by zero”\n\n\n@$i / 0; \n\n// suppressed “Notice: Undefined variable: i” \n\n// displayed “Warning: Division by zero”\n\n\n@($i / 0); \n\n// suppressed “Notice: Undefined variable: i” \n\n// suppressed “Warning: Division by zero”\n\n\n$c = @$\\_POST[“a”] + @$\\_POST[“b”]; \n\n// suppressed “Notice: Undefined index: a” \n\n// suppressed “Notice: Undefined index: b”\n\n\n$c = @foobar(); \n\necho “Script was not terminated”; \n\n// suppressed “Fatal error: Call to undefined function foobar()” \n\n// however, PHP did not “ignore” the error and terminated the \n\n// script because the error was “fatal” \n\nWhat exactly happens if you use a custom error handler instead of the standard PHP error handler:\n\n\nIf you have set a custom error handler function with set\\_error\\_handler() then it will still get called, but this custom error handler can (and should) call error\\_reporting() which will return 0 when the call that triggered the error was preceded by an @.\n\n\nThis is illustrated in the following code example:\n\n\nfunction bad\\_error\\_handler($errno, $errstr, $errfile, $errline, $errcontext) { \n\necho “[bad\\_error\\_handler]: $errstr”; \n\nreturn true; \n\n} \n\nset\\_error\\_handler(“bad\\_error\\_handler”); \n\necho @(1 / 0); \n\n// prints “[bad\\_error\\_handler]: Division by zero” \n\nThe error handler did not check if @ symbol was in effect. The manual suggests the following:\n\n\nfunction better\\_error\\_handler($errno, $errstr, $errfile, $errline, $errcontext) { \n\nif(error\\_reporting() !== 0) { \n\necho “[better\\_error\\_handler]: $errstr”; \n\n} \n\n// take appropriate action \n\nreturn true; \n\n}\n\n\n", "name": "", "is_accepted": false } ]
13cbe90613400b4c8745af00560e04d8
`public static void validate(BLangFunction resource, DiagnosticLog dlog, boolean resourceReturnsErrorOrNil, boolean isClient) { if (!resourceReturnsErrorOrNil) { dlog.logDiagnostic(Diagnostic.Kind.ERROR, resource.pos, "Invalid return type: expected error?"); } switch (resource.getName().getValue()) { case WebSocketConstants.RESOURCE_NAME_ON_OPEN: case WebSocketConstants.RESOURCE_NAME_ON_IDLE_TIMEOUT: validateOnOpenResource(resource, dlog, isClient); break; case WebSocketConstants.RESOURCE_NAME_ON_TEXT: validateOnTextResource(resource, dlog, isClient); break; case WebSocketConstants.RESOURCE_NAME_ON_BINARY: validateOnBinaryResource(resource, dlog, isClient); break; case WebSocketConstants.RESOURCE_NAME_ON_PING: case WebSocketConstants.RESOURCE_NAME_ON_PONG: validateOnPingPongResource(resource, dlog, isClient); break; case WebSocketConstants.RESOURCE_NAME_ON_CLOSE: validateOnCloseResource(resource, dlog, isClient); break; case WebSocketConstants.RESOURCE_NAME_ON_ERROR: validateOnErrorResource(resource, dlog, isClient); break; default: dlog.logDiagnostic(Diagnostic.Kind.ERROR, resource.pos, "Invalid resource name " + resource.getName().getValue() + " in service "); } }`
Clean code — Java static functions and variable reuse? ======================================================
programmertricks.com
2020.45
[ { "text": "\nThe method should be made non-static. This way, you can utilize dependency injection for the logging feature.\n\n\n", "name": "", "is_accepted": false } ]
58160bcb7bbd5a12fac8cdb29e86b92a
I am working on ms SQL server Actually my requirement is I need to add a new identity field ID to an existing table with a condition which should be like in the table below the table is: `Col1 ID 1 1 1 2 1 3 0 Null 1 4 0 Null`
Sql how to add identity column with condition? ==============================================
programmertricks.com
2020.05
[ { "text": "\nFirst, add the new column:\n\n\nalter table t add column id int; \n\nNote: id is a really bad name for a column that can be null. Then:\n\n\nwith toupdate as ( \n\nselect t.*, \n\nrow\\_number() over (partition by col1 order by ) as seqnum \n\nfrom t \n\n) \n\nupdate toupdate \n\nset id = (case when col1 = 1 then serum end); \n\nStrictly speaking, you don’t need to update the values when col1 = 0, because the default value is NULL. However, in case you want a different value there, I am leaving out where col1 = 1.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nYour query should be like below : \n\n `update` \n\n`set id=1 where Col1=1; \n\nupdate \n\n\n\n set id=null where Col1=0;`\n", "name": "", "is_accepted": false } ]
2ee4e3dfee7e7c9d86bab665dfcdd020
missing a temporary folder WordPress upload I have a WordPress installed. Host provider is 1&1. Now if I tried to upload media file it shows me the error missing a temporary folder. I also define a path for temp directory. I refer this link link. And created the php.ini file in the home directory. My php.ini file content is `upload_max_filesize = 16M upload_tmp_dir = on upload_tmp_dir = /epigram.co.uk/tmp` I also tried to change the wp-config file and added this `define('WP_TEMP_DIR','/epigram.co.uk/tmp');` Also tried with full path. like `define('WP_TEMP_DIR',$_SERVER['DOCUMENT_ROOT'].'/tmp');` Nothing helped me. any help will be appreciated.Thanks
missing a temporary folder wordpress upload ===========================================
programmertricks.com
2021.17
[ { "text": "\nYou will need to edit wp-config.php file in WordPress. If you haven’t done this before, then please see our guide on how to edit the wp-config.php file in WordPress.\n\n\nFirst, you will need to connect to your website using an FTP client or File Manager in cPanel dashboard of your hosting account.\n\n\nNext, you will need to locate the wp-config.php file and edit it.\n\n\nEditing the wp-config.php file using an FTP client\n\n\nYou need to paste this code to the file just before the line that says ‘That’s all, stop editing! Happy blogging’.\n\n\ndefine(‘WP\\_TEMP\\_DIR’, dirname(\\_\\_FILE\\_\\_) . ‘/wp-content/temp/’); \n\nSave your changes and upload the wp-config.php file back to your website.\n\n\nNext, you need to go to /wp-content/ folder and create a new folder inside it. You need to name this new folder temp.\n\n\nCreating a temp folder\n\n\nThat’s all, you can now visit your WordPress admin area and try uploading an image.\n\n\n", "name": "", "is_accepted": false } ]
1afde8cf5d254d31509c2f803ae63501
How can we make redirect in PHP?
How can we make redirect in PHP? ================================
programmertricks.com
2020.16
[ { "text": "\nI’m not sure why but this weblog is loading incredibly slow for me. \n\nIs anyone else having this issue or is it a issue on my end? \n\nI’ll check back later on and see if the problem still exists.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nIncredible! This blog looks just like my old one! \n\nIt’s on a totally different subject but it has pretty \n\nmuch the same page layout and design. Outstanding \n\nchoice of colors!\n\n\n", "name": "", "is_accepted": false }, { "text": "\nIs it possible to redirect a user to a different page through the use of PHP?\n\n\nSay the user goes to <http://www.example.com/page.php> and I want to redirect them to <http://www.example.com/index.php>, how would I do so without the use of a meta refresh? Is it possible?\n\n\nThis could even protect my pages from unauthorized users.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nThanks a lot for sharing this with all of us you actually know what you are speaking about! \n\nBookmarked. Kindly additionally visit my website =).\n\n\nWe may have a link alternate contract among us\n\n\n", "name": "", "is_accepted": false }, { "text": "\nHello it’s me, I am also visiting this website daily, this website is \n\nin fact fastidious and the viewers are actually sharing fastidious \n\nthoughts.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nThis is my first time visit at here and i am really impressed to read everthing at one place.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nWhat’s up to every single one, it’s really a pleasant for me to go to see this website, it consists of useful Information.\n\n\n", "name": "", "is_accepted": false }, { "text": "\nWow, wonderful weblog structure! How long have you been blogging \n\nfor? you make running a blog glance easy. The entire glance of your website is excellent, \n\nlet alone the content!\n\n\n", "name": "", "is_accepted": false } ]
dadb1b0902a8707273dadeec475937d6
I would like to add to the user profile the time from registration to the current day in the format: With us: 7 years 3 months 2 weeks 6 days OR With us: 1 year 1 month 1 week 1 day I bit helped this post Count days from registration date to today, but their countdown goes only in days.
WordPress: count time from registration date to today =====================================================
programmertricks.com
2019.51
[ { "text": "You can use strtotime(get\\_userdata(get\\_current\\_user\\_id( ))->user\\_registered)) to get register date, After you compare with time() to get number year, month, day.\n\n", "name": "", "is_accepted": false } ]
884b17c182c3f5fb3da65cefc0e0d6e5
What is the difference between `USE SchoolDB; SELECT * FROM StudentTable;` `SELECT * FROM SchoolDB.StudentTable;` What are the advantages and disadvantages of both of these? Is there any effect on query performance? I searched many times but I can’t get the absolute solution about this question if anyone who has the knowledge of this question please help me out! Thank you
Difference between USE dbName VS dbName.TableName? ==================================================
programmertricks.com
2021.04
[ { "text": "\nAs others have said, “Use” creates a context so all subsequent queries execute against that database; three-part-name explicitly name the database. There’s no performance impact on this choice.\n\n\nBut there are design choices you might make which impact your decision.\n\n\nFor instance, you may have development, test and production databases. If you have a SQL batch file (for instance), it’s probably better to explicitly set the database context and then execute the query without the three-part-name.\n\n\nYou may have an application design that splits data across different databases (customer, product, sales, for instance); in that case, it may be easier to agree to use the three-part-name style, so your queries can execute in any one of the databases.\n\n\n", "name": "", "is_accepted": false } ]
938e12395ce9a38f4e65085b43628ced
What will be the output by getElementsBy* and querySelectorAll?
What will be the output by getElementsBy* and querySelectorAll? ===============================================================
programmertricks.com
2021.21
[ { "text": "\nDo getElementsByClassName (and similar functions like getElementsByTagName and querySelectorAll) work the same as getElementById or do they return an array of elements?\n\n\nThe reason I ask is because I am trying to change the style of all elements using getElementsByClassName. See below.\n\n\n//doesn’t work \n\ndocument.getElementsByClassName(‘myElement’).style.size = ‘100px’;\n\n\n//works \n\ndocument.getElementById(‘myIdElement’).style.size = ‘100px’;\n\n\n", "name": "", "is_accepted": false } ]
11058bce8325e963d098c00005770df9
wondering clicking on vizhub should open in new page. explanation-like i am in my profile and just want to check the homepage, i lose my profile page.
open home link in new tab
vizhub.com
2020.10
[ { "text": "this is done! from any page other than the home page, the navbar home link opens in a new tab. on the home page, it’s not longer a link.", "name": "", "is_accepted": true } ]
1c45b65ad8e7965071406d695c3ea1f2
as a visualization author who has accidentally written code with an infinite loop in it, i want to be able to recover my work and correct the error. as it stands, user code with an infinite loop causes the browser tab to hang, and the interface is unresponsive. the only way to get the work is to m…
recovery mode
vizhub.com
2020.10
[ { "text": "this is done! you can add #recover to the end of the url for your broken viz to enter “recovery mode”. for example: \nhttps://vizhub.com/curran/90f961ce0f824558a4cc053bd38ae5f3#recover \nto get this url: \n\nright click the preview of your broken viz.\nclick “copy link address”\nopen a new tab\npaste the u…", "name": "", "is_accepted": true } ]
029d5f568dc9baeb5f353c994d9c4616
on [my first working animation](https://vizhub.com/mrwatson-de/354f6fecf7764b73b233c26af6504de8) page some text is …er… leaking out of the readme area, and appearing in the background of the page: [[image]](https://discourse.vizhub.com/uploads/default/original/1x/a7c1741011db75916724c494d6efc874da987713.png "image.png") looking at the page source html … the problem seems to be: the meta tag property=“og:description” content seems to contain the entire readme file and secondl…
bug: readme text is 'being injected' into page content!
vizhub.com
2020.16
[ { "text": "this is solved now. used <https://www.npmjs.com/package/sanitize-html> to do it.", "name": "", "is_accepted": true } ]
b02e16ad8c1e12ca759f6cd692834cef
for long descriptions, the unfurls don’t look good in slack. [[image]](https://discourse.vizhub.com/uploads/default/original/1x/dfb6b0da6b4fb32f7ff0b0371ca2ed37133dbc55.png "image.png") imo we can truncate the description to a fixed number of characters. if truncated, an ellipsis “…” can be added at the end. it looks like slack does this now, but there are too many characters for comfort. 300 characters feels …
feature request: truncate unfurl description
vizhub.com
2020.16
[ { "text": "this is done. unfurl descriptions are now truncated to 300 characters.", "name": "", "is_accepted": true } ]
e83dfc89379e6f73026c67f474fcce65
on vizhub homepage, it will be nice to have a link for datavis 2020 course.
suggestion: link course
vizhub.com
2020.10
[ { "text": "done! it’s part of the links section now.", "name": "", "is_accepted": true } ]
796ed336f98890f5889f993849647ecd
not able to delete this viz because the browser crashed while writing the code.
site feedback : crashed link
vizhub.com
2020.10
[ { "text": "try [recovery mode](https://discourse.vizhub.com/t/recovery-mode/93)! that should help you recover that work.", "name": "", "is_accepted": true } ]
abe85ff42691409952271fc7c16ea1e9
as a casual viewer or visualization author, i want to be able to search the full content of vizhub visualizations and users (5,000 and counting) based on keywords or spefific strings.
feature request: search for vizualizations
vizhub.com
2020.10
[ { "text": "search has landed! \nfor example: <https://vizhub.com/search?query=force>\n[[image]](https://discourse.vizhub.com/uploads/default/original/1x/94b95753855b2d291ea4a7030e06a00a81151e9f.png \"image.png\")", "name": "", "is_accepted": true } ]
0d1655db3fa885946208f9c1133a5483
hi, typing or space triggers the running of the code. sometime its overwhelming.
site feedback : page run
vizhub.com
2020.10
[ { "text": "this is a duplicate of [feature request: disable auto-run](https://discourse.vizhub.com/t/feature-request-disable-auto-run/35).", "name": "", "is_accepted": true } ]
b3109077ba9dd36acfc6dca778791644
as a visualization viewer, i want to be able to select the visualization title text easily. currently, when the editor is open, you can’t begin the selection from the left because the split pane resizer is in the way. the main problem currently is that you can’t select from the right. meaning, whe…
feature request: easy copying of title
vizhub.com
2020.10
[ { "text": "this is done now thanks to [@stushurik](/u/stushurik)!", "name": "", "is_accepted": true } ]
b480b6fb76914bee58b729fe243173f2
how to delete 100 lines of json data in vizhub code editor
delete multiple lines on mobile
vizhub.com
2020.10
[ { "text": "select them and hit the delete key. \nin vim mode this is easier (if you know the key mapping) - you can hit \n\nalt + v to enter vim mode\nshift + v to enter line select mode\n100j to select the next 100 lines\n\nor 100k to select the previous 100 lines\nor g to go to the bottom of the file\nor gg to go to …", "name": "", "is_accepted": true } ]
598bf3da2aa297a0b0ac0cdc4efb2e01
as a visualization author, i want to be able to set the height (in pixels) of the viz, so that i may change its aspect ratio. the ui design can follow closely the design for the privacy settings: add an entry in the settings menu on the bottom of the editor sidebar that says “height” clicking tha…
feature request: set height
vizhub.com
2020.10
[ { "text": "set height has landed! \nit’s in the “settings” dialog. \n [[image]](https://discourse.vizhub.com/uploads/default/original/1x/1904cbf581dafb8c1c4a40878abf5b491843d012.png \"image.png\")", "name": "", "is_accepted": true } ]
3b6ffef9505f4518fb4765f948383fd2
as a visualization author, i’d like to be able to turn off the auto-run feature, and instead be able to manually trigger re-runs of the code. often while crafting code, i know that it will break during intermediate stages, and want to be able to hit a keyboard shortcut, such as shift+enter to trigg…
feature request: disable auto-run
vizhub.com
2020.10
[ { "text": "this is done now and deployed. woohoo! \ndecided to go with the design where the blue semicircle is inside the black circle, because if they are the same thickness it’s actually nearly impossible to tell that it’s changing at all! \nplease give it a spin and let me know what you think. \nthe shift+ente…", "name": "", "is_accepted": true } ]
fc818458174d2701275512369bf80304
[[lastededit]](https://discourse.vizhub.com/uploads/default/original/1x/3a6442c0a7931e231b50a2d451c5d41bdd6d6b6d.png "lastededit.png") on the right bottom it says ‘lasted edited’. wondering lasted is spelled wrong. also the thumbnail of this viz is on the home page, is it a bug or was edited. see no edits.
site feedback : lasted wrong spelled
vizhub.com
2020.10
[ { "text": "whoah that is strange… fixed just now.", "name": "", "is_accepted": true } ]
40c35d3fc1cb704ebff8ee26be45a9c8
as it stands, after exporting, running npm install, and running npm run build, code that has jsx in it fails to transpile. need to add <https://github.com/rollup/rollup-plugin-buble> to generated package.json and rollup.config.js.
bug: jsx doesn't work in export
vizhub.com
2020.10
[ { "text": "this is done now thanks to [@stushurik](/u/stushurik)!", "name": "", "is_accepted": true } ]
08ac1705b044484630d56a4ff74518bb
do i actually own a leased car?
farazautosalesltd.ca
2020.29
[ { "text": "no. although manufacturers count the lease as a \"sale\" for tracking purposes, the leased vehicle stays with you for a certain term, usually 36 months. like financing a vehicle, you'll make monthly payments, but when your payments are done you either must return the vehicle or you have the option to purchase it for its predetermined value at the end of the lease term.", "name": "", "is_accepted": true } ]
219f5030d890047a2b9671e41b75c0bd
what is 8cent.com?
what is 8cent.com?
8cent.com
2019.47
[ { "text": "8cent.com is an e-commerce platform that provide free online advertisement.", "name": "", "is_accepted": true } ]
8de38b5f8a0aa6297110324e23db913c
how to buy / purchase an item in 8cent.com?
how to buy / purchase an item in 8cent.com?
8cent.com
2019.47
[ { "text": "just contact the seller directly of the item interested to purchase and deal with them.", "name": "", "is_accepted": true } ]
b89acf567093543a0e6f1565cd2668bc
is that the price in 8cent.com can be negotiate?
is that the price in 8cent.com can be negotiate?
8cent.com
2019.47
[ { "text": "just contact the seller and you can negotiate the best offer price with them.", "name": "", "is_accepted": true } ]
cd2683e992cdde6f3953acdd7bdea79f
i would like to change my order in 8cent.com. what should i do?
i would like to change my order in 8cent.com. what should i do?
8cent.com
2019.47
[ { "text": "just contact the seller to change order. ", "name": "", "is_accepted": true } ]
bc938611b9c737242488a00abf652bc3
is there any minimum item to be purchased in 8cent.com?
is there any minimum item to be purchased in 8cent.com?
8cent.com
2019.47
[ { "text": "no. you can choose how many you want to buy the item.", "name": "", "is_accepted": true } ]
aa87f26de8ccd1863e584e33e8b742dc
do i need an account to make an order in 8cent.com?
do i need an account to make an order in 8cent.com?
8cent.com
2019.47
[ { "text": "not necessary. you just can contact direct to the seller for order and purchase.", "name": "", "is_accepted": true } ]
309e0944a933e05883fbdc36d6ee23e7
how do i receive notifications about my online purchase in 8cent.com?
how do i receive notifications about my online purchase in 8cent.com?
8cent.com
2019.47
[ { "text": "the seller will contact by how you contact them.", "name": "", "is_accepted": true } ]
5be86b1974b0f1233c919c8f095deed8
what is wishlist?
what is wishlist?
8cent.com
2019.47
[ { "text": "wishlist is a features that allow you to create personalized collections of products they want to buy and save them in their user account for future reference", "name": "", "is_accepted": true } ]
a1864922cf1efec864e546e0f84e4706
what is 8cent tracker™?
what is 8cent tracker™?
8cent.com
2019.47
[ { "text": "8cent tracker™ is a database which provide details an item’s recommended retail price (rrp), retail price (srp) and specifications.", "name": "", "is_accepted": true } ]
f6b36f66c2744d909d60b6e60175dd72
how should i trust this seller?
how should i trust this seller?
8cent.com
2019.47
[ { "text": "we will giving a verified badge in seller store if seller done the id verification.", "name": "", "is_accepted": true } ]
ca249e3face288b5dfea38cec09eee31
what if there are missing or wrong items when i receive my order in 8cent.com?
what if there are missing or wrong items when i receive my order in 8cent.com?
8cent.com
2019.47
[ { "text": "we take such matters very seriously and will look into individual cases thoroughly. we does not accept / responsible on liability for any damage, loss, cost (including legal costs), expenses, indirect losses or consequential damage of any kind which may be suffered or incurred by the user from the use of this service.", "name": "", "is_accepted": true } ]
424730e0825c3d4db70333f45924e5cf
what should i do if item purchased not deliver in 8cent.com?
what should i do if item purchased not deliver in 8cent.com?
8cent.com
2019.47
[ { "text": "if the item not arrive or delays, please contact the seller immediately. ", "name": "", "is_accepted": true } ]
79e477a5af0e03e06264f5ad804e35b7
what should i do if i think the seller is fake / dishonest seller in 8cent.com?
what should i do if i think the seller is fake / dishonest seller in 8cent.com?
8cent.com
2019.47
[ { "text": "just report to us and we will do investigation on this related advertisement.", "name": "", "is_accepted": true } ]
9c8df5e65cdab6cf31e660616693fe49
is my personal information kept private and safe?
is my personal information kept private and safe?
8cent.com
2019.47
[ { "text": "at 8cent, we are committed to protecting your privacy in accordance with the personal data protection act 2010 of malaysia (pdpa).", "name": "", "is_accepted": true } ]
e20e91609dd45ce9ca29fbc352f8ce51
where i want to read news or promotion from 8cent?
where i want to read news or promotion from 8cent?
8cent.com
2019.47
[ { "text": "you can check it at our promotions page.", "name": "", "is_accepted": true } ]
6ce2fbdb00c51d9e76c275853c04fd03
how do i know the items that selling is pirated goods or not?
how do i know the items that selling is pirated goods or not?
8cent.com
2019.47
[ { "text": "do not worry we will review the advertisement before the advertisement published.", "name": "", "is_accepted": true } ]
884bc79ef3f8bb306f72291aa71eb293
what is verified store badge?
what is verified store badge?
8cent.com
2019.47
[ { "text": "verified store badge is the store seller verified their id or business registration information.", "name": "", "is_accepted": true } ]
c3b34c4a1548f7d12ee73e75ef85e13d
what is fair price store badge?
what is fair price store badge?
8cent.com
2019.47
[ { "text": "fair price store badge is seller verified their id or business registration information and pass 30 advertisement price within market price.", "name": "", "is_accepted": true } ]
456313644f2724269f363f830865bdae
what is vip store?
what is vip store?
8cent.com
2019.47
[ { "text": "fair price store badge is seller verified their id or business registration information, pass 30 advertisement price within market price, and seller had subscribe with our advertisement package.", "name": "", "is_accepted": true } ]
894157a083158a7e35d8b175fff21d53
which browser should i use to view 8cent website?
which browser should i use to view 8cent website?
8cent.com
2019.47
[ { "text": "our website competitive with any kind of web browser.", "name": "", "is_accepted": true } ]
91ac7fa436e21333f3ff112748df97e7
what are 8cent terms and conditions?
what are 8cent terms and conditions?
8cent.com
2019.47
[ { "text": "kindly refer to terms page.", "name": "", "is_accepted": true } ]