How to exclude node_modules folder from publish artifact in VSTS

npm
Question: I currently have a build definition in place to build my project and publish my files for release. My project relies on a bit of NPM to do some automation using Gulp.js. I dont need it for anything else once my gulp-tasks have run. When I get to my publish artifacts step, it publishes all of the files in the node_modules directory even though I don't even have them in my repo. I was wondering if there was a way to exclude them from within the contents section or if anyone else has a better idea? Here is my Publish Artifacts settings: In the Contents section, I also tried:*** !**node_modules* I am pretty new with the Build & Release process and I am unsure what other information might be…
Read More

Meta Query Filter in WooCommerce

Uncategorized
Question: I want to filter my products with custom post meta key ("_city_name") as well as the keyword ("s") with AND operation currently I'm doing in my functions.php:function my_modify_main_query( $query ) { $meta_query_args = array( 'meta_query' => array( array( 'key' => '_city_name', 'value' => 'new york', 'compare' => 'LIKE', ) ) ); $query->set('meta_query', $meta_query_args); } add_filter( 'pre_get_posts', 'my_modify_main_query' ); It's working if I don't add keyword in the GET params ("s"), but if I add keyword it stop working ("s=beer&city=newyork")...? Answer: Read more
Read More

django locale can't translate depend on accept-language

Uncategorized
Question: Here is my settings LANGUAGES = ( ('zh_CN', u'简体中文'), ('en-us', u'English'), ) LANGUAGE_CODE = 'en-us' USE_I18N = True USE_L10N = True MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # "django.middleware.cache.CacheMiddleware", "django.middleware.transaction.TransactionMiddleware", ) Run code snippetHide results Expand snippet Here is some print ('django_language', '') ('COOKIES', '') ('ACCEPT_LANGUAGE', 'zh_CN') ('LANGUAGE_CODE', 'en-us') My django version is 1.5.4 If i set request.session['django_language'] = 'zh_CN' I will get translation next time. What's wrong ? Answer: Read more
Read More

Angular Routing Is not Loading page Even If I added template is also Not Showing

Uncategorized
Question: Please Help me Here why i'm not able to Route app.js (function () { "use strict"; var app = angular.module("productManagement", ['ngRoute']); app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $locationProvider.hashPrefix("!") $routeProvider .when("/home", { templateUrl: "template/Home.html" }) .otherwise({ redirect:"/Login" }) }]) This is my Html code Here I defind my Navigation Buttons Home Answer: Since you had hash prefix ! in routing, your href should have ! in the URL right after # href="#!/home" Read more
Read More

warn: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given [duplicate]

Uncategorized
Question: This question already has an answer here:mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given 33 answers Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in ..php on line 21 Line 21 is for ($i=0; $i < mysqli_num_rows($result); $i++) { Code:$mysqli = connect(); $MAX_SELECT = 50; $SELECT_LIMIT_1 = 0+($MAX_SELECT*$page); $result = $mysqli->query("SELECT alog.text, users.login, alog.userid from alog JOIN users ON alog.userid=users.id LIMIT ". $SELECT_LIMIT_1 .", ". $MAX_SELECT); for ($i=0; $i < mysqli_num_rows($result); $i++) { $rows = $result->fetch_assoc(); if(isset($_GET['debug'])) print_r($rows); echo ' '. $rows["login"] .'' .': '. $rows["text"] .' '; } $mysqli->close(); Answer: you're using object oriented style for mysqli change this for ($i=0; $i < mysqli_num_rows($result); $i++) { to for ($i=0; $i < $result->num_rows;; $i++) { Read more
Read More

Add class names to React root component or change structure

Uncategorized
Question: I am trying to use flexbox with a React component but a root div is being inserted. I can't add class names to the root div (omitted). I think it could be split out into smaller components but I am not sure how? This is how the structure is now: This is how I would like the structure: Current (trimmed down) App.js code:const Hit = ({hit}) => Database name ${hit.price} const SearchResultContent = () => class App extends Component { render() { return ( ); } } export default App; The classNames that are not added to the inserted root element. Answer: Read more
Read More

Bokeh Error: h is null

Uncategorized
Question: I'm following this tutorial : https://www.analyticsvidhya.com/blog/2015/08/interactive-data-visualization-library-python-bokeh/ And this is my code (Bokeh 0.12.6, sklearn 0.18.2, and Python 3.6):from bokeh.charts import BoxPlot, output_file, show from sklearn.datasets import load_iris import pandas as pd iris = load_iris() df = pd.DataFrame(iris.data) df.columns=['petal_width','petal_length','sepal_width','sepal_length'] df = pd.read_csv("Datasets/iris/iris.csv") data = df[['sepal_length', 'petal_length']] p = BoxPlot(data, width=400, height=400) output_file("boxplot.html", title="box plot example") show(p) But when I run it, it gives this error: I've tried google it, and it leads to this question: Getting "Message: h is null" But first, I'm not running selenium and I think downgrading firefox is not best solution, is it a bug in Bokeh? Hope anybody here can help, Thank You Answer: Read more
Read More

How to check if a list of tables exists in SQL Server?

Uncategorized
Question: I have a list of table names and I want to check whether each one of them exists in database or not. I know how to check if a table exists, and I can union select expressions for each table name, but there must be an easier solution. This is my current code:select 'TableName1', CASE WHEN EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TableName1') THEN 1 ELSE 0 end union select 'TableName2', CASE WHEN EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'TableName2') THEN 1 ELSE 0 end -- and so on Answer: You can use this SELECT table_name, CASE WHEN OBJECT_ID(table_name,'U') IS NULL THEN 0 ELSE 1 END FROM (VALUES ('dbo.table1'), ('dbo.table2')) V(table_name) Read more
Read More