texts
sequence | tags
sequence |
---|---|
[
"Word Cannot Edit Range",
"I'm trying to automate the editing of a form and I've run into an issue with the bookmarks. The way I'm doing the forms is filling one out, saving it, redoing all the fields and saving it again. This saves time saving, opening and closing lots of different files and means I don't have to iterate through bookmarks and formfields each time.\n\nHowever it would appear that when a bookmark has text inserted into it using wordApp.Selection.TypeText() the bookmark is destroyed or lost. Whatever the case I can no longer get hold of it. At the moment I have been getting the range and placing a new bookmark at the location after I put text into the old one.\n\nUnfortunately this leaves the previous text behind when I try to replace it because I'm not overwriting the text in the old bookmark. Such as:\n\nForm 0:\n\nName: John Smith\n\nForm 1:\n\nName: Jane DoeJohn Smith\n\n\nI've been trying to select the previous text and delete it but I'm being blocked by two similar errors, \"Cannot Edit Range\" and \"Range cannot be deleted\". I'm attempting it with:\n\n//Exception - CANNOT EDIT RANGE\nRange range = doc.Bookmarks[fieldName].Range.Duplicate;\ndoc.Range(range.Start, range.End).Delete();\n\n\nI've also tried range.text = \"\" but I get the same result or \"Range Cannot be Deleted\".\n\nIt's a bit messy but I've tried many different variations of ranges trying to get the text but it always boils down to it not letting me change the text I've entered.\n\nI looked at the similar question to this:\n\nThe range cannot be deleted. at Microsoft.Office.Interop.Word.Range.set_Text(String prop)\n\nBut the answer there thus far has not been able to resolve my issue."
] | [
"c#",
".net",
"ms-word",
"range",
"office-interop"
] |
[
"How to exit a channel range / collect results",
"I need to process several tasks concurrently and then \"collect\" the results. Below is the code I came up with but I'm wondering if it's the right way to do this(i.e idiomatic/ best practice) or if there is something wrong that I might miss. \n\npackage main\n\nimport \"fmt\"\nimport \"sync\"\n\nfunc main() {\n // ch is the int provider. Cap is 99 but it should \n // really be 3\n ch := make(chan int, 99)\n var wg sync.WaitGroup\n for i := 0; i < 3; i++ {\n wg.Add(1)\n go func(i int) {\n defer wg.Done()\n ch <- i\n }(i)\n }\n wg.Wait()\n for v := range ch {\n fmt.Println(\"consume \", v)\n if len(ch) == 0 {\n close(ch)\n }\n }\n fmt.Printf(\"All done\")\n}"
] | [
"concurrency",
"go"
] |
[
"Python export to a TXT formatted or to Clipboard",
"I have a csv file that is something like BM13302, EM13203,etc\nI have to read this from a file then reformat it to something like 'BM13302', 'EM13203',etc\n\nWhat I'm having problems with is how do I export (write it either the clipboard or a file, I can cut and paste from. This is a tiny little project for reformatting some for part of some SQL code that's given to me in a unclean format and i have to spend a little while formatting it out. I would like to just point python to a directory and past the list in the file and have it export everything that way I need it.\n\nI have the following code working\n\nimport os\nf = open(r\"/User/person/Desktop/folder/file.csv\")\ncsv_f = csv.reader(f)\n\nfor row in csv_f:\n print(row)\n\n\nI get the expected results\n\nI would like find out how to take the list(?) and format it like this\n 'BM1234', 'BM2351', '20394',....etc\nand copy that to the clipboard\n\nI thought something doing something like \n\nwith open('/Users/person/Desktop/csv/export.txt') as f:\n f.write(\"open=\", + \"', '\")\nf.close()\n\n\nnothing is printed. Can't find an example of what I'm needing. Anyone able to help me out?? \n\nMuch Appreciate!"
] | [
"python",
"export-to-text"
] |
[
"How to tell from a media file if it's a video or an audio?",
"I have some files - audio and video files - stored in an aws s3 bucket, which can have different containers and stuff, and I would like to send them to the aws mediaConvert(MC). My issue is that I need to know whenever the file is an audio or a video file, because I need to configure the MC accordingly. The main app on the server is php based, but this information might not be that interesting.\nI have ffmpeg, and I already use ffprobe to get the file duration, however I can't tell from the returning data if it's a video or audio-only file. And in an another question someone said that maybe I can get this info by using the ffmpeg, but as far as I know that requires me to download the file from the s3 to the server.\nThere is also an s3 function that I can use to get the header of a specific object, which contains the mime type of the file, however this sometimes returns as audio/mpeg for video files, which then configures the MC incorrectly.\nI could also check the error message from the first job create of MC, which then tells me about the issue, and I can resend the file with the correct configuration, but then the job is marked as failed with error, which doesn't feel right to do.\nSo my question is; what would be the best approach to tell from a media file if it's a video or audio only? It's possible that ffmpeg or ffprobe can do it remotely, but I just don't know the tools deeply enough, so I'm not entirely sure that it can only work in that way I described it."
] | [
"amazon-s3",
"audio",
"video",
"ffmpeg",
"aws-media-convert"
] |
[
"Python 3 : empty list returned instead of list of words starting with vowel using comprehension",
"As I've recently started learning python 3 I came across Comprehensions which really intrigued me and I tried turning a few of my existing looping programs to loop with comprehensions. And I have been unsuccessfully trying to turn one of the programs to run with comprehension. It returns a list of words from an input list of strings, if that word starts with a vowel.\nThe old program which was working But without use of Python 3.0 compreshensions is given below.\noutput_list= []\nlist_vowel = ['a','e','i','o','u']\nfor word in input_list: \n if word[0] in list_vowel:\n output_list.append(word)\nprint(output_list) \n\nWhen I tried to write the same program using comprehension i'm getting empty list [] everytime i run the code whether the i/p list is ['a','e','i','o','u'] or ["aeiou"] etc\nThe code with usage of comprehension is given below\nimport ast,sys\ninput_str = sys.stdin.read()\ninput_list = ast.literal_eval(input_str)\n\noutput_list = []\nlist_vowel = ["aeiou"]\noutput_list = [ x for x in input_list if x[0] in list_vowel ]\n# for i in list_vowel if x[0] == list_vowel[i]]\nprint(output_list) \n\nWhat am I doing wrong?\nOr if there exist cases where we can't use python comprehensions?"
] | [
"python-3.x",
"list-comprehension"
] |
[
"It is possible to view css transition frame by frame?",
"I have an html div, with css transition that moves it along the screen from left to right. I would like to be able to see the different frames, one by one, instead of 1 stopless smooth animation. It that possible?"
] | [
"css",
"transition",
"frame"
] |
[
"Intellij-Share project on Github",
"I'm trying to create a repository from a Spring,Maven project from Intellij but when I try to \"Share\" it on Github this happens.\n\nhttp://prnt.sc/deaqyw\n\nIt does not push the src folder.\n\nhttp://prntscr.com/dearlg\n\nI also have the .idea folder at ignored files in Version Control in Intellij.\n\nIn Version Control tab at the Directory tab I have the src folder and the project's entire folder.\n\nSorry for the links I cannot post photos."
] | [
"java",
"maven",
"github",
"intellij-idea"
] |
[
"Assembly location for Razor SDK Tasks was not specified in my .NET Core 2.1 Project --",
"I am getting the following error in my .Net Core 2.1 Project.\n\nAssembly location for Razor SDK Tasks was not specified. The most likely cause is an older incompatible version of Microsoft.NET.Sdk.Razor, \nor Microsoft.NET.Sdk.Web used by this project. Please target a newer version of the .NET Core SDK.\n\n\nClciking on the rror shows the following portion in the codegeneration.targets file\n\n<Target Name=\"_EnsureRazorTasksAssemblyDefined\">\n <Error \n Text=\"Assembly location for Razor SDK Tasks was not specified. The most likely cause is an older incompatible version of Microsoft.NET.Sdk.Razor, or Microsoft.NET.Sdk.Web used by this project. Please target a newer version of the .NET Core SDK.\" \n Condition=\"'$(RazorSdkBuildTasksAssembly)' == ''\" />\n </Target>\n\n\nAs a remedy, I tried to update all relevant packages in my project. Even the update does not happen!\nCleaned unloaded and then reloaded the solution. Built it, but the same error is appearing. Exactly what is it indicating towards? I also downloaded and installed the framework 2.2 for Core let me tell you that.\nBut no nothing seems to solve this.\n\nWhat's the problem?\n\n*** Update\nafter running the command line for listing the sdks I found this->\n\n1.0.0 [C:\\Program Files\\dotnet\\sdk] \n1.1.0 [C:\\Program Files\\dotnet\\sdk] \n2.0.0 [C:\\Program Files\\dotnet\\sdk] \n2.1.4 [C:\\Program Files\\dotnet\\sdk] \n2.1.202 [C:\\Program Files\\dotnet\\sdk] \n2.1.300-preview1-008174 [C:\\Program Files\\dotnet\\sdk] \n2.1.505 [C:\\Program Files\\dotnet\\sdk] \n2.2.401 [C:\\Program Files\\dotnet\\sdk] \n3.0.100-preview3-010431 [C:\\Program Files\\dotnet\\sdk]\n\n\nSo what now?"
] | [
"c#",
".net",
"asp.net-core",
"sdk",
"asp.net-core-2.1"
] |
[
"Avoiding UAC in vista",
"im writing an application that downloads and installs addons for programs which needs to save the data to program files (for the programs in question). Now this works fine on xp and vista with uac disabled however it is failing on normal vista due to the virtual folders.\n\nHow would one get around this with out needing to request admin rights every time the app started?\n\nP.s. Program is written in c++, vis 2005\n\nEdit: File system virtual folders: http://www.codeproject.com/KB/vista-security/MakingAppsUACAware.aspx"
] | [
"c++",
"windows-vista",
"uac"
] |
[
"jQuery isotope 2 check if is applied",
"i'm using isotope 2 (http://isotope.metafizzy.co/) and now i need to check if isotope is applied, or destroyed.\n\nI need to destroy the applied isotope in the mobile size, so i do a \n\n$container.isotope('destroy');\n\n\non windowResize, if the window width is less than 767.\n\nAfter destroying, i need to check if isotope is active or destroyed.\n\nIn isotope v1 was the class \"isotope\" added, now there is no class in v2.\n\nAny ideas?\n\nbest regards\nCH"
] | [
"jquery",
"jquery-isotope"
] |
[
"Creating Venn diagram in C# win Form",
"I need to create a Venn diagram in win form C#. I have been trying to do it using Graphics.DrawEllipse and FillElipse. But I am not sure how do I fill in the common part. \n\nI want to achieve this,\n\n\n\nHere is my code for this,\n\nprivate void panelControlVennDiagram_Paint(object sender, PaintEventArgs e)\n{\n Brush brushLeft = new SolidBrush(Color.Blue);\n Brush brushRight = new SolidBrush(Color.LightPink);\n Brush brushCommon = new SolidBrush(Color.Purple);\n\n Pen pen = new Pen(brushLeft, 10);\n\n Rectangle leftVenn = new Rectangle(20, 50,100,100);\n Rectangle rightVenn = new Rectangle(90, 50, 100, 100);\n Rectangle commonVenn = new Rectangle(100, 120, 100, 100);\n\n Font stringFont = new Font(\"Times New Roman\", 9);\n\n e.Graphics.DrawString(\"Left:\" + leftValue, stringFont, brushLeft, 10,70);\n e.Graphics.DrawString(\"Right:\" + rightValue, stringFont, brushRight, 90,70);\n e.Graphics.DrawString(\"Common:\" + commonValue,stringFont, brushCommon, 100,70);\n\n // Fill ellipse on screen.\n e.Graphics.FillEllipse(brushLeft, leftVenn);\n e.Graphics.FillEllipse(brushRight, rightVenn);\n\n e.Graphics.DrawEllipse(Pens.White, leftVenn);\n e.Graphics.DrawEllipse(Pens.White, rightVenn);\n\n\n}\n\nI am drawing two ellipses and need to have a different color for the common part. I can not use any library. Please help."
] | [
"c#",
"winforms",
"graphics",
"onpaint"
] |
[
"Extracting from csv files with python code",
"i have a csv file which contains extracted tweets from some tweeter id. i need to get rid of first 3 columns i get before the original tweets text. e.g.\n\n\n ArvindKejriwal,630345258765697024,2015-08-09 11:49:55,\"RT @NitishKumar: No better place to start than from the land of Budhha. We commit no tickets to criminals. Now,show courage & commit to thi…\"\n\n\nI just want to extact text after \"RT....\" and store in another csv file. Please suggest...i have this in bunch say some 2k rows. how to achieve this?\n\nmy sample code:\n\nimport csv\ninputCSV = open(r'C:\\\\...\\\\ArvindKejriwal_tweets.csv', 'rb')\noutputCSV = open(r'C:\\\\...\\\\\\\\OUTPUT.csv', 'wb')\nappendCSV = open(r'C:\\\\...\\\\\\\\OUTPUT.csv', 'ab')\nappendCSV11 = open(r'C:\\\\...\\\\\\\\OUTPUT_Final.csv', 'ab')\ncr = csv.reader(inputCSV, dialect = 'excel')\ncw = csv.writer(outputCSV, dialect = 'excel')\nca = csv.writer(appendCSV, dialect = 'excel')\nca_final=csv.writer(appendCSV11, dialect='excel')\nfor row in cr:\n if row or any(row) or any(field.strip() for field in row):\n ca.writerow(row)\n\nf=csv.reader(open('C:\\\\..\\\\OUTPUT.csv','rb'))\nfor column in f:\n if column or any(column) or any(fields.strip() for fields in column):\n ca_final.writerow(column[3])\n\n# close files\ninputCSV.close()\noutputCSV.close()\nappendCSV.close()"
] | [
"python",
"csv"
] |
[
"Inserting a single record into AWS elasticsearch service using index method is not working",
"I am trying to insert single record into my AWS elastic search service. I am using the official @elastic/elasticsearch npm module.\nHere is my sample code:\nconst { Client } = require('@elastic/elasticsearch')\nconst { createAWSConnection, awsCredsifyAll, awsGetCredentials } = require('@acuris/aws-es-connection')\nconst { elasticSearchHost } = require('./config')\n\nconst getClient = async () => {\n const awsCredentials = await awsGetCredentials()\n const Connection = createAWSConnection(awsCredentials)\n\n return awsCredsifyAll(new Client({ node: elasticSearchHost, Connection }))\n}\n\nconst insert = async () => {\n const esClient = await getClient()\n const response = await esClient.index({\n index: 'someIndex',\n id: '1234',\n body: { name: 'Joe', age: 22 }\n })\n}\n\ninsert()\n\nBut I am always getting a very not so helpful error like this\nERROR Invoke Error \n{\n "errorType": "Error",\n "errorMessage": "ResponseError: Response Error",\n "stack": [\n "Error: ResponseError: Response Error",\n " at Function.exports.execute (/var/task/src/processor.js:27:11)",\n " at processTicksAndRejections (internal/process/task_queues.js:97:5)"\n ]\n}\n\nclient.index works when I run elastic search service locally. Not sure if AWS service supports it. If not then is there any other way/method I can use to insert a single record into AWS elastic search service."
] | [
"amazon-web-services",
"elasticsearch",
"aws-elasticsearch"
] |
[
"Encryption Algorithms for VDI on cloud",
"I don't need to explain the question but I am interested to know what the current encryption algorithms available for VDI (Virtual Disk images) on cloud like Open Stack or Amazon are."
] | [
"azure",
"amazon-ec2",
"cloud",
"cloud-hosting",
"openstack"
] |
[
"Anyone know of any issues with using VS2010 with TFS 2005",
"We want to upgrade to VS2010 but are currently using TFS 2005. Does VS2010 integrate cleanly with the older versions of TFS. We're not upgrading to SQL Server 2008 anytime soon which is why we're still on TFS 2005.\n\nThanks."
] | [
"visual-studio-2010",
"tfs"
] |
[
"matplotlib scatter fails with error: 'c' argument has n elements, which is not acceptable for use with 'x' with size n, 'y' with size n",
"I am trying to create a scatter plot using matplotlib where each point has a specific color value.\nI scale the values and then apply alpha blending between a 'left' and a 'right' color.\n# initialization\nfrom matplotlib import pyplot as plt\nfrom sklearn.preprocessing import MinMaxScaler\nimport numpy as np\n\nvalues = np.random.rand(1134)\n\n# actual code\ncolorLeft = np.array([112, 224, 112])\ncolorRight = np.array([224, 112, 112])\nscaled = MinMaxScaler().fit_transform(values.reshape(-1, 1))\ncolors = np.array([a * colorRight + (1 - a) * colorLeft for a in scaled], dtype = np.int64)\n# check values here\nf, [sc, other] = plt.subplots(1, 2)\nsc.scatter(np.arange(len(values)), values, c = colors)\n\nHowever the last line gives the error:\n\n'c' argument has 1134 elements, which is not acceptable for use with 'x' with size 1134, 'y' with size 1134\n\nThe scatter documentation says for parameter c\n\nc : color, sequence, or sequence of color, optional\nThe marker color. Possible values:\n A single color format string.\n A sequence of color specifications of length n.\n A sequence of n numbers to be mapped to colors using cmap and norm.\n A 2-D array in which the rows are RGB or RGBA.\n\n\nWhere I want to use the last option with RGB values.\nI replaced the check values here comment with some print statements:\nprint(values)\nprint(colors)\nprint(values.shape)\nprint(colors.shape)\n\nwhich gave the results:\n[0.08333333 0.08333333 0.08333333 ... 1. 1. 1.08333333]\n[[112 224 112]\n [112 224 112]\n [112 224 112]\n ...\n [214 121 112]\n [214 121 112]\n [224 111 112]]\n(1134,)\n(1134, 3)"
] | [
"python",
"matplotlib",
"scatter-plot"
] |
[
"How to forbid default user from viewing a database in clickhouse?",
"I want to restrict the default user from reading tables from a particular database but the revoke command gives following exception.\nREVOKE SELECT ON test_db.* FROM default\n\nReceived exception from server (version 20.5.2):\nCode: 495. DB::Exception: Received from localhost:9000. DB::Exception: Cannot update user `default` in [users.xml] because this storage is readonly. \n\n\nusers.xml has 666 permission. I am wondering how can this be done, so that default user can not view tables in the given database."
] | [
"clickhouse"
] |
[
"Nothing to geocode - Weather API - Nodejs",
"I am new to Nodejs and trying to use weather api.\n\nWhen I test the link in browser, it gives me accurate answer\n\nhttp://api.openweathermap.org/data/2.5/weather?q=karachi&appid=dcf486a78f2b8e898c4b1a464a1b31e1\n\n\nwhile it keeps throwing error.\n\nconst express = require(\"express\")\nvar logger = require(\"morgan\")\nvar path = require(\"path\")\nvar bodyParser = require(\"body-parser\")\nlet requested = require('request');\n\nvar app=express()\napp.use(bodyParser.json());\napp.use(bodyParser.urlencoded({\n extended: true\n }));\n\napp.set(\"views\", path.resolve(__dirname,\"views\"))\napp.set(\"view engine\",'ejs')\n\napp.use(logger(\"short\"))\n\napp.get(\"/\",function(request,response)\n{\n response.render(\"homepage\")\n})\n\napp.post('/', function(request, response) {\n var urlOpenWeatherCurrent = 'http://api.openweathermap.org/data/2.5/weather?'\n var queryObject = {\n APPID: \"dcf486a78f2b8e898c4b1a464a1b31e1\",\n city: request.body.cityName\n }\n console.log(queryObject)\n requested({\n url:urlOpenWeatherCurrent,\n q: queryObject // In many tutorials they used 'qs' instead of 'q'. I don't know why.\n }, function (err, response, body) {\n // response.send('You sent the name ' + request.body.cityName + \".\");\n if(err){\n console.log('error:', error);\n } else {\n console.log('body:', JSON.parse(body));\n\n }\n });\n});\n\n\napp.use(function(request,response)\n{\n response.status(404)\n response.send(\"Error\")\n})\n\n\napp.listen(3000,()=>console.log(\"Working\"))\n\n\nError\n\n{ APPID: 'dcf486a78f2b8e898c4b1a464a1b31e1', city: 'karachi' }\n'Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.'\n\n\nIf I change q to qs in nodejs, then\n\n{ APPID: 'dcf486a78f2b8e898c4b1a464a1b31e1', city: 'karachi' }\nbody: { cod: '400', message: 'Nothing to geocode' }\n\n\nNote that changing q to qs in raw html API link also gives\n\n{\"cod\":\"400\",\"message\":\"Nothing to geocode\"}\n\n\nI believe from the response that I should use qs in nodejs, because at least this time it is not considering API key wrong. But in the API link, we have q and not qs. So how come qs makes sense? Besides, as far as I Understood, it is not properly concatenating the API strings together, resulting in the malfunctioning. But I don't know how to print the entire link in console to validate what I just said.\n\nviews/homepage.ejs\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n <title>Document</title>\n</head>\n<body>\n <form class=\"pure-form\" action=\"/\" method=\"POST\">\n <input type=\"name\" placeholder=\"City name\" name=\"cityName\" autofocus required>\n <input type=\"submit\" valuue=\"Go\">\n </form>\n</body>\n</html>"
] | [
"node.js",
"express",
"post"
] |
[
"CSS float-left prevent words to go on new line",
"I have the following code:\n\nhtml\n\n<div class=\"container\">\n <div class=\"float-left\">\n <a href=\"#\"><img width=\"550\" src=\"image.jpg\" alt=\"\" /></a>\n </div>\n <div class=\"float-left\">\n <h1 class=\"new\">Some long text here that should word wrap</h1>\n </div>\n <div class=\"clear\"></div>\n<div>\n\n\ncss\n\n.container{\n width:960px;\n}\n.float-left {\n float:left\n}\n.clear{\n clear:both;\n}\nh1.new{\n font-family: RockwellMT-Light;\n font-size: 28px;\n line-height: 31px;\n}\n\n\nI want the divs to act like 2 columns One will be the image and the second one should be text that can go down as much as it takes.\nSince float left does not have a fixed width the problem is that the whole element h1 is jumping on the new line and the text does not goes on the next line.\nI don't want to give fixed widths to the floating divs.\n\nHow can I prevent this?"
] | [
"html",
"css",
"css-float",
"floating"
] |
[
"Update text on a tkinter window",
"How would I go about making it so I can add more text on a already open tkinter window without having remove the previous text or replacing the previous text with the new text? \n\nHere is my code so far:\n\ndef display_text():\n class SampleApp(tk.Tk):\n\n def __init__(self):\n tk.Tk.__init__(self)\n self.label = tk.Label(self, text='Enter text')\n self.label.pack(side = 'top', pady = 5)\n\n\n def on_button(self):z\n self.destroy()\n\n\n w = SampleApp()\n w.resizable(width=True, height=True)\n w.geometry('{}x{}'.format(100, 90))\n w.mainloop()\n\n\ndisplay_text()"
] | [
"python",
"python-3.x",
"tkinter"
] |
[
"how to iterate over an array of objects in handlebars",
"I have an array of objects that i have received from my web API, and i am using handlebars to create a template and iterate over these objects. However i am unsure on how i iterate over my array of objects.\n\nJS:\n\n $(document).ready(function(){\n $.get(\"/api/CaseStudies/top\", function (data) {\n\n var caseStudies = [];\n for (var i = 0, caseStudie; (caseStudie = data[i]); ++i) {\n caseStudies.push(caseStudie);\n }\n //console.log(caseStudies);\n\n renderTemplate(caseStudies); \n });\n\n function renderTemplate(caseStudies) {\n var template = $('#test').html();\n var templateScript = Handlebars.compile(template);\n var html = templateScript(caseStudies);\n $(\"#output\").append(html);\n }\n\n});\n\n\nHTML:\n\n <script id=\"test\" type=\"text/x-handlebars-template\">\n <div>\n\n {{#each caseStudies}}\n The title is {{Title}}And my name is{{Name}}<br />\n {{/each}}\n </div>\n </script>\n\n<div id=\"output\"></div>\n\n\nThe array of objects i receive from my api looks like this:"
] | [
"javascript",
"html",
"jquery",
"handlebars.js",
"mustache"
] |
[
"Javascript - Referenced array deleting objects",
"I'm sure I'm doing something wrong but I'm not sure what it is. I'm expecting the req.query to be the same as it was set at the start but when I log them to the console at the end data and req.query only contain rnd.\n\nvar req = {};\nreq.query = {\n url: 'https://google.com/',\n width: '500',\n height: '190',\n ref: 'http://domain.tld',\n rnd: '9314871930982'\n};\nvar data = req.query;\ndelete data.width;\ndelete data.height;\ndelete data.url;\ndelete data.ref;\n\nconsole.log(req.query);\nconsole.log(data);"
] | [
"javascript",
"arrays"
] |
[
"HDF5 Linking error 2",
"When I try to compile my program I get the following error. Any ideas?\n\ng++ -std=c++11 -m64 -DOPENFOAM_PLUS=1712 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/sampling/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/meshTools/lnInclude -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-v1712/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/3DIBicoFoam_2.o -L/opt/software/OpenFOAM/OpenFOAM-v1712/platforms/linux64GccDPInt32Opt/lib \\\n -lfiniteVolume -lsampling -L/local/hulfeldl/hdf5/lib/ -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lOpenFOAM -ldl \\\n -ggdb3 -DFULLDEBUG -lm -o /local/hulfeldl/OpenFOAM/hulfeldl-v1712/applications/bin/linux64GccDPInt32Opt/3DIBicoFoam_2\nMake/linux64GccDPInt32Opt/3DIBicoFoam_2.o: In function `main':\n/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:91: undefined reference to `H5::CommonFG::openDataSet(std::string const&) const'\n/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:166: undefined reference to `H5::CommonFG::openDataSet(std::string const&) const'\n/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:177: undefined reference to `H5::CommonFG::openDataSet(std::string const&) const'\n/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:183: undefined reference to `H5::CommonFG::openDataSet(std::string const&) const'\n/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:192: undefined reference to `H5::CommonFG::openDataSet(std::string const&) const'\nMake/linux64GccDPInt32Opt/3DIBicoFoam_2.o:/local/hulfeldl/OpenFOAM/hulfeldl-v1712/run/case13/solver/3DIBicoFoam_2.C:199: more undefined references to `H5::CommonFG::openDataSet(std::string const&) const' follow\ncollect2: error: ld returned 1 exit status\nmake: *** [/local/hulfeldl/OpenFOAM/hulfeldl-v1712/applications/bin/linux64GccDPInt32Opt/3DIBicoFoam_2] Error 1"
] | [
"c++",
"c++11",
"hdf5"
] |
[
"Checking if a specific float value is in list/array in Python/numpy",
"Care needs to be taken when checking for equality between floating point numbers, and should usually be done with a tolerance in mind, using e.g. numpy.allcose.\n\nQuestion 1: Is it safe to check for the occurrence of a specific floating point number using the \"in\" keyword (or are there similar keywords/functions for this purpose)? Example:\n\nif myFloatNumber in myListOfFloats:\n print('Found it!')\nelse:\n print('Sorry, no luck.')\n\n\nQuestion 2: If not, what would be a neat and tidy solution?"
] | [
"python",
"numpy",
"floating-point",
"floating-point-comparison"
] |
[
"Git pull request from different repo on different org",
"Ok I have a possibly unique situation\n\nI have two repository, in different organizations (B is not a fork of A but a clone), but both on GitHub. One I'm an admin of (B), the other I'm a collaborator with read access only (A).\n\nTo be clear, I am owner of neither so I can't delete and fork instead.\n\nI need to submit a pull request from repository B to repository A. Is this even possible? If so, how!"
] | [
"git",
"github",
"pull-request"
] |
[
"AWS ECS RunTask overrides for memory and cpu are not working",
"I'm trying to override the CPU and memory limits on a container when using the RunTask command. I'm using the Python SDK, boto3.\n\nThe container has default CPU limit of 0 (unlimited) and a soft memory limit of 1024. That's all fine and good.\n\nWhen I attempt to pass a containerOverrides list to the RunTask command, I don't get an error, the tasks runs mostly as expected. I'm also overriding the command the container runs, and that works - I can see as the task is running the command has been overridden, and the logs reflect this. \n\nThe CPU and memory limits, however, are not being overridden. I'm checking this by peeking at the AWS console and seeing the cpu and memory are listed as 0 and 1024, but the command is shown to be overridden. I can also do a little math by checking on the container instance to confirm the memory is not the desired 2048, but must be 1024.\n\nHere's some simplified code:\n\nimport boto3\n\nclient = boto3.client('ecs')\n\noverrides = {\n \"containerOverrides\": [\n {\n \"name\": \"runcommand\",\n \"command\": command_wrapper,\n \"cpu\": 512,\n \"memory\": 2048,\n \"memoryReservation\": 2048\n }\n ]\n }\n\nresponse = client.run_task(\n cluster='mycluster',\n taskDefinition='runcommand-qa',\n overrides=overrides,\n group='stackoverflow:run-command'\n )\n\n\nAnd the tasks section of the response:\n\n'tasks': [{\n 'taskArn': 'arn:aws:ecs:us-east-1:12345667890:task/72f1a8ae-4f51-4717-acc6-fce3199a9e92',\n 'group': 'stackoverflow:run-command',\n 'attachments': [],\n 'overrides': {\n 'containerOverrides': [{\n 'memoryReservation': 2048,\n 'memory': 2048,\n 'command': ['sh', '-c', '. /app/bin/activate && ./manage.py help'],\n 'name': 'runcommand',\n 'cpu': 512\n }]\n },\n 'launchType': 'EC2',\n 'lastStatus': 'PENDING',\n 'containerInstanceArn': 'arn:aws:ecs:us-east-1:12345667890:container-instance/f0dd320e-b1de-413d-8e1c-c64b0799e473',\n 'createdAt': datetime.datetime(2018, 5, 25, 9, 4, 3, 46000, tzinfo = tzlocal()),\n 'version': 1,\n 'clusterArn': 'arn:aws:ecs:us-east-1:12345667890:cluster/runcommand-qa',\n 'memory': '2048',\n 'desiredStatus': 'RUNNING',\n 'taskDefinitionArn': 'arn:aws:ecs:us-east-1:12345667890:task-definition/runcommand-qa:127',\n 'cpu': '512',\n 'containers': [{\n 'containerArn': 'arn:aws:ecs:us-east-1:12345667890:container/80949a81-747f-4729-a9d4-922007448729',\n 'taskArn': 'arn:aws:ecs:us-east-1:12345667890:task/72f1a8ae-4f51-4717-acc6-fce3199a9e92',\n 'lastStatus': 'PENDING',\n 'name': 'runcommand',\n 'networkInterfaces': []\n }]\n}]\n\n\nWhat am I missing here?"
] | [
"amazon-web-services",
"docker",
"boto3",
"aws-ecs"
] |
[
"How initialization works of the super class constructor when calling the sub class constructor",
"say i have a parent class and a child class and call the constructor of the child class. Would I have to have both the child constructors arguments plus the parent constructors arguments and use super( ) to initialize the parent. And does this mean if i overloaded the parents constructor I would need to have constructors matching each of the child's constructors... So if I had two parent constructors\n\nparent(int a);\nparent(int a,int b);\n\n\nand two child constructors\n\nchild(int c);\nchild(int c,int d);\n\n\nI would have to have child(int a) actually be in the form of two constructors\n\nchild(int a, int c) \n{\nsuper(a)\n\nc = this.c;\n}\n\n\nand \n\nchild ( int a, int b, int c)\n{\nsuper(a,b)\n\nc = this.c;\n }\n\n\nand have child(int c, int d) actually have two constructors\n\nchild(int a, int c, int d)\n{\nsuper(a);\n\nc = this.c;\nd = this.d;\n}\n\n\nor could i pass\n\nchild(int a,int b, int c, int d)\n{\nsuper(a,b);\n\nc = this.c;\nd = this.d;\n}\n\n\n}"
] | [
"java"
] |
[
"Multiple zero or one to one relationships EF 6 Code First",
"I have a contact table\n\npublic class Contact : EntityBase\n{\n public int TrivialContactProperty { get; set; }\n ...\n public virtual FiContact FiContact { get; set; }\n public virtual PuContact PuContact { get; set; }\n public virtual TrContact TrContact { get; set; }\n}\n\n\nand then a FiContact, PuContact, and TrContact table.\n\npublic class FiContact : EntityBase\n{\n public int TrivialFiProperty { get; set; }\n ...\n public virtual Contact Contact { get; set; }\n}\n\npublic class PuContact : EntityBase\n{\n public int TrivialPuProperty { get; set; }\n ...\n public virtual Contact Contact { get; set; }\n}\n\npublic class TrContact : EntityBase\n{\n public int TrivialTRProperty { get; set; }\n ...\n public virtual Contact Contact { get; set; }\n}\n\n\nThe contact table should have a zero or one relationship with all three other tables. So a contact can exist without any of the other three, or it can be related to one or two or all three of them.\n\nUsing fluent API I tried to configure this, after doing some research, and I came up with:\n\nmodelBuilder.Entity<FiContact>()\n .HasRequired(r => r.Contact)\n .WithOptional(o => o.FiContact);\n\nmodelBuilder.Entity<PuContact>()\n .HasRequired(r => r.Contact)\n .WithOptional(o => o.PuContact);\n\nmodelBuilder.Entity<TrContact>()\n .HasRequired(r => r.Contact)\n .WithOptional(o => o.TrContact);\n\n\nBut I am still getting the following error when I try to add a migration for this change:\n\nFiContact_Contact_Source: : Multiplicity is not valid in Role 'FiContact_Contact_Source' in relationship 'FiContact_Contact'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '(asterisk symbol here)'.\n\nPuContact_Contact_Source: : Multiplicity is not valid in Role 'PuContact_Contact_Source' in relationship 'PuContact_Contact'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '(asterisk symbol here)'.\n\nTrContact_Contact_Source: : Multiplicity is not valid in Role 'TrContact_Contact_Source' in relationship 'TrContact_Contact'. Because the Dependent Role properties are not the key properties, the upper bound of the multiplicity of the Dependent Role must be '(asterisk symbol here)'.\n\nFrom more research I saw that the primary key on the dependent entity is supposed to also be the foreign key? The only problem is that all of my entities inherit from a class \"EntityBase\" which defines common fields in all entities, including the primary key:\n\npublic abstract class EntityBase : IEntity\n{\n [Key]\n public int Id { get; set;}\n public bool IsActive { get; set; }\n public DateTime CreatedOnDate { get; set; }\n\n public int? CreatedByUserId { get; set; }\n\n [ForeignKey(\"CreatedByUserId\")]\n public User CreatedByUser { get; set; }\n\n public DateTime LastUpdatedOnDate { get; set; }\n public int? LastUpdatedByUserId { get; set; }\n\n [ForeignKey(\"LastUpdatedByUserId\")]\n public User LastUpdatedByUser { get; set; }\n}\n\n\nIs there a way to make this kind of table/entity relationship work with EF 6 Code First? Any help getting this type of relationship to work would be much appreciated."
] | [
"c#",
"entity-framework",
"entity-framework-6",
"data-annotations",
"ef-fluent-api"
] |
[
"ArrayList optimization",
"i am currently working on this for personal gratification and would like some advice on how i can make this code faster :\n\nI have one ArrayList composed of an object note, which have coordinates and color value stored in it.\n\nEach \"note\" is created in real time during the rendering call.\n\nI have made this function :\n\nvoid keyPressed() { \n if (key == 's' || key == 'S') {\n PImage img = createImage(posX, specSize, RGB);\n for(int x = 0; x < posX; x++){\n for(int y = 0; y < specSize; y++){\n for(int i = 0; i < notes.size(); i++){\n if( (notes.get(i).getX() == x) \n && (notes.get(i).getY() == y) ){\n\n int loc = x + y*posX;\n img.pixels[loc] = color(notes.get(i).getR(),\n notes.get(i).getG(), notes.get(i).getB());\n }\n }\n }\n }\n img.updatePixels();\n img.save(\"outputImage.png\");\n }\n}\n\n\nSo when i press the \"S\" key, i run a loop on the width and height because they can be different in each run, and then on my arrayList and get the corresponding \"note\" with it's x and y position.\nthen i write my picture file.\nAs you can imagine, this is really, really, slow... \nAround 5 to 6 minutes for a 1976x256px file.\nFor me it's okay but it would be great to shorten this a little.\n\nIs there a way to optimize this three loops?\nIf you need more code, please let me know it's a small code and i don't mind."
] | [
"java",
"for-loop",
"arraylist",
"processing"
] |
[
"Excel won't open/launch VSTO AddIn when running in debug mode of Visual Studio 2010",
"I had previously installed the VS11 beta, and had some issues with my Visual Studio 2010 instance, which you can see here how they were resolved: Excel AddIn Click Once deployment issue.\n\nNow I have a code base which compiles/builds a vsto, which installs fine and runs fine in Excel 2010. However, when I remove the installed version from Excel, and try to run it directly through Visual Studio 2010, the AddIn does not get loaded into Excel when running in debug configuration mode, in release configuration mode it works fine. Any ideas on why this might be occurring? I've tried re-enabling it through Com AddIns, and a few other things with no luck."
] | [
"visual-studio",
"visual-studio-2010",
"excel",
"vsto",
"excel-interop"
] |
[
"Possible to change characters in input to Circles?",
"This is just a general/vague question,\n\nIf i had a textarea...\n\n<textarea class=\"mybox\">\n myfirststring secondstring\n</textarea>\n\n\nIs it possible to use javascript/jquery so that after the first string is typed 'myfirststring'/spacebar has been hit that you can somehow convert the remaining text in the field into protexted text, as though it was a password and you want to hide the characters?"
] | [
"javascript",
"jquery",
"html"
] |
[
"How to execute keyboard macros exactly?",
"In many cases emacs doesn't execute kbd macros exactly as it should be. For example\n\n(execute-kbd-macro (read-kbd-macro \"C-x C-f\"))\n\n\nRather than to end execution of this macros with open minibuffer Find file: ... emacs just opens the first available file or dired buffer (depending on the situation). How to execute such kinds of kbd macroses without such misunderstandings?\n\nUpd 2. It is just example of such kind of keyboard macroses that behaves differently from the original behavior (i.e. C-x C-f pressed). Below is another example with grep.\n\nUpd. As @lawlist mentioned I can use\n\n(key-binding (kbd \"C-x C-f\"))\n\n\nfor transformation key sequence to command name. But it only works when there is the command. In a more complex case, e.g.\n\n(execute-kbd-macro (read-kbd-macro \"C-u M-x grep RET\"))\n\n\nthis \"brute-force\" method doesn't work (I want to continue editing pattern for grep but emacs forcedly finishes the interaction)."
] | [
"emacs",
"macros",
"keyboard"
] |
[
"Get the value of a defaultdict",
"I read data from a bunch or emails and count frequency of each word. first construct two counters:\n\ncounters.form = collections.defaultdict(dict)\n\n\nGet the frequency by\n\nfor word in re.findall('[a-zA-Z]\\w*', data):\n counters.form[word][file_name] += 1\n\n\nFor each form, there is a counter that store all the emails which this word appears in, and the frequency of the form in this email. e.g. \n\nform = {'a': {'email1':4, 'email2':3}, \n 'the': {'email1':2, 'email3':4},\n 'or': {'email1':2, 'email3':1}}\n\n\nHow to get the frequency of a certain form in a certain email? the frequency of a in email2 is 3."
] | [
"python"
] |
[
"ASP.NET MVC multiple query string parameter",
"How do I design my URL to match my function like this:\n\npublic ActionResult GetStuff(string name, string address, double latitude, double longitude)\n{ }"
] | [
"asp.net-mvc"
] |
[
"Yellow tint display on Ubuntu 18.04",
"After I upgraded Ubuntu from 16.04 to 18.04 on my laptop tonight, the display is tuned by yellow. It is hard to see things clearly. I have searched the web and also tried adjusting the RGB values from both hardware and software settings, but I ran out of luck. When I boot the laptop into the Windows 10 system on the other partition, the color on display is normal. Can someone please shed some light for how to fix it?"
] | [
"ubuntu-18.04"
] |
[
"(Angular4 / TypeScript) How to Bind Component @Input Property to View?",
"How to display a component input property in view?\n\nI've tried several ways, including this, but none has been working: https://ngdev.space/angular-2-input-property-changes-detection-3ccbf7e366d2\n\nComponent usage:\n\n<card [title]='My Awesome Card'></card>\n\n\nTemplate:\n\n<div class=\"ui card\">\n <div class=\"content\">\n <div class=\"header\">{{ title }}</div>\n </div>\n</div>\n\n\nPart of component declaration:\n\n@Component({\n selector: 'card',\n templateUrl: './card.component.html'\n})\n\nexport class CardComponent implements OnInit {\n\n private _title: string;\n\n get title(): string {\n return this._title;\n }\n\n @Input()\n set title(title: string) {\n console.log('prev value: ', this._title);\n console.log('got title: ', title);\n this._title = title;\n }\n\n ..."
] | [
"angular",
"typescript"
] |
[
"single-click vs double-click dilemma in wp7",
"single-click vs double-click dilemma\n\nI have an event happening for a single-click, and I have a different event happening for double-click.\n\nSingle-click: load preview of email message\n\nDouble-click: load message view in different window\n\nThe issue is that in order for a double-click to occurr, a single-click happens... twice.\nThe current solution has been to put a timeout on the single-click and cancel it if the double-click is detected.\n\nQuestion 1: What is the timeout on a double-click event to occur? If I single-click really slowly, it won't take place, for example.\n\nQuestion 2: Is there a better way to solve this than to use a timeout?"
] | [
"windows-phone-7",
"silverlight-4.0"
] |
[
"What's the simplest way of adding one to a binary string in Perl?",
"I have a variable that contains a 4 byte, network-order IPv4 address (this was created using pack and the integer representation). I have another variable, also a 4 byte network-order, subnet. I'm trying to add them together and add one to get the first IP in the subnet.\n\nTo get the ASCII representation, I can do inet_ntoa($ip&$netmask) to get the base address, but it's an error to do inet_ntoa((($ip&$netmask)+1); I get a message like:\n\n Argument \"\\n\\r&\\0\" isn't numeric in addition (+) at test.pm line 95.\n\n\nSo what's happening, the best as I can tell, is it's looking at the 4 bytes, and seeing that the 4 bytes don't represent a numeric string, and then refusing to add 1.\n\nAnother way of putting it: What I want it to do is add 1 to the least significant byte, which I know is the 4th byte? That is, I want to take the string \\n\\r&\\0 and end up with the string \\n\\r&\\1. What's the simplest way of doing that? \n\nIs there a way to do this without having to unpack and re-pack the variable?"
] | [
"perl",
"binary",
"math"
] |
[
"Populate tableview cells with data from NSArray / PFQuery",
"I'm using parse.com as database, and the data that I need in the cell seems to be correctly transferred to an nsarray, although I can't show it in my table. \n\nThis is the method for querying database.\n\n- (PFQuery *)queryForTable {\n PFQuery *exerciciosQuery = [PFQuery queryWithClassName:@\"ExerciciosPeso\"];\n [exerciciosQuery whereKey:@\"usuario\" equalTo:[PFUser currentUser]];\n [exerciciosQuery includeKey:@\"exercicio\"];\n\n // execute the query\n _exerciciosArray = [exerciciosQuery findObjects];\n for(PFObject *o in _exerciciosArray) {\n PFObject *object = o[@\"exercicio\"];\n NSLog(@\"PFOBJECT %@\", object);\n NSLog(@\"%@\", o);\n }\n\n NSLog(@\"%@\", _exerciciosArray);\n\n return exerciciosQuery;\n}\n\nGrupo = Biceps;\n\ndescricao = \"descricao alternada\";\n\ntitulo = \"Rosca alternada\";\n\nPeso = 10;\n\nexercicio = \"<Exercicios:Iv2XB4EHSY>\";\n\nusuario = \"<PFUser:W9ifgHpbov>\";\n\nGrupo = Biceps;\n\ndescricao = descricao;\n\ntitulo = \"Puxada Reta\";\n\nPeso = 20;\n\nexercicio = \"<Exercicios:nmqArIngvR>\";\n\nusuario = \"<PFUser:W9ifgHpbov>\";\n\nGrupo = Biceps;\n\ndescricao = \"Fazer rosca\";\n\ntitulo = \"Rosca no Pulley\";\n\nPeso = 30;\n\nexercicio = \"<Exercicios:CXecX4DJiO>\";\n\nusuario = \"<PFUser:W9ifgHpbov>\";\n\nGrupo = Biceps;\n\ndescricao = \"em pe descricao\";\n\ntitulo = \"Biceps na corda\";\n\n\nPeso = 40;\n\nexercicio = \"<Exercicios:6slVOQnj3y>\";\n\nusuario = \"<PFUser:W9ifgHpbov>\";\n\n\nOk, as shower in the outline, my query successfully populates an array with four objects from different tables in the database which are linked. But I guess this is not important.\n\nWhat I need to do is to populate my cells, four rows, as I have four items with specific keys. I want to show per row, the values assigned to \"titulo\" and \"Peso\", both seem to be correctly returned in query.\n\nWhen I use the following code, trying to populate the cell inside the for loop, it just adds four rows of the same item. \n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {\n static NSString *CellIdentifier = @\"Cell\";\n\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];\n if (cell == nil) {\n cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];\n }\n\n for(PFObject *o in _exerciciosArray) {\n PFObject *object = o[@\"exercicio\"];\n cell.textLabel.text = [object objectForKey:@\"titulo\"];\n }\n\n return cell;\n}\n\n\nWhen I delete the for loop, and add the following lines, I don't get anything in my table.\n\nobject = [_exerciciosArray objectAtIndex:indexPath.row];\ncell.textLabel.text = [object objectForKey:@\"titulo\"];\n\n\nI have tried a lot of things already, I'm sure it is something small. Please help."
] | [
"ios",
"objective-c",
"uitableview",
"parse-platform"
] |
[
"Trigger plotAreaClick event while using plot bands in KendoUI charts",
"I have several column charts in one page. I utilize the seriesClick and plotAreaClick events within those charts to trigger some filtering. Charts where I don't use plot bands have no issues triggering the plotAreaClick. As soon as I introduce a plot band to a chart - the plotAreaClick event stops triggering. \n\nAnyone know of a workaround? Am I the only one to experience this?"
] | [
"jquery",
"charts",
"kendo-ui",
"event-handling",
"kendo-chart"
] |
[
"How to modify the value of \"by ____\" in a facebook post?",
"When my website es shared on facebook there is a legend on the bottom of post, with the url and the author of the website-app. In example, this image from the fb open graph documentation\n\nhttp://i.imgur.com/5wGCADh.png\nin that example how do i change the value of \"BOILER ROOM\"?"
] | [
"facebook",
"facebook-graph-api"
] |
[
"JavaScript find index of div",
"That's my first question here so please don't hate me :)\nTried to look for it but I wasn't able to find what I need.\nHow can I print index of div with class .circle that has been clicked?\nHere's my code\n\nvar circle = document.querySelectorAll(\".circle\");\n\nfor(i=0; i<circle.length; i++){\n\n circle[i].addEventListener(\"click\", function(){\n this.classList.toggle(\"hide\");\n console.log(circle.indexOf(this));\n })\n}\n\n\nThanks!"
] | [
"javascript",
"arrays"
] |
[
"Directive within another directive - scope var undefined",
"I'm trying to generate a smart-table directive from within a custom directive I've defined:\n\n<div ng-controller=\"myContrtoller\">\n <containing-directive></containing-directive>\n</div>\n\n\nThe directive definition:\n\nangular.module('app')\n.directive('containingDirective', function() {\n return {\n restrict: 'E',\n replace: true,\n template: '<table st-table=\"collection\" st-pipe=\"scopeFun\"></table>', \n link: function(scope, elem, attrs) {\n scope.scopeFun = function () {\n // solve the misteries of life\n }\n }\n }\n});\n\n\nAs you can see my directive tries to replace the element by the template generated by the st-table directive, using the st-pipe directive depending on the first, briefly:\n\nng.module('smart-table')\n .controller('stTableController' function () {\n // body...\n })\n .directive('stTable', function () {\n return {\n restrict: 'A',\n controller: 'stTableController',\n link: function (scope, element, attr, ctrl) {\n // body\n }\n };\n })\n .directive('stPipe', function (config, $timeout) {\n return {\n require: 'stTable',\n scope: {\n stPipe: '='\n },\n link: {\n\n pre: function (scope, element, attrs, ctrl) {\n var pipePromise = null;\n if (ng.isFunction(scope.stPipe)) { // THIS IS ALWAYS UNDEFINED\n // DO THINGS\n }\n },\n\n post: function (scope, element, attrs, ctrl) {\n ctrl.pipe();\n }\n }\n };\n });\n\n\nProblem:\nThe st-pipe directive checks the scope var stPipe if it is defined or not by: if (ng.isFunction(scope.stPipe)). This turns out to be ALWAYS undefined. By inspecting I found two things:\n\n\nFrom the stPipe directive, the value supposed to be scope.stPipe that is my scopeFun defined within my containingDirective is undefined on the scope object BUT defined within the scope.$parent object.\nIf I define my $scope.scopeFun within the myContrtoller I don't have any problem, everything works. \n\n\nSolution:\nI did find a solutions but I don't know what really is going on:\n\n\nSet replace: false in the containingDirective\nDefine the scope.scopeFun in the pre-link function of containingDirective\n\n\nQuestions:\n\n\nWhy is the scopeFun available in the stPipe directive scope object if defined in the controller and why it is available in the scope.$parent if defined in the containingDirective? \nWhat is really going on with my solution, and is it possible to find a cleaner solution?"
] | [
"angularjs",
"angularjs-directive",
"angularjs-scope",
"smart-table"
] |
[
"Zurb Foundation dropdown position to very first parent",
"In Foundation 6 by default, dropdown menus appear on the same level as the parent like so:\n\n\n\nIs there a way to make it so that the menu appears on the same level as the first menu? This is the desired outcome: \n\n\n\nI have looked through the documentation and cannot seem to find a way to do it. Thanks in advance!\n\nThis is a snippet of the default code from Foundation site\n\n<ul class=\"dropdown menu\" data-dropdown-menu>\n <li>\n <a>Item 1</a>\n <ul class=\"menu\">\n <li><a href=\"#\">Item 1A Loooong</a>\n </li>\n <li>\n <a href='#'> Item 1 sub</a>\n <ul class='menu'>\n <li><a href='#'>Item 1 subA</a>\n </li>\n <li><a href='#'>Item 1 subB</a>\n </li>\n <li>\n <a href='#'> Item 1 sub</a>\n <ul class='menu'>\n <li><a href='#'>Item 1 subA</a>\n </li>\n <li><a href='#'>Item 1 subB</a>\n </li>\n </ul>\n </li>\n <li>\n <a href='#'> Item 1 sub</a>\n <ul class='menu'>\n <li><a href='#'>Item 1 subA</a>\n </li>\n </ul>\n </li>\n </ul>\n </li>\n <li><a href=\"#\">Item 1B</a>\n </li>\n </ul>\n </li>\n <li>\n <a href=\"#\">Item 2</a>\n <ul class=\"menu\">\n <li><a href=\"#\">Item 2A</a>\n </li>\n <li><a href=\"#\">Item 2B</a>\n </li>\n </ul>\n </li>\n <li><a href=\"#\">Item 3</a>\n </li>\n <li><a href='#'>Item 4</a>\n </li>\n</ul>\n\n\nHere is a fiddle of the default: http://jsfiddle.net/65017wc2/"
] | [
"javascript",
"html",
"css",
"zurb-foundation"
] |
[
"Vuex 4 Modules can't use global axios property",
"I have a Vue3 (without Typescript) app running Vuex 4.0.0.\nI'm trying to set up a simple GET request in one of my store modules using axios, however I'm getting a Cannot read property of 'get' of undefined when I try to do it via an action called in one of my components, however if I call this.$axios from the component it works fine. For some reason, my modules can't use this.$axios, while elsewhere in the app I can.\nI've declared $axios as a globalProperty in my main.js file.\n// main.js\n\nimport { createApp } from "vue";\nimport App from "./App.vue";\nimport { router } from "./router";\nimport { store } from "./store";\nimport axios from "axios";\n\nconst app = createApp(App).use(store).use(router);\napp.config.globalProperties.$axios = axios;\n\napp.mount("#app");\n\nAnd the store module looks like this (simplified for the purposes of this question):\n// store/modules/example.js\n\nconst state = () => ({\n message: ""\n});\n\nconst mutations = {\n getMessage(state, payload) {\n state.message = payload;\n }\n};\n\nconst actions = {\n async setMessage(commit) {\n this.$axios.get("example.com/endpoint").then(response => {\n commit("setMessage", response.message);\n });\n }\n};\n\nexport default {\n namespaced: true,\n state,\n getters,\n actions,\n mutations\n};\n\nThe main store/index.js that's getting imported in main.js above looks like this:\n// store/index.js\n\nimport "es6-promise";\nimport { createStore } from "vuex";\n\nimport example from "./modules/example";\n\nexport const store = createStore({ modules: { example } });\n\n\nIn the component, I have the following:\n// MyComponent.vue\n\nimport { mapGetters, mapActions } from "vuex";\n\nexport default {\n computed: {\n ...mapGetters({\n message: "example/getMessage"\n })\n },\n methods: {\n ...mapActions({\n getMessage: "example/setMessage"\n })\n }\n};\n\nAnd a simple button with @click="getMessage". Clicking this button, however, returns Uncaught (in promise) TypeError: Cannot read property 'get' of undefined, but if I copy/paste the setMessage action into a component method, it works just fine.\nIs there a way for me to expose this.$axios to the store files?"
] | [
"vue.js",
"axios",
"vuex",
"vuejs3",
"vuex-modules"
] |
[
"How to get dynamic label entries with Glade and Gtk",
"I am making an application that takes input from a gyroscope and accelerometer and displays that information in the GUI. How can I display this dynamic information with glade? Is there a way to have a label reflect a variable in my code? I am using python."
] | [
"python",
"ubuntu",
"gtk",
"glade"
] |
[
"Is it possible to get data of related model inside current model in Laravel?",
"I'm building the Laravel app which using recursive url constructing. And I want to know is it possible to access data of the hasone related model within model to return constructed url direct to the view without interacting by controller.\\\n\npublic function link(){\n var_dump($this->category());\n $url = ['news'];\n $url[] = $this->category()->url;\n $url[] = $this->url;\n return implode('/',$url);\n}\n\n\nSimple code example like this return this one\n\nUndefined property: Illuminate\\Database\\Eloquent\\Relations\\HasOne::$url (View: /???/resources/views/common/news/full_preview.blade.php) (View: /???/resources/views/common/news/full_preview.blade.php) (View: /???/resources/views/common/news/full_preview.blade.php)\n\n\nSo is there any good way solve it by using just eloquent models, or it's only possible by using controllers and so on?"
] | [
"php",
"laravel",
"oop",
"laravel-5",
"eloquent"
] |
[
"where asp.net framework 2 website output directory folders and files",
"Virtual folder in IIS can directly set to a working asp.net directory, this website project I am working on is set in IIS as well. my question is where is the generated output folder for this project when debugging? I couldn't find it anywhere inside the working folder. THere is no debug/relese obj folder?"
] | [
"asp.net",
"debugging",
"web",
"output"
] |
[
"iOS 8 - UIScrollView doesn't scroll",
"I want to make vertical scrolling depends on content inside Content View. I've created following hierarchy: View -> Scroll View -> Content View. \n\n\nI pinned (top, bottom, left, right) Scroll View to the Main View\nI also pinned Content View to the Scroll View\nThen i added Same Width and Same Height constraints between Content View and Main View in order to Scroll View could calculate it's content size\n\n\nAfter all these actions, Scroll View doesn't scroll at all (it just shrinks the content). It scrolls only if i add scrollView.contentSize.height to the viewWillLayoutSubviews(). However i don't want to hardcode this height value. I thought Autolayout should automatically calculate content height and add appropriate scrolling. Does anyone know the proper way to solve this problem?"
] | [
"ios",
"xcode",
"uiscrollview",
"autolayout",
"scrollview"
] |
[
"Sending integers via serial port and printing to LCD",
"I am trying to send integers via the a USB serial port from MATLAB to an Ardunio Uno and then subsequently display them on an LCD. I have a problem with numbers from 128 to 159 displaying as 63 on the Arduino display.\n\nHere is my MATLAB code:\n\nq = serial('COM4'); % set com port location\nset(q,'BaudRate',9600); % set baud rate\nfopen(q); % open the port\nfprintf(q,a_number) % send the integer\n\n\nHere is my Arduino code:\n\nint incomingByte = 0; // storage for integer\nvoid serialRead () // \n{\n incomingByte = Serial.read(); // read the serial port \n if (Serial.available() > 0) // if there is data print it to LCD\n {\n lcd.setCursor(0,1); // set the cursor to column 0, line 1 \n lcd.print(\"Boot: %\");\n delay(500);\n lcd.setCursor(6,1);\n lcd.print(incomingByte,DEC); // print the Integer to the LCD\n delay(500);\n }\n}\n\n\nAll numbers from 0 to 255 are displayed correctly apart from numbers 128 to 159 which are displayed as the value 63.\n\nUpdate: I tested the serial port on my from my computer using a serial analyzer and it looks like MATLAB is responsible for sending the data incorrectly. I tested the Arduino code separately and it works perfectly."
] | [
"c",
"matlab",
"serial-port",
"arduino",
"lcd"
] |
[
"Draggable div on top of entire page (on page load)",
"I am working on a web project that should include a draggable element, which I placed in the page using javascript and jquery.\n\nEverything is working as intended, but the div which is draggable takes up some space between the div above and below it. I would like this draggable element to be on top of the rest of the page right after loading the page, i.e. I would like it to not take up space between the div above and the div below but to be generated on top of everything. See the video and jsfiddle below.\n\nHow might I be able to accomplish this?\n\n\n\nJSFiddle"
] | [
"javascript",
"jquery",
"jquery-ui",
"jquery-ui-draggable",
"z-axis"
] |
[
"iOS UIView/UIScrollView overlay with zoom capability",
"I have a UIView/UIScrollView with non rectangular sections, let's call them room plans.\nThe UIView/UIScrollView should be zoomable. \nWhen the user clicks to a non rectangular region/room, I should be able to detect which region was clicked and let's say open up the detailed floorplan of that particular room.\nThe problem is that\n1. when I zoom in and out, the 'button' size must change.\n2. the button is not rectangular.\n\nsee an example of what I am trying to implement in iOS.\nhttp://www.occc.net/ifp/\n\nAny ideas of how to approach this problem are welcome.\n\nThank!"
] | [
"ios",
"uiview",
"uiscrollview",
"overlay"
] |
[
"How to make bars in bar charts fill all the gaps",
"I have a problem with matplotlib.pyplot.bar in which bars can have only constant width, but I want to make a plot, where bars are located between two points. As we can see in the figure, points have different distances, and I want to fill all the gaps with bars. Sorry if this was asked before, I couldn't find it.\n\nso basically I want to bar of the point I have a width of the distance between i and i+1, if that makes any sense."
] | [
"python",
"matplotlib",
"bar-chart"
] |
[
"How can I only sum the first element of each group in the first GroupBy column when there are multiple GroupBy columns?",
"I am relatively new to pandas and am having trouble creating a new column based on a summed groupby.\n\nHere is a snippet of my dataset:\n\nIn [1478]: mkt_vals_joined[['GameId', 'Year', 'HomeTeam', 'attMktValH']].head(10)\nOut[1478]: \n GameId Year HomeTeam attMktValH\n0 1 2005 West Ham 18.50\n1 2 2005 Aston Villa 31.85\n2 3 2005 Everton 31.38\n3 4 2005 Fulham 6.45\n4 5 2005 Man City 30.80\n5 6 2005 Middlesbrough 43.20\n6 7 2005 Portsmouth 30.70\n7 8 2005 Sunderland 5.80\n8 9 2005 Arsenal 88.75\n9 10 2005 Wigan 9.80\n\n\nIt has data up until 2018. The attMktValH column is the value of a team's offense in a particular year. So for example this code shows the value of Arsenal's offense each year:\n\nIn [1483]: mkt_vals_joined.groupby(['HomeTeam', 'Year'])['attMktValH'].first()\nOut[1483]: \nHomeTeam Year\nArsenal 2005 88.75\n 2006 77.25\n 2007 42.45\n 2008 92.50\n 2009 102.50\n 2010 110.30\n 2011 149.50\n 2012 85.50\n 2013 76.90\n 2014 129.65\n 2015 125.00\n 2016 143.50\n 2017 238.00\n 2018 176.70\n\n\nMy problem is that I need to create a column for each game in my original dataframe which is the % of the league's summed offensive value for each year.\n\nFor example, Arsenal had a value of 88.75 in 2005, and the whole league had a value of around 820, so for each Arsenal game in 2005, their value would be 88.75 / 820 * 100\n\nIf I simply sum a groupby the Year and Team it will sum each individual game and give me an incorrect result.\n\nThe code I am currently using to do this is as follows:\n\nhome_mkt_vals['attMkt%'] = home_mkt_vals['attMktValH'] / home_mkt_vals.groupby(['Year'])['attMktValH'].transform(lambda x: np.mean(x) * 20) * 100\n\n\nHowever this seems extremely ugly to me and only works because there are 20 teams in each season.\n\nThanks for any help in advance."
] | [
"python",
"pandas",
"pandas-groupby"
] |
[
"using spring cache read only, how set spring cache redis read only",
"when I use spring cache with redis, I use it in two app, the one read and write,the other is only read,how can I config? \n\nI try do like this, but it does not work!\n\n@Cacheable(value = \"books\", key = \"#isbn\", condition = \"false\")\n\n\nCan anyone help ?"
] | [
"spring-cache"
] |
[
"How can I customize simple membership provider to work with my own database ASP.NET mvc 4",
"I’m exploring ASP.NET MVC 4 these days. I will be pleased if someone can help by answering my question .\n\nI am building an academic project \"Project management and support system\" . I have designed my own database , I have my own tables for the users in my database (two kinds of users : Employee who will execute tasks , and a client who assign/hire for tasks ) ,I was about creating a new membership provider but I realized that \"It's a waste of time - reinventing the wheel\".\n\nNow , I am building a membership model on ASP.NET MVC4 using SimpleMembership (It's the future of membership services for MVC applications ).It provides a more concise membership provider to the ASP.NET framework, and supports OAuth additionally.\n\n1- I created an out-of-the-box ASP.NET MVC 4 internet application to customize the Login, Signup and User management logic to maintain the user-profile table. \nI added three roles : Admin , Employee , Client \n\nGoing through this blogpost , I am able to customize the registration http://blog.longle.net/2012/09/25/seeding-users-and-roles-with-mvc4-simplemembershipprovider-simpleroleprovider-ef5-codefirst-and-custom-user-properties/ \n\n2- Now , I am working synchronize this table with the tables of the users that I have in my own database . Taking in consideration that I have added another field of \"Account Type\" Asking the user during the registration to create a specific profile .\n\nAny help greatly appreciated.\n\nCheers"
] | [
"asp.net-mvc",
"asp.net-mvc-4",
"membership-provider",
"simplemembership"
] |
[
"LinkedList can lead to unnecessary performance overhead if the List is randomly accessed",
"I have this my code:\n @Nullable\n @Value.Default\n default List<String> write() {\n return new LinkedList<>();\n }\n\nAnd DeepCode IntelliJ plugin indicates that LinkedList can lead to unnecessary performance overhead if the List is randomly accessed. And ArrayList should be used instead.\nWhat is this performance overhead that LinkedList have over ArrayList? Is it really much of a difference as what DeepCode suggest?"
] | [
"java"
] |
[
"passing multiple column to function for fixing outlier",
"summary(standard_airline)\n\n\n#outlier treatment\noutFix <- function(x){\n\n quant <- quantile(x,probs = c(.25,.75))\n\n h <- 1.5*IQR(x,na.rm = T)\n\n x[x<(quant[1]-h)] <- quant[1]\n\n x[x>(quant[2]+h)] <- quant[2]\n\n}\n\n v <- colnames(airline[,-1]) \n\n data2 <- lapply(v,outFix)\n\n\n\nError - Error in (1 - h) * qs[i] : non-numeric argument to binary operator\n\nI couldn't find out what is the error coming here although logically seems right, Is there any way in R to pass multiple column of a dataset to a particular function. Here I want to pass every column except ID to fix the outliers."
] | [
"r",
"outliers"
] |
[
"Microsoft Office Interop Excel to Open XML SDK 2.0",
"I have an Excel 2010 Automation project using Microsoft Office Interop library in C#.NET. But now i need to migrate it to work with Open XML SDK 2.0. Any guidelines or suggestions?"
] | [
"openxml",
"office-interop",
"openxml-sdk",
"excel-interop"
] |
[
"Go - Execute a Bash Command n Times using goroutines and Store & Print its result",
"I'm pretty new to Golang in general and I'm trying to execute a bash command with its arguments n times, then, store the Output in a variable and Print it.\n\nI'm able to do it just one time, or just using loops like the following:\n\npackage main\n\nimport (\n \"fmt\"\n \"os/exec\"\n \"os\"\n \"sync\"\n)\n\n\nfunc main() {\n\n //Default Output\n var (\n cmdOut []byte\n err error\n )\n\n //Bash Command\n cmd := \"./myCmd\"\n //Arguments to get passed to the command\n args := []string{\"arg1\", \"arg2\", \"arg3\"}\n\n //Execute the Command\n if cmdOut, err = exec.Command(cmd, args...).Output(); err != nil {\n fmt.Fprintln(os.Stderr, \"There was an error running \"+cmd+\" \"+args[0]+args[1]+args[2], err)\n os.Exit(1)\n }\n //Store it\n sha := string(cmdOut)\n //Print it\n fmt.Println(sha)\n}\n\n\nThis works just fine, I'm able to read the output easily.\n\nNow, I would like to repeat this very same operation for n times, using goroutines.\n\nI tried following the very same approach of the guy who answered How would you define a pool of goroutines to be executed at once in Golang? but I'm not able to make it work.\n\nThat's what I tried so far:\n\npackage main\n\nimport (\n \"fmt\"\n \"os/exec\"\n \"sync\"\n)\n\n\nfunc main() {\n\n //Bash Command\n cmd := \"./myCmd\"\n //Arguments to get passed to the command\n args := []string{\"arg1\", \"arg2\", \"arg3\"}\n\n //Common Channel for the goroutines\n tasks := make(chan *exec.Cmd, 64)\n\n //Spawning 4 goroutines\n var wg sync.WaitGroup\n for i := 0; i < 4; i++ {\n wg.Add(1)\n go func() {\n for cmd := range tasks {\n cmd.Run()\n }\n wg.Done()\n }()\n }\n\n //Generate Tasks\n for i := 0; i < 10; i++ {\n tasks <- exec.Command(cmd, args...)\n //Here I should somehow print the result of the latter command\n }\n close(tasks)\n\n // wait for the workers to finish\n wg.Wait()\n\n fmt.Println(\"Done\")\n\n}\n\n\nBut, I don't really find out how to store the i-result of an executed command and print it.\n\nHow can I achieve this?\n\nThanks in advance, for any clarification on the question just leave a comment."
] | [
"bash",
"go",
"goroutine"
] |
[
"Hard coded path: how do I link it on a ASP.NET MVC website?",
"I have a PDF document in the following location on the remote web server:\n\nC:\\Domains\\Bin\\Invoices\\1000.pdf\n\nHow do I link it? I tried:\n\nstring rootPath = Server.MapPath(\"~\");\nstring path = Path.GetFullPath(Path.Combine(rootPath, \"..\\\\Bin\\\\Invoices\"));\n\n<p>@Html.Raw(\"<a href='\"+ path + \"\\\\\" + \"1000.pdf'>Original PDF copy</a>\")</p>\n\n\nWithout success: the browser tooltip shows me file:///C:/domains/bin/invoices/1000.pdf\n\nThanks.\n\nEDIT\n\nSolved using Joe suggestion, this way:\n\npublic FileResult InvoiceInPdf(string id)\n{\n string rootPath = Server.MapPath(\"~\");\n string path = Path.GetFullPath(Path.Combine(rootPath, \"..\\\\Bin\\\\Invoices\\\\\"));\n\n return File(path + id + \".pdf\", \"application/pdf\");\n}"
] | [
"asp.net",
"asp.net-mvc",
"url"
] |
[
"Deploying AWS Lambda with Go & Cloudformation",
"I'm working through an automated deployment of a Go-based AWS Lambda, and having issues.\n\nMy AWS Serverless template is:\n\nAWSTemplateFormatVersion: '2010-09-09'\nTransform: AWS::Serverless-2016-10-31\nResources:\n HelloLambda:\n Type: AWS::Serverless::Function\n Properties:\n Handler: hello\n Runtime: go1.x\n CodeUri: ./deploy/hello.zip\n Environment:\n Variables: \n S3_BUCKET: hello_lambda\n\n\nI deploy this via:\n\nGOOS=linux GOARCH=amd64 go build -o ./deploy/hello\nzip ./deploy/hello.zip ./deploy/hello\naws cloudformation package \\\n --template-file hello.yaml \\\n --output-template-file serverless-deploy_hello.yaml \\\n --s3-bucket hello_deploy\naws cloudformation deploy\\\n --template-file serverless-deploy_hello.yaml\\\n --stack-name hello-lambda\\\n --capabilities CAPABILITY_IAM\n\n\nWhen Cloudformation does its thing, serverless-deploy_hello.yaml has CodeUri: s3://hello_deploy/17ab86653aab79eee51fc6f77d7a152e and that s3 bucket contains the zip file (when I download it locally & use cmp it's bit-identical).\n\nBUT when I test the resulting Lambda, it gives me:\n\n{\n \"errorMessage\": \"fork/exec /var/task/hello: no such file or directory\",\n \"errorType\": \"PathError\"\n}\n\n\nNot quite sure what I'm doing wrong here....\n\n==== RESOLVED ====\n\nThe zip command above zips the directory path as well, so the executable unzips to deploy/hello rather than ./hello.\n\nAccordingly, the Lambda runtime can't connect to the process."
] | [
"go",
"aws-lambda"
] |
[
"Python Script to Run for ArcGIS",
"I want to run python scripts that use geo-processing tools. I do not want to integrate them, instead I want to run scripts outside and not in ArcGIS. Please tell me how to do it with a nice example. I have to do reclassification of 4 maps and then do a weighted sum overlay of the outputs. Below is the script which I am able to write, but I don't know where I am getting an error..\n\nenter code here # \n\nimport sys, string, os, arcgisscripting\n gp = arcgisscripting.create()\n gp.CheckOutExtension(\"spatial\")\n\n gp.AddToolbox(\"C:/../Spatial Analyst Tools.tbx\")\n\n feature_shp1 = sys.argv[1]\n if feature_shp1 == '#':\n feature_shp1 = \"D:\\\\BRIEFCASE\\\\media\\\\new shapefiles\\\\feature_shp1\"\n slope = sys.argv[2]\n if slope == '#':\n slope = \"D:\\\\\" \n\n Reclassification__2_ = sys.argv[3]\n if Reclassification__2_ == '#':\n Reclassification__2_ = \"2 1;2 3 2;3 4 3;4 5 4\" \n\n Reclassification = sys.argv[4]\n if Reclassification == '#':\n Reclassification = \"0 13 1;13 45 2;45 80 3;80 108 4;108 146 5;146 176;174 195 7;195 231 8;231 255 9\" \n\n Reclass_feat3 = \"D:\\\\\"\n Reclass_slop3 = \"D:\\\\3\"\n gjh = \"C:\\\"\n Reclass_field = \"VALUE\"\n Reclass_field__2_ = \"VALUE\"\n\n gp.Reclassify_sa(feature_shp1, Reclass_field__2_, Reclassification__2_, Reclass_feat3, \"NODATA\")\n\n gp.Reclassify_sa(slope, Reclass_field, Reclassification, Reclass_slop3, \"NODATA\")\n\n gp.WeightedSum_sa(\"'..Reclass_feat3' VALUE 1;'D:..Reclass_slop3' VALUE 1\",\"ijh\")"
] | [
"python",
"arcgis"
] |
[
"How to preload all ionic module only on device?",
"How to use preload all strategy on device and nopreload on browser?\nwe can load all module like this:\n\nimports: [\nCommonModule,\nRouterModule.forRoot(appRoutes, { preloadingStrategy: PreloadAllModules }),\n...\n],\n\n\nThis will preload all module in any platform,\nBut i want to prevent preload when running on browser. And it must only preload on device"
] | [
"angular",
"ionic-framework",
"ionic-native"
] |
[
"List vs Queue vs Set of collections in Java",
"what is the difference among list, queue and set?"
] | [
"java",
"list",
"collections",
"queue",
"set"
] |
[
"Mysql - Multi selection with a single query",
"I have a table that holds events. The front-end displays all the events as cards. One event, one card. I also have a table that holds subscriptions. One event, many subscriptions. \n\nIs there a way to retrieve all the events with all their subscriptions with a single query? \n\nCurrently, I do a query to get all the events, then I run a loop and run a query for each events to fetch its subscriptions. So, as the number of events increase, the number of sub-queries (and db connections) increase. That's why I'd like to know if it's possible to reduce this to a single query.\n\nevent subscription\n+----------+ +------------+\nid id\nname user\nlocation age\ndate event_id\n\n\n ... ...\n\nTRYING TO MAKE MY QUESTION EASIER :P\n\nTo simplify it, think about a Facebook post. Facebook shows the post and all the users that have liked it, right? So, is there a way to bring all the posts and all the usernames that have liked each post, in a single query?"
] | [
"mysql",
"arrays",
"join"
] |
[
"jquery multiple http get requests with promise",
"I'm trying to get multiple images from server using jquery get.\n\n $.each(result.Data.Files, function (i, v) {\n\n $.get('/mobile/image?path=' + v, function (res) {\n\n if (res.Success) {\n $('#images-container').append(`<img alt=\"Image Title\" src=\"${res.Image}\">`);\n }\n });\n\n });\n\n\nAfter i append all images i want to call a jquery plugin to handle these images.\nHow can i do that using promise ?\n\ni tries something like :\n\n $.when(\n $.each(result.Data.Files, function (i, v) {\n $.get('/mobile/image?path=' + v);\n })\n ).then(function () {\n\n $(\"#images-container\").image_plugin();\n\n for (var i = 0; i < arguments.length; i++) {\n\n let src = arguments[i];\n console.log(src)\n }\n\n\n\n });\n\n\nbut what i'm getting in the then section is just the urls and not the actual base64 response\n thanks"
] | [
"javascript",
"jquery",
"promise"
] |
[
"How to get the code of a java exe?",
"Possible Duplicate:\n Where can I find a Java decompiler? \n\n\n\n\nHi,\n\nhow to get the source code of a java exe file (an simple application)?\n\n(I know its not obfuscated)\n\nEDIT:\nIts an Exe File, not more not less, no *.jar"
] | [
"java"
] |
[
"Initialisation of aggregate with default constructor deleted in c++20",
"There is a struct containing POD and default constructor deleted. Trying to aggregate-initalize an instance of the struct results in compilation error in g++9.1 when compiled with -std=c++2a. The same code compiles fine with -std=c++17.\n\nhttps://godbolt.org/z/xlRHLL\n\nstruct S\n{\n int a;\n S() = delete;\n};\n\nint main()\n{\n S s {.a = 0};\n}"
] | [
"c++",
"c++17",
"c++20",
"aggregate-initialization",
"deleted-functions"
] |
[
"Efficient pytorch broadcasting not found",
"I have the following code snippet in my implemenatation. There is a nested for loop with 3 loops. In the main code the 3D coordinates of the original system is stacked as a 1D vector of constinous stacking of points as for a point with coordinate (x,y,z) a sample cells will look like\nPredictions =[...x,y,z,...]\n\nwhereas for my calulation I need reshaped_prediction vector as a 2D matrix with prediction_reshaped[i][0]=x, prediction_reshaped[i][1]=y prediction_reshaped[i][2]=z\nwhere i is any sample row in the matrix prediction_reshaped.\nThe following code shows the logic\nprediction_reshaped=torch.zeros([batch,num_node,dimesion])\n for i in range(batch):\n for j in range(num_node):\n for k in range(dimesion):\n prediction_reshaped[i][j][k]=prediction[i][3*j+k]\n\nis their any efficient broadcasting to avoid these three nested loop? it is slowing down my code. torch.reshape does not suit my purpose.\nThe code is implemented using pytorch with all matrices as pytorch tensor but any numpy solution will also help."
] | [
"pytorch",
"array-broadcasting"
] |
[
"instanceof with ember-data models not working as expected",
"I'm getting some unexpected behaviour from ember-data with instanceof\n\nA = DS.Model.extend();\nB = A.extend();\n\nstore.createRecord('b') instanceof store.modelFor('a') // false ???\n\nX = Ember.Object.extend();\nY = X.extend();\n\ny = Y.create();\ny instanceof X // true - works as expected\n\n\nI'm using the latest canary builds of both ember and ember-data. Anyone else come across this?\n\nEDIT: I'm also using ember-cli with the es6 module transpiler. Not sure how/if that could affect anything.\n\nEDIT: Just re-created this using an otherwise empty ember-cli project (http://iamstef.net/ember-cli/#getting-started). I guess I'll file an issue on that project."
] | [
"ember.js",
"ember-data",
"instanceof"
] |
[
"How to add images to painted texture in blender?",
"When painting textures in blender, I would like to add existing images to the texture image. But blender does not seem to provide such functions.\n\nI tried external editing in photoshop, but the uv unwrapped vertices are lost and so there's no reference points available.\n\nThanks!"
] | [
"blender"
] |
[
"TypeError using Telnet.write()",
"I have the following code:\n\ntry:\n tn = Telnet(host, str(port))\nexcept Exception as e:\n print(\"Connection cannot be established\", e)\n traceback.print_exc()\nprint(\"You are connected\")\ntn.write('command?'+'\\r\\n')\nwhile True:\n line = tn.read_until(\"\\n\")\n\n\nWhen I run this code on machine X everything is working just fine, but when when I try to run the same code on a different machine I end up with the following error:\n\n Traceback (most recent call last):\n File\n \"C:/Users/admin/Documents/Projects/terminalManager/terminalManager.py\", line 50, in <module>\n terminalManager()\n File\n\"C:/Users/admin/Documents/Projects/terminalManager/terminalManager.py\", line 16, in __init__\nself.connect(terminalBganIp, terminalBganPort)\nFile \"C:/Users/admin/Documents/Projects/terminalManager/terminalManager.py\", line 34, in connect\ntn.write('AT_IGPS?'+'\\r\\n')\nFile \"C:\\Program Files (x86)\\Python\\Python3.6.1\\lib\\telnetlib.py\", line 287, in write\nif IAC in buffer:\nTypeError: 'in <string>' requires string as left operand, not bytes\n\n\nAm I doing something wrong or is the second machine messing with me?\n\nEDIT:\n\nWhen i used IDLE debugger on my second machine everything is working. it seems it is not working when running it normally, is there anything i can do to resolve this?"
] | [
"python",
"python-3.x",
"telnet"
] |
[
"Gem for Finding Associated University of Email Addresses",
"I don't think this exists, but I thought I should ask before reverting to finding some CSV table with this data. I receive a college email from the user and I want to find the name of the University that is associated with the suffix of the email. For example, [email protected] should be associated to University of Georgia. Is there some Rails gem that could help me solve my dilemma or am I going to have to create some database or hash with this data?"
] | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3",
"email",
"gem"
] |
[
"RxJava - Continue infinite stream",
"I saw the other similar issue, but it did not solve my problem: \n\n Observable<Integer> resumeSequence = Observable.just(-1); \n Observable.just(1,0,2,5)\n .flatMap(x -> \n Observable.just(10/x)\n //.onErrorReturn(error -> -1)\n .onErrorResumeNext(resumeSequence)\n .onExceptionResumeNext(resumeSequence)\n )\n// .onErrorReturn(error -> -1)\n .onErrorResumeNext(resumeSequence)\n .onExceptionResumeNext(resumeSequence)\n .subscribe(System.out::println, \n throwable -> System.out.println(\"IN ERROR CALLBACK\" + throwable));\n\n\nIdeally the Resume should be inside the flatMap. The output should print 4 numbers & flow should not go to the Error Callback."
] | [
"rx-java"
] |
[
"Notepad with dialogbox appears in Deploying GAE",
"In Google app engine. When i try to deploy. Its deploying and at last it says \"Deployed Successfully\". Then it shows this screen. Y am i getting this screen..In preferences when i click on Google -> AppEnginesdk, I get the same screen\n\nImage Url: http://i44.tinypic.com/5lnh9l.png.\n\n\nPlease help me in solving this.\n\nThank you."
] | [
"java",
"google-app-engine"
] |
[
"Organization of `thy` files that come with Isabelle",
"I'm relatively new to Isabelle and I'm puzzled by the organization of the thy files that come with Isabelle. \n\nWhy are some files that pertaing to the same body of knowledge in ~~src/HOL, whereas others are in ~~src/HOL/<theoryname>?\n\nE.g. Why is GCD is in ~~src/HOL and not in ~~src/HOL/Number_Theory?\n\n\n\nSimilar question: What is the difference between the ex folder and the Isar_Examples folder in ~~src/HOL? Wouldn't it have been more natural to merge them?\n\n\n\nAlso, what is the document folder from ~~src/HOL for?"
] | [
"isabelle"
] |
[
"Oracle SYS.AUD$ Audit Actions",
"We are running into tablespace issues as a result of a large SYS.AUD$ table. Upon further investigation, we identified that 99% of the items in this table were SELECT actions\n\nSELECT COUNT(*) from SYS.AUD$ where ACTION# = 3;\n\n334698880\n\nSELECT COUNT(*) FROM SYS.AUD$;\n\n335176012\n\n\nHowever, we cannot find WHY these are being logged.\n\n\nNo system-wide auditing privileges set for SELECT (DBA_PRIV_AUDIT_OPTS)\nNo system-wide statement options set for SELECT (DBA_STMT_AUDIT_OPTS)\nNo specific objects being tracked (DBA_OBJ_AUDIT_OPTS)\n\n\nSomehow these settings are being overridden. Any suggestions with regards to places to look?"
] | [
"oracle",
"oracle11gr2",
"auditing"
] |
[
"wp-mail-smtp in wordpress Connection refused (111)",
"I developed my site with WordPress 4.5.3.I installed plugin WP-Mail-SMTP.I create mail account with my host tigrimigri.com.\nwith this setting\n\nSecure SSL/TLS Settings\nUsername: Your Email Address\nIncoming Server: freehost.tigrimigri.com\nIMAP Port: 993\nPOP3 Port: 995\n\nOutgoing Server: freehost.tigrimigri.com\nSMTP Port: 25\n\n\nThen I write this info at plugin WP-Mail-SMTP setting \nBut when I test email I get this error\n\nThe SMTP debugging output is shown below:\n2016-07-02 12:21:04 Connection: opening to ssl://freehost.tigrimigri.com:25, timeout=300, options=array (\n )\n2016-07-02 12:21:04 SMTP ERROR: Failed to connect to server: Connection refused (111)\n2016-07-02 12:21:04 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting\n\n\nPlease anyone help me."
] | [
"wordpress"
] |
[
"ASP.NET Core 3.1: authentication through Active Directory on linux",
"Our application has JWT-base authentication mechanism. I have to add an AD authentication to it but I don't know how to do it. Our application is:\n\nBackend based on ASP.NET Core 3.1.\nFrontend based on Vue.\nBackend works on Debian but that machine is not an AD domain member. But if it's necessary I can join that machine to domain.\n\nI can't find any information about this question. This page contains almost no useful information. All other examples are too old and are not actual for 3.1.\nFor test purpose i've done these steps:\n\nI've created Samba-based AD domain. Controller and member works on Debian 10:\n\nController's name is dc1.mydomain.net.\nDomain: MYDOMAIN.\nRealm: MYDOMAIN.NET.\nAD member's name is m1.mydomain.net.\n\n\nI've set an environment variable KRB5_KTNAME with path to keytab file:\n\nexport KRB5_KTNAME=$HOME/krb5.keytab. Previously I've copied krb5.keytab from /etc to ~ and set reading rights for me.\n\n\nI've added this code to Startup.cs:\n\n services\n .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)\n .AddJwtBearer(options =>\n {\n options.RequireHttpsMetadata = false;\n options.TokenValidationParameters = new TokenValidationParameters\n {\n // ...\n };\n })\n .AddNegotiate(options =>\n {\n if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\n {\n options.EnableLdap(settings =>\n {\n settings.Domain = "mydomain.net";\n settings.MachineAccountName = "administrator";\n settings.MachineAccountPassword = "...";\n });\n }\n });\n \n // …\n app.UseAuthentication();\n app.UseAuthorization();\n\nAnd my questions are:\n\nWhat I have to do now? How to authenticate the user? I can't find any example or instruction.\nWhat means MachineAccountName and MachineAccountPassword? Are it login and password of domain user? Are it necessary? If I use these parameters, I get an exception: "System.DirectoryServices.Protocols.DirectoryOperationException: Strong authentication is required for this operation".\nIs it necessary to add some another SPNs to keytab file? Now my keytab file has records:\n\n 1 2 host/[email protected]\n 2 2 host/[email protected]\n 3 2 host/[email protected]\n 4 2 host/[email protected]\n 5 2 host/[email protected]\n 6 2 host/[email protected]\n 7 2 host/[email protected]\n 8 2 host/[email protected]\n 9 2 host/[email protected]\n 10 2 host/[email protected]\n 11 2 [email protected]\n 12 2 [email protected]\n 13 2 [email protected]\n 14 2 [email protected]\n 15 2 [email protected]\n 16 2 host/[email protected]\n 17 2 host/[email protected]\n 18 2 host/[email protected]\n 19 2 host/[email protected]\n 20 2 host/[email protected]\n 21 2 host/[email protected]\n 22 2 host/[email protected]\n 23 2 host/[email protected]\n 24 2 host/[email protected]\n 25 2 host/[email protected]\n 26 2 [email protected]\n 27 2 [email protected]\n 28 2 [email protected]\n 29 2 [email protected]\n 30 2 [email protected]\n\nThanks very much for your answers!"
] | [
"asp.net-core",
"active-directory",
"debian"
] |
[
"Why is Google Maps Library for android so out of date?",
"I'm an Android platform newbie looking to port some of my Windows \nPhone 7 mapping apps over here. My WP7 apps use Bing Maps which has\ncurrent maps and POI data.\n\nI went to the Android Developers Resources center where it shows how \nto develop an app using the Google Maps Library. I did that and \nnoticed that the maps were over 7 years old. \n\nI posted that issue on the google groups forum and was told that Google had \napparently given up on that library. (Strange that they still feature \nit in their developer resources site.) \n\nSo, if they have given up on that library, is there another library \nthey haven't given up on? It seems odd that Google would give up on \nGoogle Maps (bad strategy). \n\nWhat tools, libraries, etc. should an android developer use that wants \nto write compelling mapping applications that can show maps, POIs, directions that use current\nmaps and data?\nThanks \nGary"
] | [
"android",
"google-maps"
] |
[
"Visual Studio 2010 setup project - How to avoid UAC message about unknown publisher during installation?",
"I've made a simple Windows Forms application with Visual Studio 2010 that doesn't need elevated rights to work.\n\nI've created a setup project to install the files in following location to not need administrative rights during the installation: [LocalAppDataFolder][Manufacturer][ProductName].\nAnd no registry keys are installed either by the installer.\n\nBut it keeps asking \"Do you want to allow the following program from an unknown publisher to make changes to your computer?\" during the installation, and I'd like to avoid this.\n\nI've seen that this message will keep being prompted until the installer file has not been signed with a certificate purchased from an official authority.\n\nIs there a way to do this freely? \nOr to avoid this message when the application doesn't need elevated rights?\n\nThanks in advance for your help,\nJulien"
] | [
"visual-studio-2010",
"setup-project",
"uac"
] |
[
"Component's Sizes in GridBagLayout",
"I'm having major issues aligning the components in GridBagLayout, yes I've read the tutorial by Oracle and tried changing the weightx.\n\nThis is how it looks like currently :\n \n\nBasically what I need to achieve is:\n\nJTextFields \"Nome\" and \"Filiação\" to stretch all the way to the left, just like \"Idade\" and \"Turma\" \n\nBottom JButtons to be the same size, aligned in the middle.\n\nI hope someone can point what I'm missing here.\n\nHere's a sorta SSCCE:\n\n package test1;\n\nimport java.awt.GridBagConstraints;\nimport java.awt.GridBagLayout;\nimport java.awt.Insets;\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JLabel;\nimport javax.swing.JPanel;\nimport javax.swing.JTextField;\n\npublic class Test1 {\npublic static void main(String[] args) {\n\n JFrame jf = new JFrame(\"Test\");\n JPanel jp = new JPanel(new GridBagLayout());\n GridBagConstraints gbc = new GridBagConstraints();\n gbc.insets = new Insets(10, 10, 10, 10);\n\n JLabel labelNome = new JLabel(\"Nome:\");\n gbc.gridx = 0;\n gbc.gridy = 0;\n gbc.fill = GridBagConstraints.BOTH;\n jp.add(labelNome, gbc);\n\n JTextField tfNome = new JTextField();\n gbc.gridx = 1;\n gbc.ipadx = 50;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfNome, gbc);\n\n JLabel labelIdade = new JLabel(\"Idade :\");\n gbc.ipadx = 0;\n gbc.gridx = 2;\n gbc.fill = GridBagConstraints.NONE;\n jp.add(labelIdade, gbc);\n\n JTextField tfIdade = new JTextField();\n gbc.gridx = 3;\n gbc.ipadx = 50;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfIdade, gbc);\n\n JLabel labelEndereco = new JLabel(\"Endereço :\");\n gbc.ipadx = 0;\n gbc.gridx = 0;\n gbc.gridy = 1;\n gbc.fill = GridBagConstraints.BOTH;\n jp.add(labelEndereco, gbc);\n\n JTextField tfEndereco = new JTextField();\n gbc.ipadx = 50;\n gbc.gridx = 1;\n gbc.gridwidth = 3;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfEndereco, gbc);\n\n JLabel labelFiliacao = new JLabel(\"Filiação :\");\n gbc.ipadx = 0;\n gbc.gridwidth = 1;\n gbc.gridx = 0;\n gbc.gridy = 2;\n gbc.fill = GridBagConstraints.BOTH;\n jp.add(labelFiliacao, gbc);\n\n JTextField tfFiliacao = new JTextField();\n gbc.gridx = 1;\n gbc.ipadx = 50;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfFiliacao, gbc);\n\n JLabel labelTurma = new JLabel(\"Turma :\");\n gbc.ipadx = 0;\n gbc.gridx = 2;\n gbc.fill = GridBagConstraints.BOTH;\n jp.add(labelTurma, gbc);\n\n JTextField tfTurma = new JTextField();\n gbc.gridx = 3;\n gbc.ipadx = 50;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfTurma, gbc);\n\n JLabel labelDisciplina = new JLabel(\"Disciplina :\");\n gbc.ipadx = 0;\n gbc.gridx = 0;\n gbc.gridy = 3;\n gbc.fill = GridBagConstraints.BOTH;\n jp.add(labelDisciplina, gbc);\n\n JTextField tfDisciplina = new JTextField();\n gbc.ipadx = 50;\n gbc.ipady = 0;\n gbc.gridx = 1;\n gbc.gridwidth = 3;\n gbc.fill = GridBagConstraints.HORIZONTAL;\n jp.add(tfDisciplina, gbc);\n\n JButton adicionaDisciplina = new JButton(\"Adicionar disciplina\");\n gbc.ipadx = 0;\n gbc.gridwidth = 2;\n gbc.gridx = 0;\n gbc.gridy = 4;\n jp.add(adicionaDisciplina, gbc);\n\n JButton limparDisciplina = new JButton(\"Limpar lista de disciplinas\");\n gbc.gridx = 2;\n jp.add(limparDisciplina, gbc);\n\n JButton botaoSalvar = new JButton(\"Salvar\");\n gbc.gridx = 0;\n gbc.gridy = 5;\n jp.add(botaoSalvar, gbc);\n\n JButton botaoCancelar = new JButton(\"Cancelar\");\n gbc.gridx = 2;\n jp.add(botaoCancelar, gbc);\n\n jf.setSize(500, 550);\n jf.add(jp);\n\n jf.setVisible(true);\n\n}\n\n}"
] | [
"java",
"swing",
"layout-manager",
"gridbaglayout"
] |
[
"Finding a specific value for each row in a Dataframe from another Dataframe's column",
"I am looking for alternate ways to replace functions used in Excel with Python, especially with Pandas. One of the functions is COUNTIFS(), which I have been primarily using to locate specific row values in a fixed range. This is mainly used to determine, whether the specific values in one column are present in the other column, or not.\n\nAn example in Excel would look something like this:\n\n\n\nThe code for the first row (column: col1_in_col2):\n\n=COUNTIFS($B$2:$B$6,A2)\n\nI have tried to recreate the function in Pandas, only with the difference that the two columns can be found in two different DataFrames and the DataFrames are inside a dictionary (bigdict). The code is the following:\n\nimport pandas as pd\n\nbigdict = {\"df1\": pd.DataFrame({\"col1\": [\"0110200_2016\", \"011037_2016\", \"011037_2016\", \"0111054_2016\"]}), \"df2\": pd.DataFrame({\"col1\" : [\"011037_2016\", \"0111054_2016\", \"011109_2016\", \"0111268_2016\"]})}\n\nbigdict.get(\"df1\")[\"df1_in_df2\"] = bigdict.get(\"df1\").apply(lambda x: 1 if x[\"col1\"] in bigdict.get(\"df2\")[\"col1\"] else 0, axis=1)\n\n\n\nIn the example above, the first row should get a return value of zero, while the other rows should get return values of 1, since it can be found in the other DataFrame's column. However, the return value is 0 for every row."
] | [
"python",
"excel",
"pandas",
"dataframe"
] |
[
"PHP preg_match not giving me the expected result",
"I have to check if a string matches bio control numbers for products. This link has the specifications (unfortunatly in german).\nThe numbers start with a country-code, followed by 3 characters and two or three digits. Here some examples:\nDE-ÖKO-233\nIT-BIO-053\nDK-ØKO-79\n\n\nThis is the regex, I came up with: /[A-Z]{2}-[A-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŒŠŸ]{3}-\\d{2,3}/\nWhile it works perfectly fine on regex101.com, it doesn't work in my php-script as it returns an empty array.\n$value = "DE-ÖKO-007";\n\npreg_match('/[A-Z]{2}-[A-ZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŒŠŸ]{3}-\\d{2,3}/', $value, $matches);\n\nprint_r($matches);\n\n\nMy expected output would be\nArray(\n [0] => "DE-ÖKO-007"\n)\n\nbut I actually get\nArray(\n)\n\nAm I missing something in the way preg_match works?"
] | [
"php",
"regex",
"preg-match"
] |
[
"Python - Small Change to a Huge File",
"This is a theoretical question as I don't have an actual problem, but I got to wondering ... \n\nIf I had a huge file, say many gigs long and I wanted to change a single byte and I knew the offset of that byte, how could I do this efficiently? Is there a way to do this without rewriting the entire file and only writing the single byte?\n\nI'm not seeing anything in the Python file api that would let me write to a particular offset in a file."
] | [
"python"
] |
[
"codeigniter auto incrementing ID that can be seen in view and Javascript Window.Print() function",
"so i am making an invoice, and I want that in my view, which is the receipt.php has an Invoice No: for example is 0001 and this is what will I put in my tbl_payment as the primary key, but how will I be able to have an auto incremented ID at the view when my table is still empty? and 2nd is I want to print it, BUT theres something wrong with my Window.Print() function, is that i am styling my receipt using CSS and eventhough how much I put effort into it, what I can only see is black and white, This is the one that you can see in the receipt\n\nand this is what you can see when I print, how does this happen?"
] | [
"javascript",
"php",
"css",
"codeigniter"
] |
[
"Finding duration between events",
"I want to compute the duration (in weeks between change). For example, p is the same for weeks 1,2,3 and changes to 1.11 in period 4. So duration is 3. Now the duration is computed in a loop ported from R. It works but it is slow. Any suggestion how to improve this would be greatly appreciated.\n\nraw['duration']=np.nan\nid=raw['unique_id'].unique()\nfor i in range(0,len(id)):\n pos1= abs(raw['dp'])>0\n pos2= raw['unique_id']==id[i]\n pos= np.where(pos1 & pos2)[0]\n raw['duration'][pos[0]]=raw['week'][pos[0]]-1\n for j in range(1,len(pos)):\n raw['duration'][pos[j]]=raw['week'][pos[j]]-raw['week'][pos[j-1]]\n\n\nThe dataframe is raw, and values for a particular unique_id looks like this.\n\n \n\ndate week p change duration\n2006-07-08 27 1.05 -0.07 1\n2006-07-15 28 1.05 0.00 NaN\n2006-07-22 29 1.05 0.00 NaN\n2006-07-29 30 1.11 0.06 3\n... ... ... ... ...\n2010-06-05 231 1.61 0.09 1\n2010-06-12 232 1.63 0.02 1\n2010-06-19 233 1.57 -0.06 1\n2010-06-26 234 1.41 -0.16 1\n2010-07-03 235 1.35 -0.06 1\n2010-07-10 236 1.43 0.08 1\n2010-07-17 237 1.59 0.16 1\n2010-07-24 238 1.59 0.00 NaN\n2010-07-31 239 1.59 0.00 NaN\n2010-08-07 240 1.59 0.00 NaN\n2010-08-14 241 1.59 0.00 NaN\n2010-08-21 242 1.61 0.02 5\n\n\n##"
] | [
"python",
"pandas"
] |
[
"Does Delegate.BeginInvoke require MemoryBarrier?",
"private class ParamDatas\n{\n public object Param1;\n public object Param2;\n}\n\nprivate static void Main(string[] args)\n{\n Action<ParamDatas> action = ThreadAction;\n var myParamDatas = new ParamDatas();\n var result = action.BeginInvoke(myParamDatas, null, null);\n\n // dosomething ...\n}\n\nprivate static void ThreadAction(ParamDatas paramDatas)\n{\n Thread.MemoryBarrier();\n\n // use paramDatas ....\n // var param1 = paramDatas.Param1;\n}\n\n\nIs the MemoryBarrier required in this code? \nor BeginInvoke function will avoid dirty data?"
] | [
"c#",
"thread-safety",
"begininvoke"
] |
[
"Add a UITapGestureReconizer to a UIImage",
"I have a UITapGestureReconizer set up with my view but I only want the selector to be called when the view tapped is this picture I have. I tried adding the recognizer to the imageView both programmatically and via the storyboard but neither worked. It only works for my view. Here is the code.\n\nvar tapGestureRecognizer:UITapGestureRecognizer?\n\n\nand in my viewDidLoad I have\n\ntapGestureRecognizer = UITapGestureRecognizer(target: self, action: \"handleTap:\")\nself.view.addGestureRecognizer(tapGestureRecognizer!)\n\n\nmy image is a variable as well \n\n@IBOutlet weak var mainImage: UIImageView!"
] | [
"ios",
"uigesturerecognizer",
"uitapgesturerecognizer"
] |
[
"Pass checked checkbox data attribute through JQuery",
"I have multiple checkboxes in a for each loop all with different data attributes.\n\n <input data-pid=\"<?php echo $name ?>\" class=\"live\" name=\"live\" id=\"live\" type=\"checkbox\" value=\"\">\n\n\nIn JQuery I am trying to fetch the data attribute of the checked option and whether it is checked or not.\n\n $(\".live\").click(function() {\n\n var n = this.id\n var a = this.attr(\"data-pid\");\n\n\nI don't seem to be able to get the id or attr"
] | [
"jquery"
] |
[
"Fullscreen webview xamarin",
"I'm developing a new app in xamarin forms (crossed app) using xaml/C#. In a page called webview.xaml I have insert the webview \n\nvar browser = new WebView {\n Source = \"http://xamarin.com\"\n};\n\n\nWhen I play a video with webview I can't view it in fullscreen mode. \nHow can I enable the fullscreen mode?"
] | [
"c#",
"xaml",
"xamarin",
"webview",
"fullscreen"
] |
[
"Ruby on Rails - FCKEditor Absolute Image Path Ruby",
"I am using the FCKEditor wysiwyg editor, and was wondering if anyone figured out how to use the absolute path instead of relative path after you add an image in the editor?\nAnd if so, how."
] | [
"ruby-on-rails",
"fckeditor"
] |
[
"How to load tensorflow checkponit by myself without c++ api?",
"I am using tensorflow 1.0. \n\nMy production environment cannot build tensorflow-cpp because low gcc&glibc version.\n\nIs there any doc about how to load a checkponit or freezed-graph in C++ without api? \n\n1、 how to save network parameter? (embeding...)\n\n2、 how to save graph structure (layers,weights...)"
] | [
"tensorflow",
"tensorflow-serving"
] |
[
"On C# WinForm ListBox how to clear the selection of multiple items with a key pressed?",
"I'm trying to clear the selection of all items in a WinFom ListBox when the escape key is pressed. \n\nI created a KeyPress event handler in order to catch the event. It works when only one item is selected, but when multiple items are selected the event never triggers, . Any idea of what is happening?\n\nThanks in advance.\n\nHere I attached my event handler:\n\nprivate void EscapeKeyPressed(object sender, KeyPressEventArgs e)\n {\n try\n {\n if (e.KeyChar == (char)Keys.Escape)\n {\n switch (sender.GetType().GetProperty(\"Name\").GetValue(sender, null).ToString())\n {\n case \"LineLB\":\n LineLB.ClearSelected();\n break;\n case \"ApplicationLB\":\n ApplicationLB.ClearSelected();\n break;\n default:\n break;\n }\n }\n }\n catch(Exception ex) { MessageBox.Show(ex.Message); }\n\n\n--20150526--\n\nThanks all you guys for your comments and suggestions. It was a focus problem as some of you mentioned before. I add a line of code in the SelectedIndexChange event handler, and here the comparison.\n\nBefore\n\nprivate void LineLB_SelectedIndexChanged(object sender, EventArgs e)\n {\n try\n {\n if (LineLB.SelectedItems.Count > 1)\n ClearControlsFromPanel(PanelUser);\n else{\n ...\n\n\nAfter\n\n private void LineLB_SelectedIndexChanged(object sender, EventArgs e)\n {\n try\n {\n if (LineLB.SelectedItems.Count > 1){\n ClearControlsFromPanel(PanelLine);\n LineLB.Focus();\n }\n else{\n ..."
] | [
"c#",
"winforms",
"listbox",
"multipleselection"
] |
[
"Why is my input delayed when sent to process via pipes?",
"I'm writing a program for an operating systems project which is meant to basically be a modem keyboard as in I type a key and it outputs an FSK-modulated-audio-signal corresponding to the ASCII value of that key. How I've set up my program is that it forks a process and execs a program called minimodem (see here for info). The parent is set to non canonical input mode and gets user input a character at a time. Each character is then sent to the child via a pipe. I'll just paste the code now:\n\n#include <stdlib.h>\n#include <fcntl.h>\n#include <errno.h>\n#include <unistd.h>\n#include <stdio.h>\n#include <sys/ioctl.h>\n#include <string.h>\n#include <termios.h>\n\nextern char* program_invocation_short_name;\n\nstatic struct termios old, new;\nvoid init_termios(int echo);\nvoid reset_termios(void);\nint main(int argc, char* argv[])\n{\npid_t pid;\nint my_pipe[2];\n\nchar* baud = \"300\";\nif (argc == 2) {\n if(atoi(argv[1]) == 0) {\n printf(\"Use: %s [baud]\\n\",program_invocation_short_name);\n return EXIT_SUCCESS;\n }\n baud = argv[1];\n}\n\nif (argc > 2) {\n printf(\"Too many arguments.\\nUsage: %s [baud]\\n\",program_invocation_short_name);\n return EXIT_SUCCESS;\n}\n\nif (pipe(my_pipe) == -1) {\n fprintf(stderr, \"%s: %s\",program_invocation_short_name,strerror(errno));\n return EXIT_FAILURE;\n}\n\npid = fork();\nif (pid < (pid_t) 0) {\n fprintf(stderr, \"%s: %s\",program_invocation_short_name,strerror(errno));\n return EXIT_FAILURE;\n}else if (pid == (pid_t) 0) {\n /***************/\n /*CHILD PROCESS*/\n /***************/\n close(my_pipe[1]); /*Child doesn't write*/\n dup2(my_pipe[0], 0); /*Redirect stdin to read side of pipe*/\n close(my_pipe[0]); /*Close read end as it's dup'd*/\n execl(\"/usr/local/bin/minimodem\",\"minimodem\",\"--tx\", baud,\"-q\",\"-A\",NULL);\n\n fprintf(stderr, \"%s: %s\",program_invocation_short_name,strerror(errno));\n}else if (pid > (pid_t) 0) {\n /****************/\n /*PARENT PROCESS*/\n /****************/\n char c;\n close(my_pipe[0]); /*Parent doesn't read*/\n init_termios(1);\n atexit(reset_termios);\n\n while(1) {\n c = getchar();\n if (c == 0x03)\n break;\n if (write(my_pipe[1], &c, 1) == -1) {\n fprintf(stderr, \"%s: %s\",\n program_invocation_short_name, strerror(errno));\n return EXIT_FAILURE;\n }\n }\n close(my_pipe[1]);\n}\nreturn EXIT_SUCCESS;\n}\n\nvoid init_termios(int echo)\n{\n tcgetattr(0, &old); /*get old terminal i/o settings*/\n new = old; /*make new settings same as old settings */\n new.c_lflag &= ~ICANON;\n new.c_lflag &= echo ? ECHO : ~ECHO; /*set appropriate echo mode*/\n tcsetattr(0, TCSANOW, &new); /*use new terminal i/o settings*/\n}\n\nvoid reset_termios(void)\n{\n tcsetattr(0, TCSANOW, &old);\n}\n\n\nMy problem is with the user input. When typing it seems that the first character gets written and audio is generated then there's a delay then the rest of the characters in the buffer get generated continuously like they're meant to. If there's a big enough pause in the typing then it's back to the start where the first character typed after the break gets generated followed by a delay and then the intended functionality.\nI have my fingers crossed that this isn't because the minimodem program wasn't written to be used in this way and that this problem can be overcome.\nIf anyone can shed some light on the matter I would be sooo greatful.\nThanks.\n\nNOTE: I've tried putting the input into a ring buffer and then that input being consumed and sent to the child in a seperate thread. NOOOT better. Not even sure if noting this was productive."
] | [
"c",
"audio",
"pipe",
"ipc"
] |
[
"How to set repeated task with a random interval in PHP/Laravel?",
"Is there any smart way for me to set a repeated task with random time interval. \n\nSay like if I want to do task A every time in range of 3 mins to 5 mins\nExample: \n\n1st Task A - 3 mins\n2nd Task A - 4 mins\n3rd Task A - 5 mins\n4th Task A - 4 mins\n...\n\n\n\nFinally My solution is laravel Queue jobs \nhttps://laravel.com/docs/5.6/queues"
] | [
"php",
"laravel",
"timer",
"cron",
"schedule"
] |
[
"Now.js Uncaught TypeError: Object#",
"I downloaded the example project from Now.js http://nowjs.com/guide\nand when I run it I get\n\n\n Uncaught TypeError: Object # has no method 'distributeMessage'\n\n\nafter attempting to send a message.\n\nIdeas?"
] | [
"javascript",
"object",
"node.js",
"typeerror",
"nowjs-sockets"
] |
[
"why is this dataTables jQuery plugin (TableTools) not working?",
"I am trying to add the TableTools extension for the jQuery plugin dataTables. I have gotten it onto the site but the .swf file is not being included. Here is the code:\n\n$(document).ready(function() {\nvar table = $('#balances').DataTable({\n tableTools: {\n \"sSwfPath\": \"../_inc/content/current-loan-balances-report/copy_csv_xls_pdf.swf\"\n }\n});\nvar tt = new $.fn.dataTable.TableTools( table );\n\n$( tt.fnContainer() ).insertBefore('div.dataTables_wrapper'); } );\n\n\nThe table's ID is balances. the sSwfPath is where it said to specify the path for the swf file, which I have done. When I load the page, it says the file isn't being found, and in the console it is showing a different path than the one specified above."
] | [
"javascript",
"jquery",
"datatables",
"tabletools"
] |
[
"Generated 's value taking priority over 's placeholder",
"My problem is (apparently) simple. This is the result I would like to achieve :\n\n\n\nI manage to get this result with the following code (home.page.html) :\n\n<ion-item>\n <ion-label position=\"floating\" color=\"primary\">Type</ion-label>\n <ion-select formControlName=\"type\" placeholder=\"Insert your type here...\">\n </ion-select>\n</ion-item>\n\n\nNow, when I add some ion-selected-option for this ion-select, like this :\n\n<ion-item>\n <ion-label position=\"floating\" color=\"primary\">Type</ion-label>\n <ion-select formControlName=\"type\" placeholder=\"Insert your type here...\">\n <ion-select-option *ngFor=\"let type of types\" [value]=\"type\">{{type}}</ion-select-option>\n </ion-select>\n</ion-item>\n\n\nthe placeholder is replaced by the value of the first ion-selected-option when the page loads.\n\n \n\nThe values of these ion-selected-option are declared in the constructor of my home.page.ts like such :\n\nconstructor(public formBuilder: FormBuilder){\n this.types = [\n \"Advert\",\n \"OOH/POS simple\",\n \"OOH/POS complex\",\n \"Other\"\n ];\n }"
] | [
"angular",
"ionic-framework"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.