texts
sequence | tags
sequence |
---|---|
[
"Google Analytics - tracking by country",
"I'm working on an international website. \nTo support multiple countries and language, a page URL looks like that:\n\n\n www.example.com/fr-en/Page\n\n\nwhere \"fr\" is the country code and \"en\" is the page language.\n\nWould it be possible to add a specific google tracking code for each country ?\n\nI would need that in order to give Google Analytics access for each of the countries dealers, where they will be able to view only their country traffic stats.\nOf course, I will also need a Google Analytics account for all of the site traffic (for all countries)."
] | [
"google-analytics"
] |
[
"Download TFS 2015 Build Agent without TFS 2015 install",
"We currently use TFS 2013 with a suite of XAML builds, there are a few hundred projects here, each with an average of six build definitions each.\n\nWe're wanting to upgrade to TFS 2017 (2018 doesn't support XAML) but need to be able to support the XAML builds until they're all migrated.\n\nAccording to MS, we can setup a TFS 2017 box, a build server with a 2017 build agent on it and a separate build server with a 2015 build agent on it which TFS can use to run the XAML builds.\n\nMy problem is... where to get the 2015 build agent installer from. Normally you ask TFS for the build agent installer, but we don't have a TFS 2015 installation.\n\nAm I going to have to setup a TFS 2015 VM just so I can click one lousy link and download one installer. I've searched around but can't find any other place to get the damned thing from.\n\nAnyone got a link to an MS page?"
] | [
"xaml",
"continuous-integration",
"tfs-2015"
] |
[
"Can't install packages such as dplyr or devtools sessionInfo()",
"I'm having trouble installing some packages. I previously installed data.table and had no problems. Now, when trying to install dplyr and devtools I get the following message:\n\nInstalling package into ‘[file path]’\n(as ‘lib’ is unspecified)\nWarning: unable to access index for repository http://cran.repo.bppt.go.id/src/contrib\nWarning: unable to access index for repository http://cran.repo.bppt.go.id/bin/windows/contrib/3.2\nWarning message:\npackage ‘devtools’ is not available (for R version 3.2.1) \n\n\nI am not exactly sure how to handle this. Appreciate any help."
] | [
"r",
"installation",
"package"
] |
[
"How to test main function in gin application?",
"How can I test func main? Like this:\n\nfunc main(){\n Engine := GetEngine() // returns gin router with handlers atttached \n Engine.Run(\":8080\")\n}\n\n\nIt has only 2 lines but I'd like to have them covered. \nTestMain' is reserved for test preparation, does that mean testing main was not planned by language creators?\nI can move the contents to another function mainReal but it seems to be some over engineering?\n\nHow to test gin has started well? Can I launch main in separate goroutine, check reply and stop it?\n\nThanks. \n\nP.S. Possible duplicate is not precise duplicate because it is dedicated not to testing of func main() itself, but rather ideas to move in outside and so contains different issue and approach."
] | [
"go",
"testing",
"main",
"go-gin"
] |
[
"If statement with two conditions not working properly",
"I am new to programming and I am trying to create a program which parses a file and outputs the tokens. At the minute I am trying to create an if statement which will output the name of each operator with two characters, e.g. \"&&\" or \"<=\". My if statement does not work for \"<=\" as it picks up the '<\" and '=' separately due to the earlier code: \n\nelse if (getOp(ch) != null) {\n System.out.println(line + \", \" + sglchar + \", \"+ ch);\n counter++;\n continue;\n }\n\n\nMy getOp(ch) method contains the operators with one character, however I cannot figure out how to do this with two character operators and my if statements don't seem to be doing the trick.\n\nThis is the if statement I am trying:\n\nelse if (prog.charAt(counter) == '<' && prog.charAt(counter+1) == '=') {\n String str = \"\";\n str += ch;\n str += prog.charAt(counter++);\n System.out.println(line + \", \" + getOp(str) + \", \" + str);\n counter++;\n continue;\n }"
] | [
"java",
"parsing"
] |
[
"Fill Sub-query using LINQ in EF6",
"Friends,\n\ni'm trying to create a .json file with an LINQ query using Entity Framework 6:\n\n {\n \"id\": \"1231-12321-sdff-21-31\",\n \"name\": \"Product name\",\n \"description\": \"Product description\"\n \"rating\": 4.1,\n \"price\": 7.50,\n \"photos\": \n [\n \"http://path/photo1.img\",\n \"http://path/photo2.img\"\n ]\n}\n\n\nHow can i fill the sub-vector photos? See my code below:\n\nMy select code\n\nList<ProductViewModel> products = await\n (from prod in db.product\n join prodPhoto in db.product_photo on prod.id equals prodPhoto.product_id\n where prod.id == id\n select new ProductViewModel\n {\n id = prod.id,\n name = prod.name,\n description = prod.description,\n rating = prod.rating,\n price = prod.price,\n photos = new HashSet<ProductPhotoViewModel>()\n {\n new ProductPhotoViewModel\n {\n path = prodPhoto.path\n }\n }\n }).ToListAsync();\n\n\nMy object ProductViewModel\n\n public class ProductViewModel\n {\n public ProductViewModel()\n {\n photos = new HashSet<ProductPhotoViewModel>();\n }\n\n //Product\n public string id { get; set; }\n public string name { get; set; }\n public string description { get; set; }\n public int? rating { get; set; }\n public decimal price { get; set; }\n\n //Product photo\n public virtual ICollection<ProductPhotoViewModel> photos { get; set; }\n}\n\n\nand my object ProductImageViewModel\n\n public class ProductPhotoViewModel\n {\n public string path { get; set; }\n }\n\n\nI know probably my select is wrong, but i can't see what can i do to solve this problem.\n\nEDIT:\n\nThe EF6 Classes:\n\nProduct\n\n public partial class product\n {\n public product()\n {\n this.employee_change_product = new HashSet<employee_change_product>();\n this.offer = new HashSet<offer>();\n this.order_has_product = new HashSet<order_has_product>();\n this.product_photo = new HashSet<product_photo>();\n this.product_has_category = new HashSet<product_has_category>();\n this.product_stock = new HashSet<product_stock>();\n }\n\n public string id { get; set; }\n public string description { get; set; }\n public Nullable<int> rating { get; set; }\n public Nullable<int> preparation_time { get; set; }\n public decimal price { get; set; }\n public string name { get; set; }\n public string establishment_id { get; set; }\n public System.DateTime create_time { get; set; }\n public System.DateTime update_time { get; set; }\n\n public virtual ICollection<employee_change_product> employee_change_product { get; set; }\n public virtual establishment establishment { get; set; }\n public virtual ICollection<offer> offer { get; set; }\n public virtual ICollection<order_has_product> order_has_product { get; set; }\n public virtual ICollection<product_photo> product_photo { get; set; }\n public virtual ICollection<product_has_category> product_has_category { get; set; }\n public virtual ICollection<product_stock> product_stock { get; set; }\n }\n\n\nProduct Photo\n\n public partial class product_photo\n {\n public string id { get; set; }\n public Nullable<int> width { get; set; }\n public Nullable<int> height { get; set; }\n public int size { get; set; }\n public string path { get; set; }\n public string product_id { get; set; }\n public System.DateTime create_time { get; set; }\n public System.DateTime update_time { get; set; }\n\n public virtual product product { get; set; }\n }\n\n\nMany Thanks!"
] | [
"c#",
"asp.net",
"entity-framework-6"
] |
[
"Fatal error: Uncaught PDOException: get wrong values",
"I tried to create an abstract model, but I have an error in\nthis abstract.php file:\n\npublic function create()\n{\n global $connection;\n $sql = 'INSERT INTO ' . static::$tableName . ' SET ' . self::buildNameParameterSQL();\n $stmt = $connection->prepare($sql);\n\n foreach(static::$tableSchema as $col=>$type){\n\n if($type == 4){\n $sanitizedValue = filter_var($this->$col, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);\n $stmt->bindValue(\":{$col}\", $sanitizedValue);\n }\n else{\n $stmt->bindValue(\":{$col}\", $this->$col, $type); // Error here\n }\n }\n return $stmt->execute();\n}\n\n\nAnd here is my class employee in employee.php that extends this abstract model:\n\nrequire_once 'abstract.php';\n\ncLass Employee extends AbstractModel\n{\n private $id;\n private $name;\n private $age;\n private $address;\n private $tax;\n private $salary;\n\n\n protected static $tableName = 'employees';\n protected static $tableSchema = array (\n 'name' => self::DATA_TYPE_STR,\n 'age' => self::DATA_TYPE_INT,\n 'address' => self::DATA_TYPE_STR,\n 'tax' => self::DATA_TYPE_DECIMAL,\n 'salary' => self::DATA_TYPE_DECIMAL\n );\n\n public function __construct($name, $age, $address, $tax, $salary){\n\n global $connection;\n\n $this->name = $name;\n $this->age = $age;\n $this->address = $address;\n $this->tax = $tax;\n $this->salary = $salary;\n }\n\n\nAnd when I created a new object of class employee and invoke a created method\n\n<?php\n require_once ('db.php');\n require_once ('employee.php');\n\n $emp = new Employee(\"abanoub\", 21, \"Cairo, Egypt\", 1.03, 5000);\n var_dump($emp->create());\n\n\nAnd here my error\n\n\n Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ': name, address =: address, salary =: salary, tax =: tax, age =: age' at line 1 in C:\\xampp\\htdocs\\test\\pdo\\abstract.php:47 Stack trace: #0 C:\\xampp\\htdocs\\test\\pdo\\abstract.php(47): PDOStatement->execute() #1 C:\\xampp\\htdocs\\test\\pdo\\test.php(6): AbstractModel->create() #2 {main} thrown in C:\\xampp\\htdocs\\test\\pdo\\abstract.php on line 47"
] | [
"php",
"mysql",
"pdo"
] |
[
"Getting Invalid JSON in request body everytime",
"I am trying to make a post request on url https://test.cashfree.com/api/v2/subscription-plans using node js requests but getting this body in return:\n{"status":"ERROR","subCode":"400","message":"Invalid JSON in request body"}\n\nThis is my Code:\n var querystring = require('querystring');\n var request = require('request');\n\n var form = {\n planId: "NJGRKON12354",\n planName: "Rent Product",\n type: "PERIODIC",\n amount: 100,\n intervalType: "month",\n intervals: 1\n \n };\n\n var formData = querystring.stringify(form);\n var contentLength = formData.length;\n\n \n request({\n headers: {\n 'X-Client-Id': 'XXXXX',\n 'X-Client-Secret': 'XXXXXX',\n 'Content-Type': 'application/json'\n },\n uri: 'https://test.cashfree.com/api/v2/subscription-plans',\n body: formData,\n method: 'POST'\n }, function (error1, res1, body) {\n console.log('statusCode:', res1.statusCode);\n console.log("Body: ", body);\n });\n\nWhen i try with same headers and body in postman its Running.\nPostman Hit"
] | [
"node.js",
"json",
"request",
"form-data"
] |
[
"Rebind action assigned to ajax link",
"There is a link to delete a post:\n\n<a id=\"post_232_destroy\" class=\"postDestroy\" rel=\"nofollow\" data-remote=\"true\" data-method=\"delete\" data-confirm=\"Are you sure?\" href=\"/someurl\">Delete</a>\n\n\njavascript (compiled from coffescript):\n\nfunction() {\n\n jQuery(function() {\n return $(\"a.postDestroy\").bind(\"ajax:success\", function(event, data) {\n $('#post_' + data.post_id).remove();\n }).bind(\"ajax:error\", function() {\n alert('Please try again');\n });\n });\n\n}).call(this);\n\n\nI'm adding new post via ajax, so bind to Delete button is missing, for each recently added post. Post is deleted but ajax:success is not called, so div is not removed.\nHow can I bind it again ?"
] | [
"javascript",
"jquery",
"ajax"
] |
[
"AJAX'ing blob to another domain via CORS",
"Can anyone tell me why this request is failing to get past the SO policy restriction?\n\nJS:\n\nvar blob = new Blob([req.response], {type: \"application/octet-stream\"});\nreq = new XMLHttpRequest();\nreq.open(\"POST\", ws_path(other_context, 'receive_pkg'), true);\nreq.onload = function (evt) { alert(req.response); };\nreq.send(blob);\n\n\nThe called PHP page on the other domain:\n\nheader('Access-Control-Allow-Origin: *');\nfile_put_contents('log.txt', 'script accessed');\n\n\nThe request does go, and the log is written, but the browser blocks the response. I have another request to the same script that is NOT a blob, but a normal post request, and this responds just fine. The problem seems to be with just the blob request, and I've no idea why or whether what I'm doing is actually prohibited.\n\n[Research effort: I got my hopes up when I found this question, but duplicate answers deal only with CORS in general, not blobs, as per the OP's question]"
] | [
"javascript",
"php",
"ajax",
"cors",
"same-origin-policy"
] |
[
"Why do a[] and *a behave differently?",
"I thought a[] and *a are the same thing because they work like pointers. Yet I encountered something unexpected in the following code:\n\n#include <iostream>\nusing namespace std;\n\nclass F {\npublic:\n bool a[];\n F();\n};\n\nF::F() {\n *a = new bool[5];\n a[2] = true;\n}\n\nint main() {\n F obj;\n if(obj.a[2])\n cout << '?';\n return 0;\n}\n\n\nThis code prints ?, but I don't understand how it works. When:\n\n*a = new bool[5];\n\n\nis changed into:\n\na = new bool[5];\n\n\ncompiler reports:\n\nF:\\main.cpp|11|error: incompatible types in assignment of 'bool*' to 'bool [0]'|\n\n\nI found this behaviour weird, so I was playing around with this code. When I changed the type of a from bool to int compiler always reports an error\n\nF:\\main.cpp|11|error: invalid conversion from 'int*' to 'int' [-fpermissive]|\n\n\nWhy does this work the way it does?"
] | [
"c++",
"arrays",
"oop",
"pointers"
] |
[
"launching an activity that belongs to another android module",
"I have created an android studio project \"try1\" with two modules. \n1. app\n2. Registration\n\nI have named the main activity as \"Registration\". When I click a button in app module, the activity from Registration module must be launched.\n\nI have written the following code in the onclick method of the button, with componentName(String pkg, String cls)\n\nIntent intent = new Intent(\"android.intent.action.MAIN\");\n intent.setComponent(new ComponentName(\"com.example.praveenkumar.try1\",\"com.example.praveenkumar.try1.Registration\"));\n intent.addCategory(\"android.intent.category.LAUNCHER\");\n intent.setFlags(Intent.FLAG_FROM_BACKGROUND);\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivity(intent);\n\nWhen I click the button, I get 'Unfortunately the app has stopped\". I found\n\" java.lang.IllegalStateException: Could not execute method of the activity\" in the logcat.\nSo I replaced(just for testing) '.Registration' in the componentName() with MainActivity of the app module in which the button itself is displayed, the code seem to work properly.\n\nIs it a syntax error or have I mentioned a wrong path ?"
] | [
"android-intent",
"android-activity",
"module",
"launch"
] |
[
"Rails: Rendering Models?",
"I can think of a million not-so-automatic ways to render a model in Rails, but I'm wondering if there's some built-in way to do it. I'd like to be able to this\n\n<%=@thing -%>\n\n\nobviously with partials you can do it (I mean, calling render :partial), but I'm wondering if there's some standard way to associate views with models.\n\n[Thanks in advance, weppos, for fixing the tags on this question :)]"
] | [
"ruby-on-rails",
"rendering"
] |
[
"Resolve root relative URLs when webapp is deployed to non-empty path",
"A webapp uses URLs of the form /images/image1.png, i.e. starting with a /.\n\nThe webapp should be deployed to a URL of the form http://myhost.example.org/webapp, i.e. the path part of the URL is not empty.\n\nIn a default setup the browser would try to get the image from http://myhost.example.org/images/image1.png and fail. What options do exist to make the browser resolve to http://myhost.example.org/webapp/images/image1.png without changing anything in the webapp?\n\nI am using nodejs/keystonejs for the webapp and nginx as a reverse proxy."
] | [
"http",
"url",
"nginx",
"reverse-proxy"
] |
[
"How to make text into a hyperlink in a UILabel or UITextField",
"I'd like to make a UILabel or UIText file contain text the works like an address field in html, not the site itself. I.e. it would look like \n\n\"Click here to view My Web Site etc. etc. etc.\"\n\nwhere \"My Web Site\" is text which when clicked will take you to \"http://myWebSite.com\". \n\nI've checked around, but it's not clear I can show the text instead of the hyperlink."
] | [
"ios",
"hyperlink",
"uiwebview",
"uitextfield",
"uilabel"
] |
[
"OpenMP, Python, C Extension, Memory Access and the evil GIL",
"so I am currently trying to do something like A**b for some 2d ndarray and a double b in parallel for Python. I would like to do it with a C extension using OpenMP (yes I know, there is Cython etc. but at some point I always ran into trouble with those 'high-level' approaches...). \n\nSo here is the gaussian.c Code for my gaussian.so:\n\nvoid scale(const double *A, double *out, int n) {\n int i, j, ind1, ind2;\n double power, denom;\n power = 10.0 / M_PI;\n denom = sqrt(M_PI);\n\n #pragma omp parallel for\n for (i = 0; i < n; i++) {\n for (j = i; j < n; j++) {\n ind1 = i*n + j;\n ind2 = j*n + i;\n out[ind1] = pow(A[ind1], power) / denom;\n out[ind2] = out[ind1];\n }\n }\n\n\n(A is a square double Matrix, out has the same shape and n is the number of rows/columns) So the point is to update some symmetric distance matrix - ind2 is the transposed index of ind1.\n\nI compile it using gcc -shared -fopenmp -o gaussian.so -lm gaussian.c. I access the function directly via ctypes in Python:\n\ntest = c_gaussian.scale\ntest.restype = None\ntest.argtypes = [ndpointer(ctypes.c_double,\n ndim=2,\n flags='C_CONTIGUOUS'), # array of sample\n ndpointer(ctypes.c_double,\n ndim=2,\n flags='C_CONTIGUOUS'), # array of sampl\n ctypes.c_int # number of samples\n ]\n\n\nThe function 'test' is working smoothly as long as I comment the #pragma line - otherwise it ends with error number 139. \n\nA = np.random.rand(1000, 1000) + 2.0\nout = np.empty((1000, 1000))\ntest(A, out, 1000)\n\n\nWhen I change the inner loop to just print ind1 and ind2 it runs smoothly in parallel. It also works, when I just access the ind1 location and leave ind2 alone (even in parallel)! Where do I screw up the memory access? How can I fix this?\n\nthank you!\n\nUpdate: Well I guess this is running into the GIL, but I am not yet sure...\n\nUpdate: Okay, I am pretty sure now, that it is evil GIL killing me here, so I altered the example:\n\nI now have gil.c:\n\n#include <Python.h>\n#define _USE_MATH_DEFINES\n#include <math.h>\n\nvoid scale(const double *A, double *out, int n) {\n int i, j, ind1, ind2;\n double power, denom;\n power = 10.0 / M_PI;\n denom = sqrt(M_PI);\n Py_BEGIN_ALLOW_THREADS\n #pragma omp parallel for\n for (i = 0; i < n; i++) {\n for (j = i; j < n; j++) {\n ind1 = i*n + j;\n ind2 = j*n + i;\n out[ind1] = pow(A[ind1], power) / denom;\n out[ind2] = out[ind1];\n }\n }\n Py_END_ALLOW_THREADS\n}\n\n\nwhich is compiled using gcc -shared -fopenmp -o gil.so -lm gil.c -I /usr/include/python2.7 -L /usr/lib/python2.7/ -lpython2.7 and the corresponding Python file:\n\nimport ctypes\nimport numpy as np\nfrom numpy.ctypeslib import ndpointer\nimport pylab as pl\n\npath = '../src/gil.so'\nc_gil = ctypes.cdll.LoadLibrary(path)\n\ntest = c_gil.scale\ntest.restype = None\ntest.argtypes = [ndpointer(ctypes.c_double,\n ndim=2,\n flags='C_CONTIGUOUS'),\n ndpointer(ctypes.c_double,\n ndim=2,\n flags='C_CONTIGUOUS'),\n ctypes.c_int\n ]\n\nn = 100\nA = np.random.rand(n, n) + 2.0\nout = np.empty((n,n))\n\ntest(A, out, n)\n\n\nThis gives me \n\nFatal Python error: PyEval_SaveThread: NULL tstate\n\nProcess finished with exit code 134\n\n\nNow somehow it seems to not be able to save the current thread - but the API doc does not go into detail here, I was hoping that I could ignore Python when writing my C function, but this seems to be quite messy :( any ideas? I found this very helpful: GIL"
] | [
"python",
"c",
"openmp",
"gil"
] |
[
"ember.js: Why does the on-input event not work?",
"Following the example of the ember.js 2.3.0 guide, \nEMBER.TEMPLATES.HELPERS CLASS\n\nexport default Ember.Component.extend({\n actions: {\n // Usage {{input on-input=(action (action 'setName' model) value=\"target.value\")}}\n setName(model, name) {\n model.set('name', name);\n }\n }\n});\n\n\nI write my code as follows:\n\ntemplate.hbs\n\n<div>\n{{input type='text' id='Txt01' value='firstName'\n on-input=(action \"onInput\")\n key-press=(action \"onKeyPress\")\n key-down=(action \"onKeyDown\")\n key-up=(action \"onKeyUp\")\n change=(action \"onChange\")}}\n</div>\n\n\ncontroller.js\n\nexport default Ember.Controller.extend({\n actions: {\n onKeyPress() {\n console.log('Text-Key-Pressed');\n },\n onKeyDown() {\n console.log('Text-Key-Down');\n },\n onKeyUp() {\n console.log('Text-Key-Up');\n },\n onInput() {\n var value = Ember.$('#Txt01').val();\n console.log('onInput:' + value);\n },\n onChange() {\n var value = Ember.$('#Txt01').val();\n console.log('onInput:' + value);\n }\n }\n});\n\n\nRun the code, the logs are\n\nText-Key-Down\nText-Key-Pressed\nText-Key-Up\n\n\nBoth oninput event and change event do not work when the value of input is changed.\n\nI just want to achieve the following functions with ember.js.\n\n<input type=\"text\" id=\"text1\" value=\"hello!\">\ndocument.getElementById('text1').addEventListener('input', function(){\n var temp = $('#text1').val();\n console.log('Text1: ' + temp);\n}, false);\n\n$('#text1').bind('input propertychange', function() {\n var temp = $('#text1').val();\n console.log('Text1: ' + temp);\n});\n\n\nAny hints will be appreciated. Thanks in advance."
] | [
"ember.js",
"event-handling",
"action"
] |
[
"Why does the NetworkX generate an adjacency matrix that is not symmetric for an undirected graph",
"I am trying to learn coding using NetworkX. I am now trying to get the adjacency matrix of an undirected graph using following code I wrote:\n\nmat = nx.adjacency_matrix(graph)\nmatDense = mat.todense();\n\nprint(len(matDense ))\nprint(len(matDense [0]))\n\n\nThe output is\n\n38\n1\n\n\nMy understanding for adjacency matrix is that it should be symmetric, however, the output seems like not, seems like the adjacency matrix generated by NetworkX is an 38*1 matrix instead of 38*38?\n\nIf this, how may I access individual cells of an adjacency matrix, currently I could only locate to rows.If matDense[0][2], an array index out of bounds error will be thrown.\n\nThanks in advance for any help !"
] | [
"python",
"matrix",
"graph",
"networkx",
"adjacency-matrix"
] |
[
"Trickly transact SQL needed please: going round in circles",
"I have data like the following\n\nFtitle Fvalue Freference\n------ ---------- ---------\nfilename file1.java 123\nversion 2 123\ncvstree branch1 123\n\nfilename file2.java 345\nversion 4 345\ncvstree branch2 345\n\nfilename file1.java 4556\nversion 3 4556\ncvstree branch1 4556\n\n\nfilename file3.java 4312\nversion 77 4312\ncvstree branch2 4312\n\nfilename file1.java 5616\nversion 1 5616\ncvstree branch3 5616\n\n\nI have given a blank line above between some rows for easy readability. For various reasons, the table structure cannot be changed and the table has tons and tons of data.\n\nNow, what i have is just the Fvalue for example file1.java . i would like to know if i can use a TSQL statement so that, in one single query, i get, for example all the distinct Freference values where the branch matches what i specify.\n\nSo, for example, if i give a query where i want matches for file1.java for branch1, then i just want the SQL to return me \"Freference\" 4556 and 123 . \n\nIs this doable without looping through all \"Freference\" values for file.java and then further filtering it where Fvalue is branch1? This kind of loop becomes very slow."
] | [
"sql",
"sql-server",
"tsql"
] |
[
"How to resize an ImageView programmatically in Android?",
"Take the following code:\n\nImageView imageView = new ImageView(activity);\nimageView.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));\n\n\nRunning this crashes my app. I can't for the life of me work out how to set the height/weight of an ImageView created in code.\n\n01-05 14:46:34.593: E/AndroidRuntime(12038): FATAL EXCEPTION: main\n01-05 14:46:34.593: E/AndroidRuntime(12038): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.Gallery.setUpChild(Gallery.java:772)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.Gallery.makeAndAddView(Gallery.java:741)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.Gallery.layout(Gallery.java:625)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.Gallery.onLayout(Gallery.java:339)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.ScrollView.onLayout(ScrollView.java:1296)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.View.layout(View.java:7175)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.os.Handler.dispatchMessage(Handler.java:99)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.os.Looper.loop(Looper.java:130)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at android.app.ActivityThread.main(ActivityThread.java:3683)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at java.lang.reflect.Method.invokeNative(Native Method)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at java.lang.reflect.Method.invoke(Method.java:507)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)\n01-05 14:46:34.593: E/AndroidRuntime(12038): at dalvik.system.NativeStart.main(Native Method)\n\n\nFor the record the image view I'm creating is created within the getView method of the BaseAdapter class which is then used by a Gallery."
] | [
"android",
"android-layout",
"imageview"
] |
[
"Realm lazy results type-erasure",
"I'm working on an iOS app with Realm as the database and I'm confronted to a problem I can't fix without your help.\n\n\n\nI have a function that queries objects from my Realm instance like so:\n\nstatic func trainings(containing exercise: Exercise) -> Results<Training>? {\n return Realm.workoutDatabase?.objects(TrainingEntry.self)\n .filter({ $0.exercise == exercise })\n .compactMap({ $0.training })\n}\n\n\nThis code produces the following error:\n\n\n Cannot convert return expression of type 'LazyMapCollection<LazyFilterCollection<LazyMapCollection<LazyFilterCollection<Results<TrainingEntry>>, Training?>>, Training>?' to return type 'Results?'`\n\n\nThere error is obviously that the return type should not be Results<Training>? but LazyMapCollection<LazyFilterCollection<LazyMapCollection<LazyFilterCollection<Results<TrainingEntry>>, Training?>>, Training>?.\n\nOutch! That type is soooooo long.\n\n\n\nI tried to set [Training]? as the return type for the function and it worked. \nBut by doing so, I'm afraid that this will implicitly cast the returned result of the expression into an array, thus loosing the laziness of the collection?\n\nAs far I as know, I need a type-eraser to get a much shorter type, but I'm definitely not an expert on that particular subject.\n\nI know that the Swift Standard Library provides a few type-erasure structs, such as AnyGenerator, AnySequence but I'm afraid I don't know enough about type-erasure to use them in my case.\n\nSo my question is, how to use type-erasure to get a cleaner return type for my function?\n\n\n\nEdit:\n\nI tried to cast the expression to AnyRandomAccessCollection but I get the following error:\n\n\n Type 'LazyFilterCollection<LazyMapCollection<LazyFilterCollection<Results<TrainingEntry>>, Training?>>' does not conform to protocol 'RandomAccessCollection'\n\n\nI also tried to cast to AnyCollection and AnyBidirectionalCollection, both of them work, but then I'm loosing the ability to subscript with an Int, which is something I want to keep."
] | [
"swift",
"realm",
"lazy-evaluation",
"type-erasure"
] |
[
"Stacking UIkit.modal built-in dialogs",
"UIkit has built-in helper dialogs like confirm. Which is great but by default UIkit modals replace all other modals when shown. This behaviour can be changed with the stack option as long as I am defining the modal dialog - but this is not the case with the built-in ones. I have found a snippet on how to change their labels. \n\nBut how can I make the built-in helper modal to be stacked?"
] | [
"javascript",
"html",
"getuikit"
] |
[
"how to handle loaded PouchDB data in ionic 2 and see them in PouchDB inspector",
"I want to build some sort of offline app with some json data, i want fill my database when app's life cycle is first loading. i used pouchDb in ionic 2, i added PouchDB load plugin and its work fine with this code:\n\nlet PouchDB = require('pouchdb');\nPouchDB.plugin(require('pouchdb-load'));\n\n\ninitDB() {\n\n this._db = new PouchDB('cities3', { adapter: 'websql' }); \n this._db.load('../../../assessts/cities.json').then(function () {\n\n console.log(\"Done loading!\");\n }).catch(function (err) {\n console.log(\"error while loading!\")\n\n });\n\n\nthe output will be Done loading! but when i want to check the data in PouchDB inspector i will get this error:\n\nNo PouchDB found\n\nTo use the current page with PouchDB-Fauxton, window.PouchDB needs to be set.\n\n\ni know that i should use window[\"PouchDB\"] = PouchDB; but my question is, where?"
] | [
"ionic-framework",
"ionic2",
"pouchdb"
] |
[
"Loadbalacing in minikube",
"I am trying to follow this tutorial https://kubernetes.io/docs/tutorials/hello-minikube/#create-a-service\n\nWhat confuses me is \n\nkubectl expose deployment hello-node --type=LoadBalancer --port=8080\n\n\nCan some explain if this will balance load across the pods in the node? I want to, say, make 5 requests to the service of a deployment with 5 pods and want each pod to handle each request in parallel. How can I make minikube equally distribute requests across pods in a node?\n\nEdit: There is also --type=NodePort how does it differ from type LoadBalancer above? Do any of these distribute incoming requests across pods on its own?"
] | [
"kubernetes",
"minikube"
] |
[
"AWS-SDK: listObjectsV2 makes too many get and put requests",
"While listing all the keys of s3 bucket by executing the code only 1 time shown in screenshot 1, it makes too many requests as I can see in my AWS billing console that it made around 25 requests (under put, delete, post or list) and around 214 get requests as shown in screenshot 2.Can anyone explain why this is happening?\nScreenshot 1Screenshot 2"
] | [
"javascript",
"node.js",
"amazon-web-services",
"amazon-s3",
"aws-sdk"
] |
[
"What does this message mean? from: can't read /var/mail/ex48 (Learn Python the Hard Way ex49)",
"In ex49, we are told to call the the lexicon.py file created in ex48 with the following command.\n\nWhen I try to import the lexicon file with the following command\n\n >>> from ex48 import lexicon\n\n\nit returns the following:\n\n from: can't read /var/mail/ex48\n\n\nI've tried looking this up. What does this mean? Is a file in the wrong place?"
] | [
"python"
] |
[
"C# Plaid Webhook How to Decode",
"I am writing the Webhook to handle automatic micro deposits for Plaid in C#. I don't entirely understand how it is supposed to work, mainly because the examples are in other languages I don't know.\nMy first problem is will Plaid send me a string? I'm guessing the Jwt is a string?\nMy code:\n var token = "[someJwtstring]";\n var handler = new JwtSecurityTokenHandler();\n var jsonToken = handler.ReadJwtToken(token);\n\n //Get the Json Web Key from the API using the key id\n var verifyJwt = await _plaidRepo.VerifyWebHook(jsonToken.Header.Kid);\n var webkey = new JsonWebKey()\n {\n Alg = verifyJwt.Data.alg,\n Crv = verifyJwt.Data.crv,\n Kty = verifyJwt.Data.kty,\n Use = verifyJwt.Data.use,\n X = verifyJwt.Data.x,\n Y = verifyJwt.Data.y\n };\n\nSo up to here I understand...but now what? What do I do with the web key so that I can get the request body?"
] | [
"c#",
"plaid"
] |
[
"How can I open a file in Python to a dictionary",
"I have a file with a bunch of names and emails.\nThey are written as follows:\nname \nemail \nname \nemail\nI cant figure out how to open the file and read line by line to where it pairs "name to email" in my dictionary\nI got the code to work when I manually type in the names/emails into the dictionary but I need to pull it from the file.\nLOOK_UP=1\nADD= 2\nCHANGE= 3\nDELETE=4\nQUIT=5\n\ndef main():\n emails={}\n with open('phonebook.in') as f:\n for line in f:\n (name, email)=line.split\n emails[name]=email\n \n \n \n choice=0\n while choice !=QUIT:\n choice= get_menu_choice()\n if choice == LOOK_UP:\n look_up(emails)\n elif choice == ADD:\n add(emails)\n elif choice == CHANGE:\n change(emails)\n elif choice == DELETE:\n delete(emails)\n \ndef get_menu_choice():\n print('Enter 1 to look up an email address')\n print('Enter 2 to add an email address')\n print('Enter 3 to change an email address')\n print('Enter 4 to delete an email address')\n print('Enter 5 to Quit the program')\n print()\n choice= int(input('Enter your choice: '))\n\n while choice <LOOK_UP or choice >QUIT:\n choice= int(input('Enter a valid choice'))\n return choice\ndef look_up(emails):\n name= str(input('Enter a name: '))\n value=(emails.get(name, 'Not found.'))\n print(value)\n print()\n \ndef add(emails):\n name= str(input('Enter a name: '))\n emailsaddy= input(' Enter a email address: ')\n\n if name not in emails:\n emails[name]= emailsaddy\n print()\n else:\n print('That contact already exists')\n print()\ndef change(emails):\n name=str(input ('Enter a name: '))\n if name in emails:\n emailsaddy= str(input(' Enter a new email: '))\n emails[name]= emailsaddy\n else:\n print('That contact does not exist')\ndef delete(emails):\n name=str(input ('Enter a name: '))\n\n if name in emails:\n del emails[name]\n else:\n print('That contact is not found')\nmain()"
] | [
"python"
] |
[
"Encrypted database connection from SQLAlchemy",
"What are the steps required to configure SQLAlchemy with SSL support on RedHat Linux so I can connect to a MS SQL Server instance that requires an encrypted connection?"
] | [
"python",
"sqlalchemy",
"pymssql"
] |
[
"Big Commerce - Custom Field Java Script Effecting Navigation Menu",
"I'm creating a custom form using EmailMeForm and using the full code option that uses CSS, JavaScript, and HTML. I embedded the code into the page content box and found that part of the JS code from EmailMeForm (https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js) was causing my navigation menu's CSS styles to become hidden. The JS isn't very descriptive of what is what each section is controlling.\n\nI was wondering if anyone had an idea of how to contain the scope of my Javascript to just the section of HTML added to the page content section\n\nThis is what I could find with the inspector for CSS code for the section.\nI have no means of editing it myself. What ever is in the JS is making all of the style attributes in the CSS class to display as \"none\".\n\n.Left #SideCategoryList .BlockContent, .Left .slist .BlockContent {\n padding: 0 0 0 0;\n overflow: hidden;\n}\n.Left #SideCategoryList li a, .Left .slist li a, .Left .afterSideShopByBrand a, .Left #GiftCertificatesMenu li a, .Left #SideAccountMenu li a {\n font-weight: bold;\n padding: 0;\n margin: 0 0 10px 0;\n font-size: 14px;\n}\n.Left #SideCategoryList li li a, .Left .slist li li a {\n font-weight: 400;\n font-size:13px;\n background:#f3f3f3;\n padding:7px 14px 7px 35px;\n}\n.Left #SideCategoryList li li li a, .Left .slist li li li a {\n background:#ececec;\n padding-left:50px;\n\n\nAll I want to know is how to isolate what goes in the page content section from the code embedded in the Big Commerce software."
] | [
"javascript",
"jquery",
"css",
"drop-down-menu",
"bigcommerce"
] |
[
"OWL Carousel 2 adding class to item",
"Im working on a slider that contains two synced owl-sliders.\nsync1 is main slider and sync2 is thumbnails slider. When I click on one of elements of second slider sync1 goes to proper slide.\nNow goes my issue:\n\nWhen user clicks on any of thumbnail a green border should appear on clicked elemment and should stay there until another element is clicked. \n\nI've tried to use jquery .addClass and .css but nothing happens. \n\nI think that I should add div with \"position: absolute\" that holds up to clicked element, but I don't know how to do it. Please help! :) \n\nHere is my js\n\n$(document).ready(function() {\nvar sync1 = $(\"#sync1\");\nvar sync2 = $(\"#sync2\");\nvar index2=0;\nvar flag=true;\n\n\nvar slides = sync1.owlCarousel({\n items: 1,\n loop: true,\n autoplay: true,\n autoplayTimeout:5000,\n autoplayHoverPause:true,\n nav: false,\n mousedrag: false,\n touchdrag: false,\n pulldrag: false\n\n});\n\n$(document).on('click', '.prevbutton, .nextbutton',function() {\n sync1.trigger('stop.owl.autoplay');\n\n});\n\nsync1.on('changed.owl.carousel', function(event) {\n var index1=event.item.index;\n var index11 = index1-2;\n //console.log(\"index1\", index1)\n //console.log(\"index11\", index11);\n sync2.trigger(\"to.owl.carousel\", [index11, 100, true]);\n});\n\n\n$('.nextbutton').click(function() {\n //console.log(sync1);\n sync1.trigger('next.owl.carousel');\n\n});\n\n$('.prevbutton').click(function() {\n // With optional speed parameter\n // Parameters has to be in square bracket '[]'\n //console.log(sync1);\n sync1.trigger('prev.owl.carousel', [500]);\n\n\n});\n\n\n/* thumbnails*/\n\nvar thumbnails= sync2.owlCarousel({\n items: 6,\n loop: true,\n autoplay: false,\n mousedrag: false,\n touchdrag: false,\n pulldrag: false,\n addClassActive: true\n});\n/*buttons*/\n$('.nextbutton2').click(function() {\n sync2.trigger('next.owl.carousel');\n\n});\n\n\n$('.prevbutton2').click(function() {\n // With optional speed parameter\n // Parameters has to be in square bracket '[]'\n sync2.trigger('prev.owl.carousel', [500]);\n\n\n});\n\n\nsync2.trigger(\"to.owl.carousel\", [index2, 100, true]);\nsync2.on('changed.owl.carousel', function(event) {\n index2=event.item.index;\n //console.log(\"index2\", index2);\n index22=index2-1;\n // sync1.trigger(\"to.owl.carousel\", [index22, 100, true]);\n});\n// console.log(\"index2\", index2);\n\nsync2.on('click', '.item', function(e) {\n e.preventDefault();\n sync1.trigger('to.owl.carousel', [$(e.target).parents('.owl-item').index()-6, 300, true]);\n // console.log(\"clicked index\", $(e.target).parents('.owl-item').index())\n\n});\n\n\n\n$('#stopcontainer').on('mouseover', function(){\n\n if ($('#stopcontainer:hover').length != 0) {\n flag=true;\n console.log(\"flaga\", flag);\n }\n if (flag==true) {\n sync1.trigger('stop.owl.autoplay');\n console.log(\"mousein\");\n }\n\n}).on('mouseleave', function() {\n setTimeout(\n function()\n {\n if ($('#stopcontainer:hover').length == 0) {\n flag=false;\n console.log(\"flaga\", flag);\n }\n if(flag==false){\n console.log('mouse leave');\n sync1.trigger('play.owl.autoplay');\n }\n\n }, 5000)}\n);\n\n});"
] | [
"javascript",
"jquery",
"owl-carousel",
"owl-carousel-2"
] |
[
"Swift 4 DispatchGroup repeating NSTimer calls until condition is met",
"The bluetooth library doesn't have call backs so when I write a message there is no callback to say i've received the correct response.\n\nSo i'm currently using Dispatch group to make syncronous calls.\n\nIs this the best method for doing the following?\n\nI essentially want the following to happen.\nWrite a command and set a timer of say 1s.\nNow every 0.1s I want to call a function until i've received the correct response.\nIf i've received the right response I will continue calling the next write command and checking for the write response."
] | [
"ios",
"swift",
"grand-central-dispatch",
"core-bluetooth"
] |
[
"Views in page callback function",
"In my module I have a page callback function. I want 2 views on this page. How can I do this?\n\nfunction MY_MODULE_menu() {\n $items['page-with-views/%'] = array\n (\n 'title' => 'Page with vviews',\n 'page callback' => 'MY_MODULE_page_callback',\n 'page arguments' => array(1),\n 'access callback' => TRUE,\n );\n\n return $items;\n}\n\nfunction MY_MODULE_page_callback() {\n //views_embed_view('view_name','block'); ???\n}"
] | [
"drupal",
"drupal-7",
"drupal-views"
] |
[
"For extended information, should I use Django's Multi-table Inheritance or an explicit OneToOneField",
"I have some fields on a model that won't always be filled in (e.g., the actual completion date and costs until the project is over). Because of this, I thought I'd split the model into two: \n\n\nModel #1: Dense table containing frequently searched and always completed fields\nModel #2: Sparse table containing infrequently searched and not always completed fields\n\n\nQuestions\n\n\nAm I thinking correctly in splitting this into two models/tables?\nShould I use Django's Multi-table Inheritance, or should I explicitly define a OneToOneField? Why?\n\n\nConfiguration\n\n\nDjango version 1.3.1\n\n\nModels\n\nUsing Django's Multi-table Inheritance\n\nclass Project(models.Model):\n project_number = models.SlugField(max_length=5, blank=False,\n primary_key=True)\n budgeted_costs = models.DecimalField(max_digits=10, decimal_places=2)\n\nclass ProjectExtendedInformation(Project):\n submitted_on = models.DateField(auto_now_add=True)\n actual_completion_date = models.DateField(blank=True, null=True)\n actual_project_costs = models.DecimalField(max_digits=10, decimal_places=2,\n blank=True, null=True)\n\n\nUsing an Explicit OneToOneField\n\nclass Project(models.Model):\n project_number = models.SlugField(max_length=5, blank=False,\n primary_key=True)\n budgeted_costs = models.DecimalField(max_digits=10, decimal_places=2)\n\nclass ProjectExtendedInformation(models.Model):\n project = models.OneToOneField(CapExProject, primary_key=True)\n submitted_on = models.DateField(auto_now_add=True)\n actual_completion_date = models.DateField(blank=True, null=True)\n actual_project_costs = models.DecimalField(max_digits=10, decimal_places=2,\n blank=True, null=True)"
] | [
"django",
"database-design",
"django-models"
] |
[
"How to re-level factor in ordinal logistic regression model in R?",
"I am currently working on an ordinal logistic regression model with R. The output coefficients are using the same reference level. I am wondering how can I change the reference level? Be more specific, see the example below. I do not want to use real data, so I simulated one. Both a and T are from 1 to 5\n\npolr(formula = T ~ a, data = d, Hess = TRUE)\n\nCoefficients:\n Value Std. Error t value\na2 0.18823 0.5734 0.32825\na3 0.14747 0.5287 0.27895\na4 -0.50157 0.5766 -0.86985\na5 0.02843 0.5448 0.05219\n\n\nThe coefficient of \"a\" use reference level 1, a2, a3, a4, and a5 basically compare level 2,3,4,5 with reference level 1. My question is how can I relevel it so that the output will give a3|2, a4|3, a5|4(i.e. the beta3-beta2,beta4-beta3) automatically? I have search around and didn't find similar question. Thanks a lot."
] | [
"r",
"statistics",
"regression"
] |
[
"How to create a shared static variable for all instantiation of template bass class?",
"I have a template base class and I would like to create a field call id and auto-increment it for any instantiation of derived classes who inherit from this base class. Here is my first attempt. \n\nnamespace {\n template<class T>\n class BaseClass {\n static uint global_id;\n public:\n uint m_id;\n explicit BaseClass(){\n m_id = global_id++;\n }\n };\n template<class T>\n uint BaseClass<T>::global_id = 0;\n\n class IntClass: public BaseClass<int> {};\n class DoubleClass: public BaseClass<double> {};\n\n}\n\nTEST(Exp, GlobalIdTest) {\n IntClass a;\n DoubleClass b;\n ASSERT_EQ(a.m_id, 0);\n ASSERT_EQ(b.m_id, 1);\n}\n\n\nThis code, however, creates a separate global_id for any translation unit. Is there a way to have a single static global_id for all translation units so the above test would pass?"
] | [
"c++",
"templates",
"static-variables"
] |
[
"Windows Phone 8 Set Navigate URI",
"I'm setting up a series of buttons, one for each item in a table. What I need to do is set the Navigate parameter for each button, is there anyway I can set the following from the .cs code?:\n\n<ec:NavigateToPageAction TargetPage=\"/MissionPage.xaml\"/>\n\n\nHere's the code I'm using to make the buttons:\n\nforeach (string i in missionQ)\n {\n Button btn = new Button() { Content = \"Run\", Width=120, Height=90 };\n btn.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;\n btn.VerticalAlignment = System.Windows.VerticalAlignment.Top;\n btn.Margin = new Thickness(0, (100*x), 20, 0); }"
] | [
"c#",
"windows-phone-8"
] |
[
"How to capture mean of hyphen seperated numbers in a pandas dataframe?",
"I have a Pandas DataFrame of the ages of drug users. My problem: some of the ages are seperated by a hyphen, for example '50-64'. I want to grab the mean of the hyphen seperated numbers and replace the cell with it. \n\n1.Is there a way to do it with some sort of loop or method? I don't want to simply hardcode drugs.loc[10,'age'] = np.mean(55+64)\n\n2.For future reference, is there a more elegant way of handling data with hyphen seperated numbers?\n\ninput:\ndrugs.age\noutput:\n0 12\n1 13\n2 14\n3 15\n4 16\n5 17\n6 18\n7 19\n8 20\n9 21\n10 22-23\n11 24-25\n12 26-29\n13 30-34\n14 35-49\n15 50-64\n16 65+\n\ninput:\ndrugs.age.dtype\noutput:\ndtype('O')"
] | [
"python",
"pandas",
"hyphen"
] |
[
"How to serialize form inputs in a .change event with javascript/PHP/CURL?",
"I'm working on a small project that requires Ajax to fetch data from database and update a page. The query to the database is built on the fly by the user and the query strings build like a chain. So for example the first item of the chain effects the next and the next and so on. Therefore it creates a list of post variables that I can't \"know\" ahead of time. I figured this would be a pretty simple thing to achieve however it's proving not to be. Here is my issue. \n\nWhen I use a .changed event and try to seralize the form before posting it. I get nothing but empty strings. I've noticed that if I hard code the post variables everything works just fine. Is there something I'm missing? Does .changed not have a seralize method?\n\nI am also using a CURL bridge since the server with the data is on another domain. I don't think that is causing any issues though. I believe it has to do with my event choice.\n\nHere is the code: \n\n $('#selector').change(function() {\n $.ajax({\n type: \"post\",\n dataType: 'json',\n url: \"/pages/curlbridge.php\",\n data: $(\"#queryform\").serialize(), //\"select=all&date=2013\"\n success: function(data)\n {\n console.log(data);\n var resultset = data;\n\n }\n });\n\n\nWas Asked to attach the HTML. It's just a simple form \n\n <form id=\"selector\">\n Select: <input type=\"text\" id=\"select\" />\n Date: <input type=\"text\" id=\"date\" />\n </form>\n <br />"
] | [
"php",
"javascript",
"jquery",
"ajax",
"curl"
] |
[
"Visual Studio 2017 application doesn't run in another computer",
"I've seen that there is a lot of literature about this topic, but nothing specific to VS2017. \n\nI've created an application that works properly on my PC, but when i move it to another one it doesn't start at all.\n\nI've tried to install the latest version of .Net Framework (4.7.1) but it looks like the new pc doesn't recognize it. In the framework folder below directory reference assemblies it's missing, only 3.0 and 3.5 are available. \n\nI have seen that there is another method to let the application run: static linking of dll. But I didn't find the way to do it with VS2017. There isn't section c++\\c where flag /mt instead of /md. I know that my application will be larger, but I don't mind."
] | [
"winforms",
"visual-studio-2017",
".net-framework-version"
] |
[
"How do I escape a password ending with a dollar sign icinga2?",
"I have dozens of devices I need to login to using an API script. One set of devices has a password ending in $. I've tried a bunch of things but I can't seem to escape that $ char. Here is the error I'm seeing.\n\ncritical/config: Error: Validation failed for object 'gelt-uk4-gp!HTTP/80: Status Check ' of type 'Service'; Attribute 'vars' -> 'gspass': Closing $ not found in macro format string 'n0t-real#$'.\nLocation: in /etc/icinga2/zones.d/global-templates/global-services.conf: 55:5-55:31\n/etc/icinga2/zones.d/global-templates/global-services.conf(53): if ( host.vars.company == \"gelt-emea\" ) {\n/etc/icinga2/zones.d/global-templates/global-services.conf(54): vars.gsuser = \"admin\"\n/etc/icinga2/zones.d/global-templates/global-services.conf(55): vars.gspass = \"n0t-real#$\"\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^"
] | [
"icinga2"
] |
[
"Running my application with Xcode 4.5 (iOS 6 SDK) immediately crashes my application unless I have Guard Malloc enabled",
"This problem is iOS Simulator only, it doesn't not happen on Device. \n\nMy application doesn't even get into the main function. It crashes somewhere in malloc:\n\n* thread #1: tid = 0x1c03, 0x96fc1548 libsystem_c.dylib`malloc_zone_malloc + 72, stop reason = EXC_BAD_ACCESS (code=2, address=0xc)\nframe #0: 0x96fc1548 libsystem_c.dylib`malloc_zone_malloc + 72\nframe #1: 0x02f51a38 CoreFoundation`__CFAllocatorSystemAllocate + 24\nframe #2: 0x02f51a13 CoreFoundation`CFAllocatorAllocate + 147\nframe #3: 0x02f5922c CoreFoundation`__CFGetConverter + 508\nframe #4: 0x02fa3dee CoreFoundation`CFStringEncodingGetConverter + 14\nframe #5: 0x02f6f4ee CoreFoundation`CFStringGetSystemEncoding + 62\nframe #6: 0x01b7b062 Foundation`_NSDefaultCStringEncoding + 19\nframe #7: 0x02b547cf libobjc.A.dylib`_class_initialize + 305\nframe #8: 0x02b5ba0d libobjc.A.dylib`prepareForMethodLookup + 158\nframe #9: 0x02b52aeb libobjc.A.dylib`lookUpMethod + 81\nframe #10: 0x02b52e22 libobjc.A.dylib`_class_lookupMethodAndLoadCache3 + 47\n\n\nFor some reason, enabled Guard Malloc makes it work just fine. \n\nMy application was working fine with the previous version of Xcode. Something about iOS 6/Xcode 4.5 caused this to arise."
] | [
"ios",
"xcode",
"ios6",
"xcode4.5"
] |
[
"KNN Classifier for MNIST dataset in python",
"I'm using KNN classifier in MNIST data set. First I'm reading dataset from CSV file then split it.\nHow can I calculate the accuracy here?\ndef dist(m1,m2):\n MSE = np.sqrt(sum((m1-m2)**2))\n return MSE\n\ndef knn(X,Y,testPoint,k=5):\n \n vals = []\n m = X.shape[0]\n \n for i in range(m):\n d = dist(testPoint,X[i])\n vals.append((d,Y[i]))\n \n \n vals = sorted(vals)\n vals = vals[:k]\n vals = np.array(vals)\n \n new_vals = np.unique(vals[:,1],return_counts=True)\n \n index = new_vals[1].argmax()\n pred = new_vals[0][index]\n \n return pred\n\n\npred = knn(train_image,train_label,test_image[74])"
] | [
"python",
"knn",
"mnist"
] |
[
"Is it possible for a parent element to Inherit height from an absolutely positioned child element?",
"Is it possible for a parent element to inherit the height from a child element that is positioned absolutely? \n\nCurrently, I have <div id=\"parent\"> with position: relative;. Inside this \"parent\" is another element <div id=\"child\"> with position: absolute;. \n\n\n The issue I'm facing is that the \"child\" element is not forcing the \"parent\" element to inherit it's height, in turn causing page layout problems."
] | [
"css",
"html"
] |
[
"Why singleInstance keep different Stack in Android",
"I want to know that Why singleInstance keep different Stack in Android for itself.\n\nDocs says :\n\n\n A \"singleInstance\" activity, on the other hand, permits no other activities to be part of its task. It's the only activity in the task\n\n\nSo Task here collection of activities which reside in Stack. So according to docs it keep own different Stack. Is it right but why it keeps own Stack ??"
] | [
"android",
"android-activity"
] |
[
"Gitlab ci Oauth authentification do nothing",
"I want to install gitlab ci to work with my gitlab installation.\n\nI configure in gitlab a new Oauth application with this callback : http://ci.vikindie.fr/user_sessions/callback\n\nI update my gitlab.rb to add theses lines : \n\nexternal_url \"http://code.vikindie.fr\"\nci_external_url \"http://ci.vikindie.fr\"\n\ngitlab_ci['gitlab_server'] = { 'url' => 'http://code.vikindie.fr', 'app_id' => \"xxxxxxx\", 'app_secret' => 'xxxxxxxx'}\n\n\nxxxxx is replace with gitlab code authentification.\n\nNow, when i'm connecting to gitlab-ci, it's connect through gitlab and redirect to gitlab-ci with the callback url but it does nothing else. And i can't access to gitlab-ci home. If i retry, it does exactly the same, yet and yet ... I stuck on this page that demand to login on gitlab\n\nI check the error.log of gitlab and gitlab-ci and nothing appear. (it's an omnibus install 7.8.2)\n\nVianney"
] | [
"gitlab",
"gitlab-ci"
] |
[
"I want to change jquery function to pure javascript function",
"this code already working but i want to jquery fucntion convert to pure JavaScript\n\n\r\n\r\njQuery(document).ready(function($){\r\n $('.product-addon-add-mattress option').hide();\r\n $('#pa_bed-size').change(function(){\r\n\r\n var bedSize = $(this).val();\r\n \r\n $('.addon option').each(function() {\r\n if ($(this).val().indexOf(bedSize) == 0) {\r\n $(this).show();\r\n } else {\r\n $(this).hide();\r\n }\r\n })\r\n \r\n });\r\n})\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<select id=\"pa_bed-size\" class=\"\" name=\"attribute_pa_bed-size\" >\r\n <option value=\"\">Choose an option</option>\r\n <option value=\"single\" class=\"attached enabled\">Single</option>\r\n <option value=\"small-double\" class=\"attached enabled\">Small Double</option>\r\n <option value=\"double\" class=\"attached enabled\">Double</option>\r\n <option value=\"king\" class=\"attached enabled\">King</option>\r\n <option value=\"super-king\" class=\"attached enabled\">Super King</option>\r\n</select>\r\n\r\n\r\n\r\n<select class=\"addon addon-select\" name=\"addon-2696-add-mattress-0\">\r\n <option value=\"\">Select an option...</option>\r\n <option>Not Required</option>\r\n <option value=\"single\">(Single) 3ft Spring Memory Foam Mattress (£145.00)</option>\r\n <option value=\"single\">(Single) 3ft Spring Orthopedic Foam Mattress (£185.00)</option>\r\n <option value=\"single\">(Single) 3ft Pocket 1000 Mattress (£185.00)</option>\r\n <option value=\"small-double\">(Small Double) 4ft Spring Memory Foam Mattress (£145.00)</option>\r\n <option value=\"small-double\">(Small Double) 4ft Spring Orthopedic Foam Mattress (£185.00)</option>\r\n <option value=\"double\">(Double) 4ft6 Spring Memory Foam Mattress (£145.00)</option>\r\n <option value=\"king\">(King) 6ft Spring Memory Foam Mattress (£145.00)</option>\r\n <option value=\"super\">(Super King) 6ft Spring Memory Foam Mattress (£145.00)</option>\r\n <option value=\"super\">(Super King) 6ft Spring Orthopedic Foam Mattress (£185.00)</option>\r\n</select>\r\n\r\n\r\n\n\nplease help me how to change pure javascript and im doing click the first select box and changing another select box."
] | [
"javascript",
"jquery"
] |
[
"TTPostController won't rotate",
"First, I'm sorry because my English isn't good :) This is my code to create a new TTPostController\n\npostController = [[TTPostController alloc] init];\npostController.delegate = self;\nself.popupViewController = postController;\npostController.superController = self;\n[postController showInView:self.view animated:YES]; \n\n\nIt run okay if I don't rotate the device\n\nhttp://i.stack.imgur.com/HBmpn.png\n\nBut when I rotated the device, it looks like this:\n\nhttp://i.stack.imgur.com/Nt7lq.png\n\n(Sorry i don't have enough reputation to post images)\n\nDoes anyone knows how to fix it?\n\nEdit:\nProblem fixed, I've written my own library like TTPostController :D"
] | [
"objective-c",
"ios",
"xcode",
"three20",
"autorotate"
] |
[
"How do I measure bytes in/out of an IP port used for .NET remoting?",
"I am using .NET remoting to retrieve periodic status updates from a Windows service into a 'controller' application which is used to display some live stats about what the service is doing.\n\nThe resulting network traffic is huge - many times the size of the data for the updates - so clearly I have implemented the remoting code incorrectly in a very inefficient way. As a first step towards fixing it, I need to monitor the traffic on the IP port the service is using to talk to the controller, so that I can establish a baseline and then verify a fix.\n\nCan anyone recommend a utility and/or coding technique that I can use to get the traffic stats? A \"bytes sent\" count for the port would suffice."
] | [
".net",
"windows",
"networking",
"remoting"
] |
[
"Is Dalvik's memory model the same as Java's?",
"Is Dalvik's memory model the same as Java's? I am particularly interested in whether reads and writes of reference and non-long/non-double primitive variables are atomic, but I would also like to know whether there are any differences between the two platforms' memory models."
] | [
"java",
"android",
"dalvik",
"memory-model",
"java-memory-model"
] |
[
"Insert inline assembly expressions using Llvm pass",
"I am trying to create and append inline assembly expressions using an llvm pass. I am aware that I can use void appendModuleInlineAsm(StringRef Asm) , but I couldn't make it work.\n\nBasically I want to append an instruction like this:\n\n%X = call i32 asm \"bswap $0\", \"=r,r\"(i32 %Y)\n\n\nJust before an other instruction. Has anybody tried it?"
] | [
"assembly",
"insert",
"llvm",
"inline"
] |
[
"has_many through: how to retrieve the id of a line in the correspondance table?",
"I have 2 models 'item' and 'activity'. An 'item' can have many 'activities' (limited number of activities, used by all items).\nTo make it clearer: this is represented by a table with one item per row, one activity per column and something/nothing on the intersection if a line exists in the table matrices.\n\nto see an image (worth a 1000 words :)): http://tinypic.com/r/33ygtj9/3\n\nThe relationships are (i think) set correctly:\nitem has_many matrices, item has_many activities through matrices\n\nactivity has_many matrices, activity has_many items through matrices\n\nmatrix belongs to item, matrix belongs to activity\n\nSome additional/useful info:\n - the matrix is represented graphically by a table with one item per row, one activity per column and OK/KO on the intersection if a line exists in the table matrices.\n - i have 2 other models in the picture: a course model and a chapter model (course has many chapters, chapter has many items)\n - Everything happens in the Course 'show' view\n\nSo far, i've managed to directly create a line (without going through a form) in the matrices table with the activity_id and the item_id.\nHowever I struggle to delete a line, because I don't understand how to access the matrices.id value.\n\nThe only way i've found yet is, for each item, to loop through all available activities for this item in a hash (key = activity_id, value = matrices_id).\nIf the activity is not available, i display OK + a link to create a line in matrices else,OK + link to destroy.\n\nIs there an easier/more 'Rails' way to do that ? i.e. get rid of the hash?\n\nthanks for your help.\n\nPierre"
] | [
"ruby-on-rails",
"ruby"
] |
[
"How to get the data object from a single record in the model?",
"Recently this became a bug in my application, although I don't know what changed to make it so (I haven't upgraded the version of Ember, which is still 1.13). What I need to find out is how to access the object of a single record on the model in the conventional way.\n\nI have the following code to filter my model based on two other properties:\n\n recordsBySelectedShapeAndColor = get(this, \"model\").filter(function(rec) {\n //filter the model by the chosen shape and color\n return (\n get(rec, \"shape\") === theShape &&\n get(rec, \"color\") === theColor\n );\n });\n\n\nI then need to create a summary of those filtered records, which I'm using reduce() for, but if that filter returns only one record, then reduce doesn't return the right results, so I have the following condition:\n\nif (recordsBySelectedShapeAndColor.length < 2) {\n summary = recordsBySelectedShapeAndColor[0]._data;\n} else {\n summary = recordsBySelectedShapeAndColor.reduce(function(a, b) {\n...\n}\n\n\nIt's the line within the if that is no longer returning the a simple object, so I changed it to summary = recordsBySelectedShapeAndColor[0]._internalModel._data; and it works, but it seems fishy (._data always did too). Is it code smell to be accessing underscored properties? If so, how can I get just the data from that single record on the model?"
] | [
"ember.js",
"model"
] |
[
"Launch iPhone simulator without Xcode",
"Is it possible to launch iPhone simulator from line command without using Xcode ?"
] | [
"iphone",
"xcode",
"ios-simulator"
] |
[
"eliminating the n-highest values in a python list",
"I have a list as shown below:\n\nList = [83, 36, 44, 66, 78, 34, 78, 55, 89, 100, 97]\n\n\nWhat would be the easiest way to discard the two highest values in the list?\n\nIs Pandas a route to go? Something like:\n\nimport pandas as pd\ndf = pd.DataFrame(\n List, \n index =['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'], \n columns =['Names']\n)\n\n\nAnd something like:\n\ndf = df.nsmallest(len(List)-2, 'Names')\n\n\nThe thing that I find very tedious is manually defining the index in the pandas dataframe IE, manually typing in the ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'] could a for loop do this?\n\nThanks"
] | [
"python",
"pandas"
] |
[
"Initial value on TextField with StreamBuilder",
"I have a TextField rendered with the help of a StreamBuilder, following the BLoC pattern with a sink and stream.\n\nWidget field(SignUpBloc signUpBloc) {\n return StreamBuilder(\n stream: signUpBloc.outFirstName,\n builder: (context, snapshot) {\n return TextField(\n style: TextStyle(fontSize: 15.0),\n onChanged: signUpBloc.inFirstName,\n decoration: InputDecoration(\n errorStyle: TextStyle(fontSize: 15.0),\n errorText: snapshot.error\n ),\n );\n },\n );\n}\n\n\nMy question is how do I set up an initial value? I've tried with the StreamBuilder's initialData property but no text appears in the TextField."
] | [
"flutter",
"bloc"
] |
[
"littler determine if running as deployed",
"I am pretty excited to have found Jeff and Dirk's application littler to run R functions from terminal. ¡kudos!\nSince then, I have been able to pass my functions to my development team and have them running in other servers. \n\nMy question is about it's deployment. Before passing it to others, I try it out in my computer and prepare it with RStudio... (also kudos).\nI was wondering if there's a command to run in the script on which I can tell if the function is run from the command or if it's been executed with R. \n\nThanks."
] | [
"r",
"shebang",
"littler"
] |
[
"How to clean up my Python Installation for a fresh start",
"I'm developing on Snow Leopard and going through the various \"how tos\" to get the MySQLdb package installed and working (uphill battle). Things are a mess and I'd like to regain confidence with a fresh, clean, as close to factory install of Python 2.6.\n\nWhat folders should I clean out? \n\nWhat should I run?\n\nWhat symbolic links should I destroy or create?"
] | [
"python",
"macos",
"osx-snow-leopard"
] |
[
"Extracting values from a list with S4 elements",
"I would like to extract all teststat from a list. Manually, I can achieve the expected result. Here is the code:\nlibrary(urca)\n\nset.seed(1234)\n\ndf_example <- data.frame(a = rnorm(75), b = rnorm(75), c = rnorm(75), d = rnorm(75))\n\ndf_UR_pp <- lapply(\n df_example,\n function(x){\n ur.pp(x, type = "Z-tau", model = "constant", lags = "short")\n }\n)\n\n# Problem is here\n\nall_results <- lapply(df_UR_pp, `[`, 'teststat')\n#> Error in FUN(X[[i]], ...): object of type 'S4' is not subsettable\n\n# Expected result\n\ntable_all_results <- data.frame("Variable" = c("a", "b" , "c", "d"), \n "Z-tau statistic" = c(df_UR_pp$a@teststat, df_UR_pp$b@teststat, df_UR_pp$c@teststat, df_UR_pp$d@teststat))\n\ntable_all_results\n#> Variable Z.tau.statistic\n#> 1 a -7.650956\n#> 2 b -7.396869\n#> 3 c -7.402462\n#> 4 d -8.256534"
] | [
"r",
"list"
] |
[
"Google Analytics - multiple domains tracking - linked to webmaster tools",
"I'm currently tracking multiple domains through Google Analytics but the \"Query\" report is still empty since I must link one single webmaster tool property.\n\nThis doesn't make any sense to me since my Multiple Tracking Profile, pulls data from 6 different websites.\n\nIs there a way to merge all the webmaster-tool-query-data of all the domains involved into the Google Multiple domain tracking report?"
] | [
"google-analytics",
"google-webmaster-tools"
] |
[
"What is a good deployment tool for websites on Windows?",
"I'm looking for something that can copy (preferably only changed) files from a development machine to a staging machine and finally to a set of production machines.\n\nA \"what if\" mode would be nice as would the capability to \"rollback\" the last deployment. Database migrations aren't a necessary feature.\n\nUPDATE: A free/low-cost tool would be great, but cost isn't the only concern. A tool that could actually manage deployment from one environment to the next (dev->staging->production instead of from a development machine to each environment) would also be ideal.\n\nThe other big nice-to-have is the ability to only copy changed files - some of our older sites contain hundreds of .asp files."
] | [
"iis",
"deployment"
] |
[
"Generate variables in for loop",
"I am trying to generate references to spinners and then create function .on event for all the spinners. Can I do this with a for loop since I have access to the number of times I need to repeat the code. Here is the original code:\nvar $changedInput0 = $("#mySpinnerID0");\n $changedInput0.on("input", function (event) {\n console.log("Input" + $changedInput0.val() + "counter" + slugs );\n var slug = slugs[0];\n link = "{% url 'core:addtocartproduct' 'aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz' 1 %}" \n var link = link.replace("aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz", slug)\n var link = link.replace("/1",'/'+$changedInput0.val())\n window.location.href = link\n }) \nvar $changedInput1 = $("#mySpinnerID1");\n $changedInput1.on("input", function (event) {\n var slug = slugs[1];\n link = "{% url 'core:addtocartproduct' 'aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz' 1 %}" \n var link = link.replace("aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz", slug)\n var link = link.replace("/1",'/'+$changedInput1.val())\n window.location.href = link\n }) \nvar $changedInput2 = $("#mySpinnerID2");\n $changedInput2.on("input", function (event) {\n var slug = slugs[2];\n link = "{% url 'core:addtocartproduct' 'aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz' 1 %}" \n var link = link.replace("aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz", slug)\n var link = link.replace("/1",'/'+$changedInput2.val())\n window.location.href = link\n }) \nvar $changedInput3 = $("#mySpinnerID3");\n $changedInput3.on("input", function (event) {\n var slug = slugs[3];\n link = "{% url 'core:addtocartproduct' 'aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz' 1 %}" \n var link = link.replace("aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz", slug)\n var link = link.replace("/1",'/'+$changedInput3.val())\n window.location.href = link\n }) \n\nMoreover, below is the for loop implementation which does not work. Since it is evaluated to be the maximum of the loop variable 3 in this case.\nvar k ='spin';\n for (i=0; i<slugs.length; i++){\n eval('var ' + k + i + '= $("#mySpinnerID'+i+'");');\n s=eval('spin'+i)\n\n eval(s).on("input", function (event) {\n var slug = slugs[i];\n link = "{% url 'core:addtocartproduct' 'aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz' 1 %}" \n var link = link.replace("aisle-aisle-object-5-oreo-chocolate-sandwich-cookies-party-size-255-oz", slug)\n console.log('i',i,'slug',slug)\n var link = link.replace("/1",'/'+s.val())\n // window.location.href = link\n })\n\n\n }"
] | [
"javascript"
] |
[
"How can this Python code be translated to C#?",
"I need to reverse engineer this code into C# and it is critical that ouput is absolutely the same. Any suggestions on the ord function and the \"strHash % (1<<64)\" part?\n\ndef easyHash(s):\n \"\"\"\n MDSD used the following hash algorithm to cal a first part of partition key\n \"\"\"\n strHash = 0\n multiplier = 37\n for c in s:\n strHash = strHash * multiplier + ord(c)\n #Only keep the last 64bit, since the mod base is 100\n strHash = strHash % (1<<64) \n return strHash % 100 #Assume eventVolume is Large"
] | [
"c#",
"python"
] |
[
"How do I set up a Silverlight hyperlinkbutton that actually navigates?",
"In SL4, I am finding it oddly difficult to figure out how to make a HyperlinkButton navigate to another Silverlight page in the same application when clicked. The structure is:\n\n<HyperlinkButton Content=\"Technical Information Screen\" Height=\"23\"\nName=\"hyperlinkButton1\" Width=\"320\" NavigateUri=\"/tis.xaml\" />\n\n\n\"tis.xaml\" is in the same folder as MainPage.xaml, which is where this button is located. When clicked, the button raises \"404 Not Found\".\n\nIf I change to having the NavigateUri get filled programmatically in the MainPage constructor, as in:\n\nhyperlinkButton1.NavigateUri = new Uri(\"/tis.xaml\", UriKind.Relative);\n\n\nI get the same result, as I do with not decorating with \"/\", and with UriKind set to Absolute or RelativeOrAbsolute. It is all very mysterious, but I know it must be do-able somehow, or why have the control at all?"
] | [
"c#",
"silverlight"
] |
[
"Entity Framework 6 - reuse same table in multiple edmx files",
"I have been tasked with upgrading our software to use EF6. Previously it was using a combination of EF4 & 5.\nWe use the database first approach. The upgrade went smoothly as far a code changes go, but after running the application and doing a query the following error is thrown.\n\nSchema specified is not valid. Errors:\nThe mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'tblAccountMaintenance'.\nPreviously found CLR type 'DALUsers.StatusDB.tblAccountMaintenance', newly found CLR type 'DALUsers.AccountsDB.tblAccountMaintenance'.\n\nThe class in questions, tblAccountMaintenance, is generated inside multiple .tt files. The classes are references to the same table, just referenced in different .edmx files.\nSimply removing one of the references is not a good option in this case as we have used a similar strategy with several other tables and would require thousands of lines of rewritten code.\nWhat do I need to do to fix this in EF6?"
] | [
"c#",
"entity-framework",
"edmx",
"ef-database-first"
] |
[
"Why does CreateWindowEx not work as expected?",
"I followed the tutorial at:\nhttp://www.winprog.org/tutorial/simple_window.html\n\nI have a reasonable understanding of what everything in the tutorial is doing and my test program works. I have tried to create a plugin for winamp using the hInstance of the DLL as it is imported and the parent hwnd given to my plugin by winamp. \n\nIt gets to the message loop but nothing is visible. \n\nconst char windowClassName[] = \"LastScrobblerConfig\";\n\nWNDCLASSEX wc;\nHWND hwnd;\nMSG msg; \n\n// the window class\nwc.cbSize = sizeof(WNDCLASSEX);\nwc.style = 0; \nwc.lpfnWndProc = WinEvents;\nwc.cbClsExtra = 0;\nwc.cbWndExtra = 0;\nwc.hInstance = plugin.hDllInstance;\nwc.hIcon = LoadIcon(NULL, IDI_APPLICATION);\nwc.hCursor = LoadCursor(NULL, IDC_ARROW);\nwc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);\nwc.lpszMenuName = NULL;\nwc.lpszClassName = windowClassName;\nwc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);\n\nif (!RegisterClassEx(&wc))\n{\n MessageBox(NULL, \"Window Registration Failed!\", \"Error!\",\n MB_ICONEXCLAMATION | MB_OK);\n return 0;\n}\n\nhwnd = CreateWindowEx (\n WS_EX_WINDOWEDGE,\n windowClassName, \n plugin.description,\n WS_TILEDWINDOW,\n CW_USEDEFAULT,\n CW_USEDEFAULT,\n 400,\n 400,\n plugin.hwndParent,\n NULL,\n plugin.hDllInstance,\n NULL\n);\n\nif (hwnd == NULL)\n{\n MessageBox(NULL, \"Window Create Failed!\", \"Error!\",\n MB_ICONEXCLAMATION | MB_OK);\n return 0;\n}\n\nShowWindow(hwnd, 1);\nUpdateWindow(hwnd);\n\nwhile(GetMessage(&msg, NULL, 0, 0) > 0)\n{\n TranslateMessage(&msg);\n DispatchMessage(&msg);\n}"
] | [
"windows",
"plugins",
"createwindow",
"winamp",
"createwindowex"
] |
[
"Problem with equals() method in Hibernate",
"I am developing an application in Hibernate where I have model classes like these:\n\npublic class Employee\n{\n private int ID;\n private String name;\n private Department department;\n //other properties\n //constructors, getters and setters\n}\n\n\nNote that the ID is not a value populated by the user and is populated using GenerationType.Identity as the strategy.\n\nAlso I have another class Department as follows:\n\npublic class Department\n{\n private int ID;\n private String name;\n\n private Set<Employee> employees; //this is actually a HashSet\n\n //other implementations\n}\n\n\nThere is a ManyToOne bi-directional relationship between an Employee and a Department.\n\nSo to add a new Employee to an existing Department, I do the following\n\nDepartment existingDepartment = ...;\nEmployee newEmployee = ...;\n\nexistingDepartment.addEmployee(newEmployee);\nemployee.setDepartent(existinDepartment);\n\nsession.save(newEmployee);\n\n\nNow conceptually two Employee objects are the same if they have the same ID. So my equals() method in the Employee class looks like this:\n\npublic boolean equals(Object o)\n{\n if(!(o instanceOf Employee))\n {\n return false;\n }\n\n Employee other = (Employee)o;\n\n if(this.ID == o.etID())\n {\n return true;\n }\n\n return false;\n}\n\n\nNow the problem is when I create a new Employee(); I do not have its ID, since it will be assigned when it will be persisted. So when I say \n\nexistingDepartment.addEmployee(newEmployee);\n\n\nthe internal HashSet of the Department object is effectively using an equals() method which is broken [since it uses a member variable to determine equality that as not been initialized properly].\n\nThis seems like a very basic problem but, how do I solve it? Or am I designing my classes totally wrong? Or should my equals method be re-written to compare other values instead of ID, which I guess would be absurd."
] | [
"java",
"hibernate"
] |
[
"Java NullPointerException when using scanner.hasNext();",
"I came up with the following code to read information from a file:\n\nimport java.io.*;\nimport java.util.*;\n\npublic class Reader {\n\n private Scanner s;\n\n public void openFile() {\n try {\n s = new Scanner(new File(\"file.txt\"));\n } catch (Exception e) {\n System.out.println(\"File not found. Try again.\");\n }\n }\n\n public void readFile() {\n while (s.hasNext()) {\n String a = s.next();\n String b = s.next();\n String c = s.next();\n int d = s.nextInt();\n int e = s.nextInt();\n int f = s.nextInt();\n }\n\n public void closeFile() {\n s.close();\n }\n\n}\n\n\nHowever, I get a NullPointer error on the (while (s.hasNext())) line and can't find a solution.\n\nI'm working in Eclipse and the file I'm reading from is imported correctly into the project so that should not be an issue.\n\nEDIT: \n\nThe way I access the methods:\n\npublic class Tester {\n\n public static void main(String[] args) {\n\n Reader read = new Reader();\n\n read.openFile();\n read.readFile();\n read.closeFile();\n\n }\n\n}"
] | [
"java",
"nullpointerexception",
"java.util.scanner"
] |
[
"Cypher Query - Collect two separate types of nodes connected to a third type of node",
"First, here is what I desire and I then will explain what I have tried.\nIn this simplified example I have a graph with nodes A, B, C, and D. I have relationships like A->B, B->C and B->D only. I would like to aggregate each of the connections to a node A into a list and subsequently each of the connections to node B into two separate lists: one for B->C connections and one for B->D connections. Something like the below.\n{\n 'A': 'A',\n 'Bs': [{\n 'B': 'B',\n 'Cs': [\n ...\n ]\n 'Ds': [\n ...\n ]\n }, ...]\n}\n\nNow for my specific use case. I have trip nodes that are connected to waypoints. Waypoints are connected to airports and what I call a POI. I would like to return a trip with a list of its waypoints where each waypoint has two lists: a list of airports and a list of POI. I have not been able to accomplish this successfully and have not found any examples with this exact use case. In addition to the query below, I have tried many other variations with foreach loops and other constructs. I think this is the closest I have come. In the below query, B->C would equate to the HAS_AIRPORTS relationship and B->D to the HAS_POI relationship. I think my problem comes down to there being multiple aggregations that need to be made on the same level. I am getting some strange output where things seem to be repeating themselves because of the 2 aggregations. Sorry if this is not clear, I am new to the terminology of the cypher query language. Thank you, I am appreciative of any help.\n MATCH (t:Trip {uid: $tripId})\n WITH t\n OPTIONAL MATCH (t)-[:HAS_WAYPOINTS]-(w {active: true})\n WITH t, w\n OPTIONAL MATCH (w)-[wa:HAS_AIRPORT]-(a:NeoAirport)\n WITH t, w, collect(a{.*, active:wa.active}) as airports\n WITH t, w {.*, airports:airports } as waypoints\n OPTIONAL MATCH (w)-[wp:HAS_POI {active: true}]-(p:PointOfInterest)\n WITH t, waypoints, w, collect({source:wp.source, uid:p.uid, placeId:p.placeId}) as pois\n WITH t, apoc.map.setKey( waypoints, 'pointsOfInterest', pois )\n WITH t, t {.*, waypoints: collect(waypoints) } as trips\n OPTIONAL MATCH (t)-[tsa:HAS_START_AIRPORTS]-(sa)\n WITH t, collect(sa) as sa, trips\n WITH t, apoc.map.setKey( trips, 'startAirports', sa ) as trips\n OPTIONAL MATCH (t)-[tea:HAS_START_AIRPORTS]-(ea)\n WITH t, collect(ea) as ea, trips\n WITH t, apoc.map.setKey( trips, 'endAirports', ea ) as trips\n RETURN trips"
] | [
"neo4j",
"cypher"
] |
[
"Java method keyword \"final\" and its use",
"When I create complex type hierarchies (several levels, several types per level), I like to use the final keyword on methods implementing some interface declaration. An example:\n\ninterface Garble {\n int zork();\n}\n\ninterface Gnarf extends Garble {\n /**\n * This is the same as calling {@link #zblah(0)}\n */\n int zblah();\n int zblah(int defaultZblah);\n}\n\n\nAnd then\n\nabstract class AbstractGarble implements Garble {\n @Override\n public final int zork() { ... }\n}\n\nabstract class AbstractGnarf extends AbstractGarble implements Gnarf {\n // Here I absolutely want to fix the default behaviour of zblah\n // No Gnarf shouldn't be allowed to set 1 as the default, for instance\n @Override\n public final int zblah() { \n return zblah(0);\n }\n\n // This method is not implemented here, but in a subclass\n @Override\n public abstract int zblah(int defaultZblah);\n}\n\n\nI do this for several reasons:\n\n\nIt helps me develop the type hierarchy. When I add a class to the hierarchy, it is very clear, what methods I have to implement, and what methods I may not override (in case I forgot the details about the hierarchy)\nI think overriding concrete stuff is bad according to design principles and patterns, such as the template method pattern. I don't want other developers or my users do it.\n\n\nSo the final keyword works perfectly for me. My question is:\n\nWhy is it used so rarely in the wild? Can you show me some examples / reasons where final (in a similar case to mine) would be very bad?"
] | [
"java",
"final",
"overloading",
"keyword"
] |
[
"Cloud Firestore/ Flutter - Map sorted by Database",
"When I simply upload a Map with the index values from A1 to A10, the List ist sorted like that:\n\nA1, A10, A2, A3....\n\nWhen I upload that List, it is sorted correctly (A1.A2..A10) but in Firebase it is resorted like I explained.\n\nvoid updateList(newList) async {\n try {\n await Firestore.instance\n .collection(\"centers\")\n .document(localUser.centerId)\n .updateData({\n \"list\": newList,\n });\n } catch (error) {}\n}\n\n\nSo how can I stop this auto-sort behaviour, I dont want to re-sort the list after getting it from Firebase.flutter"
] | [
"flutter",
"google-cloud-firestore"
] |
[
"Microsoft Dependency Injection & HttpClientFactory w/ .NET Framework 4.6+ / MVC 5.2 / Web API 2",
"Our web application is built on the .NET Framework 4.6+. We're using WebForms, MVC 5.2, and Web API 2.\n\nI'm in the process of trying to integrate Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Http into this solution so we can take advantage of the new HttpClientFactory that's in ASP.NET Core. We also want to start using DI in our MVC and API controllers.\n\nIt appears there are two ways this can be achieved:\n\n\nWrite a custom ControllerActivator\nWrite a custom DependencyResolver\n\n\nBased on the reading I've done, it appears the ControllerActivator method is the old way of doing this, and the DependencyResolver is the current, preferred way of handling this. I've written code for both, and both methods appear to work.\n\nConsidering the DependencyResolver appears to be the preferred solution for DI now, I'd like to use it but I'm not sure if I'm handling scope object disposal correctly.\n\nHere's how I'm configuring the DependencyResolvers in Global.asax:\n\nWeb.Mvc.DependencyResolver.SetResolver(New Mvc.DependencyInjection.DependencyResolver(serviceProvider))\nGlobalConfiguration.Configuration.DependencyResolver = New Api.DependencyInjection.DependencyResolver(serviceProvider)\n\n\nMy System.Web.Http.Dependencies.IDependencyResolver implementation for Web API is:\n\npublic class DependencyResolver : IDependencyResolver\n{\n private IServiceProvider ServiceProvider { get; }\n\n public DependencyResolver(IServiceProvider serviceProvider) => ServiceProvider = serviceProvider;\n\n public IDependencyScope BeginScope() => new DependencyResolver(ServiceProvider.CreateScope().ServiceProvider);\n\n public void Dispose() => (ServiceProvider as IDisposable)?.Dispose();\n\n public object GetService(Type serviceType) => ServiceProvider.GetService(serviceType);\n\n public IEnumerable<object> GetServices(Type serviceType) => ServiceProvider.GetServices(serviceType);\n}\n\n\nMy System.Web.Mvc.IDependencyResolver implementation for MVC is:\n\npublic class DependencyResolver : IDependencyResolver\n{\n private IServiceProvider ServiceProvider { get; }\n\n public DependencyResolver(IServiceProvider serviceProvider) => ServiceProvider = serviceProvider;\n\n public object GetService(Type serviceType) => ServiceProvider.GetService(serviceType);\n\n public IEnumerable<object> GetServices(Type serviceType) => ServiceProvider.GetServices(serviceType);\n}\n\n\nThe System.Web.Http.Dependencies.IDependencyResolver interface has Dispose(), and it appears API requests do call my implementation's Dispose method. So that appears to be working (I think).\n\nMy concern is the System.Web.Mvc.IDependencyResolver interface doesn't have Dispose(), I'm not clear if these service objects are being properly disposed after a MVC request.\n\nIf anyone can provide some insight into this I'd really appreciate it. Don't want to roll this out and find out we're leaking memory."
] | [
"asp.net",
".net",
"asp.net-mvc",
"dependency-injection"
] |
[
"Can C be used to capture system calls on a machine?",
"Good day,\n\nI was wondering if there is a way to do direct system call capture with C or C++?\n\nI know that currently on unix systems you can use SystemTap to do system capture. The problem I'm having is that in order to feed them into another program for analysis I have to pipe them to the other program. \n\nI'd like to pass things along programatically as this is easier than \"printing\" out into the pipe and then reading in with the other program.\n\nIs there a way of doing this? How difficult would it be?"
] | [
"c++",
"c",
"operating-system"
] |
[
"Predefined variable ArtifactStagingDirectory location relative to each build or each pipeline?",
"I see in the docs that this folder $(Build.ArtifactStagingDirectory) is purged on each build, but what about when another build happens for a different pipeline?\nEg. Say I have 3-4 different build / release pipelines\nIf I do a build for project 1 that goes to its first stage, but before I let that release go to its next stage, a build is kicked off for project 2.\nDoes each build pipeline get its own area where artifacts are dropped? or is this common between all of your pipelines?\nfrom the docs:\n\nThis variable is agent-scoped, and can be used as an environment\nvariable in a script and as a parameter in a build task, but not as\npart of the build number or as a version control tag.\n\nSo now I guess the question is - does each pipeline get a different build agent?\nAlso from the docs:\n\nPipeline artifacts are tied to the pipeline that they're created in."
] | [
"azure-pipelines"
] |
[
"Is Possible to use Flyway instead of Liquibase with JHipster?",
"A few months ago, I had an opportunity of working with Flyway. Flyway is straightforward for anyone who knows SQL. It is far easier to use native SQL statements in a Flyway DB change file than using XML in a Liquibase DB change files. I hope there is at least an option of DB refactoring tool so that people can use Flyway if they like."
] | [
"jhipster"
] |
[
"Allow a temporary filter view on protected sheets and ranges google sheets?",
"Is there a way to allow temporary filter view on protected sheets and ranges in google sheets? Temporary filter view is allowed on view only mode. Any script file available."
] | [
"google-apps-script",
"google-sheets"
] |
[
"Scrapyd: How to write data to json file?",
"I have a working scrapy 2.1.0 project where I write data to a json file:\n\ndef open_spider(self, spider):\n self.file = open('data/'+ datetime.datetime.now().strftime (\"%Y%m%d\") + '_' + spider.name + '.json', 'wb')\n self.exporter = JsonItemExporter(self.file)\n\n\nNow I want to deploy it to scrapyd, but since the data folder does not exist under /tmp it will lead to the following error:\n\nTraceback (most recent call last):\n File \"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/scrapy/crawler.py\", line 91, in crawl\n yield self.engine.open_spider(self.spider, start_requests)\nFileNotFoundError: [Errno 2] No such file or directory: 'data/20200518_rieger.json'\n\n\nHow can the above code be rewriten in order to work with scrapyd?"
] | [
"python",
"scrapy",
"scrapyd"
] |
[
"INSTALL_FAILED_VERIFICATION_FAILURE ON ant debug install",
"I'm developing a native application for Android in C++. The app works fine, and install (with ant debug install) correctly en several devices, but throws an error when I try to install it in a Lenovo A806 with androdid 4.4.2:\n\nenter code install:\n [echo] Installing /home/flush/Project/test/bin/NativeActivity-debug.apk onto default emulator or device...\n [exec] 7378 KB/s (6015860 bytes in 0.796s)\n [exec] Failure [INSTALL_FAILED_VERIFICATION_FAILURE]\n\n\nThe device appears when executing adb devices. I have disabled the Verify Applications Check in security and checked the Unknow sources Options.\nStill throws the same error.\n\nI also tried installing the android debug certificate (by Install from internal Storage in security options), but it does not works. Despite of a message \"certificate is installed\" is showing, the certificate are not show in the certificate list.\n\n¿Any clues?\n\nThank you"
] | [
"android",
"android-ndk"
] |
[
"Spawned process doesn't trigger exit nor close callback in node.js",
"I am using NodeJS and spawn 200 processes via child_process.spawn simultaneously. They all take around 1 second to execute each. The function looks as follows:\nstatic execute(path: string): Promise<void> {\n const proc = spawn('foo', [path], {stdio: [0, 'pipe', 'pipe']});\n console.log('Spawn');\n return new Promise((resolve, reject) => {\n proc.on('close', (code) => {\n console.log('Close');\n resolve(code);\n });\n proc.on('error', (err) => {\n console.log('error');\n reject(err);\n });\n });\n});\n\nHere is the console output of the calls:\n200x 'Spawn'\n2x 'Close'\n0x 'Error'\n\nUsing ps aux | grep foo, I can verify that foo is not running anymore. Is there a specific reason why close does not get triggered? I also tried exit, but neither is fired."
] | [
"node.js"
] |
[
"Heroku / Node - how to add git commit on server",
"I'm learning Node and Git and I have a Heroku app that is reading and writing to a local file on the server (a very simple JSON database).\n\nIf I add the file to my gitignore locally, it disappears from my Heroku app and causes the app to error. But if I don't add it to my gitignore, it overwrites the latest version (on the server) with an old one I have locally.\n\nObviously the issue is because the changes on the server file aren't being committed. However, I don't know how to do that remotely, or if it's even possible. I can run heroku git:clone locally, but I can't run heroku:git add. \n\nHow do I handle this?"
] | [
"javascript",
"node.js",
"git",
"heroku"
] |
[
"Match any word of a List/Array in a Sentence java",
"I have an List of word like below\n\nList<String> forbiddenWordList = Arrays.asList(\"LATE\", \"S/O\", \"SO\", \"W/O\", \"WO\");\n\n\nHow can I understand a String Contains any one of the word of the List. like....\n\nString name1 = \"Adam Smith\"; // false (not found)\nString name2 = \"Late H Milton\"; // true (found Late)\nString name3 = \"S/O Furi Kerman\"; // true (found S/O)\nString name4 = \"Conl Faruk\"; // false (not found)\nString name5 = \"Furi Kerman WO\"; // true (found WO)\n\n\nRegular Expression highly appreciated."
] | [
"java",
"regex",
"matcher"
] |
[
"What is the difference between my variable name and 'it' when using 'let' in kotlin?",
"In the following code snippet, what is the difference between the two Codeblocks?\nIf I check with println(name==it), that returns true, so they must be referencing the same object, right?\nHowever, when the name variable has a value, everything works, but once I set it to null, Codeblock 1 works (meaning, the let block simply will not be executed), but Codeblock 2 throws an error. Why does kotlin not just skip/ignore Codeblock 2, when nameis null?\nfun main() {\n \n var name:String? = "Cedric"\n //name = null\n \n //Codeblock 1\n name?.let{\n println("The length of name is ${name.length}")\n }\n \n //Codeblock 1\n name?.let{\n println("The length of name is ${it.length}")\n }\n \n}\n\nThank you very much, any help is appreciated."
] | [
"android",
"kotlin",
"null",
"let",
"kotlin-null-safety"
] |
[
"How to add text formatting like superscript or subscript to a label in a Shiny app?",
"I've built an app with shinydashboard and would like to format correctly some of the input labels.\nFor example, I have a numeric input like this:\nnumericInput("input_a", "Label (unit = m2)", value = 1)\n\nI cannot find how to edit the m2 to be m².\nI have tried to use the expression function, without success:\nexpression(Label~(unit~=~m^2))"
] | [
"r",
"shiny",
"label",
"shinydashboard"
] |
[
"Array declaration in C",
"How to use the arguments of a function to declare an array inside the function?\n\nMy code is:\n\ndouble function_2(int a)\n{\n int t[a];\n}\n\n\nAn error occurs:\n\nExpression must have a constant value."
] | [
"c",
"arrays"
] |
[
"VSTS Release Manager Linked Variables Groups",
"I'm trying to understand how we can associate variable groups to a particular environment within a single release definition. It does not appear as though this is currently possible?\n\nAs I understand it, in a release definition we can define variables that can be scoped to all or specific environments within that release definition. \n\nWe also have the ability to \"link\" Variables Groups to that release definition. The problem I have is that I would like to create Variable Groups that only get applied to say Production environments and not the non prods within a release definition.\n\nHas anyone been able to achieve something like this? I know this is currently possible in other Release Managers like Octopus.\n\nThanks in advance."
] | [
"azure-devops",
"azure-pipelines-release-pipeline"
] |
[
"How to merge unsupervised hierarchical clustering result with the original data",
"I carried out an unsupervised hierarchical cluster analysis in R. My data are numbers in 3 columns and around 120,000 rows. I managed to use cut tree and recognised 6 clusters. Now, I need to return these clusters to the original data, i.e. add another column indicating the cluster group (1 of 6). How I can do that?\n\n# Ward's method\nhc5 <- hclust(d, method = \"ward.D2\" )\n\n# Cut tree into 6 groups\nsub_grp <- cutree(hc5, k = 6)\n\n# Number of members in each cluster\ntable(sub_grp)\n\n\nI need that as my data got spatial links, hence I would like to map the clusters back to their location on a map. \nI appreciate your help."
] | [
"r",
"merge",
"tree",
"hierarchical-clustering"
] |
[
"How to read font size of each word in a word document using POI?",
"I am trying to find out whether there exist anything in the word document that has a font of 2. However, I have not been able to do this. To begin with, I've tried to read the font of each word in a sample word document that only has one line and 7 words. I am not getting the correct results. \n\nHere is my code:\n\nHWPFDocument doc = new HWPFDocument (fileStream);\nWordExtractor we = new WordExtractor(doc);\nRange range = doc.getRange()\nString[] paragraphs = we.getParagraphText();\nfor (int i = 0; i < paragraphs.length; i++) {\n Paragraph pr = range.getParagraph(i);\n int k = 0\n while (true) {\n CharacterRun run = pr.getCharacterRun(k++);\n System.out.println(\"Color: \" + run.getColor());\n System.out.println(\"Font: \" + run.getFontName());\n System.out.println(\"Font Size: \" + run.getFontSize());\n if (run.getEndOffSet() == pr.getEndOffSet())\n break;\n }\n}\n\n\nHowever, the above code always doubles the font size. i.e. if the actual font size in the document is 12 then it outputs 24 and if actual font is 8 then it outputs 16. \n\nIs this the correct way to read font size from a word document ??"
] | [
"java",
"ms-word",
"apache-poi",
"word-processor"
] |
[
"Android SDK - aapt: error while loading shared libraries: libc++.so",
"I downloaded the sdk-tools linux-3859397.zip and extract it to /opt/android (which is my ANDROID_HOME)\n\nSo, when I launch aapt it fail to load the libc++ shared library\n\n$ /opt/android/build-tools/27.0.3/aapt\n/opt/android/build-tools/27.0.3/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory\n\n\nBut the libc++ exists, as example the ldd tools has found it !\n\n$ ldd /opt/android/build-tools/27.0.3/aapt\n linux-vdso.so.1 (0x00007ffdd66b3000)\n libc++.so => /opt/android/build-tools/27.0.3/lib64/libc++.so (0x00007fc511580000)\n librt.so.1 => /usr/lib64/librt.so.1 (0x00007fc511378000)\n libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fc511170000)\n libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fc510f50000)\n libz.so.1 => /usr/lib64/libz.so.1 (0x00007fc510d38000)\n libm.so.6 => /usr/lib64/libm.so.6 (0x00007fc5109e0000)\n libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fc5107c8000)\n libc.so.6 => /usr/lib64/libc.so.6 (0x00007fc5103e0000)\n /lib64/ld-linux-x86-64.so.2 (0x00007fc511698000)\n\n$ file /opt/android/build-tools/27.0.3/lib64/libc++.so\n/opt/android/build-tools/27.0.3/lib64/libc++.so: setgid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped\n\n\nI tried to install libstdc++-devel both in 32bit and 64 bits but that do not solve this issue\n\nThanks for your help\n\nNote: same problem with aapt2"
] | [
"android",
"linux",
"aapt",
"aapt2"
] |
[
"What's read-before-write in NoSQL?",
"I read in a book : \"Cassandra is an NoSQL database and promotes read-before-write instead of relational model\".\n\nWhat does \"read-before-write\" means in a NoSQL context?"
] | [
"cassandra",
"nosql"
] |
[
"How to create custom loading spinner in Ionic 3",
"I have an app which has been built with Ionic 1. I upgraded this app to Ionic 3. While doing this, I am having a trouble. It is that I can't create the same spinner as Ionic 1 in Ionic 3.\nHere is a video with the spinner in Ionic 1.\n\nLoading spinner video for Ionic 1\n\nAlso, here is a video which I created in Ionic 3.\nLook forward to receiving a good solution."
] | [
"ionic3",
"spinner"
] |
[
"How to run a delay function for 5 times in JavaScript?",
"I want to run a delay function for five seconds in JavaScript which will print "Hello" in the console after every second for five times.\nSimilar Python Code:\nfrom time import delay\n\nfor I in range(5):\n print("Hello")\n delay(1)\n\nThe above code will print "Hello" five times with one second delay between each print.\nNow I want to do similar kind of operation in JS.\nNow in JS we have setTimeout function which will call a function after after a specified time. The following code will print "Hello" in the console after 1 second interval.\nsetTimeout(function(){ \n console.log("Hello"); \n }, 1000);\n\nHow can I run this code that will print 'Hello' in the console five times with an one second delay between each print?\nNB: I tried to pass this function inside a for loop, but it did not work."
] | [
"javascript",
"jquery"
] |
[
"Implement virtual function inherited from A using concrete function inherited from B",
"Suppose I have an interface class and a partial implementation class. Also, suppose that I absolutely do not want this partial implementation to inherit from the interface:\n\nclass interface {\n virtual void fnA() const = 0; \n virtual void fnB() const = 0; \n};\n\nclass partialImplementation { //Do not want to inherit from interface!\n void fnA() const {cout << \"fnA from partial implementation\" << endl;}\n //fnB() not implemented\n};\n\n\nThe idea is that I'm planning to make several new classes all inheriting the interface, but I want to implement the same fnA() in each one. So, after inheriting the interface, maybe I could also inherit the partial implementation and hope that fnA() gets implemented. For example,\n\nclass myClass : interface, partialImplementation {\n //would like fnA() to be implemented by partialImplementation\n void fnB() const {cout << \"fnB from myClass\" << endl;} \n};\n\n\nOf course, if you try to instantiate this class, you get this error:\n\nmain.cpp: In function 'int main()':\nmain.cpp:235:10: error: cannot declare variable 'm' to be of abstract type 'myClass'\nmain.cpp:201:7: note: because the following virtual functions are pure within 'myClass':\nmain.cpp:193:15: note: virtual void interface::fnA() const\nCompilation failed.\n\n\nAfter reading some other stackoverflow posts (like this one) it seems the only available solution is to do this:\n\nclass myClass : interface, partialImplementation {\n public:\n void fnB() const {cout << \"fnB from myClass\" << endl;} \n void fnA() const {\n partialImplementation::fnA();\n }\n};\n\n\nIn the linked post, the OP didn't mind typing three extra lines. But you could imagine that I actually want partialImplementation to implement more than just one function, and that I could be typing this same boilerplate over and over every time I want to make a new class inheriting this interface.\n\nDoes anyone know a way to do this without requiring partialImplementation to inherit from interface?"
] | [
"c++",
"inheritance",
"abstract-class",
"multiple-inheritance"
] |
[
"How do I get specific data from my localstorage so I can show them in a modal in JavaScript?",
"for example, let's say I have:\nstudent[ id : 1, Name: Jake]\nstudent[ id : 2, Name: John]\nso far what I have is\n const link = document.createElement("a");\n link.href = "#";\n link.addEventListener("click", function(){openModalCallback()}, false);\n link.textContent = student.id; \n\n let row = document.createElement("tr");\n let cell = document.createElement("td");\n \n row.appendChild(cell);\n cell.append(link);\n\nthis just opens the modal that contains the data. How do I specifically access the 2nd student when I click on his ID so only his data will be shown in the modal?"
] | [
"javascript",
"jquery"
] |
[
"Trying to plot some sensor info from mysql to grafana",
"I just got into saving data from my electric meter using a software defined radio, I am trying to plot this info from a mysql table in grafana.\n\nHere is some sample data and my query:\n\n <a href=\"http://i.imgur.com/pWRt5Ma.png\">\n <img src=\"http://imgur.com/pWRt5Mal.png\" />\n </a>\n\n\nCreate table statement:\n\n <a href=\"http://i.imgur.com/Duy8Iqn.png\">\n <img src=\"http://imgur.com/Duy8Iqnl.png\" />\n </a>\n\n\nI'm trying to figure out the best way to plot mConsumed to mTime for a single mId (%563) using grafana. Once I got this working I hope to get my gas meter plotting as well.\n\nIt seems no matter what I do it won't plot, and I'm really not understanding instructions on \n http://docs.grafana.org/features/datasources/mysql/ \n\nMy grafana query:\n\nSELECT\n mTime as time_sec,\n mConsumed as value,\n 'w' as metric\nFROM UtilityMon.UtilityMeter\nWHERE $__timeFilter(mTime)\nAND mId like '%563'\nORDER BY mTime DESC;\n\n\nIf you know what I am doing wrong, please let me know, as I am losing my sanity by the minute. It did work with influxdb, but I'd rather use mysql since grafana can read it.\n\nI had to codeblock my images... sorry not enough rep points...\n\nedit- I figured it out!\n\nSELECT\n mId as metric,\n mTime as time_sec,\n mConsumed as value\nFROM UtilityMon.UtilityMeter\nWHERE\n mId=xxxxxxxx\nand\n $__unixEpochFilter(mTime)\n;\n\n\nWorked nicely"
] | [
"mysql",
"grafana"
] |
[
"How can I disable button until both textFields have at least one character in them?",
"I am trying to disable a login button until both email and password textFields have at least one character in both of them. I tried looking up different answers but the code seems to be outdated on the answers I could fine. I also do not know how to observe the TextFields values to see if there is change. Can someone please assist me or point me in the right direction? \n\nThis is the count I currently have.\n\nfunc viewDidLoad() {\nsuper.viewDidLoad()\n// Setting text field delegates\n\nemailTextField.delegate = self\n\npasswordTextField.delegate = self\n\n//checking if both textFields are filled in to enable Login Button\n\nif (emailTextField.text?.count)! > 0 && (passwordTextField.text?.count)! > 0 {\n\nloginButton.isEnabled = true\nloginButton.alpha = 0.55\n\n} else {\n loginButton.isEnabled = false\n loginButton.alpha = 0.32\n\n}\n\n\n\n}"
] | [
"swift",
"uibutton",
"uitextfield",
"isenabled",
"disable"
] |
[
"SSIS how to add lookup key to inserted rows",
"I have a problem where I need to have the dimension key for all rows in the data stream.\n\n\nI use a lookup component to find the dimension key of the records\nRecords with no dimension key (lookup no match output) are redirect to a different output because they need to be inserted.\nthe no match output is multicated\nthe new records are inserted into the dimension.\na second lookup component should be executed after the records are inserted\n\nnumber 5 fails because I don't know how to wait for the ADO NET Destination to finish...\n\n\nIs there any way to solve this other than dump the stream into raw files and use other data flow to resume the task?"
] | [
"ssis"
] |
[
"Uncollapse div automatically on page open",
"I have a link like this\n<a href="http://192.168.178.165/home/item#145">Item</a>\n\nand when I click that link the page opens and gets focused on that item. There is a list of multiple items which are all collapsed with css:\n.item-hidden {\n height: 0;\n overflow: hidden;\n}\n\nAnd when I click on heading that div gets uncollapsed.\nIs there a way somehow to automatically uncollapse that div from link when that page is opened?\nupdate\nThis is the function for collapsing and uncollapsing\n$(function () {\n $(".item-panel").click(function(){\n var itemId = $(this).attr('data-item-id');\n $('#'+itemId).toggleClass('item-hidden');\n });\n});"
] | [
"jquery",
"html",
"css"
] |
[
"Accessibility and Access",
"I'd like to add some accessibility features to my Access forms, for users that have difficulty with the standard 11pt-font, white-background, black-text set-up.\n\nWindows itself has a bunch of Display Settings options for altering window font sizes, background colours etc, but these don't cover Access forms altogether well - they'll change the colour of items where system colours are used, but font face or size of labels, input boxes, data grids etc can't be changed this way as they're not connected to those settings. The Datasheet settings under File -> Options seem to have no effect on datasheet forms (or subforms).\n\nI can't find any accessibility options in Access, not so much as a Zoom function (1998 called, it wants its GUI back, etc etc). It seems ridiculously excessive to have to fire up the VBA editor and do something like:\n\nPublic Sub AccessbilityBtn_Click()\n Me.Detail.BackColor = RGB(whatever)\n\n Me.HeadingLbl.FontSize = 18\n Me.HeadingLbl.Width = 'whatever accomodates bigger text\n Me.HeadingLbl.Height = 'whatever accomodates bigger text\n Me.FieldLabel1.FontSize = 14\n Me.FieldLabel1.Width = 'whatever accomodates bigger text\n Me.FieldInput1.Width = 'whatever accomodates bigger text\n\n '... to infinity and beyond ...\nEnd Sub\n\n\nOr to craft FormName_BigText versions of every single form and replicate the entire behaivour of my entire system.\n\nSo, does Access have accessibility options? If so, where are they? And can they be called from VBA? If not, how can accessibility options be implemented into Access forms?"
] | [
"accessibility",
"ms-access-2010"
] |
[
"How to get all Objects from a big Array by an API (C#)",
"Newtonsoft.Json.JsonReaderException: "Additional text encountered after finished reading JSON content\n\nHello,\nI try to get every Object from a big Array provided by an API (steam-API).\nI need multiple calls to get all the Objects since they are a "total_count":15228.\nThis is my method to get the first page, which works perfectly fine:\npublic static Task LoadAllItemsAsync()\n {\n int start=0;\n string responseData = "";\n \n \n using (WebClient w = new WebClient())\n {\n responseData = responseData + w.DownloadString("https://steamcommunity.com/market/search/render/?search_descriptions=0&sort_column=default&sort_dir=desc&appid=730&norender=1&count=100&start=" + start);\n \n Thread.Sleep(3000);\n w.Dispose();\n }\n start = start + 100;\n \n\n \n\n dynamic parsedJson = JsonConvert.DeserializeObject(responseData);\n string jsonData = JsonConvert.SerializeObject(parsedJson, Formatting.Indented);\n System.IO.File.WriteAllText(System.IO.Path.GetFullPath(@"..\\..\\SteamData\\SteamItems.json"), jsonData);\n\n return Task.CompletedTask;\n\n }\n\nAnd to get all of the Objects, I try to loop through all pages, by increasing the start value by 100, and here is where I get an exception when I try to deserialize the responsData string.\nCode:\npublic static Task LoadAllItemsAsync()\n {\n int start=0;\n string responseData = "";\n for(int i = 0; i <= 1; i++)\n {\n \n using (WebClient w = new WebClient())\n {\n responseData = responseData + w.DownloadString("https://steamcommunity.com/market/search/render/?search_descriptions=0&sort_column=default&sort_dir=desc&appid=730&norender=1&count=100&start=" + start);\n \n Thread.Sleep(3000);\n w.Dispose();\n }\n start = start + 100;\n }\n\n \n\n dynamic parsedJson = JsonConvert.DeserializeObject(responseData); //Newtonsoft.Json.JsonReaderException: "Additional text encountered after finished reading JSON content\n string jsonData = JsonConvert.SerializeObject(parsedJson, Formatting.Indented);\n System.IO.File.WriteAllText(System.IO.Path.GetFullPath(@"..\\..\\SteamData\\SteamItems.json"), jsonData);\n\n return Task.CompletedTask;\n\n }\n\nI have found something on google, but I don't understand it and I don't know how to apply it on my code.\nI highly appreciate any answers.\nEdit: \nWhat I have tried:\npublic static Task LoadAllItemsAsync()\n {\n int start=0;\n string responseData = "";\n string jsonData = "";\n for (int i = 0; i <= 1; i++)\n { \n using (WebClient w = new WebClient())\n {\n responseData = responseData + w.DownloadString("https://steamcommunity.com/market/search/render/?search_descriptions=0&sort_column=default&sort_dir=desc&appid=730&norender=1&count=100&start=" + start);\n dynamic parsedJson = JsonConvert.DeserializeObject(responseData);\n jsonData = jsonData + JsonConvert.SerializeObject(parsedJson, Formatting.Indented);\n \n }\n start = start + 100;\n }\n System.IO.File.WriteAllText(System.IO.Path.GetFullPath(@"..\\..\\SteamData\\SteamItems.json"), jsonData);\n return Task.CompletedTask;\n }"
] | [
"c#",
"json",
"api",
"json-deserialization",
"steam"
] |
[
"To auto resize textarea when the value is changed using javascript",
"Here is my code:\n\n <html>\n <head>\n <style>\n textarea{ \n width: 30%; \n min-width:30%; \n max-width:30%; \n overflow: hidden;\n height:10%; \n min-height:10%; \n max-height:10%;\n resize: none;\n white-space:pre;\n }\n </style>\n <script>\n function textAreaAdjust(o) {\n o.style.height = \"1px\";\n o.style.height = (25+o.scrollHeight)+\"px\";\n }\n function click1()\n {\n\n document.getElementById('text').value=\"Stack Overflow is a \nprivately held website, the flagship site of the Stack Exchange Network,\n[5][6] created in 2008 by Jeff Atwood and Joel Spolsky,[7][8] as a more open\n alternative to earlier Q&A sites such as Experts Exchange. The name for the\n website was chosen by voting in April 2008 by readers of Coding Horror, \nAtwood's popular programming blog.[9]\";\n $(\"#text\").focus();\n }\n </script>\n </head>\n <body>\n\n <textarea onkeyup=\"textAreaAdjust(this)\" style=\"overflow:hidden\" id=\"text\"></textarea>\n <input type=\"button\" onClick=\"click1()\">\n </body>\n </html>\n\n\nIn this code when i click that button it should display the content what i have given in the javascript inside a textarea. But the textarea i have given here is overflow:hidden, so it shows only some content and the rest hides inside. How can i make all the content visible.\n\nNeed all your suggestion."
] | [
"javascript",
"jquery",
"html",
"css",
"textarea"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.