texts
sequence | tags
sequence |
---|---|
[
"Should the vCard microformat property 'country-name' be in the language of the website?",
"I have following code on my website:\n\n<address class=\"vcard\">\n <span class=\"fn org\"></span><br>\n <span class=\"adr\"><br>\n <span class=\"street-address\"></span><br>\n <span class=\"locality\"></span>, <span class=\"region\"></span><br>\n <span class=\"postal-code\"></span><br>\n <span class=\"country-name\">Nederland</span><br>\n </span><br>\n</address>\n\n\nAs you can see the country-name contains Nederland which is Dutch for the Netherlands. Should this always be specified in the language of the website, for search engines to recognize? Or is this only readable in English?\n\nBecause it displays on the site it should be in the language of the website, but I am questioning whether or not this is effective to SEO."
] | [
"html",
"localization",
"seo",
"microformats",
"hcard"
] |
[
"Devexpress Gridview Row command Error when Filtering Enabled",
"I am using devexpress 9.1.\n\nI have devexpress gridview binded to datasource. have set a page size=\"20\".\nEnabled Settings ShowFilterRow=\"true\";\n\nI have column with asp image button setting its command arguments to a value.\n\nBelow is the code\n\n <dxwgv:ASPxGridView ID=\"ASPxGridView2\" runat=\"server\" DataSourceID=\"sds_addingredients\" \n AutoGenerateColumns=\"False\" KeyFieldName=\"Ingredients_Id\" ClientInstanceName=\"grid2\">\n <Settings ShowFilterRow=\"true\" />\n <SettingsPager PageSize=\"20\"></SettingsPager>\n <Columns>\n <dxwgv:GridViewDataTextColumn Caption=\"S.No\" VisibleIndex=\"0\" >\n <DataItemTemplate>\n <%#Container.ItemIndex +1 %> \n </DataItemTemplate>\n </dxwgv:GridViewDataTextColumn>\n <dxwgv:GridViewDataTextColumn VisibleIndex=\"1\" Caption=\" \">\n <DataItemTemplate>\n <asp:ImageButton ID=\"btn_edit\" runat=\"server\" CommandArgument='<%# Eval(\"Ingredients_Id\") %>' Height=\"15px\" \n ImageUrl=\"~/images/document_edit.png\" ToolTip=\"Edit\" \n Width=\"15px\" />\n </DataItemTemplate>\n </dxwgv:GridViewDataTextColumn>\n <dxwgv:GridViewDataTextColumn VisibleIndex=\"1\" FieldName=\"Ingredients_Id\" \n ReadOnly=\"True\" Visible=\"False\">\n <EditFormSettings Visible=\"False\" />\n </dxwgv:GridViewDataTextColumn>\n <dxwgv:GridViewDataTextColumn Caption=\"Ingredient\" FieldName=\"Ingredients_Name\" VisibleIndex=\"2\" Settings-ShowFilterRowMenu=\"True\" > \n </dxwgv:GridViewDataTextColumn>\n\n </Columns>\n\n\nBelow show server side code\n\n protected void ASPxGridView2_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e)\n { string id = e.CommandArgs.CommandArgument.ToString();//perform certain opertation based on the id}\n\n\nThe above method works properly but when i filter the result and click certain row, the Id received in the server end seems to be different not corresponding to what i clicked . i feel it gets the wrong row index...\nthis happens only when i try filtering and perform row command click.\nOther wise it works properly. why is this."
] | [
"asp.net",
"devexpress"
] |
[
"Adding a picture to the MEAN.JS sample with Angular-file-upload",
"I am using MEAN.JS (https://github.com/meanjs/mean) and angular-file-upload (https://github.com/danialfarid/angular-file-upload). \n\nThe \"Article\" sample provided by MEAN.JS contains two fields named \"title\" and \"content\". I want to modify that and add a \"picture\" field allowing a user to upload a picture.\n\nI understand that I have to modify 3 files in MEAN.JS:\n\n~myproject/app/models/article.server.model.js \n~myproject/public/modules/articles/controllers/articles.client.controller.js\n~myproject/public/modules/articles/views/create-article.client.view.html\n\n\nHowever, I can not modify them successfully."
] | [
"meanjs",
"angular-file-upload"
] |
[
"programming wrt cloud computing",
"I have been wondering over this question for a while. I have read up stuff about cloud computing(and there has been an unusual hype these days). I have understood the theory behind, how using a cloud can help me use my resources efficiently and blah blah blah. So my question is how to use(if we can) this technology in our programs? For example, with multi-core processors dominating the market, we know our programs should support multithreading(and probably should not crash when porting from single-threaded processor to multi-threaded one). So Is there any such programming paradigm we should be following or is the cloud concept completely aloof from our programs written in object-oriented and procedural languages??"
] | [
"cloud"
] |
[
"Powershell: How can I pass a variable as a parameter value?",
"I have code that prompts a user for input for $dom.\n\n$dom = \"'DC=my,DC=com'\"\n\nGet-QADUser -SearchRoot $dom -SearchScope 'SubTree' -objectattributes @{\"EmployeeID\"=$eid} | \nSelect-Object SamAccountName, employeeID, DisplayName, Description, Email, LastLogon, legacyExchangeDN\n\n\nI get the following error when I run this.\n\n\n Get-QADUser : A referral was returned from the server.\n \n At C:\\My Scripts\\get-user_by using eid.ps1:62 char:12\n + Get-QADUser <<<< -SearchRoot:$dom -SearchScope 'SubTree' -objectattributes @\n {\"EmployeeID\"=$eid} | \n + CategoryInfo : NotSpecified: (:) [Get-QADUser], COMException\n + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Ques \n t.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet"
] | [
"powershell",
"parameter-passing"
] |
[
"BackupManagerService restoration timeout leads to force stop",
"Since yesterday, my Nexus 5 is running Lollipop and the application I am working on is stopping without any crash.\n\nEach time it exits, the device logs the following:\n\n11-20 00:23:32.679: I/ActivityManager(723): START u0 {flg=0x14008000 cmp=com.mycompany.android/.app.LoginActivity} from uid 10549 on display 0\n11-20 00:23:32.713: W/ActivityManager(723): Duplicate finish request for ActivityRecord{2cd672e4 u0 com.mycompany.android/.app.StartupActivity t39 f}\n11-20 00:23:32.926: I/ActivityManager(723): Displayed com.mycompany.android/.app.LoginActivity: +223ms\n11-20 00:23:45.734: I/ActivityManager(723): Force stopping com.mycompany.android appid=10549 user=-1: uninstall pkg\n11-20 00:23:45.734: I/ActivityManager(723): Killing 24090:com.mycompany.android/u0a549 (adj 0): stop com.mycompany.android\n11-20 00:23:45.793: W/ActivityManager(723): Force removing ActivityRecord{5367f0c u0 com.mycompany.android/.app.LoginActivity t39}: app died, no saved state\n11-20 00:23:45.846: W/ActivityManager(723): Spurious death for ProcessRecord{33eaa703 24090:com.mycompany.android/u0a549}, curProc for 24090: null\n11-20 00:23:45.853: I/ActivityManager(723): Force stopping com.mycompany.android appid=10549 user=0: pkg removed\n11-20 00:23:46.188: D/BackupManagerService(723): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.mycompany.android flg=0x4000010 (has extras) }\n11-20 00:24:23.646: E/BackupManagerService(723): Timeout restoring application com.mycompany.android\n11-20 00:24:23.647: W/BackupManagerService(723): Tried to clear data for com.mycompany.android but not found\n11-20 00:26:49.647: V/BackupManagerService(723): restoreAtInstall pkg=com.mycompany.android token=a restoreSet=3319d18fd0806258\n11-20 00:26:50.025: I/BackupTransportService(1752): Current restore app : com.mycompany.android\n11-20 00:26:50.027: I/BackupManagerService(723): Next restore package: RestoreDescription{com.mycompany.android : KEY_VALUE}\n11-20 00:26:50.028: V/BackupManagerService(723): Package com.mycompany.android restore version [0] is compatible with installed version [0]\n11-20 00:26:50.028: W/BackupManagerService(723): Signature mismatch restoring com.mycompany.android\n11-20 00:26:50.236: D/BackupManagerService(723): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mycompany.android flg=0x4000010 (has extras) }\n11-20 00:26:50.240: D/BackupManagerService(723): Now staging backup of com.mycompany.android\n\n\nIt sounds like that the system decides to force stop my application because the restoration times out.\nIt also happens when the app is correctly signed.\n\nBackupManager related implementation was running fine until 4.4.2.\n\nI am currently checking if not invoking any BackupManager APIs works around this unexpected/silent force-stop. For now it looks ok.\n\nAny suggestion?"
] | [
"android-5.0-lollipop",
"nexus-5"
] |
[
"R URL encoding issue?",
"I'm trying to get a data table off of a website using the RCurl package. My code works successfully for the URL that you get to by clicking through the website:\n\nhttp://statsheet.com/mcb/teams/air-force/game_stats/\n\nOnce you try to select previous years (which I want); my code no longer works.\n\nExample link:\nhttp://statsheet.com/mcb/teams/air-force/game_stats?season=2012-2013\n\nI'm guessing this has something to do with the reserved symbol(s) in the year specific address. I've tried URLencode as well as manually encoding the address but that hasn't worked either.\n\nMy code:\n\nlibrary(RCurl)\nlibrary(XML)\n\n#Define URL\ntheurl <-URLencode(\"http://statsheet.com/mcb/teams/air-force/game_stats?season=2012- \n2013\", reserved=TRUE)\n\nwebpage <- getURL(theurl)\nwebpage <- readLines(tc <- textConnection(webpage)); close(tc)\n\npagetree <- htmlTreeParse(webpage, error=function(...){}, useInternalNodes = TRUE)\n\n# Extract table header and contents\ntablehead <- xpathSApply(pagetree, \"//*/table[1]/thead[1]/tr[2]/th\", xmlValue)\nresults <- xpathSApply(pagetree,\"//*/table[1]/tbody/tr/td\", xmlValue)\n\ncontent <- as.data.frame(matrix(results, ncol = 19, byrow = TRUE))\n\ntesttablehead <- c(\"W/L\",\"Opponent\",tablehead[c(2:18)])\nnames(content) <- testtablehead\n\n\nThe relevant error that R returns:\n\nError in function (type, msg, asError = TRUE) : \nCould not resolve host: http%3a%2f%2fstatsheet.com%2fmcb%2fteams%2fair- \nforce%2fgame_stats%3fseason%3d2012-2013; No data record of requested type\n\n\nDoes anyone have an idea what the problem is and how to fix it?"
] | [
"r",
"urlencode"
] |
[
"How can I change bootstrap form direction, text right textbox left?",
"example of it at this link\n\n\r\n\r\n<form class=\"form-horizontal\" role=\"form\" action=\"#\">\r\n <div class=\"form-group\">\r\n <label class=\"col-sm-2 control-label\">עיר</label>\r\n <div class=\"col-sm-10\">\r\n <input class=\"form-control\" id=\"Text5\" type=\"text\"/>\r\n </div>\r\n </div>\r\n <div class=\"form-group\">\r\n <label class=\"col-sm-2 control-label\">רחוב</label>\r\n <div class=\"col-sm-3\">\r\n <input class=\"form-control\" id=\"Text6\" type=\"text\" />\r\n </div>\r\n <label class=\"col-sm-2 control-label\">מס'</label>\r\n <div class=\"col-sm-5\">\r\n <input class=\"form-control\" type=\"text\" />\r\n </div>\r\n </div>\r\n\r\n\r\n\n\nI want to change direction to be: right to left.\ntext- right, textbox- left"
] | [
"html",
"twitter-bootstrap",
"css"
] |
[
"The space character restriction to make optional",
"The HTML5 reference states:\n\n\n A head element's end tag may be omitted if the head element is not\n immediately followed by a space character or a comment.\n\n\nWhat does this \"space character\" restriction mean? I can only think that something like\n\n<title>My Page</title><p>Some stuff.</p>\n\n\nis valid, while\n\n<title>My Page</title>\n<p>Some stuff.</p>\n\n\nis not, as the implicit </head><body> tags would not surround a newline. But I feel I'm off the mark. A clarifying example will be greatly appreciated.\n\nThanks to all!"
] | [
"html"
] |
[
"Is merely requesting app transparency permissions sufficient for ensuring google mobile ads are iOS14 compliant?",
"We have an app that shows Google banner, interstitial and reward ads. In iOS14 there are new requirements for App Tracking. This impacts Google Mobile ads as described here: https://developers.google.com/admob/ios/ios14. We've implemented all their steps, including the final step:\nfunc requestIDFA() {\n ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in\n // Tracking authorization completed. Start loading ads here.\n loadAd()\n})\n\n}\nIs this sufficient for iOS14 app tracking compliance as far as Google mobile ads are concerned?\nThe reason I ask is that with the European personalized ad consent we had to also include in the GADRequest (see: https://developers.google.com/admob/ios/eu-consent#forward-consent):\nlet status = PACConsentInformation.sharedInstance.consentStatus\nlet extras = GADExtras()\n \nif status == .nonPersonalized || status == .unknown {\n extras.additionalParameters = ["npa": "1"]\n}\n\nDo we need to do something similar for iOS App Tracking? My gut feeling is "no" because otherwise they would have mentioned it specifically in their documentation, but want to be on the safe side."
] | [
"admob",
"ios14",
"googlemobileads",
"apptrackingtransparency"
] |
[
"Xcopy to multiple folder into subdirectory",
"Xcopy to multiple folder with the same name into multiple subdirectory\n\nE:\\copytest\\aaaa\\2\n\nE:\\copytest\\bbbb\\2\n\nE:\\copytest\\randome\\2\n\nxcopy E:\\copytest\\new.txt E:\\copytest\\%%\\2"
] | [
"windows",
"batch-file"
] |
[
"how to create KMZ file programmatically?",
"How can i create .KMZ (google earth file format) programmatically? .KMZ contains a .KML file (XML for location based data) and images in a directory named 'files', the KML and files directory compressed together makes KMZ. \n\nNow the challenge here is to compress the files into a KMZ format. How can i do that?"
] | [
"iphone",
"ios",
"ios4",
"xcode4.2"
] |
[
"View contents of ActiveRecord::Relation Object",
"I have produced an AR query which has returned an object of the above type. The object has the name of #<Review id: 26>\n\nI am learning how to do advanced join queries and I would like to know if I have produced the desired object. It is a pain in the neck to have to assign the object to a variable and then slowly figure out how to iterate over it's contents using the data you hope is contained within.\n\nThank you."
] | [
"ruby-on-rails"
] |
[
"Sharepoint: Communication between WebPart and silverlight control",
"Is there any way to send notifications from the webpart to silverlight control hosted in the same webpart?"
] | [
"silverlight",
"sharepoint",
"web-parts"
] |
[
"I am having the Python code for sending json Data and getting response can anyone help in sending the JSON Data by using the android",
"import requests\nurl = "https://ide.geeksforgeeks.org/main.php"\nurl1 = "https://ide.geeksforgeeks.org/submissionResult.php"\ncode = """\nprint("hello world hi")\n"""\ndata = {\n "lang":"Python3",\n "code": """\n print("hello world hi")\n """,\n"input":"0",\n"save":"false"\n }\nheaders = {\n'authority': 'ide.geeksforgeeks.org',\n'accept': 'application/json, text/javascript, */*; q=0.01',\n'x-requested-with': 'XMLHttpRequest',\n'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like \nGecko) \nChrome/86.0.4240.75 Safari/537.36',\n'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',\n'origin': 'https://ide.geeksforgeeks.org',\n'sec-fetch-site': 'same-origin',\n'sec-fetch-mode': 'cors',\n'sec-fetch-dest': 'empty',\n'referer': 'https://ide.geeksforgeeks.org/',\n'accept-language': 'en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7',\n'cookie': '__ssds=2; __ssuzjsr2=a9be0cd8e; __uzmaj2=72fca303-e361-41b2-bba4-1589c25df78f; \n __uzmbj2=1588696171; _ga=GA1.2.792984080.1588696178; _gac_UA-71763465- \n1=1.1596706783.CjwKCAjw1K75BRAEEiwAd41h1HmzsMxasGrGn- \n13gBVGu1OaFroH1MDb46tYX9CE5ps_QQQlLKtvMhoCuogQAvD_BwE; \n_gcl_aw=GCL.1596706783.CjwKCAjw1K75BRAEEiwAd41h1HmzsMxasGrGn- \n13gBVGu1OaFroH1MDb46tYX9CE5ps_QQQlLKtvMhoCuogQAvD_BwE; _fbp=fb.1.1596706785309.995420085; \n__qca=P0-1441563761-1597601442117; default_lang=java; \n__gads=ID=b869a834b05dc13e:T=1599318219:S=ALNI_Mb-bHiqdMBbpBaUp59Zh5cbcqOmMw; \ng_state=^{^\\\\^i_l^\\\\^:4,^\\\\^i_p^\\\\^:1602773797074^}; \nRT=^\\\\^z=1^&dm=geeksforgeeks.org^&si=8qiwp2gs6z9^&ss=kfvd39wa^&sl=0^&tt=0^\\\\^; \n__utma=245605906.792984080.1588696178.1601996864.1602142160.71; \n__utmz=245605906.1602142160.71.64.utmcsr=google^|utmccn=(organic)^|utmcmd=organic^|utmctr= \n(not^%^20provided); __uzmdj2=1602142123; __uzmcj2=98467103045590; \n_gid=GA1.2.546473506.1602435412; _gat=1; authtoken=dafd6e47aabe90f3743e98f08ae2de60; \n_gat_gtag_UA_144087254_1=1; G_ENABLED_IDPS=google',\n}\nr = requests.post(url, data=data)\nr.json()`\n\nAnd in this output, the only sid is taken and used for the next JSON response\nOutput:{'status': 'SUCCESS', 'sid': 'cbc46c11a94ee0d58b7d89ced9978b91'}\nrequesttype = {\n'sid': r.json()['sid'] ,\n'requestType': 'fetchResults'\n}\nr1=requests.post(url1,headers=headers,data=requesttype)\nr1.json()\n\nOutput:\n{'valid': '1',\n'output': 'hello world hi\\n',\n'time': '0.02',\n'compResult': 'S',\n'memory': '0.125',\n'hash': 'e62a0831b033cc107bd0b0d43cb83164_Tester_U16',\n'status': 'SUCCESS'}\nCan anyone help using this in the android as I tried many but couldn't find any proper result\nand it may be the"
] | [
"android",
"json"
] |
[
"Why is int[] considered an object instead an array of objects",
"I was making a JSON builder lib in java, my lib has a little bug. I noticed because when I changed the type of the \"suit\" variable to int[] instead of Integer[] my lib stopped working properly. Well my idea was to let the second addProperty(..., Object[] value) method overload the first method addProperty(..., Object value).\n\npackage mypack;\n\npublic class JSON {\n private static String $s = \"\\\"\";\n private String name, json = \"{\";\n\n public JSON() {\n this.name = null;\n }\n\n public JSON(String name) {\n this.setName(name);\n }\n\n public void setName(String name){\n this.name = \"var \" + name + \" = \";\n }\n\n public String getJson() {\n return json;\n }\n\n public void addAttribute(String attribute, Object value){\n json += $s + attribute + $s + \": \";\n\n if(value instanceof JSON){\n json += ((JSON) value).json + \", \";\n } else if (value instanceof String) {\n json += $s + value + $s + \", \";\n } else {\n json += value + \", \";\n }\n }\n\n //THIS SHOULD BE USED BY int[].... I think :(\n public void addAttribute(String attribute, Object[] value){\n json += $s + attribute + $s + \": [\";\n\n for (int i = 0; i <value.length; i++) {\n if(value[i] instanceof JSON){\n json += ((JSON) value[i]).json + \", \";\n } else if (value[i] instanceof String) {\n json += $s + value[i] + $s + \", \";\n } else {\n json += value[i] + \", \";\n }\n }\n json = json.substring(0, json.length() - 1) + \"], \";\n }\n\n public void build(){\n json = json.substring(0, json.length() - 2) + \"}\";\n json = (name == null) ? json : (name + json);\n }\n}\n\n\nTo test it I used this:\n\npackage mypack;\n\npublic class Test {\n public static void main(String[] args){\n int[] suit = {1,2,3};\n JSON json = new JSON();\n json.addAttribute(\"x\", \"suit\");\n json.addAttribute(\"y\", suit );\n json.build();\n System.out.print(json.getJson());\n }\n}\n\n\nPD: Please don't answer suggesting to use a pre-made lib. I am studying and in the universities we use to be Sisyphus pupils, redo things over and over again until the end of time."
] | [
"java",
"json"
] |
[
"Error 403 when getting data from Airbnb API",
"I am trying to pull data from the Airbnb API, but I get a HTTP 403 error when running my code, this means I somehow don't have access to the Airbnb server. However, I do have an API key. Can someone please help me out here? Help is very much appreciated!\n\nThis is my code:\n\n#Import required modules\nimport amadeus\nimport urllib2\nimport json\n\nclient_id= \"**********\"\n\n\n#URL\nURL = \"https://api.airbnb.com/v2/search_results? client_id=***********otqw18e8nh5nty&locale=en-US&currency=USD&_format=for_search_results_with_minimal_pricing&_limit=10&_offset=0&fetch_facets=true&guests=1&ib=false&ib_add_photo_flow=true&location=Lake%20Tahoe%2C%20CA%2C%20US&min_bathrooms=0&min_bedrooms=0&min_beds=1&min_num_pic_urls=10&price_max=210&price_min=40&sort=1&user_lat=37.3398634&user_lng=-122.0455164\"\nprint URL\n\n#Convert to Json format\njson_obj = urllib2.urlopen(URL)\n\ndata = json.load(json_obj)\n\nprint data"
] | [
"python",
"api",
"airbnb"
] |
[
"BOOST TEST: Custom type?",
"I've just started to learn Boost Test library (and C++ also).\nI have this code inside a source file:\n#include <boost/test/unit_test.hpp>\n#include <iostream>\n#include <vector>\n\n#include "../../MyLibrary/Matrices.h"\n\nstd::ostream& operator<<(std::ostream& os, const std::vector<float>& result)\n{\n os << result << std::endl;\n\n return os;\n}\n\nBOOST_AUTO_TEST_CASE(MatrixVectorProduct_1)\n{\n std::vector<float> matrix = { 1.0, 2.0, 3.0, 4.0 };\n std::vector<float> vector = { 1.0, 1.0 };\n std::vector<float> result = { 3.0, 7.0 };\n\n BOOST_REQUIRE_EQUAL(result, Matrices::MatrixVectorProduct(matrix, vector));\n}\n\nBut, when I compile it I get this error:\nMatricesTest.cpp\nd:\\vcpkg-master\\installed\\x86-windows\\include\\boost\\test\\tools\\detail\\print_helper.hpp(53): error C2338: Type has to implement operator<< to be printable\nd:\\vcpkg-master\\installed\\x86-windows\\include\\boost\\test\\tools\\detail\\print_helper.hpp(62): note: see reference to function template instantiation 'std::ostream &boost::test_tools::tt_detail::impl::boost_test_print_type<R>(std::ostream &,const T &)' being compiled\n with\n [\n R=std::vector<float,std::allocator<float>>,\n T=std::vector<float,std::allocator<float>>\n ]\n\nThere are a lot of more errors that I don't copy here for brevity.\nWhat am I doing wrong?\nUPDATE\nI have used the code suggested by JohnFilleau's answer, but it still throws the same errors:\n#include <boost/test/unit_test.hpp>\n#include <iostream>\n#include <vector>\n\n#include "../../MyLibrary/Matrices.h"\n\ntemplate <typename T>\nstd::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {\n os << '{';\n for (const auto& v : vec) {\n os << v << ' ';\n }\n os << '}';\n\n return os;\n}\n\nBOOST_AUTO_TEST_CASE(MatrixVectorProduct_1)\n{\n std::vector<float> matrix = { 1.0, 2.0, 3.0, 4.0 };\n std::vector<float> vector = { 1.0, 1.0 };\n std::vector<float> result = { 3.0, 7.0 };\n\n BOOST_REQUIRE_EQUAL(result, Matrices::MatrixVectorProduct(matrix, vector));\n}"
] | [
"c++",
"boost",
"boost-test"
] |
[
"Cookies store seems to be not initialized",
"I have rails 3.1 app with ruby 1.9.3-p286. In one of my before filters in ApplicationController I have session_create_params = {deviceId: cookies.signed[:device_id]}\n\nWhen I'm calling some of my integration tests I get undefined method [ ]' for nil:NilClass Seems to cookies is nil. How can I fix this or what I'm doing wrong ?\n\nrequire 'test_helper'\n\nclass CreatingSomeStuff < ActionDispatch::IntegrationTest\n setup do\n Capybara.current_driver = :webkit\n end\n context 'When viewing some stuff' do\n setup do\n @some_url = 'http://www.google.com'\n visit(\"/stuff?url=#{@some_url}\")\n end\n end\nend"
] | [
"ruby-on-rails",
"ruby",
"cookies"
] |
[
"Python-Nmap.0.3.4 fail to install",
"I get following error when installing python-nmap-0.3.4.tar.gz:\n\nMicrosoft Windows [Version 6.1.7601]\nCopyright (c) 2009 Microsoft Corporation. All rights reserved.\n\nD:\\python\\lib>cd D:\\python\\lib\\python-nmap-0.3.4\n\nD:\\python\\lib\\python-nmap-0.3.4>python setup.py install\n File \"C:\\Python34\\Lib\\site.py\", line 176\n file=sys.stderr)\n ^\nSyntaxError: invalid syntax\n\nD:\\python\\lib\\python-nmap-0.3.4> \n\n\nI have python3.4 installed.\n\nEDIT:\n\nThe problem was because of pip which I didn't mark it my installation, So I uninstall my python and then install it with pip capability and finally I install python-nmap."
] | [
"python",
"python-3.x",
"pip",
"nmap"
] |
[
".NET, Is Equal() just ==?",
"Possible Duplicate:\n C# difference between == and .Equals()\n == vs Equals in C# \n\n\n\n\nHi,\nIn terms of general use, is == the same as Equals()? I mean, both just return true if he objects are the same (reference)?"
] | [
"c#",
"reference",
"operators",
"equals"
] |
[
"set a php page to useSSL",
"Hi I have a php application I would like the account.php page to be secure however after adding this to the page \n\n $use_sts = true;\n\n // iis sets HTTPS to 'off' for non-SSL requests\n if ($use_sts && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {\n header('Strict-Transport-Security: max-age=31536000');\n } elseif ($use_sts) {\n header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);\n // we are in cleartext at the moment, prevent further execution and output\n die();\n } \n\n\nhowever when I browse the page it is set to HTTPS but the content is all over the place when I look at the source it shows file requests using http: \n\n<script type=\"text/javascript\" src=\"http://****/assets/jquery.js\"></script>\n<script type=\"text/javascript\" src=\"http://****/assets/jquery-ui.js\"></script>\n<script type=\"text/javascript\" src=\"http://****/assets/tables.js\"></script>\n<script type=\"text/javascript\" src=\"http://****/assets/global.js\"></script>\n<script type=\"text/javascript\" src=\"http://****/assets/cycle.js\"></script>\n\n\nis there a way to set a specific page to use SSL\n\nI also tried this with the .htaccess but got the same result \n\n # force https for\n RewriteCond %{HTTPS} =off\n RewriteRule ^(index|login)\\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] \n\n\nthanks\n\nM"
] | [
"php",
"https",
"secure-coding"
] |
[
"Create Model for ApplicationUsers that has Followers and Followees using EntityFramework Core 2.1",
"I'm trying to generate a model for and AspnetUser that has one-to-many relationships with Followers and Followees. The Following Class is defines as:\n\npublic class Following\n{\n [Key]\n [Column(Order = 1)]\n public string FollowerId { get; set; }\n\n [Key]\n [Column(Order = 2)]\n public string FolloweeId { get; set; }\n\n public ApplicationUser Follower { get; set; }\n public ApplicationUser Followee { get; set; }\n}\n\n\nThe following worked in EntityFramework but not in EntityFramework Core.\n\nprotected override void OnModelCreating(DbModelBuilder modelBuilder)\n {\n modelBuilder.Entity<ApplicationUser>()\n .HasMany(u => u.Followers)\n .WithRequired(f => f.Followee)\n .WillCascadeOnDelete(false);\n\n modelBuilder.Entity<ApplicationUser>()\n .HasMany(u => u.Followees)\n .WithRequired(f => f.Follower)\n .WillCascadeOnDelete(false);\n\n base.OnModelCreating(modelBuilder);\n }\n\n\nAny help figuring this out greatly appreciated."
] | [
"asp.net-core-2.1",
"entity-framework-core-2.1"
] |
[
"Rails href with hash value not updating url",
"I'm using Materialize Tabs and have everything working fine, except the fact that my URL doesn't update when I click a tab link. I have the following two links:\n\n<ul id=\"db-tabs\" class=\"tabs\">\n <li class=\"tab col s3\"><a class=\"tab-text active\" href=\"#activegroups\">Active Groups</a></li>\n <li class=\"tab col s3\"><a class=\"tab-text\" href=\"#submittedgroups\">Submitted Groups</a></li>\n</ul>\n\n\nYet when I click one of these links, the URL remains unchanged. I would have expected the URL to change to something like /admin#submittedgroups, yet is just remains /admin.\n\nIf I manually enter the url /admin#submittedgroups, i'll get taken to the correct tab but otherwise the URL never changes.\n\nAny ideas of what i'm doing wrong?"
] | [
"ruby-on-rails",
"materialize"
] |
[
"AJAX call from function won't work",
"var usernameInfo= $('#usernameInfo');\nvar ele= $('#username');\nvar username= ele.val();\nif(username.length >=6 || username.length <=32)\n{\n usernameInfo.removeClass('error').addClass('correct').html('<img src=\"loader.gif\" align=\"absmiddle\" />&nbsp;Checking availability...');\n ele.removeClass('wrong').addClass('normal');\n $.ajax({\n type: \"POST\",\n url: \"ajax_check_username.php\",\n data: \"username=\" + username,\n succes: function (server_response) {\n usernameInfo.ajaxComplete(function(event, request){\n if(server_response == '1') \n {\n jVal.errors= true;\n usernameInfo.removeClass('correct').addClass('error').html('<img src=\"not_available.png\" align=\"absmiddle\" /> Not Available').show();\n ele.removeClass('normal').addClass('wrong');\n }\n else if(server_response == '0')\n {\n usernameInfo.removeClass('error').addClass('correct').html('<img src=\"available.png\" align=\"absmiddle\" /> Available').show();\n ele.removeClass('wrong').addclass('normal');\n }\n });\n }\n }); \n}\n\n\nThe thing is that i have used this AJAX call from another script that it works with working .php file (tested and working), but now it just won't... any help would be good. Thanks"
] | [
"javascript",
"jquery",
"ajax"
] |
[
"How to get a big-O, Big-Ω and big-Θ for this function?",
"I have a function f(n) defined as follows:\n\n\n f(n) = (n-1)(n+1)lg(n+5)/(n+3)\n\n\nHere, lg is log2. I'd like to determine the big-O, big-Ω, and big-Θ values for this function. How would I go about approaching this?\n\nThanks!"
] | [
"math",
"big-o"
] |
[
"AttributeError: 'dynamodb.Table' object has no attribute 'primary_key'",
"this is a trivial question but I didn't found the answer on how to get the primary from a dynamoDB table in AWS.\n(I know we can from the dynamodb object but I would like to keep it directly from dynamodb.Table.\nProblem: AttributeError: 'dynamodb.Table' object has no attribute 'primary_key'\nSolution: Something like my_table.get_primary_key() ?"
] | [
"python",
"amazon-dynamodb"
] |
[
"Image in the UINvaigationItem - high resolution",
"I'm setting the title view to my UINavigationItem like this\n\nUIImageView *navigationImage = [[UIImageView alloc] \n initWithImage:[UIImage imageNamed:@\"header\"]];\nself.navigationItem.titleView = navigationImage;\n[navigationImage release];\n\n\nCan I have 2 images, using the header@2x for high resolution, like it happens with icons?"
] | [
"iphone",
"uiimageview",
"uinavigationitem"
] |
[
"SideMenu Functionality in swift 4",
"I am setting up the side menu by following SideMenu\n\nWhen the app is loaded first the side menu controller is working fine (.menuslide)\n\nbut when I come back to the same controller from the side menu to the same view controller or any other controller or any other page it is not following (.menuslide)\n\n\nI have tried by assigning the navigation \n\nlet menu = SideMenuNavigationController(rootViewController: YourViewController)\nlet rightMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController) \nSideMenuManager.default.rightMenuNavigationController = rightMenuNavigationController\npresent(menu, animated: true, completion: nil) \n\n\n\nthrough code and also \n\n\nFrom the story board \n\nI am navigating from every controller to side menu like this\n\n let navigationController = storyboard!.instantiateViewController(withIdentifier: \"sidemenunavigation\") as! SideMenuNavigationController present(navigationController, animated: true, completion: nil)\n\n\n\nfor the first time after loading it is navigating properly (.menuslide)\n\nbut after navigating to other controller and get the side menu it is not following (.menuslide)"
] | [
"ios",
"swift4.1"
] |
[
"Importing Data from ms access into Python as List of dict",
"I've been able to insert records from python into a ms access database but having trouble reading it back into Python. I require it to be in the format of a List of Dictionarys in Python. \n\nSo far I have tried using pyodbc to do this with the following code;\n\ndb_path = (\"path/tomy/db/mine.mdb\")\nodbc_connection_str = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=%s;' % (db_path)\nconnection = pyodbc.connect(odbc_connection_str)\ncursor = connection.cursor()\n\n\nI then tried the following but i get a no read permission error.\n\nquery = \"SELECT * FROM MSysObjects WHERE Type=1 AND Flags=0\"\ncursor.execute(query)\nrows = cursor.fetchall()\nfor row in rows:\n print row\n\n\nAnyone have experience in extracting from a ms access database and then able to store it in python as a list of dicts?"
] | [
"python",
"ms-access",
"dictionary"
] |
[
"How to make DropdownButtonFormField to occupy the minimum possible space?",
"The flutter DropDownButton will automatically shrink to size of the largest label of the choices, like so :-\n\n\n\nBut a DropDownButtonFormField changes this behavior, and instead occupies the whole space available to it.\n\n\n\nSo, how do I make the DropDownButtonFormField mimic the space occupation behavior of a DropDownButton ?"
] | [
"user-interface",
"dart",
"flutter"
] |
[
"How can we draw the half circle with custom radius over the map.\" or any lib that can provide such feature over the map",
"I am using https://leafletjs.com for mapping features.\nfor creating semiCircle over the map i have used https://github.com/jieter/Leaflet-semicircle but i need feature that allows me to edit that arc and radius. just like below image."
] | [
"reactjs",
"leaflet",
"mapping",
"drawing"
] |
[
"Trying to assign an object to an object of different type in C++",
"I'm trying to understand the behaviour of this code:\nclass A {\npublic:\n int a;\n A(int x = 0): a(x) {cout << "A-ctor" << endl;}\n ~A() {cout << "A-dtor" << endl;}\n};\n\nclass B {\npublic:\n int b;\n B(int x = 0): b(x) {cout << "B-ctor" << endl;}\n ~B() {cout << "B-dtor" << endl;}\n};\n\nint main() {\n A a;\n B b;\n a = b.b;\n return 0;\n}\n\nThe output of this program is:\nA-ctor\nB-ctor\nA-ctor\nA-dtor\nB-dtor\nA-dtor\n\n\nMy question is, in this line in main(): a = b.b, an instance of class A is created and immediately destroyed. Why is this happening? Moreover, shouldn't I get a compilation error when trying to assign an object of one class to a different class?"
] | [
"c++",
"oop"
] |
[
"To read two elements of lists",
"I have this code\n\ndef ch1(div, pares):\n for j in zip(div,pares):\n dtm=pares[j]\n etiqueta=div[j] \n\n fig = go.Figure(data=[go.Candlestick(x=dfm['Date'],\n open=dfm['Open'],\n high=dfm['High'],\n low=dfm['Low'],\n close=dfm['Price'])])\n\n\n fig.update_layout(\n title= etiqueta,\n )\n\n fig.show()"
] | [
"python",
"list"
] |
[
"Guava's EventBus - visibility of @Subscribe",
"Annotation from interface methods are not inherited to objects implementing that interface, afaik. SO search results.\n\nI wanted to use an interface together with Guava's EventBus, which requires that an object has a callback method annotated with @Subscribe.\nI was wondering if I could simply put that annotation into the interface and let the object implement that listener interface. According to above, this should not work. However, it does work (see code below). \n\nWhy?\n\nMy machine is Java 1.8.0_151 (32 bit) with Windows 7.\n\nimport static org.junit.Assert.assertEquals;\nimport org.junit.Test;\nimport com.google.common.eventbus.EventBus;\nimport com.google.common.eventbus.Subscribe;\n\n/**\n * This test should fail, but... it works!\n */\npublic class EventTests {\n\n\n @Test\n public void test_events_are_heard() {\n\n MyListener listener = new MyListener();\n DeafListener deafListener = new DeafListener();\n EventBus bus = new EventBus();\n bus.register(listener);\n bus.register(deafListener);\n bus.post(new MyEvent());\n assertEquals(1, listener.eventCount); // ok\n assertEquals(0, deafListener.eventCount); // ok\n }\n\n // this interface includes the @Subscribe annotation\n private interface Listener {\n @Subscribe\n public void onEvent(MyEvent event);\n }\n\n // this interface does not include the @Subscribe annotation\n private interface NoListener {\n public void onEvent(MyEvent event);\n }\n\n // just something different from Object\n private static class MyEvent {\n } \n\n // implementation of \"Listener\" (with @Subscribe in interface)\n private static class MyListener implements Listener {\n int eventCount = 0;\n @Override\n public void onEvent(MyEvent event) {\n eventCount ++;\n }\n }\n\n // IDENTICAL implementation as above, but of \"NoListener\" \n // (without @Subscribe in interface)\n private static class DeafListener implements NoListener {\n int eventCount = 0;\n @Override\n public void onEvent(MyEvent event) {\n eventCount ++;\n }\n }\n\n}"
] | [
"java",
"guava",
"event-bus",
"greenrobot-eventbus"
] |
[
"Gradle: how to display where a dependency conflict arises",
"I have a Gradle project with many dependencies, one of which is resolved as follows:\n\ngradle dependencyInsight --configuration compile --dependency javax.activation\n\n:dependencyInsight\njavax.activation:activation:1.1 (conflict resolution)\n+--- com.sun.mail:mailapi:1.4.4\n| \\--- compile\n\\--- com.sun.mail:smtp:1.4.4\n \\--- compile\n\njavax.activation:activation:1.0.2 -> 1.1\n\\--- compile\n\n\nVersion 1.1 must be a transitive dependency because I explicitly specified 1.0.2. How can I find out where this specific transitive dependency comes from?"
] | [
"dependencies",
"gradle",
"conflict"
] |
[
"How to get GNU Parallel report every file processed?",
"I would like to keep track of GNU parallel in a simple log file and would like it to emit the name of each as it starts / ends (either or both are equally fine). It seems verbose is too verbose for this."
] | [
"gnu-parallel"
] |
[
"Setup App Insights for an application which is hosted on a server with no internet",
"Is there a way to setup Application Insights on Azure for an application which is setup on a server with no internet connection?"
] | [
"azure",
"azure-application-insights"
] |
[
"Convert Type Class to Table with Javascript in Enterprise Architect",
"I'm trying to convert a Class to a Table using Javascript.\nWhen I execute the following code (assuming currentElement is an Element), the Stereotype of the Class updates to \"table\", in which updates to Stereotype \"table\" and takes on a blue-purplish colour when viewed. But, the Type does not update.\n\ncurrentElement.Stereotype = \"table\"\ncurrentElement.Type = \"Table\"\ncurrentElement.Update();\n\n\nWhen I select the updated element in the project browser, I still see that it is Class : <name>. How can I convert perform a Type conversion Class to Table using scripting (specifically Javascript)?\n\nThanks!"
] | [
"javascript",
"enterprise-architect"
] |
[
"Project is not compiling because of `@withGesture`",
"I have this code that compiles just fine in codesandbox. However if I clone and npm install and then try to run it locally, I get a compile error:\n\nFailed to compile.\n./src/index.js\nSyntax error: Unexpected token (9:0)\n\n 7 | import './styles.css'\n 8 |\n> 9 | @withGesture // https://github.com/drcmda/react-with-gesture\n | ^\n 10 | class Slider extends React.Component {\n 11 | render() {\n 12 | const { xDelta, down, children } = this.props\n\n\nreact-with-gesture module shows different ways of using it, but I am wondering why I am getting compilation error an if there's a way to prevent it. Appreciate any answers."
] | [
"javascript",
"reactjs"
] |
[
"Amazing algorithms for image processing",
"I have recently came across a great image processing algorithm called Seam Carving. \nIt uses graphs (Shortest Path algorithm) to do its job.\n\nWhat other amazing algorithms are out there worth looking at?\n\nI'm not talking about the majority of boring matrix based ones, rather something you could never think about before you came across it, just like this one."
] | [
"algorithm",
"image-processing"
] |
[
"custom paperclip validation error message",
"I have this validation for content type: \n\nvalidates_attachment_content_type :photo, :content_type => /^image\\/(jpg|jpeg|pjpeg|png|x-png|gif)$/, :message => 'file type is not allowed (only jpeg/png/gif images)'\n\n\nI want only the message above to be displayed but instead it says \n\n Photos photo content type file type is not allowed (only jpeg/png/gif images)\n\n\nbecause its a photos model and attached file photo.\n\nthanks"
] | [
"ruby-on-rails",
"paperclip",
"paperclip-validation"
] |
[
"JavaScript Function to Pull related object fields",
"I am using the following query to try to pull fields off of a User lookup on the Account. There is a field on the Account called Dedicated_Rep__c which is a user lookup. I am building my button off the opportunity, and I want to be able to pull the Opportunity's Account's Dedicated Rep's First Name, Last Name, and Email. Here's my code:\n\n function getDedicatedAccountRep (oppId) {\nvar result = sforce.connection.query(\"select Account.Id, Account.Dedicated_CS_Rep__r.FirstName from Opportunity where Id = '\" + oppId + \"' \");\n\nif(!result || result['size'] != 1) { \n return null;\n }\n\n var DedRepRole = result.getArray('records')[0];\n\n return DedRepRole.Account;\n}\n\nvar dedicatedRep = getDedicatedAccountRep('{!Opportunity.Id}'); \n\n\nI am getting an error:\n\nCannot read property 'Dedicated_CS_Rep__c' of undefined\n\nI am referencing the code later in the button and I am instantiating it by putting: dedicatedRep.Dedicated_CS_Rep__r.FirstName"
] | [
"javascript",
"salesforce",
"salesforce-service-cloud"
] |
[
"Update Table Column value in BigQuery using BigQueryClient",
"I am uploading my data on a daily basis into BigQuery tables from C# application using BigQueryClient UploadJson Method. Some of the values from the table columns get updated on a frequent basis, and those updates need to be applied on BigQuery too.\n\nIt seems BigQuery won't allow updating those values from my C# application. Is it possible to update the table using the BigQuery client library?\nInsert Example : \n\n using (BigQueryClient client = BigQueryClient.Create(_projectId, _googleCredential))\n {\n BigQueryTable table = client.GetTable(_datasetId, _tableId);\n BigQueryJob job = table.UploadJson(dataStream, new UploadJsonOptions() { AllowUnknownFields = true });\n return CheckJobStatus(client, job.Reference);\n }"
] | [
"google-bigquery"
] |
[
"Scaling multiple gearman workers",
"I created 500 gearman workers on server that have 32 cores and 64GM RAM.\nThe server working well with 60-70% CPU, 22 load avg. i created it with supervisor.\n\nWhat is the best practice for this amount of workers, can you advise to other solution that is not supervisor? what about gearman manager?\n\nThe worker process a job between 10-100MS - on avg the queue is always 90%."
] | [
"php",
"supervisord",
"gearman"
] |
[
"mysql insert fails on certain form fields",
"I get the following error when I try to insert into a mysql database.\n\n\n MYSQL Error: You have an error in your SQL syntax; check the manual\n that corresponds to your MySQL server version for the right syntax to\n use near 'Condition, Status) VALUES ( '20140715_173221.jpg','rt',\n 'Vessel', 'hf',' ','New'' at line 1\n\n\nI can insert fine without fields Condition and Status.\nhere is the form/javascript.\n\n<script type=\"text/javascript\">\n $(document).ready(function(){\n $('#upload select[name=\"Type\"]').change(function(){\n if($('#upload select[name=\"Type\"] option:selected').val() == 'Shroud' || $('#upload select[name=\"Type\"] option:selected').val() == 'Vessel' ){\n $('#Status').show();\n }else{\n $('#Status').hide();\n }\n });\n });\n\n $(document).ready(function(){\n $('#upload select[name=\"Type\"]').change(function(){\n if($('#upload select[name=\"Type\"] option:selected').val() == 'Collector' ||\n $('#upload select[name=\"Type\"] option:selected').val() == 'M150' ||\n $('#upload select[name=\"Type\"] option:selected').val() == 'TC' ){\n $('#Condition').show();\n }else{\n $('#Condition').hide();\n }\n });\n }); \n\n</script>\n<form id=\"upload\" name=\"upload\" enctype=\"multipart/form-data\" action=\"ImageUpload.php\" method=\"POST\"> \n\n <label for=\"Type\">Type:</label>\n <select id=\"Type\" name=\"Type\">\n <option value=\"\">Select a Type...</option>\n <option value=\"Shroud\">Shroud</option>\n <option value=\"Vessel\">Vessel</option>\n <option value=\"Collector\">Collector</option>\n <option value=\"M150\">M150</option>\n <option value=\"TC\">TC</option>\n <option value=\"VanesHOBIF\">Vanes/HOB/IF</option>\n </select><br><br>\n\n\n Title: <input type=\"text\" name=\"UserTitle\"><br> \n\n <div id=\"Status\" style=\"display:none\">Status: \n <input type=\"text\" name=\"Status\" value=\"\">\n <br>\n </div>\n\n <div id=\"Condition\" style=\"display:none\">\n <label for=\"Condition\">Condition:</label>\n <select name=\"Condition\">\n <option value=\" \"></option>\n <option value=\"New\">New</option>\n <option value=\"Cleaned\">Cleaned</option>\n <option value=\"Drained\">Drained</option>\n <option value=\"NA\">NA</option>\n </select><br><br>\n </div> \n\n\n <label for=\"Desciption\">Description:</label><br>\n <textarea type=\"text\" name = \"Description\" cols=\"40\" rows= \"4\"></textarea><br> \n File: <input type=\"file\" name=\"file\" id=\"file\"><br> \n <input type=\"submit\" name=\"submit\"value=\"Submit\"> \n </form>\n\n\nand my PHP Post file\n\n$title=$_POST['Title'];\n $usertitle=$_POST['UserTitle'];\n $type=$_POST['Type'];\n $Description=$_POST['Description'];\n $files=($_FILES['file']['name']);\n $Condition=$_POST['Condition'];\n $Status= $_POST['Status'];\n\n\n\n $sql=\"INSERT INTO ImageTable (Title,UserTitle,Type,Description,Condition, Status) VALUES ( '$files','$usertitle', '$type', '$Description','$Condition','$Status')\";\n\n if (!mysqli_query($con,$sql))\n {\n die('MYSQL Error: ' . mysqli_error($con));\n }\n\n\nIf I echo out the $Condition and $Status i see the values selected in the form. Not sure what is going wrong with the insert statement. Thanks in advance"
] | [
"javascript",
"php",
"mysql"
] |
[
"ATK Radio Buttons with a model field",
"How can I define radio buttons for a model field.\n\nclass Model_Campaign extends Model_Table {\n public $entity_code = 'campaign';\n function init() {\n parent::init();\n\n $this->addField('nombres')->mandatory(TRUE);\n $this->addField('email')->mandatory(TRUE);\n $this->addField('celular')->mandatory(TRUE);\n $this->addField('ciudad');\n $this->addField('operador')->mandatory(TRUE);\n }\n}\n\n\nI want to 'operador' field shows like radiobuttons, and I want to 'celular' field only accepts numeric values."
] | [
"php",
"frameworks",
"atk4"
] |
[
"Mono does not like Euro symbole?",
"I have in public class variable this:\n\n string[] par_semb = new string[3] {\"$\",\"€\",\"Tl\"};\n\n\nWhen I use my program in mono $ and Tl are displayed but not € sign.\nBut when I change my string array as below \n\n string[] par_semb = new string[3] {\"$\",\"EURO\",\"Tl\"};\n\n\nThe \"EURO\" is displayed.\n\nWorking on windows there is no problem. This occurs when I run it on mono.\n\nAny idea ?\n\nPS I'm using c# 8 express edition and working with win forms. It's the same program running on win7 and on wine."
] | [
"c#",
"string",
"winforms"
] |
[
"How to archive the contents of a HTML page into 1 file?",
"I was wondering how to save an HTML file and all dependencies into one file. Unlike an MHTML file, it won't cut it to change style.css to example.com/style.css. It needs to become:<style>[css]</style>\n\nWould you do this by getting, for example, the CSS then creating the <style> tags in the <head> and pasting the style tags? What (if any) JS libraries would I use? Or should I use JQuery and AJAX?\n\nEDIT:\n\nI'm making a tool that can archive pages with CSS and JS inline. For Example, so you can archive data on a site before heading into a meeting, so you don't have to worry about a server being down, or the stats changing."
] | [
"javascript",
"html",
"jquery"
] |
[
"Rotating/scaling around point of gesture",
"I want a user control to be moved/scaled/rotated by gestures, and I want the rotation and scaling to have its center point in the center of the gesture (e.g. when using two fingers to rotate, the point between the fingers should be the center of the rotation). \n\nWhen I don't attempt to set a center point for rotation/scaling or set a static point, everything works as expected. When setting the CompositeTransform.CenterX/Y to the values of ManipulationDeltaRoutedEventArgs.Position, the usercontrol will rotate with center points that get more wrong for every gesture, and occasionally speed away. \n\nI'm using a CompositeTransform as the render transform of my user control, and I have hooked up to the ManipulationDelta-event like so:\n\nprivate void UserControl_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)\n {\n //this.transform is my composite transform \n //which is set to be the render transform of the user control\n this.transform.CenterX = e.Position.X;\n this.transform.CenterY = e.Position.Y;\n this.transform.ScaleX *= e.Delta.Scale;\n this.transform.ScaleY *= e.Delta.Scale;\n this.transform.Rotation += e.Delta.Rotation;\n this.transform.TranslateX += e.Delta.Translation.X;\n this.transform.TranslateY += e.Delta.Translation.Y;\n }\n\n\nIt seems that e.Position doesn't give me what I want, and unfortunately the documentation is very brief, only stating Gets the point from which the manipulation originated. From my debug prints, it appears that both CompositeTransform.CenterX/Y and ManipulationDeltaRoutedEventArgs.Position are in the coordinate system of the user control."
] | [
"uwp",
"gesture"
] |
[
"Force show favicon on Google Drive hosted websited",
"I put the favicon in the html like this:\n\n<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />\n\n\n...but when visited with Google Chrome it shows the logo of Google Drive instead of my favicon. \n\nThis doesn't happen on Firefox, only on Chrome. So is there any way how to force MY favicon to show on google drive hosted webpages? thank you!"
] | [
"google-drive-api",
"favicon"
] |
[
"JWT authentication and permission_callback",
"In angular, I have following to get the JWT token for wordpress.\n\nimport { HttpClient, HttpHeaders} from '@angular/common/http';\n...\nlogIn(){\n let loginInfo ={\n username: 'admin',\n password: 'password.'\n }; \n\n let headers = new HttpHeaders();\n headers.set('Content-Type', 'application/json');\n\n this.http.post( this.apiURL + 'wp-json/jwt-auth/v1/token',loginInfo,{headers: headers}).subscribe(data => { \n\n this.token = data['token']; \n\n },err => { \n console.log(err);\n\n })\n};\n\n\nHere, I get a successful token for the logged in user.\n\nTo access a custom endpoint, I am sending the token as following:\n\n Test() {\n\n let test = this.apiURL + 'wp-json/test/v1/test';\n\n let headers = new HttpHeaders({\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer ' + this.token\n });\n\n this.http.get(test,{headers: headers}).subscribe(data => {\n console.log(data);\n\n }, error=>{\n console.log(error);\n\n });\n};\n\n\nIn the php:\n\n add_action( 'rest_api_init', function ($data) {\n register_rest_route( 'test/v1', '/test/', array(\n 'methods' => 'GET',\n 'callback' => 'testFunction',\n 'permission_callback' => function () {\n return current_user_can( 'edit_others_posts' );\n }\n ) );\n} );\n\n function testFunction($data) {\n\n $current_user = wp_get_current_user();\n\n return $user_id;\n };\n\n\nHowever I am still get forbidden error:\n\n{code: \"rest_forbidden\", message: \"Sorry, you are not allowed to do that.\",}\n\n\nMy understanding is that using permission_callback I can check the user authentication. \n\nUltimately, I am trying to get the loggedin user id. \n\nWhat am I missing?\n\nAny help will be much appreciated."
] | [
"php",
"wordpress",
"angular",
"rest"
] |
[
"how to display the sum of values in labels on kendo ui stacked bar mvc (using .net mvc)",
"I want to know how to display the sum of values in labels on kendo ui stacked bar mvc (using .net mvc).\n\nI know it can be achieved using javascript. The js code is:\n\n$(function(){\n //create Kendo UI Chart\n $(\"#chart\").kendoChart({\n dataSource:{\n data:[{\n a: 22,\n b: 11,\n c: 33\n },{\n a: 2,\n b: 1,\n c: 3\n }],\n schema: {\n parse: function(response){\n return processResponse(response);\n }\n }\n },\n seriesDefaults: {\n type: \"column\",\n stack: true\n },\n series: [{\n field: \"a\",\n name: \"a\"\n },{\n field: \"b\",\n name: \"b\"\n },{\n field: \"c\",\n name: \"c\",\n labels: {\n //get total via dataItem\n template: \"#= dataItem.total #\",\n visible: true\n }\n }],\n legend: {\n visible: true,\n position: \"bottom\"\n }\n })\n })\n\n function processResponse(response){\n console.log(response);\n var length = response.length,\n item, i; \n\n for (i=0; i<length; i++){\n item = response[i];\n //sum of a + b + c\n item.total = item.a + item.b + item.c;\n }\n return response; \n }\n\n\nThe HTML code is:\n\n<div id=\"chart\"></div>\n\n\nI want to achieve the same thing using .net mvc . Is there any way of passing schema as in the above code to series.column attribute?. The below is the js fiddle link.\n\nhttp://jsfiddle.net/5rsLt/\n\nAny help would be appreciated."
] | [
"kendo-ui",
"kendo-asp.net-mvc",
"kendo-chart"
] |
[
"Convert rewrite rule from antlr3 to antlr4",
"I want to convert below rewrite rule.\ncause I have to move from antlr3 to antlr4\n\nabs_key\n : {input.LT(1).getText().equalsIgnoreCase(\"abs\")}? REGULAR_ID -> ABS_VK[$REGULAR_ID]\n ;\n\n\nIn lexer\n\nREGULAR_ID\n : (SIMPLE_LETTER) (SIMPLE_LETTER | '$' | '_' | '#' | ':' | '0'..'9')*\n ;\n\n\nIs there any good idea?"
] | [
"parsing",
"antlr4",
"antlr3"
] |
[
"Jquery : Hide first row of all the tables except first table",
"I have many tables like \n\n <table class=\"mytable\">\n<tr class = \"first_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n<tr class = \"second_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n<tr class = \"third_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n </table>\n\n<table class=\"mytable\">\n<tr class = \"first_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n<tr class = \"second_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n<tr class = \"third_tr\">\n <td></td>\n <td></td>\n <td></td>\n</tr>\n </table>\n\n\ni may have more than 10 such tables\n\ni need to hide the first row (class name first_tr) of all the tables except first table"
] | [
"javascript",
"jquery"
] |
[
"Extracting timestamp from string with regex in Spark RDD",
"I have a log like :\n\n[Pipeline] timestamps\n[Pipeline] {\n[Pipeline] echo\n20:33:05 0\n[Pipeline] echo\n\n\nI am trying to only extract the time information here (20:33:05).\n\nI have tried to do the following:\n\nval lines = sc.textFile(\"/logs/log7.txt\") \nval individualLines=lines.flatMap(_.split(\"\\n\")) //Splitting file contentinto individual lines\nval dates=individualLines.filter(value=>value.startsWith(\"[0-9]\"))\n\n\nI am getting the output as \n\nMapPartitionsRDD[3] at filter at DateExtract.scala:30\n\n\nHow should the regex be defined here?\n\nAny help would be much appreciated."
] | [
"regex",
"hadoop",
"apache-spark",
"rdd"
] |
[
"How can I reload the store after creating a resource at runtime?",
"I am fetching the resources at run time via an api call. I have a create view that creates a resource. How do I reload the react-admin redux store so that the sidebar gets updated with the new resource?\n\nI thought of following the example here\n\nconst saveWithNote = (values, basePath, redirectTo) => {\n console.log('creating new dataset...')\n crudCreate('datasets', values, basePath, redirectTo);\n}\n\n\nMy thought was to fire some action here that could trigger a store state change and reload the page but I get an error \n\nTypeError: Cannot read property 'type' of undefined\n(anonymous function)\n/form/formMiddleware.js:21\n 18 | var previousLocation;\n 19 | return function (next) {\n 20 | return function (action) {\n> 21 | if (action.type !== LOCATION_CHANGE || action.payload.state && action.payload.state.skipFormReset) {\n | ^ 22 | return next(action);\n 23 | } // history allows one to redirect to the same location which can happen\n 24 | // when using a special menu for a create page for instance. In this case,\n\n\nHere is my toolbar\n\nconst DatasetCreateToolbar = props => {\n\n return (\n <Toolbar {...props} >\n <SaveWithNoteButton\n label=\" Save \"\n redirect=\"list\"\n submitOnEnter={false}\n variant=\"flat\"\n />\n </Toolbar>\n )\n};\n\n\nThe rest of the code is as is from the example link\n\nIs there a better way to trigger a store reload to get my sidebar to show the new resources created?"
] | [
"javascript",
"reactjs",
"redux-form",
"react-admin"
] |
[
"2 dimensional JSON parse",
"I have a JSON object as such\n\n{\n \"Data\": [\n {\n \"Iden\": \"12\",\n \"Date\": \"01/23/2011\",\n \"City\": \"Clearwater\",\n \"State\": \"FL\"\n },\n {\n \"Iden\": \"12\",\n \"Date\": \"02/09/2012\",\n \"City\": \"Elgin\",\n \"State\": \"IL\"\n },\n {\n \"Iden\": \"00010-LV01-12\",\n \"Date\": \"06/22/2010\",\n \"City\": \"Newport Beach\",\n \"State\": \"CA\"\n }\n ]\n}\n\n\nAs you can see, it has 3 rows and 4 columns. How do I use the .each in jquery to iterate through this object?\n\nI tried:\n\n$.each(Data, function () {\n\n\nbut it only did the first iteration"
] | [
"jquery",
"json"
] |
[
"Implement Certain timeout session on multiple pages of a website - REACTJS",
"Suppose there 5 pages to a website. User flow will be 1->2->3->4->5->FINISH. I want to implement is that whenever a user enters page 3 a timer starts and if he doesn't finish a task within that time it is redirected to page 2. \n\nI am thinking of implementing it using a Higher Order Component(HOC) which on mount starts the timer. And finally when exporting the components of pages 3-4-5 (which are part of the session) with the Higher Order Component created earlier. \n\nAny flaw in my approach considering user can open multiple tabs? Any new suggestion?"
] | [
"javascript",
"reactjs",
"timeout",
"higher-order-components"
] |
[
"Stop views from overlapping in ConstraintLayout",
"I am trying to build a simple layout with three views using ConstrainLayout:\n\nWhen the text in the left view is very long, I want to see this:\n\nBut what I get instead is this - the left view growth too much to the right and hides middle view.\n\nHere is my code:\n<android.support.constraint.ConstraintLayout\n xmlns:android="http://schemas.android.com/apk/res/android"\n xmlns:app="http://schemas.android.com/apk/res-auto"\n android:layout_width="match_parent"\n android:layout_height="match_parent">\n\n <TextView\n android:id="@+id/left"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n app:layout_constraintLeft_toLeftOf="parent"\n app:layout_constraintTop_toTopOf="parent"/>\n \n <TextView\n android:id="@+id/middle"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n app:layout_constraintLeft_toRightOf="@id/left"\n app:layout_constraintTop_toTopOf="parent"/>\n \n <TextView\n android:id="@+id/right"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n app:layout_constraintTop_toTopOf="parent"\n app:layout_constraintRight_toRightOf="parent"/>\n\n</android.support.constraint.ConstraintLayout>\n\nSome of the things I tried so far:\n\nmaking a chain and trying out different chain styles\nsetting android:minWidth to Middle view to prevent it from being squashed by left view\nusing Guidline to prevent the left and/or middle view to expand too far right\n\nI spent around 4 hours trying to make things work, but so far without success. Would really appreciate help."
] | [
"android",
"android-constraintlayout"
] |
[
"Why swapping integer variable by XOR doesn't work in a single line?",
"I want to swap the value of two integer variables in java using the XOR operator.\n\nThis is my code:\n\nint i = 24;\nint j = 17;\n\ni ^= j;\nj ^= i;\ni ^= j;\n\nSystem.out.println(\"i : \" + i + \"\\t j : \" + j);\n\n\nIt will work fine but the following equivalent code doesn't work:\n\nint i = 24;\nint j = 17;\n\ni ^= j ^= i ^= j;\n\nSystem.out.println(\"i : \" + i + \"\\t j : \" + j);\n\n\nOutput is like this:\n\ni : 0 j : 24\n\n\nFirst variable is zero! What's wrong with Java?"
] | [
"java",
"operators"
] |
[
"Prevent hotlinking from harassing domain by showing an image or iframe? .htaccess",
"I've some site that keep stealing my images and sometime even iframe to get my content.\n\nI've tried using .htaccess to redirect any images that stolen to image like stop hotlinking but I still get the same problem they get around it like using something not to give an extension like .jpg .gif .png or something\n\nis there anyway that I can edit .htaccess to prevent this happening by showing an iframe instead?"
] | [
".htaccess"
] |
[
"Why my 4 bit binary half adder circuit design is showing incompatible width in LOGISIM?",
"I am trying to create a half adder circuit using logisim to compute two 4 bit binary numbers but somehow Logisim tells me that I have incompatible widths and I therefore have to change the bit width of every single component including the carry-out which is suppose to be a 1 bit (showing carry 1 or carry 0). Now I understand that my output has to be at least 4 bit in length and I need an extra bit as a carry out but even when I change the length the way Logisim wants then my design does not work anymore.\n\nHalf adder of a 2 four bit binaries"
] | [
"logic"
] |
[
"Makefile unable to compile file",
"Netbeans 7.3\ngcc 4.5.3\n\nI've looked at some of the answers to this question but I don't see my specific case. \n\nThe makefile generated by Netbeans seems to be correct. The output given in the Netbeans terminal window gives a No rule to make target ReadList.cpp , which seems to be wrong. I can't figure out what's going on.\n\nThe output window shows:\n\n\"/usr/bin/make\" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf\nmake[1]: Entering directory `/c/home/skidmarks/Projects/SLIP/slip'\n\"/usr/bin/make\" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/slip.exe\nmake[2]: Entering directory `/c/home/skidmarks/Projects/SLIP/slip'\nmake[2]: *** No rule to make target `ReadList.cpp', needed by `build/Debug/Cygwin_4.x-Windows/ReadList.o'. Stop.\nmake[2]: Leaving directory `/c/home/skidmarks/Projects/SLIP/slip'\nnbproject/Makefile-Debug.mk:94: recipe for target `.build-conf' failed\nmake[1]: *** [.build-conf] Error 2\nmake[1]: Leaving directory `/c/home/skidmarks/Projects/SLIP/slip'\nnbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed\nmake: *** [.build-impl] Error 2\n\n\nBUILD FAILED (exit value 2, total time: 375ms)\n\n\nThe makefile used shows:\n\n${OBJECTDIR}/SlipReadList.o: SlipReadList.cpp \n ${MKDIR} -p ${OBJECTDIR}\n ${RM} [email protected]\n $(COMPILE.cc) -g -w -MMD -MP -MF [email protected] -o ${OBJECTDIR}/SlipReadList.o SlipReadList.cpp\n\n\nThe makefile appears correct and works for other files. I have verified that the .cpp and .h files are in the same directory and are in the same directory as other successfully compiled files. Anyone have an idea what's wrong?"
] | [
"c++",
"netbeans",
"makefile"
] |
[
"Scrapy - Manual Login",
"I am building a very simple scraper using scrapy in order to scrape a certain element from a set of urls. However, I have to be logged in to the website in order to do this and I can not get the login part of my scraper working.\n\nIs it possible to login to the website manually and then let my scraper do the scraping task?"
] | [
"python",
"login",
"scrapy",
"manual"
] |
[
"Understanding I/O disk accesses from docker container",
"As we know in docker there exists something like storage-driver (like devicemapper, overlay2 and so on). \nThere exists some thing that I don't understand:\nContainer can access to volume or its own filesystem.\n\nHow is it possible that docker storage driver can intercept such request of I/O access? After all, code of storage driver must do the work, however, container is like process, so requests should be processed by OS. On the other hand, these requests must be processed by storage driver (after all, it may require some diving into deeper layers and so on). \n\nDoes it mean that each I/O request is processes by storage driver? How is it possible? What about accesses to volumes?"
] | [
"linux",
"docker",
"filesystems",
"storage",
"block-device"
] |
[
"Chrome Browser Uncaught TypeError in Handlebars Template",
"Hi I am using following code to display durations with handlebars template. But Chrome browser says error: \n\n\n Uncaught TypeError: Cannot read property 'replace' of undefined\n\n\nPlease assist me what I am doing wrong.\n\nJSON:\n\nduration : [\"monthly\", \"yearly\"]\n\n\nTemplate:\n\n{{#each duration}}\n <input type=\"radio\" name=\"duration\" id=\"{{.}}\" class=\"mLZero {{#ifCond . 'monthly'}}ns-month {{else}}ns-year {{/ifCond}}\" />\n <label type=\"radio\" name=\"duration\" for=\"{{.}}\" class=\"fCaps mR10 {{#ifCond . 'monthly'}}ns-month {{else}}ns-year {{/ifCond}}\">{{.}}</label>\n{{/each}}"
] | [
"javascript",
"jquery",
"json",
"handlebars.js"
] |
[
"Passing Variable to Java Through JSP?",
"I'm wondering if it is possible to pass form data from index.jsp file to a java class and then back to the response.jsp. I'm trying to compute something with the data they have entered into index.jsp but it can't be done in Javascript. Is there a way that I can retrieve the data?\n\nThe other thing is using http servelts and writing the entire html in Java, but that seems overly complex and not worth the effort if there are simpler ways of doing this.\n\nThanks in advance for the help!\n\nThis is one of the scripts (in javascript) that I written to try and solve this problem, but my class, RunPython.java, always comes an error?\n\n<script type=\"text/javascript\">\n\nfunction onSubmit(){\n var Bugfile = document.forms[0][\"BugFile\"].value;\n var GD = document.forms[0][\"GD\"].value;\n\n<%\nString s = request.getParameter(\"Bugfile\"); \nString d = request.getParameter(\"GD\");\nRunPython re = new RunPython(s,d);\n%>\n\n}\n\n\n\n\nError:\norg.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP\n\nPWC6197: An error occurred at line: 61 in the jsp file: /index.jsp\nPWC6199: Generated servlet error:\nstring:///index_jsp.java:106: cannot find symbol\nsymbol : class RunPython\nlocation: class org.apache.jsp.index_jsp\n\nPWC6197: An error occurred at line: 61 in the jsp file: /index.jsp\nPWC6199: Generated servlet error:\nstring:///index_jsp.java:106: cannot find symbol\nsymbol : class RunPython\nlocation: class org.apache.jsp.index_jsp"
] | [
"java",
"javascript",
"jsp",
"servlets"
] |
[
"Google App Script - Send long email from google sheet - email broken into lines",
"I tried to autosend mass emails from google script editor, using a list of email addresses on google sheet. I followed this tutorial.\n\nI used my other gmail address as a test and succeeded in receiving the email, but I found that some longer sentences are broken into several lines that are not compatible with the browser size. \nI have tried the GmailApp.sendEmail method instead of the MailApp.sendEmail one, but the sentences are just broken in slight different ways.. However, the email format seems current when I sent it to my sender address..\n\nDoes anyone know how to send a complete normal long email? Many thanks!"
] | [
"google-apps-script",
"gmail-api",
"mailmerge"
] |
[
"most efficient way to build json from php and mysql",
"My target JSON object is to look like this structure\n\n[\n {\n \"categories\":[\n {\n \"CATEGORY_ID\":\"Drinks\",\n \"subcategorys\":[\n {\n \"subcateory_ID\":\"beer\",\n \"items\":[\n {\n \"item_NAME\":\"yuengling\",\n \"item_id\":1\n },\n {\n \"item_NAME\":\"miller lite\",\n \"item_id\":2\n }\n ],\n \"subcateory_ID\":\"wine\",\n \"items\":[\n {\n \"item_NAME\":\"white zin\",\n \"item_id\":3\n }\n ]\n }\n ]\n },\n {\n \"CATEGORY_ID\":\"food\",\n \"subcategorys\":[\n {\n \"subcateory_ID\":\"sandwiches\",\n \"items\":[\n {\n \"item_NAME\":\"hamburger\",\n \"item_id\":1\n },\n {\n \"item_NAME\":\"ham & cheese\",\n \"item_id\":2\n }\n ],\n \"subcateory_ID\":\"sides\",\n \"items\":[\n {\n \"item_NAME\":\"fries\",\n \"item_id\":3\n }\n ]\n }\n ]\n }\n ]\n }\n]\n\n\nMy sql queries are like this\n\nSELECT categories.id, category_name FROM categories WHERE site_id = 1\n\nSELECT sub_categories.id, sub_category_name FROM sub_categories WHERE site_id = 1 AND category_id = 1\n\nSELECT items.id, item_name FROM items WHERE site_id = 1 AND sub_category_id = 1 AND site_id = 1\n\n\nI've struggled with finding the most efficient way to create this json in php with nested loops after each select.\n\nThis is the path I started down\n\n $query1 = \"SELECT categories.id, category_name FROM categories WHERE site_id = \".$siteId;\n\n $result1 = mysqli_query ($dbc, $query1) or trigger_error(\"Query: $query1\\n<br />MySQL Error: \" . mysqli_error($dbc));\n\n if($result1 === FALSE)\n{\necho(mysqli_error()); // TODO: better error handling\n} else\n{\n\n$categoriesJson = ' [ {\"categories\":[{'\n\nwhile( $row = mysqli_fetch_array($result1) )\n{\n $category = $row['category_name'];\n $categoriesJson = $categoriesJson.'\"CATEGORY_ID\":\"'.$category.'\",\"subcategorys\":[{';\n\n\n // Make the query:\n $query2 = \"SELECT sub_categories.id, sub_category_name FROM sub_categories WHERE site_id = \".$siteId . \" AND category_id = \". $row['id'];\n $result2 = mysqli_query ($dbc, $query2) or trigger_error(\"Query: $query2\\n<br />MySQL Error: \" . mysqli_error($dbc));\n if($result2 === FALSE)\n {\n echo(mysqli_error());\n }\n else\n {\n while( $row2 = mysqli_fetch_array($result2) )\n {\n $subcategory = $row2['sub_category_name'];\n $categoriesJson = $categoriesJson.'\"subcateory_ID\":\"'.$subcategory.'\",\"items\":[{';\n\n\n $query3 = \"SELECT items.id, item_name FROM items WHERE site_id = \".$siteId . \" AND sub_category_id = \". $row2['id'] . \" AND site_id = \".$siteId;\n $result3 = mysqli_query ($dbc, $query3) or trigger_error(\"Query: $query3\\n<br />MySQL Error: \" . mysqli_error($dbc));\n if($result3 === FALSE)\n {\n echo(mysqli_error());\n } else\n {\n\n while( $row3 = mysqli_fetch_array($result3) )\n {\n $itemname = $row3['item_name'];\n $itemid = $row3['id'];\n $categoriesJson = $categoriesJson.'\"itemName\":\"'.$itemname.'\",\"itemId\":\"'.$itemid.'\"';\n\n\n\n }\n $categoriesJson = $categoriesJson.'}]';\n }\n\n }\n\n $categoriesJson = $categoriesJson.'}]';\n\n }\n $categoriesJson = $categoriesJson.'}]';\n}"
] | [
"php",
"mysql",
"json"
] |
[
"Apache gora, where to set new table name in reducer",
"I have an application that is basically an Hbase Mapreduce job with Apache Gora.\nI am very simple case that I want to copy one Hbase table data to a new table. Where to write new table name. I have reviewed this Guide but could not find where to put new table name.\nFollowing is the code snippet, \n\n/* Mappers are initialized with GoraMapper.initMapper() or \n * GoraInputFormat.setInput()*/\n GoraMapper.initMapperJob(job, inStore, TextLong.class, LongWritable.class,\n LogAnalyticsMapper.class, true);\n\n /* Reducers are initialized with GoraReducer#initReducer().\n * If the output is not to be persisted via Gora, any reducer \n * can be used instead. */\n GoraReducer.initReducerJob(job, outStore, LogAnalyticsReducer.class);\n\n\nSimple MR job is very easy for this case."
] | [
"java",
"hadoop",
"mapreduce",
"hbase",
"gora"
] |
[
"How to post text message to server using ASIHTTPREQUEST handler in iOS?",
"I am create one comment screen with one textFileds and buttons when I enter some text in textfield and press buttons that text should post on my sever . my request is started but my textField value not display . give me this message.\n\n2014-10-31 14:01:29.314 SMSProject[5894:137428] request started...\n2014-10-31 14:01:29.922 SMSProject[5894:137428] Response 200 : \"Invalid Request\"\n\n\nI am using this API.\n\n -(void)sendRequest\n {\n deatilinfoarray = [[NSMutableArray alloc] init];\n NSURL *url = [NSURL URLWithString: \n @\"http://sms.instatalkcommunications.com/apireq/AddCommentForSMS\"];\n ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];\n [request setRequestMethod:@\"POST\"];\n\n [request setPostValue:@\"Id\" forKey:@\"Id\"];\n [request setPostValue:commenttext forKey:@\"Comment\"];\n [request setPostValue:@\"Author\" forKey:@\"Author\"];\n [request setPostValue:@\"SMSId\" forKey:@\"SMSId\"];\n [request setPostValue:@\"CreatedDate\" forKey:@\"CreatedDate\"];\n [request setDelegate:self];\n [request startAsynchronous];\n\n }\n\n - (void) requestFinished:(ASIHTTPRequest *)request\n {\n\n NSLog(@\"Response %d : %@\", request.responseStatusCode, [request responseString]);\n\n //NSData *responseData = [request responseData];\n }\n\n - (void) requestStarted:(ASIHTTPRequest *) request\n {\n NSLog(@\"request started...\");\n }\n\n - (void) requestFailed:(ASIHTTPRequest *) request\n {\n NSError *error = [request error];\n NSLog(@\"%@\", error);\n }\n\n - (IBAction)btnpost:(id)sender\n\n {\n\n [self sendRequest];\n\n }\n\n\nI am not getting how to code for that please suggest me."
] | [
"ios",
"objective-c",
"asihttprequest"
] |
[
"My app with 3 servlet runs fine on Tomcat but displays 404 error when I try to run it as a container in Docker",
"Structure of project and Docker file I tried :\n\nI have an app with 3 servlets that is running fine from tomcat when I start it from IDEA but I have trouble making it run as a docker container. The container runs successfully but then it displays 404 error. What changes do I need to make to the dockerfile?"
] | [
"java",
"docker",
"tomcat",
"servlets"
] |
[
"ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked",
"import { Component } from '@angular/core'; import { PeriodsService } from '../periods';\n\n@Component({\n selector: 'app-control-panel',\n templateUrl: './control-panel.component.html',\n styleUrls: ['./control-panel.component.css'] \n}) \nexport class ControlPanelComponent {\n private selectedPeriod;\n private selectedPosition;\n\n constructor(\n private periodsService: PeriodsService,\n private positionsService: PositionsService,\n private classifierService: ClassifierService\n ) {\n this.periodsService.periodChange.subscribe(period => {\n this.selectedPeriod = period;\n });\n }\n\n get periodTitle() {\n return this.selectedPeriod.p_display_name;\n }\n\n }\n\n\n //Template file: control-panel.component.html\n {{periodTitle}}\n\n\n\n Blockquote"
] | [
"angular",
"angular-components"
] |
[
"Redshift separate partitions with identical data by time",
"I have data in a Redshift table like product_id, price, and time_of_purchase. I want to create partitions for every time the price changed since the previous purchase. In this case the price of an item may go back to a previous price, but I need this to be a separate partition, e.g.:\n\nNote the price was $2, then went up to $3, then went back to $2. If I do something like (partition by product_id, price order by time_of_purchase) then the last row gets partitioned with the top two, which I don't want. How can I do this correctly so I get three separate partitions?"
] | [
"sql",
"amazon-redshift",
"partition"
] |
[
"VBA Debugging with breakpoints",
"I need to debug part of a VBA code. \nSo I've set a breakpoint in the line I want to start debugging.\nBut after pressing F8 a few times I want the code to run normally (without having to press F8).\n\nHow do I do it?"
] | [
"vba",
"debugging",
"breakpoints"
] |
[
"Value referenced by NEW on an unchanged column in an UPDATE trigger",
"I have a table Group_Members with a DELETE trigger and an UPDATE trigger. The DELETE trigger updates some rows in A hence invoking the UPDATE trigger.\n\nHere's the DELETE trigger code:\n\nUPDATE Group_Members\nSET Role = 'Admin'\nWHERE JoinDate = (SELECT MIN(JoinDate)\n FROM Group_Members\n WHERE GroupName = OLD.GroupName);\n\n\nHere's the invoked UPDATE trigger code:\n\nINSERT INTO Group_Notifications (Destination, Source, \"Group\", Type)\nVALUES (OLD.Username, NEW.Affector, OLD.GroupName, 'Membership Promotion');\n\n\nMy question is: what would be the value referenced by NEW in the UPDATE trigger given the column value has not been changed i.e. in this scenario, what would be the value referenced by NEW.Affector?"
] | [
"sql",
"database",
"sqlite",
"triggers"
] |
[
"Compile-Time container of functors for controlling an algorithm?",
"Suppose i want something simple like the following:\n\nI have an core-algorithm, which randomly selects one of the specialized algorithms (specialized at compile-time) and process this algorithm. These specialized algorithms are implemented trough functors. \n\nThe question is now: how to implement a container, which is build at compile-time, where the core-algorithm can first check the size of this container (\"i got 4 algorithms -> need to randomly select algorithm 0-3\") and can then execute the functor in this container (\"randomly chosen 2 -> process the third functor in container\").\n\nHow would one implement it as simple as possible? I suppose it is possible.\n\nIs there any connection to the curiously recurring template idiom? (wiki link)\nIs there a simple way with the use of Boost::Fusion? (official doc)\n\nEdit: All the algorithms will be used in the core-algorithm. The use pattern (random-numbers) is a runtime-decision (so i don't need compile-time-rands). The algorithm just has to know the container of functors and the size of this container for safe access."
] | [
"c++",
"generic-programming",
"boost-fusion",
"template-meta-programming"
] |
[
"Switch statement doesn't work with enum (C++)",
"enum Maximum_Value{\n MAXIMUM_VALUE_1 = 0,\n MAXIMUM_VALUE_7 = 1,\n MAXIMUM_VALUE_15 = 2,\n MAXIMUM_VALUE_26 = 3,\n MAXIMUM_VALUE_34 = 4\n};\n\nint value_from_function = functionetc();\n\nswitch(value_from_function){\n MAXIMUM_VALUE_1: printf(\"MAXIMUM_VALUE_1 :%x\\n\",value_from_function); break;\n MAXIMUM_VALUE_7: printf(\"MAXIMUM_VALUE_7 :%x\\n\",value_from_function); break;\n MAXIMUM_VALUE_15: printf(\"MAXIMUM_VALUE_15 %x\\n\",value_from_function); break;\n MAXIMUM_VALUE_26: printf(\"MAXIMUM_VALUE_26 %x\\n\",value_from_function); break;\n MAXIMUM_VALUE_34: printf(\"MAXIMUM_VALUE_34 %x\\n\",value_from_function); break; \n default: printf(\"default :%x\\n\",value_from_function);\n }\n\n\nThe code above always seems to hit the default statement, printing \"default :0\" even though that should hit MAXIMUM_VALUE_1.\n\nI've tried casting the variable in switch to no effect\n\nI guess I should save the return value into a variable of type \"Maximum_Value\", but why doesn't the code work anyway?\n\nEdit: Thanks for pointing out the awfully stupid mistake everyone :P. The root of the problem was copying coding from systemverilog, which uses 'case' as a keyword instead of 'switch', and doesn't require 'case' at the start of each case"
] | [
"c++",
"enums",
"switch-statement"
] |
[
"How to mock JPA repository's find method in unit tests",
"I'm trying to UT my little project and I have a problem.\nMy application use a simple Layered Architecture and I can't happen to UT the service Layer.\nIn fact I'm trying to mock the class CrudRepository from Spring-data.\nI'm trying to mock the method findAll of one of my repository that is extending this class but mockito can't mock Interface.\nIs there a way to do it simply aside from creating the bean myself and filling it ?\n\n[Update]\nHere is the Repository Code :\n\npackage fr.kaf.interview.Repository;\n\nimport fr.kaf.interview.model.Book;\nimport org.springframework.data.repository.CrudRepository;\nimport org.springframework.stereotype.Repository;\n\n@Repository\npublic interface BookRepository extends CrudRepository<Book,Long> {\n}\n\n\nHere Is The UT :\n\n@ExtendWith(MockitoExtension.class)\nclass BookServiceTest {\n\n\n@Mock\nprivate BookRepository bookRepository;\n\n@InjectMocks\nprivate BookService bookService;\n\n@Test\npublic void should_get_All_books_from_database() {\n //Given\n\n Person author = new Person();\n author.setFirstName(\"Ka\");\n author.setLastName(\"AwQl\");\n\n Book firstBook = new Book();\n firstBook.setTitle(\"One Book\");\n firstBook.setAuthors(singletonList(author));\n\n Book secondBook = new Book();\n secondBook.setTitle(\"Second Book\");\n secondBook.setAuthors(singletonList(author));\n\n given(bookRepository.findAll()).willReturn(asList(firstBook, secondBook));\n\n //When\n List<Book> allBooks = bookService.getAllBooks();\n\n //Then\n assertThat(allBooks).containsExactly(firstBook, secondBook);\n\n}\n\n}"
] | [
"java",
"unit-testing",
"spring-boot",
"mockito",
"junit5"
] |
[
"How to get a list of area names from geo coding",
"Iam getting a area name from geo coding my code is.\n\n $geocode=file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng='.$latitude.','.$longitude.'&sensor=false');\n\n\ncan i give here list of lat and long instead of one lat and long because i have a 700 points and geo coding taking too much time to compute."
] | [
"php",
"android",
"google-maps"
] |
[
"Title bar picture shows up on one page, but not the others",
"I am doing a website for someone and I have their logo in the title of my html. The home page has the logo on it, but when I open any of the other pages for the site, the picture doesn't show up. Anyone know what the problem might be?\n<head>\n <meta charset = "utf-8">\n <title src = "./images/Title.jpg" alt = "header">Sample Title</title>\n</head>\n\nThis is how it looks on all the other pages as well."
] | [
"javascript",
"html",
"css",
"jpeg"
] |
[
"How to create ng-pattern not allowing uppercase",
"How to create ng-pattern in angular not allowing input in uppercase?Thanks in advance. Like this pattern. ng-pattern=\"/^[a-zA-Z0-9]*$/\""
] | [
"regex",
"angularjs"
] |
[
"Delay appending to element",
"I'm new to JavaScript, and i'm just wondering if it's possible to delay appending elements to another element. I have a map, which i've appended points in the form of anchor tags. Once the page loads all of the markers are displayed. I thought it would be a nice feature to add each pointer with a short delay. Here is how I currently append,\n\nelement = $(\"<a href='#' class='deskBtn tooltip fancybox' title='\" + this.allData[i].Name + \"' data-name='\" + this.allData[i].UserName + \"' data-department='\" + this.allData[i].DepartmentName + \"'></a>\");\n\n$(element).css({\n \"top\": this.allData[i].DeskYCoord,\n \"left\": this.allData[i].DeskXCoord\n}).appendTo(\".map\");\n\n\nI tried exposing the setInterval method after the append, however, I was unable to do so. Any help would be greatly appreciated."
] | [
"javascript",
"jquery"
] |
[
"Converting a Google-esque Search Query to search a Mongo database via Node.js",
"I'd like to be able to translate a search string in \"Google-eqsue\" format into something that can be used to search a Mongo database (I assume that RegEx is a good idea here, but am open to other ideas). What I mean by Google-esque queries:\n\n\"Search for\" +this -\"but not this\"\n\n\nIdeally, I'm looking for a Javascript algorithm that will take the Google-esque query and return something that will allow me to perform a single, fast query on the text of documents in a MongoDB. The reason I assumed that it would be best to translate this into a RegExp is that Regular Expressions fit these goals (edited)."
] | [
"javascript",
"regex"
] |
[
"React hot-loading stopped self updating",
"I'm trying to implement a solution with react and symfony 2.8, but as I'm new to react I'm still in the tutorials step. Once I though I had a good enough knowledge from react I decided to try and integrate React with symfony and I was almost successful in that. I managed to get a symfony view to load react components but was unable to do live edits, and by that I mean, I have to restart webpack and press F5 to reload the page. So I decided to go back to the tutorials I made and see what I was doing wrong. When I start a new react project (by using \"create-react-app projectName\") to see where I failed, this project had the same problem, I had to reload the webpack so I could see the changes I made, and I know that this project was able to live-edits (because was the first tutorial I made and was working at the time), all I needed to do is to save the document and the page should automatically show the changes I made.\nI think that showing the code its not important in this case because it's a fresh project by using the command I said before, but anything you need I can try to explain you or giving the code."
] | [
"reactjs",
"webpack",
"symfony-2.8",
"react-hot-loader"
] |
[
"Attachment empty when shell script runs python module to make file and email",
"My shell script runs a python task manager module that, at the end, makes a .png file. Then the shell script emails me the .png. If I run the tasks separately, they're fine, but combining them in the same .sh results in an email with an empty attachment.\n\nTail end of the python:\n\nfig = plt.figure()\nax2 = fig.add_subplot(111)\nax2.scatter(goodRIDs.ASL75,goodRIDs.closet_count_per_slot, \n color='green',alpha=0.2)\nax2.scatter(badRIDs.ASL75,badRIDs.closet_count_per_slot, \n color='red',alpha=0.5)\n\nplt.savefig('todaysASL'+str(pct)+'chart.png')\n\npath = os.getcwd()\nos.chdir(path+'/ASLgraphs')\nplt.savefig(today+'ASL'+str(pct)+'vClosetperSlot.png')\n\n\nAnd the shell script:\n\n. venv/bin/activate\n\n\nfile=/home/todaysASL75chart.png\nfile1=/home/todaysASL95chart.png\n\npython ~/WeeklyRIDTrendFinder.py 75 > $file\npython ~/WeeklyRIDTrendFinder.py 95 > $file1\n\n\n(echo \"Today's ASL chart for the past week\" ; uuencode $file ; uuencode $file1 )\n | mail -s \"Weekly ASL Chart\" -r \"[email protected]\" [email protected]\n\n\nIs this some sort of flushing issue? I tried doing plt.flush(), but apparently plot modules don't act like files."
] | [
"python",
"shell"
] |
[
"Wrapper DLL for Python: \"fatal error LNK1127: library is corrupt\"",
"Brief description\n\nI have a DLL programmed in ADA with GNAT. I want to compile with MSVC another DLL in C as a wrapper to the ADA_DLL in order to use it with Python.\n\nI have compiled the ada_DLL, then I have generated the .lib file according to gnat documentation about MSVC. And finally I tried to compile the C_DLL with Visual-Studio, getting the error:\n\nlibmath.lib : fatal error LNK1127: library is corrupt\n\n\nUpdate: In the case of compiling with gcc as suggested by @Brian, I get the following output:\n\n>\"C:\\GNAT\\2015\\bin\\gcc.exe\" -c -IC:\\Python27\\include -o libmath_c.o libmath_c.c\n>\"C:\\GNAT\\2015\\bin\\gcc.exe\" -shared -LC:\\Python27\\libs -L./ -l libmath -o DIVISION_CPP.pyd libmath_c.o -lpython27\n .//libmath.lib: error adding symbols: Malformed archive\ncollect2.exe: error: ld returned 1 exit status\n\n\nThings I tried & more data:\n\nI have tried importing the ADA_DLL directly with ctypes in Python and it works, so I believe that the ADA_DLL is correctly compiled. Also, forgetting about the C_DLL is not really an option.\n\nI did a small example with a division example module. My .def file looks something like:\n\n; dlltool -z libmath.def --export-all-symbols libmath.dll\nEXPORTS\n [...]\n div @ 259\n [...]\n\n\nThe libmath_c.c:\n\n#include \"libmath_c.h\"\n PyObject* _wrap_DIVISION(PyObject *self, PyObject *args){\n div(10, 2);\n return Py_None;\n }\n __declspec(dllexport) void __cdecl initDIVISION_CPP(void){\n Py_InitModule(\"DIVISION_CPP\", LIB_METHODS_methods);\n }\n\n\nThe libmath_c.h:\n\n#include <windows.h>\n#include <stdio.h>\n#include <Python.h>\nPyObject* _wrap_DIVISION(PyObject *self, PyObject *args);\nstatic PyMethodDef LIB_METHODS_methods[] = {\n { \"CPP_DIVISION\", _wrap_DIVISION, METH_VARARGS },\n {NULL, NULL, 0, NULL} //Added as indicated by @Brian. Thanks! \n};\n__declspec(dllexport) void __cdecl initDIVISION_CPP(void);\n\n\nAny idea of what is happening? Any help would be really appreciated. Thanks!"
] | [
"python",
"c",
"dll",
"ada",
"gnat"
] |
[
"Transaction failed while using viva payment",
"We are using viva payment gateway, when we try to make payment with credit card some cards are able to make payment and for some cards we receive error "The merchant with id xxxx does not have a source with code '123' assigned or the source is disabled".\nAlso we found that some cards do not ask for OTP and make direct transaction"
] | [
"android",
"payment-gateway",
"payment"
] |
[
"Modify Bootstrap's navbar",
"I have applied a style of padding left to the #my_account li. But I don't want that style applied when the navbar is collapsed. \n\nDoes anyone know on how I can have that style only when the navbar is not collapsed? Thanks!\n\nCSS\n\n#my_account {\n padding-left: 60px;\n}\n\n\nHTML\n\n <nav class=\"navbar navbar-default navbar-static-top' role='navigation' \">\n <div class=\"fluid\" >\n <!-- Brand and toggle get grouped for better mobile display -->\n <div class=\"navbar-header\">\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#nav_bar_collapsed\" aria-expanded=\"false\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <div class=\"collapse navbar-collapse\" id=\"nav_bar_collapsed\">\n <ul class=\"nav navbar-nav\">\n <li>\n <a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">My Projects</a>\n </li>\n <li>\n <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n Freelancers\n <span class=\"caret\"></span>\n <ul class=\"dropdown-menu\">\n <li>\n <a href=\"#\">Manage Hired Freelancers</a></li>\n <li><a href=\"#\">Manage Applicants</a></li>\n </ul>\n </a>\n </li>\n <li><a href=\"#\">Project To Do List</a></li>\n <li><a href=\"#\">Inbox</a></li>\n <!-- Email Templates , Account Setting, Finical Summary, Contact Us Log Out-->\n <li id=\"my_account\"><a href=\"#\">My Account</a> </li>\n </ul>\n </div>\n </div>\n </div>\n</nav>"
] | [
"twitter-bootstrap",
"twitter-bootstrap-3"
] |
[
"TestNG not Compatible with Eclipse Luna and Eclipse Indigo",
"I installed TestNG in Eclipse Luna and Eclipse Indigo but TestNG is not showing in the preferences window. I followed right step 2 times as mentioned at below link\n\nhttp://www.guru99.com/all-about-testng-and-selenium.html\n\nIt is giving me the same problem in both versions of Eclipse... Any suggestion how to start working with TestNG?"
] | [
"java",
"selenium",
"testng",
"eclipse-luna",
"eclipse-indigo"
] |
[
"Windows Phone 8.1 AppBar Taking Up Unnecessary Room",
"I have an AppBar in my app which holds only a secondary command.\n\n<Page.BottomAppBar>\n <CommandBar>\n <CommandBar.SecondaryCommands>\n <AppBarButton Label=\"refresh\" Click=\"Refresh_WebView\"/>\n </CommandBar.SecondaryCommands>\n </CommandBar>\n</Page.BottomAppBar>\n\n\nHowever, it still leaves enough of the AppBar \"visible\" (you don't have to pull it up to see it) to leave room for the PrimaryCommands that aren't there. This is wasting a lot of space. The Store is doing the same thing in the Downloads section, but the AppBar doesn't take up that unnecessary space. How can I specify that I don't want mine to, either?"
] | [
"xaml",
"windows-phone-8.1"
] |
[
"OSGi logging from legacy apps?",
"Let's say I have four legacy jars:\n\n\nmy-library.jar\nmy-app.jar\nmy-other-app.jar\nlog4j.jar\n\n\n\"My App\" and \"My Other App\" are unrelated applications, both with main() functions. They both use various library functions from \"my-library-app\". All three do logging through log4j (really slf4j, but I just want to keep the example simple).\n\nCurrently, the two applications are set up with two different log4j config files, which cause them to log to two different files.\n\nNow I want to convert everything to OSGi. So I bundle up the first three each as a separate bundle, convert the main() of the actual apps to Activators, and either bundle up or find an existing bundle of log4j. I start both apps in the same OSGi framework.\n\nBut now the two distinct apps no longer log to different files! Right? There's only one instance of log4j running in the JVM, and it gets its configuration out of one single log4j.properties file.\n\nSo maybe instead of bundling each of my four jars separately, I make three bundles:\n\n\nMy Library\nMy App plus log4j\nMy Other App plus log4j\n\n\nNow I can get different logging config files for the two different apps. But what about log calls from My Library? The My Library bundle will latch onto one of the two copies of log4j, and now all log messages produced from My Library will come out in one specific one of the two log files - let's say the one for My App. But that's true even if it's a log message from My Library due to a call from My Other App! They'll go to the wrong log file.\n\nSo maybe bundle:\n\n\nMy Library plus log4j\nMy App plus log4j\nMy Other App plus log4j\n\n\nNow the log messages from My Library are going to their own log file, which I guess is better than some of them going to the wrong app's log file, but still, it's not great. That file has log messages from both apps, and neither of the log files intended to be for either app have all log messages from those apps. \n\nSo maybe bundle:\n\n\nMy App plus My Library plus log4j\nMy Other App plus My Library plus log4j\n\n\nBut now what's the point of OSGi? I'm not sharing use of My Library or of log4j. And in reality it will likely be even worse - there will be a bunch of jars that I have to stick multiple copies of into all of my actual app bundles, simply because I want to see their log messages associated with the app that caused them.\n\nSo maybe back up and try something different: I don't think this is possible in log4j, but in (say) slf4j I could go back to the original bundle plan:\n\n\nMy Library\nMy App\nMy Other App\nlog4j\n\n\nAnd then I do something like put MDC information in each thread saying what app the thread is from. React to that MDC info to determine what log file it goes into.\n\nBut it seems like that won't work either! A call from some thread in My App to some function in My Library could cause a new thread to be spawned from My Library, which would not necessarily be associated with that MDC.\n\nAnd it's worse than that: My Library could have some thread that is shared by any app that uses My Library, so cannot possibly be associated with some such marker.\n\nSo, all in all, I'm stumped. Any suggestions would be greatly appreciated. Thanks in advance."
] | [
"logging",
"log4j",
"osgi",
"slf4j",
"legacy"
] |
[
"Powershell winform event handlers in classes cause scope trouble",
"I'm experimenting with creating GUIs and using classes in powershell. I'm really new to both of those things (and to a lesser extent powershell generally) so bear with me.\nThe problem I am having is I cannot make any control which makes any modification to the form. This is because when adding a handler to a button it goes into the scope of the button class in the handler and none of the form references are accessible.\nMost examples of UI code in powershell are not class heavy. I realize that I could get around this, if it was not in a class, by having the handlers and form being in the global scope, but I'm trying to make use of classes so that I have the ability to make base forms and inherit from them. And I want to see what is possible.\nBelow is some test code including multiple of my attempts to make this work with the results commented. I even got the idea of passing the form reference into the handler (DI style). Things I'm trying are all over the map since I'm also feeling out basic powershell syntax.\nAdd-Type -AssemblyName System.Windows.Forms\nAdd-Type -AssemblyName System.Drawing\n\n \nclass Window : System.Windows.Forms.Form\n{\n Handler () {\n Write-Host Handler\n $this.BackColor = [System.Drawing.Color]::Blue\n }\n\n HandlerArgs ([object]$sender, [System.Eventargs]$eventArgs) {\n Write-Host HandlerArgs\n $this.BackColor = [System.Drawing.Color]::Blue\n }\n \n $HandlerVar = {\n Write-Host HandlerVar\n $this.BackColor = [System.Drawing.Color]::Blue\n }\n\n HandlerParam ($form) {\n Write-Host HandlerParam\n $form.BackColor = [System.Drawing.Color]::Blue\n }\n\n $HandlerVarParam = {\n (params $form)\n Write-Host HandlerVarParam\n $form.BackColor = [System.Drawing.Color]::Blue\n }\n \n Window ()\n {\n $button = New-Object System.Windows.Forms.Button\n $button.Text = "ClickMe"\n $button.AutoSize = $true\n $this.Controls.Add($button)\n\n\n\n # $button.Add_Click( $this.Handler )\n # "Cannot convert argument "value", with value: "void Handler()", for "add_Click"\n # to type "System.EventHandler": "Cannot convert the "void SelectNextPage()" \n # value of type "System.Management.Automation.PSMethod" to type "System.EventHandler"."\n\n # $button.Add_Click(([System.EventHandler]$x = $this.Handler ))\n # turns the window blue immediatly\n \n # $button.Add_Click( $this.HandlerArgs )\n # "Cannot convert the "void HandlerArgs(System.Object sender, System.EventArgs eventArgs)" \n # value of type "System.Management.Automation.PSMethod" to type "System.EventHandler".""\n\n # $button.Add_Click( $this.HandlerVar ) \n # this works but turns the button blue instead of the form\n\n # $button.Add_Click( { $this.Handler } )\n # does nothing?\n\n # $button.Add_Click( { $this.Handler() } )\n # Method invocation failed because [System.Windows.Forms.Button] does not contain a \n # method named 'Handler'.\n\n # $button.Add_Click( $this.HandlerParam($this) )\n # turns the window blue immediatly \n\n # $button.Add_Click( { $this.HandlerParam($this) } )\n # Method invocation failed because [System.Windows.Forms.Button] does not contain a\n # method named 'HandlerParam'.\n\n # $button.Add_Click( $this.HandlerVarParam $this )\n # parse error\n # I can't find a syntax that lets me pass a param to a function in a variable\n }\n}\n\n\n$foo = New-Object Window\n$foo.ShowDialog()\n\nAlthough it's likely super obvious already, c# is my main language.\nPerhaps this is just a limitation of the OO support in an interpreted scripting language, or maybe it's just my syntax deficiency. Is there any pattern that will get me what I want in this class-based structure? I would hope the pattern would be a general solution for doing normal form-things with handlers of form-controls."
] | [
"winforms",
"powershell",
"class",
"oop",
"user-interface"
] |
[
"inavlid o_auth signature error while using fatsecret food api",
"I am stuck in invalid oauth signature issue for FatSecret REST api in my iphone app. Below is the response \nerror = {\n code = 8;\n message = \"Invalid signature: oauth_signature 'giWu0JtjgG3OBqD_sBCByz-Q2Gk='\";\n };\n\nI am creating signed request using HMAC_SHA1, for some of the searches its returning the correct signature and in some of the cases its giving above error for food.get and food.search methods\n\nAny help would be useful\nThanks in advance!!"
] | [
"iphone",
"oauth",
"error-handling"
] |
[
"protractor Page Object - method is not being called",
"I am in the process of learning protractor using paject object. Here is my Page object file and my test spec. files:\n\nPage Object (file name PO_Login.js)\n\nvar ptor;\nvar LoginPage = function () \n{\n ptor = protractor.getInstance();\n this.login = function()\n {\n console.log(\"here\"); \n var user=ptor.findElement(protractor.By.id(\"username\"));\n user.sendKeys('admin');\n var pwd=ptor.findElement(protractor.By.id('password'));\n pwd.sendKeys('admin');\n }\n}\nmodule.exports = new LoginPage();\n\n\nMy Test spec file:\n\nvar ptor;\ndescribe(\n 'homepage', \n function() \n {\n var LoginPage = require('./LoginPO.js');\n beforeEach(\n function() \n {\n ptor = protractor.getInstance();\n var driver=ptor.driver;\n ptor.driver.get('http://localhost/xxxxxxxxxx/login');\n ptor.waitForAngular();\n }\n );\n\n it(\n 'xxxx',\n function()\n {\n ptor = protractor.getInstance();\n ptor.driver.findElement(protractor.By.tagName('html'))\n .getAttribute('ng-app').then(function(text)\n {\n expect(text).toBe('xxxxxxx.sso')\n }\n );\n\n ptor.driver.findElement(\n protractor.By.tagName('body')).getAttribute('id')\n .then(function(text)\n {\n expect(text).toBe('cas')\n }\n );\n },\n 10000\n );\n\n it(\n 'login', \n function() \n { \n console.log(\"here...\");\n LoginPage.login;\n // var ctrlpoints_url=ptor.getCurrentUrl();\n // expect(ctrlpoints_url).toContain('http://localhost/xxxxxxxxxxxxxxx/#/dashboard/points');\n // expect(loginPage.header.getText()).toEqual('xxxxxx'); \n }\n ); \n }\n);\n\n\nI am not sure what is wrong - the login method defined in Page object is not getting called. I used console.log() to debugg the script."
] | [
"javascript",
"angularjs",
"testing",
"protractor",
"end-to-end"
] |
[
"Downloading file though Box API 2.0 giving 200 as response instead of 302 found",
"I'm trying to download a file from Box.com through API using the following code.\n\n<cfhttp url=\"https://api.box.com/2.0/files/(FILE_ID)/content/\" method=\"GET\" redirect=\"true\" >\n<cfhttpparam type=\"header\" name=\"Authorization\" value=\"Bearer (DEVELOPER_TOKEN)\">\n</cfhttp>\n\n\nAs per documentation it should return 302 Found as response. And redirects to dl.boxcloud.com for download. But I'm getting 200 as response. \n\n\n\nNot sure why I'm getting 200 as response. I need to download the file through the API call. Did I missed anything?"
] | [
"coldfusion",
"box-api",
"box",
"boxapiv2"
] |
[
"javascript \"this\" keyword works as expected in browser but not in node.js",
"I know I'm making a mistake here but I can't figure out what it is.\n\nThe following code (non-strict mode) works as I expect in a browser and outputs \"hello\" to the console.\n\nfunction a() {\n console.log(this.bar);\n}\nvar bar = \"hello\";\na();\n\n\nBut when I run it in node \"undefined\" is the output. \n\nDoes anyone know the reason?"
] | [
"javascript",
"node.js"
] |
[
"WSO2 Enterprise Store - how can I add mobile apps?",
"I'm trying out the beta/unreleased code for EMM 2.0 (which I believe is now MDM) and I undestand that the mobile app store and publisher function have been moved to Enterprise Store, however I'm unable to see/add mobile apps - I only see Gadgets and Sites.\n\nI was looking for the source in case I missed the plugin, but at https://github.com/wso2/carbon-store/tree/master/features/extensions I only see Gadgets and Sites.\n\nCan someone tell me how to enable mobile apps and/or point me to the mobile app plugin source?\n\nFYI, I installed ES from http://wso2.com/products/enterprise-store/ and also master branch from the following:\n\n\nhttps://github.com/wso2/product-mdm.git\nhttps://github.com/wso2/carbon-device-mgt-plugins.git\nhttps://github.com/wso2/carbon-device-mgt.git"
] | [
"wso2",
"wso2-emm",
"wso2es"
] |
[
"Marquee not working in Google Chrome?",
"The code for bouncing in marquee is not working in Google Chrome browser...Why is it so?\nThe code is:\n\n <marquee height=200 width=1200 behavior=alternate>...</marquee>\n\n\nWhat behavior will work in Google Chrome?"
] | [
"html",
"google-chrome",
"marquee"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.