texts
sequence | tags
sequence |
---|---|
[
"Using protobuf, how to remove a field from a parsed object?",
"I have parsed successfully a proto buffer into my object and can display or modify my fields:\n\nprint \"convolution param = \" + str(net.layer[1].convolution_param)\nnet.layer[1].convolution_param.num_output = 0\n\n\nreturns\n\nconvolution param = num_output: 64\npad: 1\nkernel_size: 3\n\n\nHowever, I am trying to remove convolution_param altogether and can't:\n\ndel net.layer[1].convolution_param\n\n\nreturns\n\ndel net.layer[1].convolution_param\nTypeError: Can't set composite field\n\n\nI believe this is what triggers this error in the source of the proto library:\n\nint SetAttr(CMessage* self, PyObject* name, PyObject* value) {\n if (PyDict_Contains(self->composite_fields, name)) {\n PyErr_SetString(PyExc_TypeError, \"Can't set composite field\");\n return -1;\n }\n\n\nWhat is the prescribed method for removing a field? I also tried without more success the following:\n\ndel net.layer[1].convolution_param.num_output\ndel net.layer[1].convolution_param[:] = []"
] | [
"python",
"field",
"protocol-buffers"
] |
[
"Google thin fonts are not readable in windows safari, how can I fix it?",
"I have used Google thin font(Shadows Into Light Two) in my website. When i tested this with windows safari, it's shows unreadable. Other Windows browsers and Mac safari working fine.\n\nMenu in Windows Safari\n\n\n\nMenu in Windows Other Browsers(IE,FF,Chrome...etc) and Mac Safari\n\n\n\nThis is working but it's browser settings.\nhttps://forums.adobe.com/message/5751340#5751340\n\nThis solution not working for me.\nFont weight turns lighter on Mac/Safari"
] | [
"html",
"css",
"windows",
"fonts",
"safari"
] |
[
"Bitbucket Pipelines: pulling an image from GCR with environment variables fails",
"So I'm trying to use an image from my Google Container Registry, since this is a private registry I need to authenticate.\n\nObviously I don't want to renew my auth token every hour to make my pipelines work, so I need to go for the json key file.\n\nIt works when I define the image as follows:\n\nimage:\n name: eu.gcr.io/project_id/image:latest\n username: _json_key\n password: >\n {JSON file content}\n email: [email protected]\n\n\nBut that means your json key file is out in the open available for everyone with access to the pipelines fine to see, not what I'd like.\n\nThen I've put the contents of the JSON file into an Environment Variable and replaced the actual json with the environment variable as follows:\n\nimage:\n name: eu.gcr.io/project_id/image:latest\n username: _json_key\n password: >\n ${JSON_KEY}\n email: [email protected]\n\n\nSomehow in the second scenario it doesn't work :("
] | [
"google-container-registry",
"bitbucket-pipelines"
] |
[
"Some tutorial examples not working",
"in this tutorial example it says that there should be an output of 3 notification messages.\n\n<!doctype html>\n<html>\n<head>\n<title>JavaScript Chapter 2</title>\n</head>\n<body>\n<h1>Here’s another basic page</h1>\n<script type=”text/javascript”>\nvar ball = {\n“color”: “white”,\n“type”: “baseball”\n};\nball.weight = 15;\nfor (var prop in ball) {\nalert(ball[prop]);\n}\n</script>\n</body>\n</html> \n\n\nbut when I try it all I get is a page with the header \"Here's another basic page\"\n\nhi I am just using notepad to edit the html files. But now to update I changed the file to be exactly like an earlier example which is just alert(\"Hello\"); in the script. The file still does not work yet the earlier file works. can anybody think why this would be(I have checked through the files and I mean they are exactly identical other than the name of the files).\nI am using a apache server configured to my local IP address and PHP and MySQL also running the files through IE10. The tutorial examples are from PHP,Mysql,javaScript and html5 all in one for dummies\n\nThanks guys I wrote it out a second time in a new file and it didn't work tried your suggestions and still nothing. Then wrote it out a third time and it worked both in its original form and with your suggestions. So I am putting it down to it just doesn't like me. lol"
] | [
"javascript"
] |
[
"Calculate the sum of filtered column",
"I'm trying to filter a html table and calculate the sum of the filtered column.\nSo far the filtering is working fine but I can't update the total.\n\n\r\n\r\nfunction searchTable() {\r\n var input, filter, found, table, tr, td, i, j;\r\n input = document.getElementById(\"search\");\r\n filter = input.value.toUpperCase();\r\n table = document.getElementById(\"displaytable\");\r\n tr = table.getElementsByTagName(\"tr\");\r\n for (i = 0; i < tr.length; i++) {\r\n td = tr[i].getElementsByTagName(\"td\");\r\n for (j = 0; j < td.length; j++) {\r\n if (td[j].innerHTML.toUpperCase().indexOf(filter) > -1) {\r\n found = true;\r\n }\r\n }\r\n if (found) {\r\n tr[i].style.display = \"\";\r\n found = false;\r\n } else {\r\n tr[i].style.display = \"none\";\r\n }\r\n }\r\n\r\n}\r\nvar cls = document.getElementById(\"displaytable\").getElementsByTagName(\"td\");\r\nvar sum = 0;\r\nfor (var i = 0; i < cls.length; i++) {\r\n if (cls[i].className == \"countable\") {\r\n sum += isNaN(cls[i].innerHTML) ? 0 : parseInt(cls[i].innerHTML);\r\n }\r\n}\r\ndocument.getElementById('total').innerHTML += sum;\r\n<input type=\"text\" id=\"search\" onkeyup='searchTable()' placeholder=\"Type to search\">\r\n<table id=\"displaytable\">\r\n <thead>\r\n <tr>\r\n <th>User</th>\r\n <th>Number</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr>\r\n <td>John</td>\r\n <td class=\"countable\">5</td>\r\n </tr>\r\n <tr>\r\n <td>Tom</td>\r\n <td class=\"countable\">4</td>\r\n </tr>\r\n <tr>\r\n <td>Jordan</td>\r\n <td class=\"countable\">7</td>\r\n </tr>\r\n <tr>\r\n <td>David</td>\r\n <td class=\"countable\">3</td>\r\n </tr>\r\n <tr>\r\n <td>Marc</td>\r\n <td class=\"countable\">1</td>\r\n </tr>\r\n </tbody>\r\n <tfoot class=\"shown\">\r\n <tr>\r\n <td colspan=\"4\">Total:</td>\r\n <td id=\"total\"></td>\r\n </tr>\r\n </tfoot>\r\n</table>\r\n\r\n\r\n\n\nWhen I use the filter the sum is not refresh(the 'tfoot' disappear). \nWhat must I do to always have the 'tfoot' visible and the total updated?"
] | [
"javascript"
] |
[
"Empty runlist when running chef-client from node",
"I'm not sure why at this point but after knife bootsrapping a new node the node seems to loose it's run list. sshing to the node, if I run chef-client it dumps all the cookbooks I just bootstrapped it with and says it's has an empty run list:\n\n...\n[2017-03-19T14:39:21-04:00] INFO: Removing cookbooks/nfs/.kitchen.yml.aws from the cache; its cookbook is no longer needed on this client.\n[2017-03-19T14:39:21-04:00] INFO: Removing cookbooks/users/.foodcritic from the cache; its cookbook is no longer needed on this client.\n[2017-03-19T14:39:21-04:00] INFO: Removing cookbooks/java/.rubocop_todo.yml from the cache; its cookbook is no longer needed on this client.\nSynchronizing Cookbooks:\nInstalling Cookbook Gems:\nCompiling Cookbooks...\n[2017-03-19T14:39:21-04:00] WARN: Node app-test004 has an empty run list.\nConverging 0 resources\n[2017-03-19T14:39:21-04:00] INFO: Chef Run complete in 0.229085419 seconds\n\nRunning handlers:\n[2017-03-19T14:39:21-04:00] INFO: Running report handlers\nRunning handlers complete\n[2017-03-19T14:39:21-04:00] INFO: Report handlers complete\nChef Client finished, 0/0 resources updated in 02 seconds\n\n\nThis is on one of two new chef servers and the other is behaving correctly. Any ideas on what to look for?"
] | [
"chef-infra",
"chef-recipe"
] |
[
"How to get the date of a Twitter post (tweet) using BeautifulSoup?",
"I am trying to extract posting dates from Twitter. I've already succeeded in extracting the name and text of the post, but the date is a hard rock for me. \n\nAs input I have a list of links like these: \n\n\nhttps://twitter.com/BarackObama/status/1158764847800213507; \nhttps://twitter.com/Pravitelstvo_RF/status/1160613745208549377\nhttps://twitter.com/BarackObama/status/1157016227681918981\n\n\nI am using searching by class, but I think this is a problem. Sometimes it works with some links, sometimes not. I've already tried these solutions:\n\nsoup.find(\"span\",class_=\"_timestamp js-short-timestamp js-relative-timestamp\")\nsoup.find('a', {'class': 'tweet-timestamp'})\nsoup.select(\"a.tweet-timestamp\")\n\n\nBut none of these works every time.\n\nMy current code is: \n\ndata = requests.get(url) \nsoup = BeautifulSoup(data.text, 'html.parser')\ngdata = soup.find_all(\"script\") \nfor item in gdata:\nitems2 = item.find('a', {'class': 'tweet-timestamp js-permalink js-nav js-tooltip'}, href=True) \nif items2:\nitems21 = items2.get('href')\nitems22 = items2.get('title')\nprint(items21)\nprint(items22)\n\n\nI need to have output with the posting date."
] | [
"python",
"twitter",
"beautifulsoup"
] |
[
"jQuery blur issues on multiple fields",
"I am trying to create a dynamic quote form where the user can add as many rows as they need. After typing in an input field with the class of 'reCal' I want the total price field to be calculated.\n\n<div class=\"orderItem\">\n<div class=\"row col2\">\n<input class=\"reCal nvo\" id=\"iQty\" name=\"item[1][qty]\" placeholder=\"1\" value=\"\" />\n</div><!--col2-->\n<div class=\"row col3\">\n<input class=\"ctp reCal nvwdo currency\" id=\"iPrice\" name=\"item[1][price]\" placeholder=\"100.00\" value=\"\" />\n</div><!--col3-->\n</div><!--orderItem-->\n\n<div class=\"box\">\n<p>Net Total (£)</p>\n<input class=\"noh\" id=\"netTotal\" name=\"netTotal\" type=\"text\" readonly=\"readonly\" value=\"0\" />\n</div>\n\n\nThis is the jQuery I currently have.\n\n$(document).ready(function(){\n\n $('.reCal').blur(function(){\n calculate();\n });\n\n function calculate(){\n var net = 0;\n $('.ctp').each(function(){\n net += parseInt($(this).val());\n });\n $('input#netTotal').val(net.toFixed(2));\n }\n});\n\n\nThis code does calculate the total sum correctly but the blur function only works on the first input box even though all the other input boxes have the same class. \n\nI dont know if maybe my issue stems from using the .after() command to write each new row. Just a theory though."
] | [
"javascript",
"jquery",
"blur"
] |
[
"Does ArcView and/or R use Graphics Card (GPU) acceleration",
"Pretty much exactly what it says in the title. I'm looking to buy a new computer cause I'm tired of spending 2 hours waiting to edit a point in ArcView and I was curious if either ArcView or R uses GPU acceleration. I plan on getting the Intel i7 3770k processor (and using its onboard Intel HD 4000 graphics card) and a Samsung SSD to speed things up with a decent amount of RAM. But when I posed the question to knowledgeable computer users that don't use GIS or R they asked about the GPU and if either program uses GPU acceleration. As far as I can tell they don't, but I figured I would go for a more knowledgeable second opinion.\n\nThanks in advance,"
] | [
"r",
"gis",
"gpu",
"acceleration"
] |
[
"How to play same animation 'reverse' with no selector and 'normal' on :active?",
"I'm trying to use the same animation with no selector and with selector :active. The only difference is that I change the animation-direction. The result is that the browser plays the animation once (on page load). When I click the animation is not being played.\nI could create two keyframes, with the same content and different names, then it works. But I don't like copy-paste code. So I'm tying to find a way to make this work. Any suggestions?\n<style>\nbutton.click {\n animation: click 0.5s 0s 1 reverse ease none;\n}\n\nbutton.click:active {\n animation: click 0.5s 0s 1 normal ease forwards;\n}\n\n@keyframes click {\n0% {\n margin-left: 0px;\n margin-top: 0px;\n box-shadow: 5px 10px rgba(0,0,0,0.2);\n}\n\n100% {\n margin-left: 2.5px;\n margin-top: 5px;\n box-shadow: 2.5px 5px rgba(0,0,0,0.2);\n}\n}\n\n</style>\n\n<button class="click">test</button>"
] | [
"html",
"css",
"css-animations"
] |
[
"How to find multiple elements within an index of divs using Selenium",
"So I'm currently trying to find all the src links among a list of generated divs. The problem is it shares the same class name and alt tag as other elements on the page so I'm stuck using the xpath. But when I try to use it I am limited to only returning the value that is indexed in the xpath. For example div[3]. How could I get it to find all the elements div[1-inf] and not just one specific one? I discovered position() as a parameter but I haven't had much luck getting it to work. Maybe I'm just not using it right. driver.find_elements_by_xpath(\"//*[@id='tab-history-flow']/div[3]/a/img\").get_attribute('src')\n\n<div style=\"display:inline-block\">\n <a target=\"_blank\" title=\"Inventory Profile\" href=\"http://csgo.exchange/profiles/76561197969720703\">\n <img class=\"Avatar\" alt=\"avatar\" title=\"ArieBier | 2015-09-16 18:20:58\" style=\"width:32px;height:32px\" src=\"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/df/dfd267c19d759f730e1051ae4657d0100a6b6c0d.jpg\">\n </a> \n</div>\n<div style=\"display:inline-block\">\n<a target=\"_blank\" title=\"Inventory Profile\" href=\"http://csgo.exchange/profiles/76561198136313290\">\n<img class=\"Avatar\" alt=\"avatar\" title=\"by | 2015-09-17 02:53:25\" style=\"width:32px;height:32px\" src=\"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/5d/5d4c06db9ba89f8a945108af10075ebd348cd1ae.jpg\">\n</a> \n</div>\n<div style=\"display:inline-block\">\n <a target=\"_blank\" title=\"Inventory Profile\" href=\"http://csgo.exchange/profiles/76561198152970370\">\n <img class=\"Avatar\" alt=\"avatar\" title=\"Marn | 2015-10-05 14:40:37\" style=\"width:32px;height:32px\" src=\"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ae/ae7878915405c9ad622c9d7fc3b52f3b71ed140a.jpg\">\n </a> \n</div>\n\n\nWhat I already tried. \n\ndriver.find_elements_by_xpath(\"//*[@id='tab-history-flow']/div/a/img\"[position() < 1000]).get_attribute('src')\ndriver.find_elements_by_xpath(\"//*[@id='tab-history-flow']/div[position() < 1000]/a/img\").get_attribute('src')"
] | [
"python",
"selenium",
"xpath",
"css-selectors",
"webdriverwait"
] |
[
"nighwatchjs screenshots on_error vs on_failure",
"Can someone explain the difference between on_error and on_failure for screenshot generation in nightwatchjs? The explanation below isn't clear to me what the difference is.\n\nFrom http://nightwatchjs.org/guide: \n\n\n screenshots object none Selenium generates screenshots when command errors occur. With on_failure set to true, also generates screenshots for failing or erroring tests. These are saved on the disk. \n \n Since v0.7.5 you can disable screenshots for command errors by setting \"on_error\" to false. \n \n Example:\n \n \"screenshots\" : {\n \"enabled\" : true,\n \"on_failure\" : true,\n \"on_error\" : false,\n \"path\" : \"\"\n }"
] | [
"selenium",
"terminology",
"nightwatch.js"
] |
[
"Remove unforgeted records",
"I have two tables\n\nCREATE TABLE `server` (\n `server_id` int(3) NOT NULL AUTO_INCREMENT,\n `server_name` varchar(15),\n `server_alias` varchar(50),\n `server_status` tinyint(1) DEFAULT '0',\n `server_join` tinyint(1) DEFAULT '1',\n `server_number_member` int(5),\n PRIMARY KEY (`server_id`)\n) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\nCREATE TABLE `member` (\n `member_id` int(11) NOT NULL AUTO_INCREMENT,\n `member_server` int(3) DEFAULT NULL COMMENT 'Id server',\n `member_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Tên của member',\n PRIMARY KEY (`member_id`)\n) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;\n\n\nAn I create table VIEW to get list server\n\nCREATE VIEW `server_client` AS \nSELECT\n `s`.`server_id` AS `server_id`,\n `s`.`server_name` AS `server_name`,\n `s`.`server_alias` AS `server_alias`,\n IF (`s`.`server_join` = 1, (COUNT(`m`.`member_id`) / `s`.`server_number_member` * 100) DIV 1, 100) AS `server_full` \nFROM (`server` `s`\n LEFT JOIN `member` `m`\n ON ((`m`.`member_server` = `s`.`server_id`)))\nWHERE `s`.`server_status` = 1\n\n\nNow, server table have 1 record:\n\n-------------------------------------------------------------------------------------------\n|server_id|server_name|server_alias |server_status|server_join|server_number_member|\n|-----------------------------------------------------------------------------------------|\n| 1 | SV 01 | http://example.com/ | 0 | 0 | 10 |\n-------------------------------------------------------------------------------------------\n\n\nIn membertable\n\n------------------------------------------\n| member_id | member_server | member_name|\n|----------------------------------------|\n| 1 | 1 | aaa |\n|----------------------------------------|\n| 2 | 1 | bbb |\n|----------------------------------------|\n| 3 | 1 | ccc |\n------------------------------------------\n\n\nResult in server_client table\n\n--------------------------------------------------------\n| server_id | server_name | server_alias | server_full |\n|------------------------------------------------------|\n| NULL | NULL | NULL | 100 |\n--------------------------------------------------------\n\n\nserver_full is used to calculate the percentage of the number of members already in a server\n\nI want to remove record NULL in server_client table\nHow to do it\n\nThank"
] | [
"mysql"
] |
[
"Low disk space causes RabbitMQ to loose messages instead of blocking the connection",
"I have a java application that publishes messages to a RabbitMQ server.\nWhen the available disk space drops below rabbit's low watermark I get unexpected behavior. \n\nThe expected behavior is that the connection will become blocking, making my application hang on the call to Channel.basicPublish.\n\nThe actual behavior is that the connection appears to be blocking in the management console, but calls to Channel.basicPublish return with no errors and the messages that were supposed to be published are lost.\nThis behavior undermines the most important feature of RabbitMQ, which is robustness.\n\nBelow is a minimal version of my application for testing. All it does is publish a message every second with an incrementing index (1, 2, 3, ...). The messages are received just fine by the RabbitMQ server, until I set the low watermark to a very high value, by putting the following line in the rabbitmq.config file:\n\n[ \n {rabbit, [{disk_free_limit, 60000000000}]}\n].\n\n\nAfter restarting the server, I get a low disk space notification in the management console, the connection is marked as 'blocking', and no more messages are received by the server. However, the application keeps running and sending messages as if nothing is wrong. When I reduce the watermark back to a normal value messages are received by the server again, but all the messages that were sent while the connection was blocking are lost.\n\n\nAm I doing something wrong?\nIs this a bug in RabbitMQ?\nIf so, is there a workaround?\n\n\nOS: Windows 8 64bit\nRabbitMQ server version: 3.1.1\nRabbitMQ Java client version: 3.1.0 \n\nTest application code:\n\nimport com.rabbitmq.client.Channel;\nimport com.rabbitmq.client.Connection;\nimport com.rabbitmq.client.ConnectionFactory;\nimport com.rabbitmq.client.MessageProperties;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport java.io.IOException;\n\npublic class Main {\n\n private final static Logger logger = LoggerFactory.getLogger(Main.class);\n private final static String QUEUE_NAME = \"testQueue\";\n\n private static Channel channel = null;\n\n private static void connectToRabbitMQ() throws IOException {\n ConnectionFactory factory = new ConnectionFactory();\n Connection connection = factory.newConnection();\n channel = connection.createChannel();\n channel.queueDeclare(\n QUEUE_NAME,\n true, // Durable - survive a server restart\n false, // Not exclusive to this connection\n false, // Do not autodelete when no longer in use\n null // Arguments\n );\n }\n\n private static void disposeChannel()\n {\n if (channel == null) {\n return;\n }\n try {\n channel.close();\n } catch (Exception e) {\n } finally {\n channel = null;\n }\n }\n\n public static void main(String[] args) throws Exception {\n\n boolean interrupted = false;\n int messageNumber = 1;\n\n while (!interrupted) {\n byte[] message = Integer.toString(messageNumber).getBytes();\n try {\n if (channel == null) {\n connectToRabbitMQ();\n }\n channel.basicPublish(\n \"\",\n QUEUE_NAME,\n MessageProperties.MINIMAL_PERSISTENT_BASIC,\n message\n );\n logger.info(\"Published message number {}\", messageNumber);\n messageNumber++;\n } catch (Exception e) {\n logger.info(\"Unable to connect to RabbitMQ...\");\n disposeChannel();\n }\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n logger.info(\"Interrupted\");\n interrupted = true;\n }\n }\n }\n}"
] | [
"java",
"rabbitmq",
"blocking",
"diskspace"
] |
[
"What Are the Maximum Number of Base-10 Digits in the Integral Part of a Floating Point Number",
"I want to know if there is something in the standard, like a #define or something in numeric_limits which would tell me the maximum number of base-10 digits in the integral part of a floating point type.\n\nFor example, if I have some floating point type the largest value of which is: 1234.567. I'd like something defined in the standard that would tell me 4 for that type.\n\nIs there an option to me doing this?\n\ntemplate <typename T>\nconstexpr auto integral_digits10 = static_cast<int>(log10(numeric_limits<T>::max())) + 1;"
] | [
"c++",
"floating-point",
"max",
"decimal",
"numeric-limits"
] |
[
"How to use api constrains for versioning in Sinatra app?",
"I have simple Sinatra application.\n\n# app/routes/v2/accounts.rb\nmodule Oauth2Provider\n module Routes\n module V2\n class Accounts < Base\n get '/accounts' do\n content_type :json\n 'version 2'\n end\n end\n end\n end\nend\n# app/routes/v1/accounts.rb\nmodule Oauth2Provider\n module Routes\n module V1\n class Accounts < Base\n get '/accounts' do\n content_type :json\n 'version 1'\n end\n end\n end\n end\nend\n\n# app.rb\nrequire 'rubygems'\nrequire 'bundler'\n\n# Setup load paths\nBundler.require\n$: << File.expand_path('../', __FILE__)\n$: << File.expand_path('../lib', __FILE__)\n\nrequire 'sinatra/base'\nrequire 'app/models'\nrequire 'app/routes'\n\nmodule Oauth2Provider\n class App < Sinatra::Application\n configure do\n set :database, {\n adapter: \"sqlite3\",\n database: \"db/oauthdb.sqlite3\"\n }\n end\n\n use Oauth2Provider::Routes::V1::Accounts\n use Oauth2Provider::Routes::V2::Accounts\n end\nend\n\ninclude Oauth2Provider::Models\n\n# app/routes.rb\nmodule Oauth2Provider\n module Routes\n autoload :Base, 'app/routes/base'\n # autoload :Accounts, 'app/routes/v2/accounts'\n module V1\n autoload :Accounts, 'app/routes/v1/accounts'\n end\n module V2\n autoload :Accounts, 'app/routes/v2/accounts'\n end\n end\nend\n\n\nI tried to use this gem => https://github.com/techwhizbang/rack-api-versioning\n\nUpdate: I also found https://github.com/brandur/sinatra-router but can't figure out how to add it to my app\n\nBut how to implement this in my code to choose correct module to render based on header."
] | [
"ruby",
"api",
"routes",
"sinatra",
"rack"
] |
[
"Setting color for the line in line series chart in extjs 4.2",
"I was trying to set custom color for the line series in extjs chart.\n\nThe thing is the color gets affected only to the dots and not to the whole line.\n\nI am using renderer config in line series to achieve this. \n\nHere is the code snippet:\n\n{\n type: 'line',\n axis: 'left',\n //fill: true,\n //fillOpacity: 0.5,\n xField: 'month',\n yField: 'plan_cost',\n renderer: function (sprite, record, attr, index) {\n var color = '#faf56c';//RED COLOR\n\n return Ext.apply(attr, {\n fill: color\n });\n }\n}\n\n\nThis is how it appears:\n\n\n\nWhat should I do to change the line color too?"
] | [
"javascript",
"extjs",
"charts",
"extjs4.2"
] |
[
"Error in setFragment - FB-Native Login",
"i am using Facebook Nativelogin , so that it would be faster than traditional method but i get the error as below (image) ,\n\n\n\nActually this pointer points to the current Fragment here , is that right ? if not , \nwhat does this this pointer points to ? and why i get this error ? i dont know where i am going wrong .\n\nI am following https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/#protip1\n\nand http://code.google.com/p/app-container/source/browse/trunk/AppContainer/src/levelrewind/android/app/FacebookFragment.java?spec=svn237&r=237 \n\nbut i get the same error i have searched a lot but there are only a few threads about the native FB login and i have went through all those threads but i was not successful"
] | [
"android",
"facebook",
"fragment",
"android-fragmentactivity"
] |
[
"Changing ajax jquery request to a XMLHttpRequest",
"I have this Ajax request with jquery:\n\n$(document).ready(function () {\n var pageName;\n\n $('li a').on('click', function (){\n pageName = $(this).attr('data-url');\n\n $.ajax({\n type: 'GET',\n url: 'http://mywebsite.com/' + pageName + '/?json=1',\n contentType: 'application/json',\n dataType: 'jsonp',\n success: function(data) {\n var page = data.content;\n $('.mypage').html(page);\n }\n })\n });\n});\n\n\nAnd i want change to XMLHttpRequest, so i did this:\n\nfunction showPage () {\n\n var httpRequest = new XMLHttpRequest();\n httpRequest.onreadystatechange = function () {\n if (httpRequest.readyState == 4) {\n document.getElementById('.mypage').innerHTML = httpRequest.responseText;\n }\n };\n\n var attr = document.getElementByTagName(this);\n var pageName = attr.getAttribute('data-url');\n var url = 'http://mywebsite.com/' + pageName + '/?json=1',\n\n httpRequest.open('GET', url);\n httpRequest.send();\n}\n\n\nIt's not working at all, anyone knows what i did wrong?"
] | [
"javascript",
"jquery",
"ajax"
] |
[
"Win32: Set text length in Tree View with cchTextMax",
"Is it possible to define text length that would be displayed in the node of Tree View control in Win32 application?\n\nFor example we have string \"text|2\". Then I want to store pointer to this string in the node, but display only \"text\" without \"|2\".\n\nI thought that cchTextMax field is responsible for this, but the next code won't work:\n\nTV_INSERTSTRUCT tvinsert;\ntvinsert.item.mask = TVIF_TEXT;\ntvinsert.item.pszText = \"text|2\";\ntvinsert.item.cchTextMax= 4;\nSendDlgItemMessage(hDlg,IDD_TREE,TVM_INSERTITEM,0,(LPARAM)&tvinsert);\n\n\nNode strill displays full text \"text|2\".\n\nOne solution was to copy required text to new pointer, and then use it. But this solution not satisfied me, since I need to store last part of string with node too."
] | [
"c++",
"c",
"winapi",
"treeview",
"win32gui"
] |
[
"Is it possible to create a page from a string in ASP.Net?",
"I can create a page from a file with:\n\nPage page = BuildManager.CreateInstanceFromVirtualPath(\n virtualPath, typeof(Page)) as Page;\n\n\nHow can I instantiate a page from a stream or a string?\n\nThank you."
] | [
".net",
"asp.net",
"virtualpathprovider"
] |
[
"Memory usage issue with Python csv.DictReader",
"I'm using csv.DictReader in Python 3 to process a very large CSV file. And I found a strange memory usage issue.\n\nThe code is like this\n\nimport os\nimport csv\nimport psutil # require pip install\n\n# the real CSV file is replaced with a call to this function\ndef generate_rows():\n for k in range(400000):\n yield ','.join(str(i * 10 + k) for i in range(35))\n\n\ndef memory_test():\n proc = psutil.Process(os.getpid())\n print('BEGIN', proc.memory_info().rss)\n\n fieldnames = ['field_' + str(i) for i in range(35)]\n reader = csv.DictReader(generate_rows(), fieldnames)\n result = []\n for row in reader:\n result.append(row)\n\n print(' END', proc.memory_info().rss)\n return result\n\n\nif __name__ == '__main__':\n memory_test()\n\n\nIn the code above the program will print the memory usage (which requires psutil installed) and the result is like\n\nBEGIN 12623872\n END 2006462464\n\n\nYou can see by the end of the process it would take nearly 2GB memory.\n\nBut if I copy each row, the memory usage become lower.\n\ndef memory_test():\n proc = psutil.Process(os.getpid())\n print('BEGIN', proc.memory_info().rss)\n\n fieldnames = ['field_' + str(i) for i in range(35)]\n reader = csv.DictReader(generate_rows(), fieldnames)\n result = []\n for row in reader:\n # MAKE A COPY\n row_copy = {key: value for key, value in row.items()}\n result.append(row_copy)\n\n print(' END', proc.memory_info().rss)\n return result\n\n\nThe result is like\n\nBEGIN 12726272\n END 1289912320\n\n\nIt only takes about 1.29G memory, much less.\n\n(I tested the code on 64-bit Ubuntu and got those results.)\n\nWhy does this happen? Is it proper to copy the rows from a DictReader?"
] | [
"python",
"memory-management"
] |
[
"Aggregate overlapping intervals using data table",
"I have some sample data, where there is (faulty) overlapping intervals, so I would like to split the data into non-overlapping intervals, adding data to each intervals according to the original data. \n\nAssume i have a data table like this:\n\nx <- c(1000, 2000, 2000, 1000, 1500)\ny <- c(1200, 3000, 4000, 2000, 3000)\nz <- c(\"a\", \"a\", \"a\", \"b\", \"b\")\nn1 <- 1:5\nn2 <- 4:8\n\nDT <- data.table(id=z,\n start=as.POSIXct(x, origin = \"2016-01-01\"), \n end=as.POSIXct(y, origin = \"2016-01-01\"),\n x=x,\n y=y,\n data1=n1,\n data2=n2)\n\nDT\n\n id start end x y data1 data2\n1: a 2016-01-01 01:16:40 2016-01-01 01:20:00 1000 1200 1 4\n2: a 2016-01-01 01:33:20 2016-01-01 01:50:00 2000 3000 2 5\n3: a 2016-01-01 01:33:20 2016-01-01 02:06:40 2000 4000 3 6\n4: b 2016-01-01 01:16:40 2016-01-01 01:33:20 1000 2000 4 7\n5: b 2016-01-01 01:25:00 2016-01-01 01:50:00 1500 3000 5 8\n\n\nfor each id i would like to aggregate the data, using the sum of data within each interval. For id==a, it would look like this:\n\n1: a 2016-01-01 01:16:40 2016-01-01 01:20:00 1000 1200 1 4\n2: a 2016-01-01 01:33:20 2016-01-01 01:50:00 2000 3000 3.5 8\n3: a 2016-01-01 01:50:01 2016-01-01 02:06:40 3001 4000 1.5 3\n\n\nSince half of row 3 would be added to row 2. For id==\"b\", it gets a little more complicated:\n\n4: b 2016-01-01 01:16:40 2016-01-01 01:24:59 1000 1499 2 3.5\n5: b 2016-01-01 01:25:00 2016-01-01 01:33:20 1500 2000 3.67 6.16\n6: b 2016-01-01 01:33:21 2016-01-01 01:50:00 2001 3000 3.33 5.33\n\n\nHere an extra row is added, since we have three different times. the data is divided into each row according to how much was in there in the original interval. For example DT$data1[5] is calculated as 1/2 * 4 + 1/3 * 5.\n\nI assume you could use foverlaps in data.table, but I don't really see how. Please help."
] | [
"r",
"data.table",
"intervals"
] |
[
"How Can I compare my own sorting algorithm to other ones?",
"I wrote a sorting algorithm and I have implemented it in C++.\nHow can I compare the speed and performance with other sorting algorithms?\nI have the time it takes to sort but I didn't find any resource that have the number of the numbers they tested (in other algorithm) and also the time!"
] | [
"c++",
"sorting"
] |
[
"Stateless Objects good practice or not",
"This is my understanding about stateless objects:Any object created from class that doesn't have class variables is a stateless object.\nMy question is when should we write stateless classes. Is it a good habit to have stateless objects."
] | [
"java",
"class",
"oop",
"object",
"stateless"
] |
[
"SDL apps don't run on other computers",
"I've just written an app in C++ using SDL 1.2.15 and SDL_image 1.2.12 libraries. It works on my computer but whenever I send *.exe to my friends (of course with all *.dll files from SDL libraries and images that program needs) they say that nothing happens (no message, no error, etc.). The content of the program doesn't matter as every SDL app written by me create such a problem.\n\nI'm working on Code::Blocks 10.05 on Windows XP (as my friends). Obviously I've sent the release version.\n\nI discovered that my program doesn't run in the compatibility mode with Windows NT and lower."
] | [
"c++",
"windows",
"sdl",
"codeblocks"
] |
[
"Umbraco :: Catching or Extending User Login",
"I am trying to catch the login event of Umbraco Users (login in the CMS).\n\nI have tried to extend from MembersMembershipProvider and override the ValidateUser method. I also changed the web.config to use my class.\nWhen i put a breakpoint in this overrited method it doesnt stop and logsin the user as usual.\n\npublic class CustomUmbracoMembershipProvider : Umbraco.Web.Security.Providers.UsersMembershipProvider\n{\n public override bool ValidateUser(string username, string password)\n {\n return base.ValidateUser(username, password);\n }\n}\n\n\nThanks in advance."
] | [
"asp.net",
"asp.net-membership",
"umbraco",
"umbraco7"
] |
[
"Graph API: An unknown error occurred while fetching fql multiquries",
"I have a problem using the PHP SDK:\n\n$fql=\"{'query1':'SELECT uid2 FROM friend WHERE uid1=me()',\n 'query2':'SELECT author_uid FROM checkin WHERE author_uid IN(SELECT uid2 FROM #query1) AND page_id = $page_id'}\";\n\n $friends= $facebook->api(array(\n 'method' => 'fql.multiquery',\n 'queries' => $fql,\n 'access_token' => $access_token\n ));\n\n\nAnd I use plenty page ids.\n\nWhen I ran this script in https://graph.facebook.com/fql/?access_token=AC&q=QUERIES\nIt works perfect.\n\nBut when I use the php-sdk, sometime it works but for some pages it returns me the error:\n\nFacebookApiException Object\n(\n [result:protected] => Array\n (\n [error_code] => 1\n [error_msg] => An unknown error occurred\n )\n\n [message:protected] => An unknown error occurred\n [string:Exception:private] => \n [code:protected] => 1\n [file:protected] => /APP_PATH/base_facebook.php\n [line:protected] => 1249\n [trace:Exception:private] => Array\n (\n [0] => Array\n (\n [file] => /APP_PATH/base_facebook.php\n [line] => 816\n [function] => throwAPIException\n [class] => BaseFacebook\n [type] => ->\n [args] => Array\n (\n [0] => Array\n (\n [error_code] => 1\n [error_msg] => An unknown error occurred\n )\n\n )\n\n )\n\n\nAnyone can help me please?\nI can't figure why I get this error....."
] | [
"facebook",
"facebook-graph-api",
"facebook-fql",
"fql.multiquery"
] |
[
"Converting *.raw to *.tiff",
"There was such a problem. Requires conversion of *.RAW files received the camera 4K NDVI CAMERA for GitUp G3.\n\nI use libraw.h, \nwhich contains dcraw.c. She works with the GitUp Git2 camera format. \n\nMy file she does not recognize it and deduces \n\n\n Unsupported file format or not RAW file\n\n\nI also tried the raw2dng utility, but also there is an \n\n\n Unsupported file format\n\n\nHelp please find a way to convert this *.RAW file. \n\nI attach the file (https://yadi.sk/d/sdHHY4jw3aj4Ga).\n\nThank you in advance!"
] | [
"c",
"dcraw",
"libraw"
] |
[
"HTML5 drag and drop element over div with Hammer.js drag events",
"TL;DR\n\nI want to use HTML5 drag and drop of an element to a container with drag Hammer.js events. However, there are conflicts.\n\nDetailed description:\n\nAs presented in the attached figure, I have two containers:\n\n\nLeft: container with draggable elements\nRight: container with Hammer.js events, namely drag, dragstart and dragend.\n\n\n\n\nI want to drag and drop elements from the left container to the right one.\nHowever, while dragging, when entering on the right container, the Hammer.js dragstart event is activated. After dropping the element, I apply the drag event on the right container. However, the Hammer.js drag event is activated and it considers the deltaX and deltaY from the previous dragstart event.\n\nHammer.js is being used with preventDefault: true:\n\nHammer(this.container, {preventDefault: true}).on('dragstart', function (event) { ... }\n\n\nI have already used event.preventDefault() and event.stopPropagation() on the dragstart of the draggable element, without success.\n\nI have also partially solved the problem. In the dragstart event of the Hammer.js container, I have added the following verification, in order to check if the source element and the target are the same. However, the drag in the right container only works on the second action, since the first one is ignored.\n\nif (event.gesture.startEvent.srcEvent.srcElement != event.gesture.target) {\n return false;\n}\n\n\nAny idea on how to prevent Hammer.js events while dragging elements using the HTML5 drag and drop API?\n\nI want to use flags as a last resort, since Hammer.js events should be developed by third-parties.\n\nThanks for your help."
] | [
"javascript",
"jquery",
"html",
"drag-and-drop",
"hammer.js"
] |
[
"Why doesn't pyserial write on Linux?",
"I've coded a simple script for Windows that works fine and I have adapted it to Linux (Ubuntu). The problem is that it doesn't read the byte sent.\n\nI tried all the different serial ports available according to the Arduino IDE but the problem persists.I also used \\n and \\r without success and different encodings.\n\nCode working on win10:\n\nimport serial\nimport time\nimport keyboard\narduino = serial.Serial('COM4', 9600, timeout=0)\n\nwhile True:\n arduino.write('a'.encode()) \n time.sleep(0.1)\n print(arduino.readline())\n\n\nCode not working on Ubuntu:\n\nimport serial, time\narduino = serial.Serial('/dev/ttyAMC0', 9600, timeout = 0)\nwhile True:\n arduino.write('a'.encode()) \n time.sleep(0.1)\n print(arduino.readline())\n\n\nSo the first script prints continuously a\\r\\n, the second doesn't. Simply shows b'' continuously. So I think it doesn't simply write the letter."
] | [
"python",
"arduino",
"pyserial"
] |
[
"How to activate RequestScope inside CompletableFuture (getting org.jboss.weld.context.ContextNotActiveException)",
"I'm developing a JEE Web Application (no Spring), and I'm getting this exception.\nclass org.jboss.weld.context.ContextNotActiveException,message=WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped\n\nFrom a JSF Backing bean I'm calling a method in an aplication scoped class, and this method executes asynchronously some\nCompletableFuture.runAsync(()-> methodInTransactionGoingToRepository()}\n\nHowever I'm getting that exception because it runs with no Request Context.\nI know I could isolate these calls in Rest APi and make some Async Posts, and it would work.\nBut the application is small, and not suitable to have other services.\nHow can I solve this. Is there a way to activate a Request Scope before calling methodInTransactionGoingToRepository();\nThanks in Advance."
] | [
"asynchronous",
"jakarta-ee",
"completable-future"
] |
[
"Adding server side rendering to an existing React site created with create-react-app",
"I've been building a site for a client using CRA(create-react-app) and react-router v4.2.0 and was unaware of the implications regarding google's SEO. When I index the page from Google Search Console, I get this:\n\n\nI found several similar issues which suggested adding 'babel-polyfill' to my entry point, but this only causes my root component to render in the console, not taking into account my react-router routes. I'm aware that CRA is not designed for SSR. I was hoping to find a workaround within CRA, or migrate gracefully to another library such as Next.js without having to rebuild the entire site. Let me know if any additional information is needed. Thanks for any suggestions."
] | [
"javascript",
"reactjs",
"create-react-app",
"server-side-rendering",
"nextjs"
] |
[
"Angularjs, how to reset directive variables when button clicked in controller?",
"First of all, I'm sorry to ask simple like below.\n\nI have no code to show you.\n\nMaybe this seems like a kind of rude question, but I expect somebody will give me some examples.\n\nI've succeeded to link directive and controller.\n\nI built modal like this link.\n\nAdd element dynamically by using Modal\n\nIn my original code, modal have a button to close itself.\n\nWhat I want is when I click this button, all variables related with directive to be initialized.\n\nBut I don't know how.\n\nHelp me please. Thanks in advance for any help."
] | [
"javascript",
"angularjs",
"angularjs-directive",
"angularjs-scope",
"angularjs-ng-model"
] |
[
"Python: Formatting file paths with a variable filename",
"I used r' in front of the string so that Python doesn't treat the backslashes as escape sequences.\ndf.to_excel(r'C:\\Users\\A\\Desktop\\Data\\file.xlsx', index = False) #exporting to excelfile named "file.xlsx"\n\nHowever, this time I need the filename to be a variable instead.\nI usually format it by using F-string but I can't combine the r' and f' together. It doesn't work\ndf.to_excel(r'f'C:\\Users\\A\\Desktop\\Data\\{filename}.xlsx'', index = False) \n\nHow can i solve this? Thanks"
] | [
"python"
] |
[
"Datatype class: H5T_FLOAT F0413 08:54:40.661201 17769 hdf5_data_layer.cpp:53] Check failed: hdf_blobs_[i] ->shape(0) == num (1 vs. 1024)",
"My data set is a HDF5 file consists of data with shape [129028,1,12,1024] and label of shape [129028,1,1,1].\nBut when I run solver.prototxt, I get the error message:\n\n\nI0413 08:54:34.689985 17769 hdf5.cpp:32] Datatype class: H5T_FLOAT\nF0413 08:54:40.661201 17769 hdf5_data_layer.cpp:53] Check failed: \nhdf_blobs_[i] -&gt;shape(0) == num (1 vs. 1024) \n*** Check failure stack trace: ***"
] | [
"neural-network",
"hdf5",
"deep-learning",
"caffe",
"matcaffe"
] |
[
"Some questions about using CComPtr (when use Release()? Can I return CComPtr?, ...)",
"I writing add-on for Internet Explorer(BHO) and I'm using CComPtr smart pointers. I wonder:\n\n\n When should I use CComPtr.Release() function? \n\n In this this link it's used to release \nbrowser object. Where else should I use it? In 'normal' use (with my own classes) I don't need it. Should I use it in this situation:\n I get document object using m_spWebBrowser->get_Document(&spDispDoc):\n \nvoid STDMETHODCALLTYPE CHelloWorldBHO::OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL)\n{\n // Query for the IWebBrowser2 interface.\n CComQIPtr spTempWebBrowser = pDisp;\n\n // Is this event associated with the top-level browser?\n if (spTempWebBrowser && m_spWebBrowser &&\n m_spWebBrowser.IsEqualObject(spTempWebBrowser))\n {\n // Get the current document object from browser...\n CComPtr spDispDoc;\n hr = m_spWebBrowser->get_Document(&spDispDoc);\n if (SUCCEEDED(hr))\n {\n // ...and query for an HTML document.\n CComQIPtr htmlDoc2 = spDispDoc;\n m_spHTMLDocument = spHTMLDoc;\n }\n }\n\n}\n\n\n Should I release spHTMLDocument in SetSite function like I do with m_spWebBrowser (like in link mentioned before)?\nCan I return CComPtr from a function safely?\nI mean like this:\n\nCComPtr getObjects(CComQIPtr<IHTMLDocument3> htmlDoc3)\n{\n CComPtr objects;\n hr = htmlDoc3->getElementsByTagName(CComBSTR(L\"object\"), &objects);\n if(SUCCEEDED(hr) && objects != NULL)\n {\n return objects;\n }\n return NULL;\n}\n\n\nShould I never use normal pointer?\nIn previous link RemoveImages private function is declared this way:\nvoid RemoveImages(IHTMLDocument2 *pDocument); \nbut invoked with smart pointer:\n\nCComQIPtr<IHTMLDocument2> spHTMLDoc = spDispDoc;\nif (spHTMLDoc != NULL)\n{\n // Finally, remove the images.\n RemoveImages(spHTMLDoc);\n}\n\nI would rather write it this way:\nvoid RemoveImages(CComPtr<IHTMLDocument2> document2);\nIs it better?"
] | [
"c++",
"com",
"smart-pointers",
"bho"
] |
[
"Collections from LINQ to SQL and the ability to filter",
"I have asked this question on more than one forums and it seems no one would even want to take a crak at it.\n\nMy problem is simple and i would guess everyone has run into it when using LINQ to SQL.\n\nIf your have a LINQ object called: Person and you would like to poulate a list box based on all of the people you have in your DB the task is simple:\n\nBindingListCollectionView view;\nview = (BindingListCollectionView)CollectionViewSource.GetDefault (dataContext.Persons);\n\n\nNow say you wish to have a text box over the list to filter the results. that\nwould not work since IBindingList interface implemented by the LINQ to SQL objects returns false on \"CanFilter\" property.\n\nWhat most people do is create an ObservebleCollection, the folloing is an example\nim sure most of you use.\n\nObservebleCollection<Person> col = new ObservebleCollection<Person>(dataContext.Persons.ToList());\nListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefault(col);\n\n\nSince this will return a ListCollectionView and not a BindingListCollectionView\nit will be filterbale and all is well with the world.\n\nHere comes the problem, say you have Multi levels of Forign key relations:\nPerson<---Alias<---Tickets\n\nand now you wish to have 3 list boxes binded when a person is selected the second list box will diplay only his Alias's and when an Alias is selected only it's Ticket's are shown, this is very simple with binding and syncronizing. the problem is if i want to add a textbox filter on tob of all of the listboxes ( say a person has over 1000 Aliases and i want to be able to filter them to choose 1 ).\n\nThe prvious solution of ObservebleCollection will not work since all the Person objects returned will have EntitySet objects for the forgin relation, and this will again return a none filterbale BindingListCollectionView and not a ListCollectionView.\n\nThe only way i found around this is to manually bulid an ObserverbleCollection based on the retunred Query this is tedious work and causes me to tie the BusnessObjects layer and the application Layer. also its very slow since you need to make many trips to the database...\n\nDoes anyone have a solution to this?\n\nThanks,\n Eric."
] | [
"linq",
"collections",
"filtering"
] |
[
"iOS Firebase UI Gives many errors",
"I get many errors when trying to build the project with (pod 'FirebaseUI', '~> 4.0') dependency. \n\nMy pod file looks something like this:\n\nplatform :ios, '9.0'\n\nuse_frameworks!\n\npod 'Firebase/Core'\n\npod 'Firebase/Database'\n\npod 'Firebase/Auth'\n\npod 'Firebase/Storage' \n\npod 'FirebaseUI', '~> 4.0' (This causes a lot of errors)\n\npod 'FirebaseUI/Google'\n\npod 'FirebaseUI/Facebook'\n\npod 'FirebaseUI/Twitter'\n\nSome of the errors are:\n\n\n /Users/Home/GoogleDrive/iOS/TheBolt/Pods/Target Support Files/nanopb/nanopb-umbrella.h:1:9: Could not build module 'UIKit'\n\n\nand\n\n\n /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:505:9: Unknown type name 'NSString'\n\n\nand\n\n\n /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:514:50: Missing '#include '; declaration of 'Protocol' must be imported from module 'ObjectiveC.runtime' before it is required\n\n\nI'm using Xcode 9 with swift 4. I tried to use swift 3.2 in build settings but the same errors still there."
] | [
"ios",
"swift",
"firebaseui"
] |
[
"KendoUI Grid Populate adjacent cell on selection from AutoComplete",
"I have an AutoComplete set up all working for one of the cells in my grid.\n\nHow do I select the next adjacent <td> or input so that I can populate it with a value I specify?\n\nI know the first thing I need to change is that the id needs to go on the input. So all it is, is just a case of selecting the next cell/input along.\n\nHere is my dropdown code:\n\nfunction partNumberScanner(container, options)\n{\n $('<input id=\"partEntry\" class=\"k-input k-textbox\" data-bind=\"value:' + options.field + '\"/>')\n .appendTo(container);\n $('#partEntry').kendoAutoComplete({\n dataTextField: \"idealForm\",\n dataValueField: \"Id\",\n dataSource: {\n serverFiltering: true,\n transport: {\n read: {\n url: ROOT+\"part/fetchParts\",\n type: \"POST\",\n dataType: \"json\"\n }\n },\n error: function(e) {\n alert(e.errorThrown+\"\\n\"+e.status+\"\\n\"+e.xhr.responseText) ;\n },\n schema: {\n id: \"id\",\n\n }\n },\n change: function(e)\n {\n\n },\n minLength: 5,\n filter: \"contains\",\n placeholder: \"Start typing...\",\n change: function(e) {\n selectedPart = this.value();\n alert(this.element[0].id)\n\n $(this).next('td').val(selectedPart);\n }\n });\n}"
] | [
"jquery",
"kendo-ui",
"kendo-grid"
] |
[
"Split 4 digit value into 3 integers",
"I'm trying to split a user entered 4 digit value (ex. 0123) into 3 integer values (ex. 0,1,23) and then do some calculations using the individual values. The way that I have it set up here is just for testing purposes to make sure that my math works. They user would enter 0123 and they should be broken up into int variables. (0, 1, and 23) and saved. Then they are put back together in the end after calculations are completed and given back to the user. I can't seem to quite figure out how to split the input into this pattern. Thanks!\n\n}"
] | [
"java"
] |
[
"How to change the text of a NativeScript label",
"I am new to NativeScript and I need to be able to change the text of a label. I am confused about how to do this and need help. How can I do this? Thanks in advance!"
] | [
"user-interface",
"label",
"nativescript"
] |
[
"Most computationally efficient algorithm to create square sub-matrices of 1's along the diagonal of a large matrix, given size specs of sub-matrices",
"Given a list of numbers, for example [2, 4, 1, 3], create a square matrix of dimension sum(list) x sum(list) , where along the diagonals , there are square matrices of the sizes specified by the list. In the case of [2, 4, 1, 3] , that would result in\n\n1 1 0 0 0 0 0 0 0 0\n1 1 0 0 0 0 0 0 0 0\n0 0 1 1 1 1 0 0 0 0\n0 0 1 1 1 1 0 0 0 0\n0 0 1 1 1 1 0 0 0 0\n0 0 1 1 1 1 0 0 0 0\n0 0 0 0 0 0 1 0 0 0\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n0 0 0 0 0 0 0 1 1 1\n\n\nThe method should generalize to any (positive) values in the list, and any length of list. \n\nWhat I came up so far:\n\nBrute force method: Create each sub matrix individually, and then concatenate all of them them. This becomes very inefficient of several of the size specifications are of size 1."
] | [
"python",
"numpy",
"matrix",
"scipy"
] |
[
"Conda ResolvePackageNotFound Error",
"I'm trying to run conda env create command in terminal, but I'm getting the following error: \n\n`(base) *******-MBP:Tensorflow-Bootcamp-master ******$ conda env create -f tfdl_env.yml\nSolving environment: failed\n\nResolvePackageNotFound:\n - libpng==1.6.30=vc14_1\n - six==1.10.0=py35_1\n - tk==8.5.18=vc14_0\n - openssl==1.0.2l=vc14_0\n - icu==57.1=vc14_0\n - wincertstore==0.2=py35_0\n - zlib==1.2.11=vc14_0\n - vs2015_runtime==14.0.25420=0\n - jpeg==9b=vc14_0\n - win_unicode_console==0.5=py35_0\n - qt==5.6.2=vc14_6`\n\n\nI've tried updating Conda, but that's not working. Do I need to manually install each of these packages? I tried manually installing zlib, but it didn't remove it from the list of packages. Thanks!"
] | [
"python",
"anaconda",
"conda"
] |
[
"PHP array values and strpos function",
"I have been using this piece of code to compare two values, I am getting the matched items exactly, The only problem is with non matched items.\n\n$filter1 = \"red,green,blue,yellow\"; \n$parts1 = explode(',', $filter1);\n\n$filter2 = \"red,green,blue\"; \n$parts2 = explode(',', $filter2);\n\nfor($i=0; $i< count($parts1); $i++)\n{\n for($j=0; $j< count($parts2); $j++)\n {\n if(strpos($parts1[$i],$parts2[$j]) !== false)\n {\n $match[] = $parts1[$i];\n }\n else\n {\n $nomatch[] = $parts2[$j];\n }\n }\n}\n\nprint_r($match);\necho \"<br>\";\nprint_r($nomatch);\n\n\nAnd what i am getting as result is \n\nArray ( [0] => red [1] => green [2] => blue ) \nArray ( [0] => green [1] => blue [2] => red [3] => blue [4] => red [5] => green [6] => \nred [7] => green [8] => blue )\n\n\nArray 1 is giving the exact matched values but array 2 is giving absurd results instead of yellow."
] | [
"php"
] |
[
"Publishing in facebook page as admin in v2.3 Javascript api",
"I try to post in fan page as admin but it does not work:\n\nit works but not as admin\n\n var wallPost = {\n access_token: token,\n message: 'asdasdasd'\n };\n FB.api('/xxxxx/feed', 'post', wallPost, function(response) {\n console.log(response);\n });\n\n\nThis has an error:\n\n FB.api('/' + page_id, {fields: 'access_token'}, function(resp) {\n if(resp.access_token) {\n FB.api('/' + page_id + '/feed',\n 'post',\n { message: \"I'm a Page!\", access_token: resp.access_token }\n ,function(response) {\n console.log(response);\n });\n }else{\n console.log(resp);\n }\n });\n\n\nthe error is:\n\"(#200) The user hasn't authorized the application to perform this action\"\n\nMy scope: 'manage_pages,publish_actions,read_stream,user_groups'"
] | [
"javascript",
"facebook",
"facebook-graph-api",
"facebook-javascript-sdk"
] |
[
"Moving ASP.NET project from TFS to GITHUB. Opening project says it is bound to source control on tfs server:",
"I moved my project from tfs to github using git-tfs and now when I open the project it gives a message stating it is under TFS Server Version Control.\n\nThe message Says\n\nTeam Foundation Server Version Control\n\nThe solution you are opening is bound to source control on the following Team \nFoundation Server: http://tfs:8080/tfs/defaultcollection. \nWould you like to contact this server to try to enable source control integration.\n\n\nI would really like to remove this myself and anyone else who opens the project does not get this message.\n\nThe code in tfs and github are still the same if that makes it easier to just redo the extract -> push to github process. Or even better are there a few files I can try modify or changes in the UI I can make?\n\nI seen one recommendation to go to \nFile -> Source Control -> Advanced -> Change Source Control\nbut everything is listed as not connected currently."
] | [
"visual-studio",
"git",
"tfs",
"github",
"visual-studio-2012"
] |
[
"Why can't I use .this in anonymous class?",
"I recently use this code, and realize that in anonymous class, I can't access the instance by .this, like this:\n\nSprite sprFace = new Sprite() {\n\n @Override\n protected void onManagedUpdate(float pSecondElapsed) {\n runOnUpdateThread(new Runnable() {\n\n @Override\n protected void run() { \n Sprite.this.getParent().detach(Sprite.this); // Here\n }});\n }\n\n};\n\n\nI know how to solve it (just declare a \"me\" variable), but I need to know why I can't use <Class>.this?"
] | [
"java",
"oop",
"anonymous",
"anonymous-class"
] |
[
"Parsing fields and values from an XML file using PHP",
"I am trying to find a way to get fields and values reading a file. The file is constructed similar to an XML so its like this..\n\n<tag field1=\"value1\" field2=\"value2\" field3=\"value3\" .... />\n<tag2 field5=\"value5\" field6=\"value6\" field7=\"value7\" ... />\n\n..\n<tagn .... />\n\n\nIf I only interested in only one specific tag (e.g. the first one), how can I easily get the fields and values from that line ?\n\nHere is what I have managed to do, but there may be an easier way since the file is XML constructed ?\n\nfunction string2KeyedArray($string, $delimiter = '\" ', $kv = '=') {\n if ($a = explode($delimiter, $string)) { // create parts separated by a \" + space\n foreach ($a as $s) { // each part\n// Removing the known tag name\n $s = str_replace(\"tag \",\"\",$s);\n//removing the starting < and the ending />\n $s = str_replace(\"<\",\"\",$s);\n $s = str_replace(\">\",\"\",$s);\n $s = str_replace(\"/\",\"\",$s);\n//removing the \" from the value\n $s = str_replace(\"\\\"\",\"\",$s);\n if (strpos($s,\"=\")) {\n if ($pos = strpos($s, $kv)) { // key/value delimiter\n $ka[trim(substr($s, 0, $pos))] = trim(substr($s, $pos + strlen($kv)));\n } else { // key delimiter not found\n $ka[] = trim($s);\n }\n }\n }\n return $ka;\n }\n}\n\n$string ='<tag field1=\"value1\" field2=\"value2\" field3=\"value3\" />'\n$fields = string2KeyedArray($string);\n\n\n//Which returns what I am looking for"
] | [
"php",
"xml"
] |
[
"python find matching strings in log file",
"I have two files which I am working with, one contains a list of user names.\n\n$cat user.txt\njohnsmith\nMikeSmith\n\n\n$cat logfile \nroot@host1 : /home/johnsmith\nroot@host2 : /home/johnsmith\nroot@host3 : /home/MikeSmith\n\n\nThe log logfile, contains a dump of different configs of systems across multiple hosts, it also includes home directory of users if any in following pattern.\n\nHow can I iterate through user.txt and find/match any/all lines which contains username."
] | [
"python-3.x"
] |
[
"What is \"Audio data\"",
"I am building a web game which is going to use tracks' preview from deezer API. To be able to get a preview URL I need to query Deezer API with the track's ID - e.g. http://developers.deezer.com/api/explorer?url=track/3135556\n\nSo in order to be able to query the API, I need to store tracks' IDs in the DB.\n\nHowever when I read http://developers.deezer.com/guidelines there's paragraph in the end:\n\nLocal Storage/Offline Storage policy\nImportant Local Storage/Offline Storage of audio data is strictly forbidden. If in some cases you need to optimize your application and store audio data, please contact Deezer.\n\nI am curios what to imagine under \"audio data\". Does storing track's id violate this restriction or is it fine?\n\nThanks."
] | [
"deezer"
] |
[
"JmsSerializer Encoding",
"jmsSerializer encode perisan(or arabic) characters.\n\n $serializer = $this->get('jms_serializer');\n dump('test');\n dump($serializer->serialize('test', 'json'));\n dump('تست');\n dump($serializer->serialize('تست', 'json')); // <<---\n die();\n\n\n\n\nHow can I prevent this behavior?"
] | [
"php",
"symfony",
"encoding",
"utf-8",
"jmsserializerbundle"
] |
[
"custom validation acces form components",
"I want to make a custom validation for angular2. This validation must access another component of the form. Is this possible?\n\nMy template\n\n<input type=\"tekst\" id=\"startDate\" name=\"startDate\" [(ngModel)]=\"model.startDate\" #startDate=\"ngModel\" >\n\n<input type=\"tekst\" id=\"endDate\" name=\"endDate\" [(ngModel)]=\"model.endDate\" #endDate=\"ngModel\" customValidator>\n\n\nMy validator\n\n...\n@Directive({\n selector: '[customValidator][ngModel][customValidator][formControl]',\n providers: [\n provide : NG_VALIDATORS,\n useExisting : forwardRef(() = > CustomValidator),\n Multi : true\n }]\n})\n\nexport class CustomValidator impelments Validator {\n constructor(){}\n\n validate(c : FormControl) : {[key : string] : any} {\n\n // HOW TO ACCESS startDate CONTROL HERE? OR ITS VALUE? OR THE MODEL\n }"
] | [
"angular",
"custom-validators"
] |
[
"How to know the line joining two points?",
"I have two points and I want to know the line which is joining them.\nI don't want to draw the line.\n\nI want to create a matrix with all the points which formed the line.\n\nIn the future, I want to solve if two points belong or not to a shape. And this is the first part.\n\nEDIT: Thanks to everyone!! I've solved my doubts!\nI have to apply the equation of the straight line!\n\nThanks again!"
] | [
"java",
"geometry"
] |
[
"Is it possible to manually edit data after a dropdown auto-populates the field?",
"I am the opposite of a code monkey, so please forgive me if this is a simple solution. I have searched and searched and though I've found possible code examples, cannot find any information on how to fix the issue.\nI've created a form-fillable PDF. I have fields that calculate based on inputs. I have a dropdown box that auto-populates some of the numbers (to add to the manual inputs). All of these work great!\nI thought I would get fancy and further fill some of my data in the form. This is where the problems get funky.\nI am setting the fields as shown, but those numbers can no longer be modified afterward.\n this.getField("RanksPsy").value = psy;\n this.getField("RanksBlade").value = blde;\n this.getField("RanksBrawl").value = brwl;\n this.getField("RanksCou").value = cou;\n this.getField("RanksDip").value = dip;\n\nI have buttons to increase/decrease the Ranks... fields, but the dropdown locks them and I'd like to avoid that if possible.\nIs there another way to set those fields without using this.getField?\nThank you."
] | [
"javascript",
"forms",
"pdf"
] |
[
"Converting Gridview to DataTable in VB.NET",
"I am using this function to create datatable from gridviews. It works fine with Gridviews with AutoGenerateColumns = False and have boundfields or template fileds. But if I use it with Gridviews with AutoGenerateColumn = True I only get back an empty DataTable. Seems Gridview viewstate has been lost or something. Gridview is binded on PageLoad with If Not IsPostback. I can't think of anything else to make it work. Hope someone can help me. \n\nThanks,\n\nPublic Shared Function GridviewToDataTable(gv As GridView) As DataTable\n\n Dim dt As New DataTable\n\n For Each col As DataControlField In gv.Columns\n dt.Columns.Add(col.HeaderText)\n Next\n\n For Each row As GridViewRow In gv.Rows\n Dim nrow As DataRow = dt.NewRow\n Dim z As Integer = 0\n For Each col As DataControlField In gv.Columns\n nrow(z) = row.Cells(z).Text.Replace(\"&nbsp;\", \"\")\n z += 1\n Next\n dt.Rows.Add(nrow)\n Next\n Return dt\n\nEnd Function"
] | [
"vb.net",
"gridview",
"datatable"
] |
[
"Cobertura with JavaScript",
"Has Cobertura been known to be used for code coverage in a JavaScript codebase? \nhttp://cobertura.github.io/cobertura/ says that it is for java codebase."
] | [
"javascript",
"code-coverage",
"cobertura"
] |
[
"Query about MySql behaviour",
"I would like to know about a behavior of MySql. Like,I need to search a piece of information from a table from Last one month records where I have records of several years in that table. In this regard What MySql will do?? Will MySql search in the whole table among the records of several years ?? \n\nThanks"
] | [
"mysql",
"database"
] |
[
"How to select an argument + argument choice and use both options together in a statement",
"Working with this argument:\n\ndef get_args(arglist):\n parser = argparse.ArgumentParser(\n formatter_class=argparse.RawDescriptionHelpFormatter,\n description=textwrap.dedent('''\n text '''))\n parser.add_argument('--add',\n default='',\n nargs='?',\n choices=['user', 'database'],\n help='Add user or database (default: %(default)s)')\n\n args = parser.parse_args(arglist) # Passing argument list into parse\n args_dict = vars(args) # Dictionary for args\n return args, args_dict # Return the parsed arguments\n\n\nI need to perform logic that will read which choice was made and go down a path of if statements based on that choice.\n\nHere is basically what I'm trying to do:\n\nif args.add+args.user:\n print(f\"do something to add user {args.add}\")\nif args.add+args.database:\n print(f\"do something to add database {args.add}\")\n\n\nI want this CLI script to know what the user is trying to add (for now, a user or a database).\n\nThe end goal is that the user will enter ./myscript.py --add user USERNAME to add a user."
] | [
"python",
"argparse"
] |
[
"Cache web view remote html and assets to serve locally",
"I'm using a web view inside a cordova app, for a hosted web app.\n\nMuch of the content for the cordova web app comes from the server - the shipped app has very little files held locally.\n\nI'd like to cache the response from page loads in the app, so that on subsequent requests, I can serve up the cached version.\n\nI've started looking at cordova-plugin-file and I've got something working that loads a remote URL and then saves that to the phone.. I can then navigate to that saved URL, and it does attempt to load it up, but that's just the start of it - I'd need to intercept and cache all the resources (js and styles) requested too, so that they'd be served up with the app, assuming the links are all relative. The more I look into this, the more effort it seems.\n\nIs there a simple way to do this in Cordova? \n\nEDIT\n\nI've looked at some suggestions which include:\n\n\nHTML5 appCache (cache manifest). But this isn't supported in Cordova any more\nNSUrlCache. This is iOS specific and I'm looking for something that will work on android and ios"
] | [
"android",
"ios",
"cordova",
"caching"
] |
[
"Get first table count which has been unioned into multiple tables",
"Here is a pseudo code what I want.\nI need to get count of fist union in following statement.\n\nSELECT * \nFROM Table1 \nUNION \nSELECT Cats.Id + (SELECT COUNT(*) FROM Fist_Union_Result), \n Cats.Name \nFROM Table2\n\n\nAny idea ?"
] | [
"sql",
"sql-server",
"visual-studio"
] |
[
"Check if incoming call was missed",
"I have a broadcast receiver registered for incoming call event states and I want to be sure that the idle incoming call was a Missed Call as oposed to a rejected call. For this I access to the CallLog provider to get the latest device call and I compare it's type with CallLog.Calls.MISSED_TYPE. The problem is that my receiver does this before the CallLog provider is updated with the last call that was received by the device... That is why I'm using Thread.sleep on the receiver, to make my receiver wait for the CallLog provider to be update before he queries it, as you can see below:\n\nprivate boolean isMissedCall(Context context){\n //previous state is a global var \n if(previousState != null && previousState.equals(RINGING)){\n\n //THIS IS UGLY!!\n try {\n Thread.sleep(2000);\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n\n String callType = android.provider.CallLog.Calls.TYPE;\n String callNew = android.provider.CallLog.Calls.NEW;\n String callDate = android.provider.CallLog.Calls.DATE;\n String[] strFields = { callType, callNew, callDate};\n\n String strOrder = callDate + \" DESC\";\n\n Cursor mCallCursor = context.getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, \n strFields, \n null, \n null, \n strOrder);\n\n if (mCallCursor.moveToFirst()) {\n if(mCallCursor.getInt(mCallCursor.getColumnIndex(callNew)) > 0) {\n return mCallCursor.getInt(mCallCursor.getColumnIndex(callType)) == CallLog.Calls.MISSED_TYPE;\n }\n }\n }\n return false;\n}\n\n\nI am not happy with the solution of having to put the thread on sleep, but I didnt find anywhere, so far, another solution for the problem. I feel that there must be a beeter way to do this so, I ask you for the best ways you know on how to get the most recent incoming call from the CallLog, on the onReceive method of a bradcast receiver. \n\nP.S: my min target Android sdk is 8.\n\nThanks in advance"
] | [
"java",
"android",
"calllog"
] |
[
"Is possible to use Primeng, Angular2 embedded in JSF without npm?",
"I want to use angular2 framework for frontend, so for UI part I want to use primeng but I don't know how npm works.\n\nTech info:\n\n\nMy IDE is eclipse/netbeans \nproject is going to be deployed on Wildfly8.0\n\n\nCan I mix JSF components with primeng?"
] | [
"angular",
"jsf",
"primeng"
] |
[
"Mysql Complex Select Query in 5 table",
"I have 5 table:\n\n\nmp3s\nalbums\nremixes\nusers\nlikes\n\n\nlikes table:\n\n╔════════╦══════════╦═════════╦═════════════╦═════════════════════╗\n║ id ║ user_id ║ type_id ║ target_id ║ like_date ║\n╠════════╬══════════╬═════════╬═════════════╬═════════════════════╣\n║ 1 ║ 1 ║ 1 ║ 1049 ║ 2016-05-23 19:50:41 ║\n╠════════╬══════════╬═════════╬═════════════╬═════════════════════╣\n║ 2 ║ 2 ║ 2 ║ 457 ║ 2016-01-09 19:50:42 ║\n╠════════╬══════════╬═════════╬═════════════╬═════════════════════╣\n║ 3 ║ 2 ║ 3 ║ 457 ║ 2016-01-09 19:50:42 ║\n╠════════╬══════════╬═════════╬═════════════╬═════════════════════╣\n║ 4 ║ 2 ║ 1 ║ 457 ║ 2016-01-09 19:50:42 ║\n╠════════╬══════════╬═════════╬═════════════╬═════════════════════╣\n║ 5 ║ 3 ║ 3 ║ 4955 ║ 2016-06-12 19:50:41 ║\n╚════════╩══════════╩═════════╩═════════════╩═════════════════════╝\n\n\ntype_id columns: \n\n\n1--> mp3s\n2--> albums\n3--> remixes\n\n\ni need this query like:\n\nselect col1, col2, col3\nfrom likes, mp3s, albums, remixes\n where likes.user_id == 2\n\n if (likes.type_id == 1)\n select col1, col2, col3\n from mp3s\n where likes.target_id == mp3s.id\n\n union\n\n if (likes.type_id == 2)\n select col1, col2, col3\n from albums\n where likes.target_id == albums.id\n\n union\n\n if (likes.type_id == 3)\n select col1, col2, col3\n from remixes\n where likes.target_id == remixes.id\n\n order by likes.like_date desc\n limit 0,20\n\n\nthanks."
] | [
"jquery",
"mysql",
"sql",
"database",
"mysqli"
] |
[
"Getting \"DebugType\" parameter is not supported by the \"XamlCTask\" task error on building my Xamarin ios project",
"I get these errors when building my Xamarin.ios project,\n\nThe \"XamlCTask\" task could not be initialized with its input parameters.\n\nand\n\nThe \"DebugType\" parameter is not supported by the \"XamlCTask\" task. Verify the parameter exists on the task, and it is a settable public instance property.\n\nHow can I fix this."
] | [
"xamarin",
"xamarin.ios",
"xamarin.android"
] |
[
"How to implement a dynamic rebuilding the size of the slider",
"Good afternoon , I wrote a simple jQuery plugin slider. I'm asking a question about how to implement a \" rubber \" of the slider. Data about the size of the slider are set and counted in the beginning and then simple flipping is used on both sides. How to implement a dynamic rebuilding the size of the slider.\n\njsfiddle\n\n<div class=\"sliderWrapper\">\n <div id=\"slider\">\n <div class=\"slider_left\"></div>\n <div class=\"slider_right\"></div>\n <ul class=\"sliderItemWrapper\">\n <li class=\"slider-item\">\n <a href=\"#\">\n <img src=\"assets/porsche.jpg\" alt=\"porsche-356\" class=\"slider-img\" />\n </a>\n </li>\n <li class=\"slider-item\">\n <a href=\"#\">\n <img src=\"assets/porsche.jpg\" alt=\"porsche-356\" class=\"slider-img\" />\n </a>\n </li>\n <li class=\"slider-item\">\n <a href=\"#\">\n <img src=\"assets/porsche.jpg\" alt=\"porsche-356\" class=\"slider-img\" />\n </a>\n </li>\n <li class=\"slider-item\">\n <a href=\"#\">\n <img src=\"assets/porsche.jpg\" alt=\"porsche-356\" class=\"slider-img\" />\n </a>\n </li>\n </ul>\n </div>\n</div>\n\n\njQuery\n\n(function($) {\n\n$.fn.slide = function() {\n var el = this,\n lengthSlides = $(this).find('.slider-item').length,\n widthSlide = $(this).find('.slider-item').width(),\n widthSlides = widthSlide * lengthSlides,\n currentSlide = 1;\n\n $(this).find('.sliderItemWrapper').width(widthSlides);\n\n var init = function() {\n var inter = setInterval(nextSlide, 3000);\n $(el).hover(function() {\n clearInterval(inter);\n }, function() {\n inter = setInterval(nextSlide, 3000);\n });\n $(el).find('.slider_left').click(prevSlide);\n $(el).find('.slider_right').click(nextSlide);\n }\n\n var nextSlide = function() {\n if ( currentSlide == lengthSlides ) \n currentSlide = 0;\n $(el).find('.sliderItemWrapper').animate({\n 'left': - (currentSlide * widthSlide)\n }, 700);\n currentSlide++;\n }\n\n var prevSlide = function() {\n currentSlide--;\n if ( currentSlide == 0 )\n currentSlide = lengthSlides;\n $(el).find('.sliderItemWrapper').animate({\n 'left': - ((currentSlide - 1) * widthSlide)\n }, 700);\n }\n\n init();\n};})(jQuery);"
] | [
"javascript",
"jquery",
"resize",
"slider",
"image-resizing"
] |
[
"How to append a 2d array with a 1d array in VB?",
"I'm having difficulties to find a way to add 1d array to a 2d array in VB. For example:\n\nDim arr(,) As Integer\narr = { {0, 1}, {2, 3}, {4, 5} }\narr{3} = {6, 7}\n'Now arr should be = { {0, 1}, {2, 3}, {4, 5}, {6, 7} }\n\n\nNote that the code above is just a demonstration on what I want to achieve, it doesn't work.\n\nI have been trying things suggested on forum such as:\n\n\nReDim Preserve\nArray.Resize\nMaking 2d loop to copy everysingle element to a new variable and add new element then ReDim it back to arr\n\n\nAll I tried, but they all doesn't seem to work. At the end of the day, I'm looking for a subroutine that could append an 2d array of unknown length for example:\n\nDim arr(,) As Integer\nappend(arr, {0, 1})\nappend(arr, {2, 3})\n'Now arr should be = {{0, 1}, {2, 3}}"
] | [
"arrays",
"vb.net",
"multidimensional-array",
"append"
] |
[
"How to get asp.net identity to pick up changes to claims from database?",
"I am using asp.net identity along with Identity Server 4 to log into my web site. The Identity code uses SQL server as its data store. When I add custom claims to the AspNetUserCliams table, log out and back in I do not see any of the values (old or new) in the ClaimsIdentity.Claims list. It does populate with a number of others that don't actually exist in that table:\n\n\n\nHow does one tell identity server to actually pull the associated claims from the table?\nI've tried this code, but it's only when the object is in memory, doesn't persist the new claim to the database:\nClaimsIdentity id = new ClaimsIdentity();\nid.AddClaim(new Claim("MyNewClaim", "bla"));\ncontext.HttpContext.User.AddIdentity(id);\n\nI've read a number of posts that talk about the elusive UserManager. However I'm not seeing anything inserted into the ServiceProvider that has the signature of UserManager<AspNetUser, Guid> or similar.\nI'm using Microsoft.AspNetCore.Identity.EntityFrameworkCore, I would expect that to provide at least enough of a UserManager to persist and retrieve the data and allow me to override everything as needed. Does such an implementation already exist or do I have to reinvent the wheel and create a UserManager?\nUpdate:\nAfter a lot of cussing and searching I was able to create the UserManager instance with the following code:\npublic UserManager<AspNetUser> UserManager\n{\n get\n {\n var store = new UserStore<AspNetUser, AspNetRole, AuthorizationDbContext, Guid, AspNetUserClaim, AspNetUserRole, AspNetUserLogin, AspNetUserToken, AspNetRoleClaim>(Context);\n \n var manager = new UserManager<AspNetUser>(\n store, \n null, \n new PasswordHasher<AspNetUser>(), \n new []{new UserValidator<AspNetUser>()},\n new IPasswordValidator<AspNetUser>[]{},\n new UpperInvariantLookupNormalizer(),\n new IdentityErrorDescriber(), \n null,\n NullLogger<UserManager<AspNetUser>>.Instance);\n\n return manager;\n }\n}\n\nThat allows me to update the datastore with the claim, but it's not being returned when I log in.\nUsing .Net Core 3.1, v3.10 of the Microsoft NuGet packages.\nMy Startup.cs has the following added:\n.AddOpenIdConnect("oidc", options =>\n{\n options.Authority = Configuration.GetSection("Authentication")["Authority"];\n options.ClientId = Configuration.GetSection("Authentication")["ClientId"];\n options.ClientSecret = Configuration.GetSection("Authentication")["Secret"];\n options.ResponseType = "code";\n options.SaveTokens = true;\n options.GetClaimsFromUserInfoEndpoint = true;\n options.ClaimActions.MapAll();\n options.Events.OnUserInformationReceived = async context =>\n {\n var mi = services.BuildServiceProvider().GetRequiredService<IModuleInfo>();\n mi.ClearLoggedInUsersCache();\n\n var userManager = services.BuildServiceProvider().GetRequiredService<UserManager<AspNetUser>>();\n var userName = context.User.RootElement.GetString("name");\n\n // Get the user object from the database.\n var currentUser = (\n from u in userManager.Users\n where u.NormalizedUserName == userName\n select u\n ).FirstOrDefault();\n\n // Get the claims defined in the database.\n var userClaims = await userManager.GetClaimsAsync(currentUser);\n\n // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-\n // Just need to figure out how to attach them to the user.\n // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-\n };\n\nSo now I can pull the claims using UserManager, but have no way to persist them to the user information to maintain across requests. Still missing a piece to the puzzle. But still seems odd that IdentityServer4 isn't returning the associated claims."
] | [
"asp.net-core-mvc",
"asp.net-identity"
] |
[
"Ember.js how does reopenClass work?",
"I don't really get the function of ember.js' reopenClass. I thought it added extra code to the Object's prototype, so all instances of that Object would get the functionality that was added in a non static way. It does not do this however. It looks like it only adds code that can be statically executed. For instance. I have this code:\n\nLogger = Ember.Object.extend({ \n log: function(thing) { \n console.log(thing + ' wassup'); \n }\n});\n\nvar logger = Logger.create();\nlogger.log(\"1, yo\")\n\nlogger.reopen({ \n log: function(name) { \n console.log(name + 'ghurt')\n }\n});\nlogger.log(\"2, yo\")\n\nLogger.reopenClass({ \n log: function(name) { \n console.log(name + 'fresh')\n }\n});\nlogger.log(\"3, yo\")\nLogger.log(\"4, yo\")\n\n\nIt outputs this:\n\n1, yo wassup\n2, yoghurt\n3, yoghurt\n4, yofresh\n\n\nWhat I expected was this:\n\n1, yo wassup\n2, yoghurt\n3, yofresh\n4, undefined (I think)\n\n\nSo my question is: What does reopenClass do and when do I use it?"
] | [
"ember.js"
] |
[
"Retrofit 2, parsing json, ignore wrong data type inside array",
"i'm trying to parse a response json from server. the data is an array of objects, but some times server send an boolean between items of array. like this:\n\n{\n \"msg_code\": 200,\n \"msg_type\": \"success\",\n \"msg_text\": \"success\",\n \"msg_data\": [\n {\n \"pid\": \"1234567\",\n \"time\": \"1459029423\",\n \"parent_pid\": \"0\"\n },\n false,\n {\n \"pid\": \"987654\",\n \"time\": \"1458997403\",\n \"parent_pid\": \"0\"\n }\n ]\n}\n\n\nas you can see there is a false between them. \n\nwhen i try to parse these the the converter reach the wrong data type and throw an exception like these:\n\ncom.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BOOLEAN at line 1 column 9988 path $.msg_data[12]\n\n\nso how can i skip this wrong datatype and continue to parse other elements?\n\nthis is my code for creating Retrofit client:\n\nHttpLoggingInterceptor logging = new HttpLoggingInterceptor();\n logging.setLevel(logLevel);\n\n OkHttpClient okHttpClient = new OkHttpClient.Builder()\n .addInterceptor(logging)\n .connectTimeout(60, TimeUnit.SECONDS)\n .writeTimeout(60, TimeUnit.SECONDS)\n .readTimeout(60, TimeUnit.SECONDS)\n .build();\n\n gooderApi = new Retrofit.Builder()\n .baseUrl(BASE_API_URL)\n .addCallAdapterFactory(RxJavaCallAdapterFactory.create())\n .addConverterFactory(GsonConverterFactory.create())\n .client(okHttpClient)\n .build()\n .create(ApiInterface.class);\n\n\ni searched alot and i know i must create a custom converter factory, but all the example are old and belongs to Retrofit < 2, and i don't know how to make them work for me.\n\nUpdate:\nsimilar question:\nGSON ignore elements with wrong type\n\ntnx in advance."
] | [
"android",
"json",
"gson",
"retrofit",
"retrofit2"
] |
[
"Problem with mysql query",
"How can I optimize this mysql query:\n\nSELECT * \nFROM messages \nWHERE toid='\".$mid.\"' \n AND fromid='\".$fid.\"' \n OR (toid='\".$fid.\"' AND fromid='\".$mid.\"') \n AND subject != 'something' \norder by id ASC LIMIT 0,5\n\n\nI need to get messages between users in one page. This query id taking to much time and server resources. Can it be done in some other way?\n\nThanks."
] | [
"php",
"mysql"
] |
[
"Import statement breaks in class-containing module when importing the class from different files",
"Here's my directory structure:\n\napp\n -Folder1\n -class-container.py\n -queries.py\n -script.py\n -Folder2\n -Folder3\n -main.py\n\n\nIn my class-container file I import the SQL queries from queries.py with from Folder1.queries import sql_queries\nWhen I import and use the class in main.py everything runs smoothly. But when I do the same from script.py I get a ModuleNotFoundError... no module named Folder1. I've tried relative imports and changing it to from queries import sql_queries but every time I change it, it breaks one or the other. Any insight would be valuable. Thanks!"
] | [
"python-3.x"
] |
[
"Update count column from data in another table",
"In my DB I have two tables Items(Id, ..., ToatlViews int) and ItemViews (id, ItemId, Timestamp)\n\nIn ItemViews table I store all views of an item as they come to the site. From time to time I want to call a stored procedure to update Items.ToatlViews field. I tried to do this SP using a cursor ... but the update statement is wrong. Can you help me to correct it? Can I do this without cursor?\n\nCREATE PROCEDURE UpdateItemsViews\nAS\nBEGIN\n -- SET NOCOUNT ON added to prevent extra result sets from\n -- interfering with SELECT statements.\n SET NOCOUNT ON;\n\n DECLARE @currentItemId int\n DECLARE @currentItemCursor CURSOR\n SET @currentItemCursor = CURSOR FOR SELECT Id FROM dbo.Items\n\n OPEN @currentItemCursor\n FETCH NEXT FROM @currentItemCursor INTO @currentItemId\n WHILE @@FETCH_STATUS = 0\n BEGIN\n Update dbo.Items set TotalViews = count(*) \n from dbo.ItemViews where ItemId=@currentItemId\n FETCH NEXT FROM @currentItemCursor INTO @currentItemId\n END \nEND\nGO"
] | [
"sql-server",
"stored-procedures"
] |
[
"How to print base64 Image coming from WebApi, in Angularjs?",
"I am going to print an Image (embeded as a property into an object), which retrieved from a WebApi.\n\nSo far, I could load the image and show it perfectly on my page like the following:\n\n<img ng-src=\"data:image/jpeg;base64,{{t.Image}}\"/>\n\n\nHowever the problem is I don't know how can I print this image?\n\nI have tried out the following listing but I am faced with crashed google chrome page.\n\n var img= window.open($scope.t.Image);\n img.print();\n\n\nQuestion is How can I print the Image?\n\nThis is my Object coming from WebApi:\n\n public class TestImage\n {\n public string Name { get; set; }\n public byte[] Image { get; set; }\n }\n\n\nand the following is how I call the Get method:\n\n $scope.getData = function (val) {\n return $http.get('http://localhost:2740/GetData', {\n params: {\n name: val\n }\n }).then(function (response) {\n $scope.t = response.data;\n return response.data;\n });\n };\n\n\n********UPDATED********\n\n$scope.imgName = \"myImage\";\n$scope.print = function () {\n\n var printContents = document.getElementById($scope.imgName);\n var popupWin = window.open('', '_blank', 'width=300,height=300');\n popupWin.document.open();\n popupWin.document.write('<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" /></head><body onload=\"window.print()\">' + printContents + '</html>');\n popupWin.document.close();\n}\n\n\n\n<img id=\"{{imgName}}\" ng-src=\"data:image/jpeg;base64,{{t.Image}}\" />"
] | [
"javascript",
"c#",
"angularjs",
"web-applications"
] |
[
"spring boot problems with aop and controller",
"when i use spring boot,the aop couldn't be effective with annotation controller , how can i best do it ?\n\n@Aspect\n@Component\n@Configuration\npublic class MethodStatisticsPointcutAspect {\n\n @Resource\n private CounterService counterService;\n\n // aop defined\n @Around(\"@annotation(com.xxx.xxx.metrics.annotation.MethodStatistics)\")\n private void around(ProceedingJoinPoint pjp) {\n // do sth\n }\n}\n\n\nmy controller defined like this:\n\n@RestController\n@RequestMapping(\"/usertest\")\npublic class UserTestController {\n\n @RequestMapping(\"/test\")\n @MethodStatistics\n String test() {\n // do sth\n }\n}\n\n\ni wish to use aop manager all the methods with annotation @MethodStatistics,but it couldn't work with @controller at all~"
] | [
"java",
"controller",
"spring-boot"
] |
[
"get hidden input value on click of button in reactive forms angular",
"I am trying to get values of hidden input which is added dynamically on click of insert more button.\n\nHere is stackblitz link: get hidden input value\n\nI tried to use patchValue() method on linkTo() function but no luck, I am getting empty string on click of Get Values button in console.\n\nin console:\n\nloginFromArr: Array[2]\n0: Object\nname: \"p1\"\npassword: \"p235\"\nselectedLinkTo: \"\"\n1: Object\nname: \"876548\"\npassword: \"43545t\"\nselectedLinkTo: \"\"\n\n\nhere selectedLinkTo value is empty."
] | [
"angular",
"typescript",
"angular-reactive-forms",
"angular-forms",
"hidden-field"
] |
[
"Are pysnmp examples updated?",
"I am trying yo run a pysnmp example, from the librarys repository. And the example is not working. I run the program and try the snmpget command that comes in the example but nothing happens, and if I run the snmp command snmpget -v2c -c public 127.0.0.1 1.3.6.5.1 I still don't get anything, only when I try snmpget -v2c -c public 127.0.0.1 1.3.6.5.1.0 I get an answer from the agent and it returns a NULL value instead of the line returned by the new default getValue function.\nThe only thing I can think of is that this example worked with a previous version of pysnmp.\nThank you very much for any guidance you can provide.\n"""\nImplementing scalar MIB objects\n+++++++++++++++++++++++++++++++\nListen and respond to SNMP GET/SET/GETNEXT/GETBULK queries with\nthe following options:\n* SNMPv2c\n* with SNMP community "public"\n* serving custom Managed Object Instance defined within this script\n* allow read access only to the subtree where the custom MIB object resides\n* over IPv4/UDP, listening at 127.0.0.1:161\nThe following Net-SNMP commands will walk this Agent:\n| $ snmpwalk -v2c -c public 127.0.0.1 .1.3.6\n"""#\nimport sys\nfrom pysnmp.entity import engine, config\nfrom pysnmp.entity.rfc3413 import cmdrsp, context\nfrom pysnmp.carrier.asyncore.dgram import udp\nfrom pysnmp.proto.api import v2c\n\n# Create SNMP engine\nsnmpEngine = engine.SnmpEngine()\n\n# Transport setup\n\n# UDP over IPv4\nconfig.addTransport(\n snmpEngine,\n udp.DOMAIN_NAME,\n udp.UdpTransport().openServerMode(('127.0.0.1', 161))\n)\n\n# SNMPv2c setup\n\n# SecurityName <-> CommunityName mapping.\nconfig.addV1System(snmpEngine, 'my-area', 'public')\n\n# Allow read MIB access for this user / securityModels at VACM\nconfig.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (1, 3, 6, 5))\n\n# Create an SNMP context\nsnmpContext = context.SnmpContext(snmpEngine)\n\n# --- create custom Managed Object Instance ---\n\nmibBuilder = snmpContext.getMibInstrum().getMibBuilder()\n\nMibScalar, MibScalarInstance = mibBuilder.importSymbols(\n 'SNMPv2-SMI', 'MibScalar', 'MibScalarInstance'\n)\n\n\nclass MyStaticMibScalarInstance(MibScalarInstance):\n # noinspection PyUnusedLocal,PyUnusedLocal\n def getValue(self, name, idx, **context):\n return self.getSyntax().clone(\n 'Python %s running on a %s platform' % (sys.version, sys.platform)\n )\n\n\nmibBuilder.exportSymbols(\n '__MY_MIB', MibScalar((1, 3, 6, 5, 1), v2c.OctetString()),\n MyStaticMibScalarInstance((1, 3, 6, 5, 1), (0,), v2c.OctetString())\n)\n\n# --- end of Managed Object Instance initialization ----\n\n# Register SNMP Applications at the SNMP engine for particular SNMP context\ncmdrsp.GetCommandResponder(snmpEngine, snmpContext)\ncmdrsp.NextCommandResponder(snmpEngine, snmpContext)\ncmdrsp.BulkCommandResponder(snmpEngine, snmpContext)\n\n# Register an imaginary never-ending job to keep I/O dispatcher running forever\nsnmpEngine.transportDispatcher.jobStarted(1)\n\n# Run I/O dispatcher which would receive queries and send responses\ntry:\n snmpEngine.transportDispatcher.runDispatcher()\n\nfinally:\n snmpEngine.transportDispatcher.closeDispatcher()"
] | [
"python",
"pysnmp"
] |
[
"Kill child process without killing parent",
"I am using os.system() to run a python program and am trying to log its output to the file. This works fine. \n\nos.system(\"myprogram.py -arg1 -arg2 > outputfile.txt\")\n#something here to kill/cleanup whatever is left from os.system()\n#read outputfile1.txt- this output file got all the data I needed from os.system()\n\n\nThe problem is that myprogram.py calls another python program which gives me the output i need but doesn't finish- I can even see the prompt become different as in the picture below\n\n\n\nIs there a way to kill the child process when I get to the next line of my program \nI tried using os.system(\"quit()\") and subprocess.popen(\"quit()\", shell=False) and that didn't do anything.\n\nI can't really use exit() because that just kills python all together.\n\nBtw this stalls \n\nf=subprocess.Popen(\"myprogram.py -arg1 > outputfile.txt\") and then \nf.communicate() #this just stalls because the child program does not end."
] | [
"python",
"windows"
] |
[
"SFINAE and partial class template specializations",
"I have been using SFINAE-based approaches for quite some time, especially to enable/disable specific class template specializations via std::enable_if.\n\nI was thus a bit puzzled while reading the paper describing the proposed void_t alias / detection idiom:\n\nhttp://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf\n\nSection 4 is devoted to the discussion of the validity of the idiom, and refers to a discussion in which two parties argue about the applicability of SFINAE in partial class template specializations (with Richard Smith pointing out that the standard is lacking wording about this topic). Towards the end of the section, the following CWG issue is mentioned\n\nhttp://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2054\n\nHere again it is stated that the standard does not explicitly allows the example reproduced in the issue.\n\nI am a bit baffled because it seems to me that, e.g., the usage of enable_if in partial specializations has been standard practice for quite some time (see for instance the Boost documentation, which explicitly mentions partial specializations).\n\nAm I misunderstanding the points in the documents above or is this really a grey area?"
] | [
"c++",
"templates",
"c++11",
"c++14"
] |
[
"Calculate Monthly Average per Category",
"Is it possible to use a calculated field in Google Data Studio to return monthly average values for specific categories? I can't find an elegant solution for calculating averages. \n\nFor example if the data studio doc was a monthly budget dashboard, could data studio calculate the average spent per month per category over a given time period. It could be the average spent per month for last year or year to date. I can't figure out a formula within GDS that can handle this."
] | [
"google-data-studio"
] |
[
"Joomfish translation issues",
"I have been working on a site which is bilingual(Eng/Arb).......english part is done and perfect and when iam using joomfish component to translate it in arabic im having issue like\n\nwhen i go like joomfish - > translation - > languages - > selected arb - > content elements - > content - > and when i select an article or topic it is not displaying the original english text to be translated in arabic.....and i know this is not correct coz i have done this kind of translation before where always there is orginal english text which has to be translated and a text editor below to do it in arabic.......but not getting why it is not showing like this on the site which im working on right now and i dont know what iam missing here.....\n\nany help/advise is highly appreciated..."
] | [
"joomla",
"translation",
"arabic",
"joomfish"
] |
[
"Contextual help in Xcode not showing",
"I'm trying to use 'Option-click' to see inline documentation in xcode. Here's what I get when I Option-click 'hasPrefix()':\n\n\n\nHere's what I'm supposed to get:\n\n\n\nHow to fix? I've tried installing the command line tools from dev.apple site.\n\nxcode 10.0 / swift 4"
] | [
"swift",
"xcode",
"documentation"
] |
[
"Plot stacked bar chart of likert variables in R",
"lets say I have a data frame that looks like this:\n P Q1 Q2 ...\n 1 1 4 1\n 2 2 3 4\n 3 1 1 4\n\nwhere the columns tell me which person answered which of the questions q1, q2, ... accordingly. Those questions require an answer on a 4 point likert scale (e.g. "approve" means 1, "slightly approve" means 2 and so on). How do I plot e.g. both question results in a stacked bar plot (in %)?\nIt should look somewhat like this.\nAll I find online is very complex code I can't handle or fail to understand ... Isn't there just a simple function that does what I want?\nThank you!"
] | [
"r",
"ggplot2",
"bar-chart",
"stacked-chart",
"likert"
] |
[
"how to calculate mean/median per group in a dataframe in r",
"I have a dataframe recording how much money a costomer spend in detail like the following:\n\ncustid, value\n1, 1\n1, 3\n1, 2\n1, 5\n1, 4\n1, 1\n2, 1\n2, 10\n3, 1\n3, 2\n3, 5\n\n\nHow to calcuate the charicteristics using mean,max,median,std, etc like the following? Use some apply function? And how?\n\ncustid, mean, max,min,median,std\n1, ....\n2,....\n3,...."
] | [
"r",
"mean",
"median"
] |
[
"PowerShell Task Scheduler job failed to start. Additional Data: Error Value: 2147944187",
"Registered a PowerShell Scheduled job using the following script:\n\nenter $T = New-JobTrigger -Daily -AT \"04:00 AM\" here\nenter Register-ScheduledJob -Name JobName -FilePath C:\\Jobs\\myScript.ps1 -Trigger $T here\n\n\nWhen I try to Run this job using Windows Task Scheduler I get the following issue:\n\nTask Scheduler failed to start \"\\Microsoft\\Windows\\PowerShell\\ScheduledJobs\\JobName\" task for user \"myUser\". Additional Data: Error Value: 2147944187.\n\nThere is a pretty the same issue Task Scheduler failed to start. Additional Data: Error Value: 2147943726 but with different Error Value ID. Anyway, I tried all suggestions from there but no results.\n\nSome more details:\n\n\nCurrent user is not an Administator\nI've check the box Run with highest privileges\nMachine - Windows Server 2012\n\n\nAny ideas how I can resolve this issue?"
] | [
"powershell",
"scheduled-tasks"
] |
[
"Adding Three20 to my project on Xcode",
"I've try to add the Three20 library to my project in manual mode how described in this link\n\nenter link description here\n\nWell at the point 4. I can't find the \"Details\" table for add the libThree20.a and libThree20Core.a\n\nAt the point 5 I can't find the \"Targets\" section of the sidebar.\n\nMaybe the SDK XCODE 4.2.1 Framework is different.\n\nHow Can I add the Three20 library to a my project under XCODE 4.2.1???"
] | [
"xcode4.2",
"three20"
] |
[
"Alternate to non-trivial \"> child\" sub-selection in jquery",
"The official documentation for the child selector ('>') states the following: \n\n\n Note: The $(\"> elem\", context) selector will be deprecated in a future release. Its usage is thus discouraged in lieu of using alternative selectors.\n\n\nI currently have a selector of the form $(\"> thead th:eq(\" + columnIndex + \")\", context). What alternative syntax is suggested?\n\nI'm aware of the .children() method, which could select the thead element, but would require additional selections afterwards. Multiple selection steps seem less efficient than a single selector."
] | [
"jquery",
"jquery-selectors",
"deprecated"
] |
[
"GLib: propagate warning errors through UI",
"I'm making a framework in ANSI C using GLib. The GError struct provides a nice method to manage errors, but I would like to modify my print_error macro, to propagate the error, for example, to the UI.\n\n'print_error' macro is the following one:\n\n#define print_error( error ) \\\ng_assert(error != NULL); \\\ng_warning(\"%s\", error->message); \\\ng_error_free(error);\n\n\nHow can I modify it for my purpose?"
] | [
"c",
"user-interface",
"error-handling",
"glib"
] |
[
"Create Custom touch action for Navigation drawer in android",
"Navigation drawer in android has 3 behaviors\n\n - Always opened, and can be close only programming using LOCK_MODE_LOCKED_OPEN.\n - Always closed, and can be open only programming LOCK_MODE_LOCKED_CLOSED.\n - User can open and close the drawer. using LOCK_MODE_UNLOCKED\n\n\nThe third one will be closed automatically if user click out side the drawer when it is open. While the first one will remain always open.\n\nI need to have custom one that user can open and close the drawer, and when he clicks outside the drawer it will remains open. \n\n\nI was thinking for overriding onInterceptTouchEvent.\n\nAny one did something similer?\n\n/*********ADED***********\nI extended the DrawerLayout , and it works not sure yet if 100% \n\npublic class CustomDrawerLayout extends DrawerLayout {\n Context ccontext;\n public CustomDrawerLayout(Context context) {\n this(context, null);\n }\n\npublic CustomDrawerLayout(Context context, AttributeSet attrs) {\n this(context, attrs, 0);\n}\n\npublic CustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {\n super(context,attrs,defStyle);\n this.ccontext = context;\n}\n\n//@Override\npublic boolean onTouchEvent(MotionEvent ev) {\n final int action = ev.getAction();\n\n\n switch (action & MotionEventCompat.ACTION_MASK) {\n\n\n case MotionEvent.ACTION_UP: {\n final float x = ev.getX();\n final float y = ev.getY();\n boolean peekingOnly = true;\n final View touchedView = findTopChildUnder((int) x, (int) y);\n if (touchedView != null && touchedView instanceof FrameLayout) {\n return true;\n }\n break;\n }\n }\n return super.onTouchEvent(ev);\n\n}\n\npublic View findTopChildUnder(int x, int y) {\n final int childCount = this.getChildCount();\n for (int i = childCount - 1; i >= 0; i--) {\n final View child = this.getChildAt(i);\n if (x >= child.getLeft() && x < child.getRight() &&\n y >= child.getTop() && y < child.getBottom()) {\n return child;\n }\n }\n return null;\n}\n}"
] | [
"android",
"navigation-drawer"
] |
[
"lang attribute Vs meta tags charset attribute",
"The w3c points out the use of lang attribute as\n\n\n Assisting search engines\n \n Assisting speech synthesizers\n \n Helping a user agent select glyph variants for high quality typography\n \n Helping a user agent choose a set of quotation marks\n \n Helping a user agent make decisions about hyphenation, ligatures, and\n spacing\n \n Assisting spell checkers and grammar checkers\n\n\nBut I found nothing useful for charset attribute of meta tag except for encoding the document\n\nDo charset provide the same functionality as the lang attribute such as assisting speech synthesizers,search engines......."
] | [
"html",
"character-encoding",
"web"
] |
[
"How to use cookie in Zend Framework 2?",
"I cant understand how to use cookies in ZF2? Can some one advise some links with set and get cookie?"
] | [
"zend-framework2",
"httpcookie"
] |
[
"check/log network utilization(shown in task manager) for remote systems",
"I have created a python script which runs a LanPort test on a group of systems for a specified number of hours. \n\nNow for me the problem is that I need to log the Network Utilization % which can be seen by clicking on networkork tab of Task manager for all these systems. Is there any way of getting this done in python? If not , is there any other tool which allows me to open the task manager of remote systems such that I can monitor the performance from my management station.\n\nAny kind of hep is really appreciated.\n\nThank You!!\n\nAshu"
] | [
"python",
"networking",
"lan",
"taskmanager"
] |
[
"Delete row from table and sqlite database",
"I still need your help.\nI have this piece of code that doesn't want to work.\n\n-(void)tableView:(UITableView *)_tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {\n\nif (editingStyle == UITableViewCellEditingStyleDelete) {\n\n NSDictionary *rowVals = (NSDictionary *) [shoppingListItems objectAtIndex:indexPath.row];\n NSString *keyValue = (NSString *) [rowVals objectForKey:@\"key\"];\n\n [tableView beginUpdates];\n\n sqlite3 *db;\n int dbrc; //Codice di ritorno del database (database return code)\n DatabaseShoppingListAppDelegate *appDelegate = (DatabaseShoppingListAppDelegate*) [UIApplication sharedApplication].delegate;\n const char *dbFilePathUTF8 = [appDelegate.dbFilePath UTF8String];\n dbrc = sqlite3_open(dbFilePathUTF8, &db);\n if (dbrc) {\n NSLog(@\"Impossibile aprire il Database!\");\n return;\n }\n\n sqlite3_stmt *dbps; //Istruzione di preparazione del database\n\n NSString *deleteStatementsNS = [NSString stringWithFormat: @\"DELETE FROM \\\"shoppinglist\\\" WHERE key='%@'\", keyValue];\n const char *deleteStatement = [deleteStatementsNS UTF8String];\n dbrc = sqlite3_prepare_v2(db, deleteStatement, -1, &dbps, NULL);\n dbrc = sqlite3_step(dbps);\n\n\n //faccio pulizia rilasciando i database\n sqlite3_finalize(dbps);\n sqlite3_close(db);\n\n [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];\n [shoppingListItems removeObjectAtIndex:indexPath.row];\n [tableView reloadData];\n\n [tableView endUpdates];\n}\n}\n\n\nActually, it's working fine. I can swipe to a row in the table, delete it, i have my fade effect, the content is removed from the database and from the table.\nBut if I try to remove another element just after the first one I have a SIGABRT on\n\n [shoppingListItems removeObjectAtIndex:indexPath.row];\n\n\nIf I move to another tab, go back and remove a row, everything works fine... \nAny ideas?"
] | [
"iphone",
"objective-c",
"xcode",
"sqlite",
"tableview"
] |
[
"Ruby on Rails: Child Class Gives Parent Class values when child class is created",
"I am basically looking for the opposite of this:\n\nRuby on Rails: Building a child with default values when its parent is created\n\nBut I have not been able to find anything on stack overflow or the documentation to assist me with this.\n\n class GeneralError < Details\n #ASSOCIATIONS\n belongs_to :type\n belongs_to :error_log\n has_one :exception\n\n after_create :create_error_log\n\n def create_error_log\n self.error_log = ErrorLog.new(store_proc: \"Columbia::GeneralError.log\", type_id: 1, summary: \"A general error was logged at: '#{Time.now}\")\n save\n end\nend\n\n\nSo general_errors belongs_to error_log. ErrorLog is also GeneralErrors header table in my database. \n\n\nErrorLog has a column called summary, where I would like to pass in a\nshort description of the error that happened.\nGeneralErrors I have a column named description, where I would like to pass in a longer description of what happened. Ultimately I would like to be able to call GeneralError.new() and pass in both summary AND description.\n\n\nAs of right now, with the code I listed above, I have been able to give ErrorLog default values every time I create a GeneralError. However, those values are hardcoded and not dynamic at all. What's the best, most dry way, to accomplish my task?"
] | [
"ruby-on-rails",
"ruby",
"parent-child",
"belongs-to"
] |
[
"C# print pdf file in wpf application programatically",
"I have a WPF application and I want to be able to print PDF document, but I don't want use the Adobe Reader (because I don't know if on client machine adobe was installed). Is there another way to print pdf in different manner programmatically in C#."
] | [
"wpf",
"pdf"
] |
[
"Nested struct viewer for Linux Kernel",
"I am in the process of tackling the Linux Kernel learning curve and trying to get my head round the information stored in nested struct specifically to resolve a ALSA driver issue.\n\nHence, I am spending a lot of my time in the source code tracing through structures that have pointers to other structures that in turn have pointers to yet other structures...by which time my head has become so full that I start to loose track of the big picture!\n\nCan anybody point me at either a tool or a website (along the lines of the highly usful Linux Cross Reference http://lxr.linux.no/) that will allow me to, ideally graphically, expand down through the nested struct of the source code?\n\nAt the moment we are developing for an Embedded PowerPC in Eclipse CDT version 4.0 but wouldn't be opposed to switching tool chains.\n\nRegards \n\nKermitG"
] | [
"linux",
"eclipse",
"ide",
"data-structures",
"linux-kernel"
] |
[
"cannot convert from 'string' to 'string[]' when using In clause with linq",
"This is the query i tried but above error is coming.\nb is a comma seperated list. image shows the output of b.\nvar CheckInHand = from item in PaymentList\n where item.Id.In(b) \n select item.TotalAmt;\n\n[image is the comma seperated list which is b]\n[1]: https://i.stack.imgur.com/Y39bd.png"
] | [
"c#",
"linq",
"select",
"where-clause",
"in-clause"
] |
[
"How to create custom folders inside WordPress uploads folder without any plugins?",
"I want to create custom folders without using any plugins. I go to "wp-content/uploads" and create a new folder inside, but it doesn't appear online. How do I make it appear? Thanks."
] | [
"wordpress",
"media-library"
] |
[
"How to connect two view controllers to one button in storyboard?",
"Up to now, there is a button in a view controller (let's call it Main View Controller). What I want is: if it satisfies a certain condition, when I press the button, the segue would lead to View Controller A; if not, when I press the button, it would lead to View Controller B.\nBut it seems that one button can only have one segue from it, so I wonder whether what I want is possible to be achieved in storyboard???\nThanks in advance!!!\n\nIf this question is too basic for you, I am so sorry. I am still a very starter in iOS programming."
] | [
"ios",
"objective-c",
"storyboard"
] |
[
"Nodejs can't establish a connection to the server at ws:// apache proxy",
"I am trying to configure my nodejs application to run on localhost with a domain name.\n\nSo my website on local is http://app.local which points to http://localhost/app\n\nNow I have an app on nodejs which runs on 6060 port http://localhost:6060\n\nI am trying to configure localhost:6060 to work on http://app.local/nodejs\n\nHere's my apache config file.\n\n <VirtualHost app.local>\n ServerAdmin [email protected]\n ServerName app.local\n ServerAlias app.local\n\n DocumentRoot /var/www/app\n\n ProxyPass /service http://localhost:3000\n ProxyPassReverse /service/ http://localhost:3000/\n\n ProxyPass /nodejs http://localhost:6060\n ProxyPassReverse /nodejs/ http://localhost:6060/\n\n ProxyPass /nodejs ws://localhost:6060\n ProxyPassReverse /nodejs/ ws://localhost:6060/\n\n <Directory >\n Options FollowSymLinks\n AllowOverride None\n </Directory>\n\n <Directory /var/www/app>\n Options Indexes FollowSymLinks MultiViews\n AllowOverride All\n Order allow,deny\n allow from all\n </Directory>\n\n ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/\n <Directory \"/usr/lib/cgi-bin\">\n AllowOverride None\n Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n Order allow,deny\n Allow from all\n </Directory>\n\n ErrorLog ${APACHE_LOG_DIR}/error.log\n\n # Possible values include: debug, info, notice, warn, error, crit,\n # alert, emerg.\n LogLevel warn\n\n CustomLog ${APACHE_LOG_DIR}/access.log combined\n\n Alias /doc/ \"/usr/share/doc/\"\n <Directory \"/usr/share/doc/\">\n Options Indexes MultiViews FollowSymLinks\n AllowOverride None\n Order deny,allow\n Deny from all\n Allow from 127.0.0.0/255.0.0.0 ::1/128\n </Directory>\n\n\n</VirtualHost>\n\n\nMy javascript code listen emits:\n\nvar socket = io.connect('http://app.local/', {path:'/nodejs/socket.io/', port: 6060});\nsocket.on('connect', function(){\n console.log(\"Connected\");\n});\n\n\nWhen I try to run the app through this URL http://app.local/nodejs, it throws following error:\n\nFirefox can't establish a connection to the server at ws://app.local/nodejs/socket.io/?EIO=3&transport=websocket&sid=NQ2LSn--THwZkrStAAAH.\n\nI followed this question but still not working.\n\nI am using Apache/2.4.7 (Ubuntu)"
] | [
"node.js",
"apache2"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.