texts
sequence | tags
sequence |
---|---|
[
"Correct location for ESAPI.properties under web project",
"I added a OWASP ESAPI library to my project. And currently I'm stuck with a problem where to locate ESAPI.properties file. This project later should be deployed on few servers to which I don't have an access. So in my opinion there is no way to customizeorg.owasp.esapi.resources variable and I can't put it under user home directory. So the only place where I can put this file is SystemResource Directory/resourceDirectory but where is it? I have already tried to put these files:\n\n.esapi/ESAPI.properties\nesapi/ESAPI.properties\nESAPI.properties\n\n\nInto these locations:\n\n$CATALINA_HOME/webapps/<MY_PROJECT>/\n$CATALINA_HOME/webapps/<MY_PROJECT>/WEB-INF\n$CATALINA_HOME/webapps/<MY_PROJECT>/WEB-INF/classes\n$CATALINA_HOME/webapps/<MY_PROJECT>/META-INF\n\n\nBut in all of these places I get an error:\nNot found in SystemResource Directory/resourceDirectory: .esapi\\ESAPI.properties\n\nSo where I should locate this file? It's a legacy project(just Eclipse Project without Maven) and it's structure is pretty ugly. There is no such directory like /src/main/resources where in my opinion this ESAPI.properties file should be located. I have created this directory, but where finally this file should be after deployment a WAR archive to Tomcat?"
] | [
"java",
"eclipse",
"esapi"
] |
[
"Returning text between a starting and ending regular expression",
"I am working on a regular expression to extract some text from files downloaded from a newspaper database. The files are mostly well formatted. However, the full text of each article starts with a well-defined phrase ^Full text:. However, the ending of the full-text is not demarcated. The best that I can figure is that the full text ends with a variety of metadata tags that look like: Subject: , CREDIT:, Credit. \n\nSo, I can certainly get the start of the article. But, I am having a great deal of difficulty finding a way to select the text between the start and the end of the full text. \n\nThis is complicated by two factors. First, obviously the ending string varies, although I feel like I could settle on something like: `^[:alnum:]{5,}: ' and that would capture the ending. But the other complicating factor is that there are similar tags that appear prior to the start of the full text. How do I get R to only return the text between the Full text regex and the ending regex?\n\ntest<-c('Document 1', 'Article title', 'Author: Author Name', 'https://a/url', 'Abstract: none', 'Full text: some article text that I need to capture','the second line of the article that I need to capture', 'Subject: A subject', 'Publication: Publication', 'Location: A country')\n\ntest2<-c('Document 2', 'Article title', 'Author: Author Name', 'https://a/url', 'Abstract: none', 'Full text: some article text that I need to capture','the second line of the article that I need to capture', 'Credit: A subject', 'Publication: Publication', 'Location: A country')\n\nMy current attempt is here:\n\ntest[(grep('Full text:', test)+1):grep('^[:alnum:]{5,}: ', test)]\n\nThank you."
] | [
"r",
"regex",
"stringr"
] |
[
"Is Microsoft OCR library suitable for handwritten recognition?",
"I need to do a project to capture data from handwritten structured forms. \nI am looking for a OCR SDK with an API preferably in C# or C++. This project will be service in our server, so I would prefer to develop at \"low\" level instead of purchasing an ended solution like Abby or similar.\n\nIs Microsoft OCR suitable for handwritten structured forms? or is it mainly focused to strokes?"
] | [
"c#",
"ocr"
] |
[
"Android Studio 3.2 for Windows wrong repository",
"today I tried to install Android Studio 3.2 in Windows 10 and I received a lot of errors. When I tried to correct I observed that download is getting WRONG MACOSX sdk and tools. Anyone know how can I correct it?"
] | [
"android",
"android-studio"
] |
[
"Cannot install phantomJS in Karma",
"WARN [config]: config.configure() is deprecated, please use config.set() instead.\nWARN [plugin]: Cannot find plugin \"karma-phantomjs\".\n Did you forget to install it ?\n npm install karma-phantomjs --save-dev\nINFO [karma]: Karma v0.10.2 server started at http://localhost:9018/\nWARN [launcher]: Can not load \"PhantomJS\", it is not registered!\n Perhaps you are missing some plugin?\n\n\nGetting this error. When running npm install karma-phantomjs --save-dev I get an error.\n\nnpm ERR! 404 'karma-phantomjs' is not in the npm registry.\n\n\nI installed karma-phantomjs-launcher --save-dev but i still get an error when running grunt watch.\n\nAnyone else run into this issue?"
] | [
"phantomjs",
"gruntjs",
"karma-runner"
] |
[
"Appended nodes not formatted",
"I made a PHP script that updates an existing XML file by adding new nodes. The problem is that the new nodes are not formatted. They are written in a single line. Here is my code :\n\n$file = fopen('data.csv','r');\n$xml = new DOMDocument('1.0', 'utf-8');\n$xml->formatOutput = true;\n\n$doc = new DOMDocument();\n$doc->loadXML(file_get_contents('data.xml'));\n$xpath = new DOMXPath($doc);\n$root = $xpath->query('/my/node');\n$root = $root->item(0);\n$root = $xml->importNode($root,true);\n\n// all the tags created in this loop are not formatted, and written in a single line\nwhile($line=fgetcsv($file,1000,';')){\n $tag = $xml->createElement('cart');\n $tag->setAttribute('attr1',$line[0]);\n $tag->setAttribute('attr2',$line[1]);\n $root->appendChild($tag);\n}\n$xml->appendChild($root);\n$xml->save('updated.xml');\n\n\nHow can I solve this?"
] | [
"php",
"xml",
"dom",
"dom-node"
] |
[
"Partial/Abbreviated Name Matching",
"Im trying to write a query that will match partial matches to stored name values.\n\nMy database looks as follows\n\n\n Blockquote\n\n\nFirstName | Middle Name | Surname\n----------------------------------\nJoe | James | Bloggs\nJ | J | Bloggs\nJoe | | Bloggs\nJane | | Bloggs\n\n\nNow if a user enters their name as\n\nJ Bloggs\n\n\nmy query should return all 4 rows, as they are all potential matches. \n\nSimilarly if a user enters the name\n\nJ J Bloggs\n\n\nall rows should be returned.\n\nIf a user enters their name as \n\nJoe Bloggs\n\n\nonly the first three should be returned.\n\nI have tried the following\n\nSELECT * \nFROM PERSON \nWHERE CONCAT(' ',FirstName,' ',MiddleName,' ', Surname) LIKE '% Joe%'\n AND CONCAT(' ',FirstName,' ',MiddleName,' ', Surname, ' ') LIKE '% Bloggs%';\n\n\nBut this doesn't return 'J J Bloggs'.\n\nAny ideas?"
] | [
"mysql",
"fuzzy-search"
] |
[
"iOS 5 lock screen integration: displays currently playing song info including artwork",
"I would like to display currently playing song info including artwork in iOS lock screen like Djay for iPad does.\n\nDo you have an idea ?\n\nThanks a lot for your help.\n\nThierry"
] | [
"iphone",
"objective-c"
] |
[
"Repeating part of texture over another texture",
"So I'm trying to replace a part of a texture over another in GLSL, first step in a grand scheme.\nSo I have a image, 2048x2048, with 3 textures on the top left, each 512x512. For testing purposes I'm trying to just repeatedly draw the first one.\n\n//get coord of smaller texture\ncoord = vec2(int(gl_TexCoord[0].s)%512,int(gl_TexCoord[0].t)%512);\n\n//grab color from it and return it \nfragment = texture2D(textures, coord);\ngl_FragColor = fragment;\n\n\nIt seems that it only grabs the same pixel, I get one color from the texture returned to me. Everything ends up grey. Anyone know what's off?"
] | [
"glsl"
] |
[
"oracle subquery in where clause with order by",
"I'm trying to get a customer's address with these rules:\n\n\nGet preferred address if it exists (preferred_ind = 'Y')\nIf multiple preferred addresses, get first one (max(address_id) is fine)\nIf no preferred addresses, then just get first one (max(address_id) is fine, again.)\nIf no addresses, just return customer name with no address info.\npreferred_ind can be 'Y', 'N' or null.\n\nSELECT c.first_name,\n c.last_name,\n a.address_line_1,\n a.city,\n a.state_code,\n a.postal_code\nFROM my_customer c,\n my_customer_address a\nWHERE c.customer_id = a.customer_id(+)\nAND (a.address_id IS NULL OR a.address_id = (SELECT MAX(a2.address_id)\n FROM my_customer_address a2\n WHERE a2.customer_id = c.customer_id\n ORDER BY nvl(a2.preferred_ind, 'N') DESC));\n\n\n\nBut, of course, Oracle doesn't allow for the ORDER BY in a subquery. So how can I get the results I want?\n\nThanks."
] | [
"sql",
"oracle",
"subquery"
] |
[
"How does typecasting/polymorphism work with this nested, closure type in Swift?",
"I know that (Int) -> Void can't be typecasted to (Any) -> Void:\n\nlet intHandler: (Int) -> Void = { i in\n print(i)\n}\nvar anyHandler: (Any) -> Void = intHandler <<<< ERROR\n\n\nThis gives:\n\n\n error: cannot convert value of type '(Int) -> Void' to specified type\n '(Any) -> Void'\n\n\n\n\nQuestion: But I don't know why this work?\n\nlet intResolver: ((Int) -> Void) -> Void = { f in\n f(5)\n}\n\nlet stringResolver: ((String) -> Void) -> Void = { f in\n f(\"wth\")\n}\n\nvar anyResolver: ((Any) -> Void) -> Void = intResolver\n\n\nI messed around with the return type and it still works...:\n\nlet intResolver: ((Int) -> Void) -> String = { f in\n f(5)\n return \"I want to return some string here.\"\n}\n\nlet stringResolver: ((String) -> Void) -> Void = { f in\n f(\"wth\")\n}\n\nvar anyResolver: ((Any) -> Void) -> Any = intResolver (or stringResolver)\n\n\nSorry if this is asked before. I couldn't find this kind of question yet, maybe I don't know the keyword here.\nPlease enlighten me!\n\nIf you want to try: https://iswift.org/playground?wZgwi3&v=3"
] | [
"swift",
"casting",
"polymorphism"
] |
[
"C/C# - Marshal.PtrToStringAnsi",
"What's the equivalent to Marshal.PtrToStringAnsi (C#) in C language ? \n\nBecause, I would like rewrite a function C# in C. \nThis is the C# function:\n\npublic int GetProcessName(uint processId, out string name)\n {\n IntPtr ptr = Marshal.AllocHGlobal((int)(0x211)); int result = -1;\n result = getProcessName(processId, ptr);\n name = String.Empty;\n if(SUCCESS(result))\n name = Marshal.PtrToStringAnsi(ptr);\n Marshal.FreeHGlobal(ptr);\n return result;\n }\n\n\nAnd actually my C function:\n\nint\nGetProcessName(uint processId, char *name)\n{\n HINSTANCE hLib = LoadLibrary(\"CCAPI.DLL\");\n __cGetProcessName getProcessName = (__cGetProcessName)GetProcAddress(hLib, \"CCAPIGetProcessName\");\n int *ptr = malloc((int)(0x211));\n int result = -1;\n result = getProcessName(processId, ptr);\n\n name = \"\";\n if (SUCCESS(result))\n {\n name = /* ?? */;\n }\n\n free(ptr);\n return (result);\n}"
] | [
"c#",
"c"
] |
[
"How can I securely communicate between a Java Client and CodeIgniter Server?",
"I need to pass commands and data between a PHP CodeIgniter based server and a Java Client. I was thinking of using very simple encryption to encrypt / decrypt the messages. I have run into a lot of issues trying to do very basic crypto on the Java side.\n\nEither I would like some help with the Java side of the Crypto, or a different idea to secure communication between the Client and Server.\n\nThe data is not sensitive and can be sent in the clear, as long as I can ensure it is coming from the correct source. I was thinking of using the basic encryption as an authentication measure that would not be circumvented by a replay attack. But I could be going about this all wrong.\n\nAny help or comments are appreciated."
] | [
"java",
"php",
"security",
"codeigniter",
"encryption"
] |
[
"A description for this result is not available because of this site's robots.txt - Wordpress site",
"I have a blog at snowtoseas.com. When I google my site, this appears in the description: A description for this result is not available because of this site's robots.txt. \n\nI host with biz.nf and have installed wordpress.org. I've found out that wordpress.org usually creates a virtual robots.txt file that you cannot edit. To get around this, I installed the Virtual Robots.txt to modify the file. \n\nCurrently, this is my robots.txt: http://snowtoseas.com/robots.txt\n\nIs it ok? Should I change it to something else or should I install a different plugin? \n\nIt's been like this for over a week now, and the description still hasn't changed. I've also searched the site on alternative search engines like DuckDuckGo and the description is still blocked.\n\nWhen I try to ping Google through the xml-sitemap plugin wordpress offers, it fails and I get this message: WP HTTP API Web Request failed: cURL error 7: Failed to connect to....\n\nI have very, very limited experience with coding and just want my site working, so if anyone can give me some super straightforward or step-by-step advice, that would be appreciated!\n\nThanks!"
] | [
"php",
"wordpress",
"web-crawler",
"robots.txt"
] |
[
"Tkinter .after() method going faster than it should",
"I been working on a simple Tkinter Gui in which a timer gets involved. The thing is that the timer goes faster than the milliseconds specified in the .after() method. Here is my code:\nimport tkinter\nimport time\nfrom tkinter import *\nseconds = 604800\n\nFONT = ("Arial", 24)\nwindow = tkinter.Tk()\nwindow.attributes('-topmost', True)\nwindow.attributes('-fullscreen', True)\nwindow.title("Sandbox Crypto")\nwindow.configure(bg='red')\nseconds = 604800\n\ndef gui():\n text = StringVar()\n\n def substract_seconds():\n global seconds\n seconds -=1\n\n while seconds > 0:\n mins, secs = divmod(seconds, 60)\n hours, mins = divmod(mins, 60)\n days, hours = divmod(hours, 24)\n timer = '{:02d}:{:02d}:{:02d}:{:02d}'.format(days,hours,mins, secs)\n text.set(timer)\n Time_label = Label(window, textvariable=text, bg='red', fg='white', font=FONT)\n Time_label.grid()\n Time_label.place(x=10, y=300)\n Time_label.update()\n\n Time_label.after(1000, substract_seconds)\n\n window.mainloop()\n\n\ngui()\n\nThe strange thing here is that i investigated the .after() method common errors and most of them were related to the method actually going slower than it should. One of my theories is that is an error related to the CPU speed because the speed of the clock varies through the time. What I infer from this is that sometimes it goes faster and then it slows down and continue going faster."
] | [
"python",
"tkinter"
] |
[
"PostgreSQL connect asynchronously with epoll_wait",
"I whant to work with PostgreSQL (9.1) asynchronously in my linux project. For this I have to use epoll_wait (because of other parts of the application). The goal will be to finally use epoll in edge triggered mode. But I cannot make the connection process work, even in non edge triggered mode. And I don't know why. However, when user name and password is correct, it works. But it also have to work when the password is wrong, too. In that case, I get some error I don't understand. :-/ Here is the code I use (the connection is already initialized with an PQconnectStart() and a parameter list that works fine with PQconnectdb()):\n\nvoid ConnectDB(PGconn * connection)\n{\n int pq_fd = PQsocket(connection);\n int epoll_fd = epoll_create1(0);\n struct epoll_event event;\n struct epoll_event *eventList = (epoll_event *)calloc(64, sizeof(epoll_event));\n\n event.data.fd = pq_fd;\n event.events = EPOLLOUT | EPOLLERR;\n epoll_ctl(epoll_fd, EPOLL_CTL_ADD, pq_fd, &event);\n\n while (true) {\n PostgresPollingStatusType pt = PQconnectPoll(connection);\n switch (pt)\n {\n case PGRES_POLLING_OK:\n printf(\"*** connection established!\\n\");\n return;\n\n case PGRES_POLLING_FAILED:\n printf(\"*** connection failed: %s\\n\", PQerrorMessage(connection));\n return;\n\n case PGRES_POLLING_ACTIVE:\n printf(\" --- poll result: PGRES_POLLING_ACTIVE\\n\");\n break;\n\n case PGRES_POLLING_READING:\n printf(\" --- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\\n\");\n event.events = EPOLLIN | EPOLLERR;\n if (epoll_ctl(epoll_fd, EPOLL_CTL_MOD, PQsocket(connection), &event) == -1) {\n printf(\"epoll_ctl() error: %u: %s\\n\", errno, strerror(errno));\n exit(1);\n }\n break;\n\n case PGRES_POLLING_WRITING:\n printf(\" --- poll result: PGRES_POLLING_WRITING - Modifiing epoll to EPOLLOUT\\n\");\n event.events = EPOLLOUT | EPOLLERR;\n if (epoll_ctl(epoll_fd, EPOLL_CTL_MOD, PQsocket(connection), &event) == -1) {\n printf(\"epoll_ctl() error: %u: %s\\n\", errno, strerror(errno));\n exit(1);\n }\n break;\n }\n\n int n = epoll_wait(epoll_fd, eventList, 64, -1);\n if (n == -1) {\n printf(\"epoll_wait() error: %u: %s\\n\", errno, strerror(errno));\n exit(1);\n }\n }\n}\n\n\nAnd here is the output I get:\n\n--- poll result: PGRES_POLLING_WRITING - Modifiing epoll to EPOLLOUT\n--- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\n--- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\n--- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\n--- poll result: PGRES_POLLING_WRITING - Modifiing epoll to EPOLLOUT\n--- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\n--- poll result: PGRES_POLLING_READING - Modifiing epoll to EPOLLIN\n--- poll result: PGRES_POLLING_WRITING - Modifiing epoll to EPOLLOUT\nepoll_ctl() error: 2: No such file or directory\n\n\nHas anyone an idea?"
] | [
"c",
"linux",
"postgresql"
] |
[
"Start-Job only runs if I wait for completion",
"I have a Start-Job -ScriptBlock that will run correctly if I wait for the job to complete. If I don't wait/receive job completion status, the -ScriptBlock does not run. I'm not sure what I'm missing. Likely not understanding fundamental behaviour of PS Background Jobs.\n\nThis is running on a Win 2012R2 server. The following is my $PSVersionTable dump:\n\nName Value \n---- ----- \nPSVersion 5.0.10586.117 \nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} \nBuildVersion 10.0.10586.117 \nCLRVersion 4.0.30319.42000 \nWSManStackVersion 3.0 \nPSRemotingProtocolVersion 2.3 \nSerializationVersion 1.1.0.1 \n\n\nI have tried placing tests before and after the -ScriptBlock to catch other errors, but the entire -ScriptBlock doesn't seem to be running at all.\n\nAs an example, the following works currently in my setup:\n\nStart-Job -ScriptBlock {\n New-Item -Path 'c:\\ivanti-patch-automation\\logs\\tempfile.txt' -ItemType File\n} | Wait-Job\n\n\nThe file is correctly created.\n\nThe following does not work. The only change is removing the pipeline command Wait-Job.\n\nStart-Job -ScriptBlock {\n New-Item -Path 'c:\\ivanti-patch-automation\\logs\\tempfile.txt' -ItemType File\n}\n\n\nI expected both to work and am unsure why waiting for the job to complete is influencing whether it does or not."
] | [
"powershell",
"start-job"
] |
[
"Remove NULLS from dynamic query",
"I am unable to remove the nulls from a dynamic query result. \n\nHere's an example of what would be in #t3 table:\n\nBornDate | ClickDate | Clicks\n10/23/2014 | 11/19/2014 | 25\n10/23/2014 | 11/18/2014 | 6\n10/23/2014 | 11/20/2014 | 5\n10/23/2014 | 11/22/2014 | 17\n10/23/2014 | 11/23/2014 | 11\n10/24/2014 | 11/19/2014 | 1\n10/24/2014 | 11/18/2014 | 6\n10/24/2014 | 11/20/2014 | 3\n10/24/2014 | 11/21/2014 | 3\n10/24/2014 | 11/23/2014 | 2\n\n\nSo, my question is, how do I remove the NULL values when I run the following query?\n\nHere's my query\n\nDECLARE @DynamicPivotQuery AS NVARCHAR(MAX)\nDECLARE @ColumnName AS NVARCHAR(MAX)\n\n--Get distinct values of the PIVOT Column \nSELECT @ColumnName= ISNULL(@ColumnName + ',','') \n + QUOTENAME(ClickDate)\nFROM (SELECT DISTINCT ClickDate FROM #t3 ) AS ClickDate order by ClickDate\n\n--Prepare the PIVOT query using the dynamic \n\nSET @DynamicPivotQuery = \n 'SELECT BornDate, ' + @ColumnName + ' \n FROM #t3 \n PIVOT (SUM(Clicks) \n FOR ClickDate IN (' + @ColumnName + ')) AS PVTTable order by 1, 2'\n\n--Execute the Dynamic Pivot Query\nEXEC sp_executesql @DynamicPivotQuery\n\n\nThe result of the query is:\n\n| BORNDATE | 2014-11-18 | 2014-11-19 | 2014-11-20 | 2014-11-21 | 2014-11-22 | 2014-11-23|\n|------------|------------|------------|------------|------------|------------|-----------|\n| 2014-10-23 | 6 | 25 | 5 | (null) | 17 | 11 |\n| 2014-10-24 | 6 | 1 | 3 | 3 | (null) | 2 |\n\n\nYou see the NULLS on the 10/23/2014 line for the column on 11/21/2014...and again for the 10/24/2014 row in the column for 11/22/2014. I want to replace these nulls."
] | [
"sql",
"sql-server",
"pivot"
] |
[
"Why does var evaluate to System.Object in \"foreach (var row in table.Rows)\"?",
"When I enter this foreach statement...\n\nforeach (var row in table.Rows)\n\n\n...the tooltip for var says class System.Object\n\nI'm confused why it's not class System.Data.DataRow.\n\n(In case you're wondering, yes, I have using System.Data at the top of my code file.)\n\n\n\nIf I declare the type explicitly, as in...\n\nforeach (DataRow row in table.Rows)\n\n\n...it works fine with no errors.\n\n\n\nAlso if I do...\n\nvar numbers = new int[] { 1, 2, 3 };\nforeach (var number in numbers)\n\n\n...var evaluates to struct System.Int32. So, the problem is not that var doesn't work in a foreach clause.\n\n\n\nSo, there's something strange about DataRowCollection where the items don't automatically evaluate to DataRow. But I can't figure out what it is. Does anyone have an explanation?\n\n\n\nUpdate\n\nI was really torn which answer to mark (Codeka and Oliver)...In the end, I decided to mark Codeka's because it truly answers my question, but Oliver answers the question I should have been asking :)"
] | [
"c#",
"ado.net"
] |
[
"Visual C++ nuget: boost include files not found",
"I'm pretty new to visual studio as I usually work in linux.\n\nI installed boost package via nuget and I can see all the headers files installed correctly into my solution's 'packages' folder.\n\nHowever whenever I try to include a boost header I get an error, e.g:\n\nCannot open include file: 'boost/type_traits/has_equal_to.hpp': No such file or directory\n\nAt the same time I installed SFML libraries and those work perfectly.\n\nAlso I noticed, that in my project properties, 'Referenced Packages' section SFML libraries are listed, but boost ones are not. This is strange, because when I installed the packages I did click the checkboxes for the projects I installed the packages for.\n\nI tried hard to find how to add package references but miserably failed. I'm probably just being thin here...\n\nI'm using Visual Sudio 14 (2015) Update 3 Community Edition."
] | [
"c++",
"visual-c++",
"boost",
"nuget"
] |
[
"HTML: checkbox using c# razor & model",
"i have a checkbox that i'm using the model's company value to see if it should be checked.\ncompany value can have more than one company as such: 1,9,10,15\n\nin this case of multiple companies, following statement will never be true.\n\n<input type=checkbox id=drsc class=\"comp\" value=\"9\" data-mini=\"true\" @(Model.company==\"9\" ? \"data-chkd=true\" : \"\") />\n\n\nso i'm trying to use logic below using the 'contains' clause and it doesn't seem to be working. \n\n<input type=checkbox id=nn class=\"comp\" value=\"9\" data-mini=\"true\" @((Model.company).Contains(\"9\") ? \"data-chkd=true\" : \"\") />\n\n\nif my company field has just company 9, first stmt is working. but not 2nd.\nany thoughts?"
] | [
"c#",
"html"
] |
[
"UiView background colour is different",
"I want to show same background colour for all UIView.\nI use same background colour for all Views, But it will show different different background colours.\nPlease give me any solution to do this."
] | [
"ios",
"uiview",
"uicolor"
] |
[
"Google Ads DEVELOPER_TOKEN_PROHIBITED, would removing the project/ad manager account solves the problem?",
"The google ads rule is 1 devtoken = 1 manager account = 1 google project\nCould removing/deleting the project or removing the manager account destroy the links of this 3? and free the devtoken.\nAlso does the rule applies on google adwords api? since the rule is only stated on google ads api documentation.\nThanks.\nPlease help."
] | [
"google-ads-api"
] |
[
"How to Import Time Zone Description Tables to MySQL/MariaDB in cPanel?",
"I was encountered with following error in localhost while setting MySQL timezone\n\n\n execute() failed: Unknown or incorrect time zone: 'Asia/Karachi'\n\n\nThen I imported the time zone description tables to mysql database using phpMyAdmin in localhost.\nAnd error was resolved. \n\nNow I am facing same error on livehost but mysql database is missing in cPanel. \n\nSo, how can I import MySQL time zone description tables in cPanel.\n\nUpdate\nUnfortunately command line terminal is not available in my shared hosting cPanel."
] | [
"php",
"mysql",
"mariadb",
"cpanel",
"web-hosting"
] |
[
"How is best to make database application?",
"I need to make an application which will read and parse information from xml file and store them to database. What would you recommend?And by that I mean, what do you think is the best programing language for this, what do you think is the best way to work with xml file in this language and what kind of database to use. This database will have to consume from 60 to 300 of new informations per week, and application needs to run also in gui. Thanks for all the answers."
] | [
"xml",
"database",
"windows-applications"
] |
[
"How to intercept wp_mail function and add an attachment to it",
"I am developing a wordpress plugin where i need to intercept wp_mail function \"executed from another plugin\" and add an attachment file to its headers, point me in the right direction where i can intercept this call from my custom plugin.\n\nthe code that executes the wp_mail function\n\n $message = apply_filters( 'frm_email_message', $message, $atts );\n $header = apply_filters('frm_email_header', $header, array(\n 'to_email' => $atts['to_email'], 'subject' => $atts['subject'],\n ) ); \n\n $sent = wp_mail($recipient, $atts['subject'], $message, $header, $atts['attachments']);\n if ( ! $sent ) {\n $header = 'From: '. $atts['from'] .\"\\r\\n\";\n $recipient = implode(',', (array) $recipient);\n $sent = mail($recipient, $atts['subject'], $message, $header);\n }\n\n\nI think i found the solution in case some one else was looking for this too.\nfrom the wordpress codex here: https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail\n\nadd_filter( 'wp_mail', 'my_wp_mail_filter' );\nfunction my_wp_mail_filter( $args ) {\n\n $new_wp_mail = array(\n 'to' => $args['to'],\n 'subject' => $args['subject'],\n 'message' => $args['message'],\n 'headers' => $args['headers'],\n 'attachments' => $args['attachments'],\n );\n\n return $new_wp_mail;\n}\n\n\nthe above solution seems to be not working."
] | [
"php",
"wordpress"
] |
[
"show/hide divs jQuery",
"I want to have 4-8 \"hidden\" divs on a page. Then also have 2 Buttons, one \"plus\" and one \"remove\". When I click the \"plus\" button it shows the 1st div, and if I click the \"plus\" button again it shows div nr 2. And if i use \"remove\" it removes the div.\n\nDo I have to use conditional statements or is there any simple solution to this?\n\n $(document).ready(function() {\n $('#show').click(function () {\n $(\"#hiddencontent\").fadeIn(\"slow\");\n });\n});"
] | [
"jquery",
"html"
] |
[
"Bolt CMS access Bolt\\Twig\\TwigExtension from twig file",
"I try to use localdatetime in my template twig file, but I get an error that localdatetime does not exists:\n\nUnknown \"localizeddate\" filter. Did you mean \"localdate\" in \"listing.twig\" at line 51?\n\nHowever when I look into the code, the TwigExtension class is already there and defines the localdatetime Twig_SimpleFilter too. \n\nSo I cannot see why I cannot use them in the code. Do someone know whats going on?\n\nThis is my twig template code:\n{{ record.datepublish | localizeddate('full', 'none', app.request.locale ) }}"
] | [
"twig",
"bolt-cms"
] |
[
"How to correctly manage versions of your application?",
"I need tips on how you control different versions of you applications. At the moment I simple overwrite the same project every time I make changes. As my projects get bigger and bigger, this is becoming a problem for me. Is there a built-in function to correctly manage different versions of you program, and maybe even a simple form to fill out a change log, or should I simple just save the entire project in a separate folder each time?"
] | [
"vb.net",
"multiple-versions"
] |
[
"I cannot access an object property",
"I'm using Java and Jena API.\nI have a class Marriage which have 3 Object Properties called \"hasHusband\", \"Haswife\" and \"dateOfMarriage\". The first two are associated with a class Person which has the datatypeproperties like hasFirstName, hasLastName, dateOfBirth....\n\nI'd like to access the objects properties \"Haswife\" and \"hasHusband\" and then the wife's first name and the husband's first name.\n\nHere is how that is represented in my rdf file:\n\n(...)\n\n <j.0:FAMmariage rdf:about=http://www.fam.com/FAM#BrunoCatherine> \n\n <j.0:FAMaDateMariage>25/07/2011</j.0:FAMaDateMariage>\n\n <j.0:FAMhasWife>\n <rdf:Description rdf:about=\"http://www.fam.com/FAM#Catherine20/03/1982\">\n <j.0:FAMDateOfBirth>20/03/1980</j.0:FAMDateOfBirth>\n <j.0:FAMHasName>Gomez</j.0:FAMHasName>\n <j.0:FAMHasFirstName>Catherine</j.0:FAMHasFirstName>\n </rdf:Description>\n </j.0:FAMHasWife>\n\n <j.0:FAMHusband>\n <rdf:Description rdf:about=\"http://www.fam.com/FAM# Bruno15/06/1980 \">\n <j.0:FAMaDateOfBirth>15/06/1980 </j.0:FAMDateOfBirth>\n <j.0:FAMHasName>Jeandet </j.0:FAMHasName>\n <j.0:FAMHasFirstName>Bruno</j.0:FAMHasFirstName>\n </rdf:Description>\n </j.0:FAMHusband>\n\n </j.0:FAMmariage>\n(...)\n\n\nI tried like this but it still does not works:\n\nStmtIterator iter = onto.model.listStatements(); \n while (iter.hasNext()) {\n Statement stmt = iter.nextStatement(); \n Resource subject = stmt.getSubject(); \n Property predicate = stmt.getPredicate(); \n RDFNode object = stmt.getObject();\n if (predicate.equals(onto.hasWife))\n { \n System.out.print(\" \" + object.toString() + \" \");\n }\n }\n\n\nCan you please tell me what's wrong?\n\nThanks\n\nEDITED\n\nMore useful details:\n\n(...)\n\nperson = model.createClass(uriBase+\"person\");\nperson.addSubClass(man);\nperson.addSubClass(woman);\nmarriage = model.createClass(uriBase+\"marriage\");\n\n\n(...)\n\nhasHusband = model.createObjectProperty(uriBase+\"hasHusband\");\nhasHusband.setDomain(marriage);\nhasHusband.setRange(man);\n\nhasWife = model.createObjectProperty(uriBase+\"hasWife\");\nhasWife.setDomain(marriage);\nhasWife.setRange(woman);\n\nhasFirstName = model.createDatatypeProperty(uriBase+\"hasFirstName\"); \nhasFirstName.setDomain(person);\nhasFirstName.setRange(XSD.xstring);\n\n\n(...)"
] | [
"java",
"rdf",
"jena",
"object-properties"
] |
[
"Making javascript external",
"I have too much of javascript in the beta site of mine which will be the real one, So what I am thinking is to make the javascript external BUT this raises some really important questions.\n\n\nWhat is the standard size for an external javascript (e-g should be\nnever more than 50KB per file).\nHow many javascript files should be make if the above question is\nanswered like that the size doesn't matter, then does it mean I\nshould put all scripts (including Jquery library) in one external\nfile?\nIf a javascript is already minified and it is added with other files\nthat are not minified will it effect the one that is already\nminified?\nWhat is the best minifier for Javascript and CSS (best means that\nmaintains the standards).\nIf I place the external script just after <body> is it good\nenough?(as if I go more lower some scripts might stop working).\n\n\nHere is the link to beta site just incase if you want to check http://bloghutsbeta.blogspot.com/"
] | [
"javascript"
] |
[
"Linq to Entities Vs. Table Adapters (.Net Windows Forms)",
"I'm starting on a small windows forms project that makes extensive use of editable grids. I want to use Linq to Entities, but while it's trivial to bind a grid to the Linq query it's read-only. I couldn't figure out a good way to have an editable grid that auto-updates the database. (I hacked a work-around where I copy the data into a dataset for display/update and translate back... ugly!)\n\nSo for now I've decided to forget Linq to Entities and use the old table adapter/dataset method from 2.0.\n\nIs there a compelling reason why I should use Linq to Entities instead?\nIs there a way to do editable grids that I just missed?"
] | [
".net",
"winforms",
"linq-to-entities",
"dataset",
"tableadapter"
] |
[
"Is there a way to get a new list of ints from a list of ints, that add up to a certain value?",
"I have a list of integers, they are randomly sorted and may repeat: mylist = [5,4,2,4,5,6,7,3,8,3]\nand a certain value (for example: value=35)\nNow I want to get a list of list of integers out of mylist, we name it sumlist, that includes all the posible options of numbers that together add up to value.\nSo that when I would do:\nsum=0\nfor i in sumlist[0]:\n sum+=i\n\nsum == value would return True."
] | [
"python",
"list",
"sum",
"add"
] |
[
"Assigning existing values to smart-ptrs?",
"I am just learning about smart pointers, and I am having trouble assigning a pre-existing location of a variable to the standard library's shared pointer.\n\nFor example, lets say you have an int x, which you do not know the value of. With normal pointers, I just did\n\nint* ptr;\nptr = &x;\n\n\nI tried both that with shared pointers, and\n\nstd::tr1::shared_ptr<int> ptr;\nptr = std::make_shared<int> (&x)\n\n\nSo i'm fairly lost as to how to do it."
] | [
"c++",
"std",
"shared-ptr",
"tr1"
] |
[
"Merging multiple related firebird select procedure using If else or case method",
"How to merge this two firebird select procedure using this REFERENCE variable thru if else, case, or other method. If REFERENCE = 1 then the procedure 1 will display, if REFERENCE = 2 then the procedure 2 will display. I am trying to have 1 select procedure with conditions rather than 2 procedure.\n\nCREATE PROCEDURE PRINT_NON_REF1(\n M VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n Y VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n REFERENCE VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1)\n RETURNS(\n AP_PSTIONLVL_NON VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n AP_POSTION_NON VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n RANKING_MONTH VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n RANKING_YEAR VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1)\n AS\n BEGIN\n FOR\n SELECT\n '',\n '',\n RANKING_MONTH,\n RANKING_YEAR\n\n FROM APPLICANT\n WHERE RANKING_MONTH = :M AND RANKING_YEAR = :Y\n\n GROUP BY\n RANKING_MONTH,\n RANKING_YEAR\n\n INTO\n :AP_PSTIONLVL_NON,\n :AP_POSTION_NON,\n :RANKING_MONTH,\n :RANKING_YEAR\n DO\n BEGIN\n SUSPEND;\n END\n\n END;\n\n\nand\n\nCREATE PROCEDURE PRINT_NON_REF2(\n M VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n Y VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n REFERENCE VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1)\n RETURNS(\n AP_PSTIONLVL_NON VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n AP_POSTION_NON VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n RANKING_MONTH VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,\n RANKING_YEAR VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ISO8859_1)\n AS\n BEGIN\n FOR\n SELECT\n AP_PSTIONLVL_NON,\n AP_POSTION_NON,\n RANKING_MONTH,\n RANKING_YEAR\n\n FROM APPLICANT\n WHERE RANKING_MONTH = :M AND RANKING_YEAR = :Y\n\n GROUP BY\n AP_PSTIONLVL_NON,\n AP_POSTION_NON,\n RANKING_MONTH,\n RANKING_YEAR\n\n INTO\n :AP_PSTIONLVL_NON,\n :AP_POSTION_NON,\n :RANKING_MONTH,\n :RANKING_YEAR\n DO\n BEGIN\n SUSPEND;\n END\n\n END;"
] | [
"sql",
"stored-procedures",
"firebird",
"procedural-programming",
"firebird-3.0"
] |
[
"How to get list of points type in python",
"I have a class that needs to have variable that is list and contains points, those represents vertices in shape.\n\nI'm writing a point in that way: a = [x, y]\n\nso the list of points will be list(list)?\n\nthis is my vertices setter:\n\ndef set_vertices(self, vertices):\n if not isinstance(vertices, list(list)):\n raise TypeError(\"vertices must be list of points\")\n self.__vertices = vertices\n\n\nbut pycharm tells me that list(list) should be replaced by: \"Union[type, tuple]\"\n\nand this code:\n\nf = Figure(self.position);\nf.set_vertices([[2, 2], [2, 2], [2, 2], [2, -2]])\n\n\nraises an exception: TypeError: 'type' object is not iterable"
] | [
"python",
"list"
] |
[
"Slide to side with jquery on click and toggle",
"So i have a site where i need to have a div slide in from side with a click from a button (slide in from left and slide out on right) - and on reclick it should slide out again... So it needs to be hidden from pageload and only become visible once the button is clicked. \n\nI try to make this, but im new to jquery, so if someone could help me proceed, i would appreciate it.\n\nhere is a fiddle of how far i am now.\n\nLINK: http://jsfiddle.net/iBertel/zes8a/21/\n\nJquery:\n\n$('#btn').click(function() { \n$('#div1').slideToggle('slow', function() { \n});\n});\n\n\nHTML:\n\n<div id=\"div1\">Div 1</div>\n<div><a href=\"#\" id=\"btn\">Click</a></div>\n\n\nCSS:\n\n#div1 {\nwidth:100px; height:100px; background-color:#F30; color:#FFF; text-align:center; font-size:30px;\n\n\n}"
] | [
"jquery",
"hide",
"toggle",
"slide"
] |
[
"C# Cant connect to Local SQL database",
"I've created a local SQL Server database and Login form, Here is the code of Login form : \n\nnamespace WindowsFormsApplication1\n{\n public partial class LoginForm : Form\n {\n public LoginForm()\n {\n InitializeComponent();\n }\n\n private void button1_Click(object sender, EventArgs e)\n {\n if (!(Usertxt.Text == string.Empty))\n {\n SqlConnection connection = new SqlConnection(@\"Data Source=|DataDirectory|\\crimemanagement.sdf\");\n connection.Open();\n\n SqlCommand cmd = new SqlCommand(@\"SELECT Count(*) FROM Login_table \n WHERE Username=@Username and \n Password=@Password\", connection);\n\n cmd.Parameters.AddWithValue(\"@Username\", Usertxt.Text);\n cmd.Parameters.AddWithValue(\"@Password\", Passtxt.Text);\n\n int result = (int)cmd.ExecuteScalar();\n\n if (result > 0)\n {\n MessageBox.Show(\"Login Success\");\n }\n else\n {\n MessageBox.Show(\"Incorrect login\");\n }\n }\n else if (Passtxt.Text == string.Empty || Usertxt.Text == string.Empty)\n {\n MessageBox.Show(\"Enter Username and Password\");\n }\n }\n }\n}\n\n\nBut when I try to login using the form which I created it give me a connection error and highlights connection.open();\n\n\n System.Data.SqlClient.SqlException was unhandled\n \n A network-related or instance-specific error occurred while establishing a >connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
] | [
"c#",
"database",
"sql-server-ce"
] |
[
"Select Distinct columns from table JPA",
"I was wondering if there was a way using JPA query (not sure what the word I'm looking for is sorry). \n\n@Transactional\npublic interface UserRepository extends JpaRepository<User, Long> {\n\n\n List<User> findByLastNameIgnoreCase(String lastName); //This is the format I am looking for\n\n @Query(\"SELECT DISTINCT t.lastName FROM User t\") //Don't want to have to use the @Query \n List<String> findDistinctLastNames();\n\n}\n\n\nHopefully that makes it more clear. But I am trying to perform that Query without having to use the @Query. It doesn't really affect anything having it there, I would just like it. Is that statement possible?"
] | [
"java",
"spring",
"spring-data-jpa"
] |
[
"Content-type set to text/plain in Chrome version 84 Browser online vs application/javascript in firefox",
"With the latest Chrome Browser, we are seeing an issue with Javascripts files response headers content-type to text/plain rather setting as application/javascript. It was working till previous versions of chrome at the same time it works in firefox. Same case working in PROD but fails in QA ... Anybody had this issue? is there any specific Tomcat or Apache configurations needed.\nMore Context...\nWe have spring based applications with javascript files that need to be loaded the first time. We use static file cache feature in the spring to cache and render javascript files. All are working fine from years, all of a sudden with the latest Chrome 84 version we are seeing that javascript files are not getting loaded. The error says Strict Mime-type text/plain cant run in the chrome console... but it works fine in monster at the same time... Default mimetype from apache webserver is text/plain.\nIs there any specific configuration in Tomcat or Apache to enforce mimetype to application/javascript in the response"
] | [
"javascript",
"apache",
"google-chrome",
"tomcat"
] |
[
"How do I download a file with WWW::Mechanize after it submits a form?",
"I have the code:\n\n#!/usr/bin/perl\nuse strict;\nuse WWW::Mechanize;\n\nmy $url = 'http://divxsubtitles.net/page_subtitleinformation.php?ID=111292';\nmy $m = WWW::Mechanize->new(autocheck => 1);\n$m->get($url);\n$m->form_number(2);\n$m->click();\nmy $response = $m->res();\nprint $m->response->headers->as_string;\n\n\nIt submits the download button on the page, but I'm not sure how to download the file which is sent back after the POST.\n\nI'm wanting a way to download this with wget if possible. I was thinking that their may be a secret url passed or something? Or will I have to download it with LWP directly from the response stream?\n\nSo how do I download the file that is in that header?\n\nThanks,\n\nCody Goodman"
] | [
"perl",
"download",
"form-submit",
"www-mechanize"
] |
[
"angular2 router unexpectedly recreates components when navigating",
"Router instantiates a new component every time navigating to a different component type. This has serious repercussions. Also, this is very different paradigm not only from previous versions of the router, but any routing framework. \n\nHere is an example: A user may be in the middle of filling a long form on a tab1, he needs to lookup or verify some other details in tab2, when he comes back to tab1, everything is wiped out (as the component is re-instantiated). This implies that every time a user makes a change on a part of the UI, the state if the UI should be preserved (in anticipation of his unexpected navigation to another component, which co-exists on the same UI. \n\nOn a complex UI, say with graphics and multiple open tree controls (reflecting a user who is in middle of something), one would have to not only preserve content, but also unnecessarily preserve state of every bit of various widgets or graphics on the component. If the router had an option of reusing the components on the tree, (when navigating to a component of a different type from current component), one doesn't have to preserve the UI state. \n\nThis idea of destroying the component every time (someone navigates to a different type of component) doesn't sound right from a performance point of view as well. the model from heavy backend call, would have to be cached or call repeated. \n\nWhat are your experiences with this routing model?\n\nThis design makes the developer do a lot extra work (to preserve and recreate the work in progress - which we have never even cared about in the past) the and places performance penalty on the application. How do you overcome these challanges?\n\nUI-router another third party routing library (has been around since angular1 days) doesn't mandate/ force the developer by recreating components. Did you adopt it as an alternative? Any recommendations of if UI-Router is a better alternative than Router 3?"
] | [
"angular",
"router"
] |
[
"Line read in a loop from a file doesn't assign properly in batch program",
"I am reading each line of a .txt file in a .batch program using For /f loop. The .txt file contains all the names of the test cases (e.g. ShipmentPostErrorPathXPERF.txt) which I need to read and assign to a variable called testCaseName and pass this to another .cmd program as a parameter and continue in loop until it reads all lines (test cases),\n\nHere is my sample batch file, my problem is when I assign testCaseName=%%A, it only shows assigned to the last line of the file (REST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentNULLServiceSchedID_TestCase). But when I use echo %%A, it shows all lines as it reads in loop.\n\nWhy set testCaseName=%%A in the batch file only reading the last line ?\n\n.batch file:\n\necho off\ncd d:\\SWAT\nset fileNameXPERF=d:\\SWAT\\ShipmentPostErrorPathXPERF.txt\nfor /F \"tokens=*\" %%A in (D:\\SWAT\\ShipmentPostErrorPathXPERFxxx.txt) do (\nset testCaseName=%%A\necho %testCaseName%\necho %%A\ncall d:\\SWAT\\testRunner.cmd %testCaseName%\n)\n\n\nThe text file (ShipmentPostErrorPathXPERF.txt):\n\nREST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentEmptyDockNum_TestCase\nREST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentNULLDockNum_TestCase\nREST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentInvalidDockNum_TestCase\nREST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentEmptyServiceSchedID_TestCase\nREST0007-SHIPMETDATA_POST-XPERF_ErrorPath-ShipmentNULLServiceSchedID_TestCase"
] | [
"batch-file"
] |
[
"PHP - Strategy for renewing cookie and session in one page application",
"I've seen this post: What's a good strategy for renewing the expiration of a forms auth ticket between .net and php?\nThat post suggests renewing the cookie on every PHP page the user accesses. What if I am designing a one-page application, which of the following works or what better methods are there to renew the session and cookie to let the user stay logged in?\n\nScenario:\n\nA user is on a page writing a long post, which would cost him >30mins. The cookie remains 30mins until expire.\nSuppose even if the cookie got renewed, the user left the public PC that he was using and forgot to logout. After a lengthy time of inactivity, the application should be able to log itself out.\n\nDo I...\n\nAjax POST to renew the cookie and session upon every click and key press? (sounds like a ridiculous work load)\nDisplay a popup before cookie expires that let user renew cookie on button press. (sounds annoying)\n\n\nQuestions to sum up:\n\nWhat methods are there to renew the session and cookie to let the user stay logged in in a one-page application?\nAlso, how does StackOverflow and other platforms manage to let user stay logged in so seamlessly, what techniques might they be using?"
] | [
"php",
"session",
"authentication",
"cookies",
"login"
] |
[
"Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Unknown Host",
"TFS 2015. I am installing a VSO agent on build server. This agent needs to run under its own AD account. The agent installs fine but it appears offline in TFS. Logs contain the following error:\n\n> 16:32:37.077613\n> --------------------------------------------------------------------------- 16:32:37.077613\n> Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException:\n> Unknown Host\n> \n> 16:32:37.077613 at\n> Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponse(HttpResponseMessage\n> response)\n> \n> 16:32:37.077613 at\n> Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__79.MoveNext()\n> \n> 16:32:37.077613 --- End of stack trace from previous location where\n> exception was thrown ---\n> \n> 16:32:37.077613 at\n> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n> \n> 16:32:37.077613 at\n> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task\n> task)\n> \n> 16:32:37.077613 at\n> Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__76`1.MoveNext()\n> \n> 16:32:37.077613 --- End of stack trace from previous location where\n> exception was thrown ---\n> \n> 16:32:37.077613 at\n> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n\n\nWhen I run the agent under my admin account order under network service account then it goes online. Also, in these cases the above exception doesn't appear in logs. I added service account user to service pool's Agent Pool Administartor and Agent pool Service Account groups but this didn't help. What permissions does it miss?"
] | [
"tfs",
"azure-pipelines"
] |
[
"Why aren't global (dollar-sign $) variables used?",
"I'm hacking around Rails for a year and half now, and I quite enjoy it! :)\n\nIn rails, we make a lots of use of local variables, instance variables (like @user_name) and constants defined in initializers (like FILES_UPLOAD_PATH). But why doesn't anyone use global \"dollarized\" variables ($) like $dynamic_cluster_name? \n\nIs it because of a design flaw? Is it performance related? A security weakness?"
] | [
"ruby-on-rails",
"ruby",
"ruby-on-rails-3"
] |
[
"Elixir Guard a specific protocol",
"I'd like to know if it's possible in Elixir to guard for a specific protocol.\n\ndef some_fun(f) when implement?(f, Dict.Behaviour), do: ...\n\n\nOr is there something to assert that f is specifically a HashDict for example ?\n\nThanks !"
] | [
"elixir"
] |
[
"Can I use Google Play Services on apps installed outside the Google Play Store?",
"If I wanted to publish my app to the Amazon App Store for example, would Google Play Services work on that version of the app? Or does Google require apps to be downloaded from the Google Play Store exclusively to be able to connect to Google Play Services?"
] | [
"android",
"google-play-services",
"amazon-appstore"
] |
[
"Combine 3 single-dimensional arrays into one multi-dimensional array by key",
"So I have 3 arrays. One which contains user's first names, the second one containing user's last names, and the third one containing their last names. \n\nThe arrays have one thing in common, the keys.... So user_first[0] belongs to user_last[0] and it also matches with email[0] and so on. \n\nSo I want a new array to look like:\n\nArray\n(\n [0] => Array\n (\n [first_name] => John\n [last_name] => Doe\n [email] => [email protected]\n )\n\n [1] => Array\n (\n [first_name] => Jane\n [last_name] => Doe\n [email] => [email protected]\n )\n\n)\n\n\nInstead of the original, which would be this:\n\nArray\n(\n [0] => John\n [1] => Jane\n)\nArray\n(\n [0] => Doe\n [1] => Doe\n)\nArray\n(\n [0] => [email protected]\n [1] => [email protected]\n)"
] | [
"php",
"arrays"
] |
[
"How to get Remote server untrusted SSL certificate using Apache HTTP Client API",
"I have a remote server which may or may not be running using a valid SSL cert (using self-signed SSL cert).\n\nWe are making connection to remote server, which may fail if remote server is using self-signed SSL cert. So, we want to be able to download/view the remote server cert if our SSL handshake fails.\n\nIf I use Apache HTTP Client then I couldn't find a method which could allow me to view remote server certificate (you can do it with HttpsURLConnection but we are trying to avoid using it see this example).\n\nI also looked into Spring RestTemplate, and it didn't provide any option either - I searched on Google and didn't find anything around Spring or Apache HTTP Client."
] | [
"ssl",
"https",
"apache-httpclient-4.x",
"apache-commons-httpclient"
] |
[
"Does unshift mutate the state? How do you tell if the state is mutated (from tools)?",
"I'm still new to native and react so I was following this tutorial for a todo app and reading the following articles:\n\n\nhttps://lorenstewart.me/2017/01/22/javascript-array-methods-mutating-vs-non-mutating/\nhttps://daveceddia.com/why-not-modify-react-state-directly/\n\n\nThe addNewTodo method uses unshift which if i'm not mistaken mutates the array/state?\n\nIs there more efficient way to write this with spread on the add method?\nOr if I'm completely wrong and its fine, what are good ways to use react tools to figure out if the state is being mutated (say for maintaining other ppl code)?\n\nexport default class App extends React.Component {\n constructor(){\n super();\n this.state = {\n todoInput: '',\n todos: [\n {id: 0, title: 'Insult Jerry', done: false},\n {id: 1, title: 'Build something', done: false},\n {id: 2, title: 'Morty Mind Blowers', done: false}\n ]\n }\n }\n addNewTodo () {\n let todos = this.state.todos;\n\n todos.unshift({\n id: todos.length + 1,\n title: this.state.todoInput,\n done: false\n });\n\n this.setState({\n todos,\n todoInput: ''\n });\n }\n toggleDone (item) {\n let todos = this.state.todos;\n todos = todos.map((todo) => {\n if (todo.id == item.id) {\n todo.done = !todo.done;\n }\n return todo;\n })\n this.setState({todos});\n }\n\n removeTodo (item) {\n let todos = this.state.todos;\n todos = todos.filter((todo) => todo.id !== item.id);\n this.setState({todos});\n }\n..."
] | [
"javascript",
"react-native"
] |
[
"Laravel routing: The requested was not found on this server",
"I just set up an Ubuntu environment on Amazon to run my Laravel application. However, I cannot access my routes, which work fine on my local machine (MAMP).\n\nWhen trying to access ip/recipe-site/public/recipes I am met with the following error:\n\nThe requested URL /recipe-site/public/recipes was not found on this server.\n\n\nHowever, I can reach ip/recipe-site/public/ just fine, which leads me to suspect something is wrong with my Apache configuration.\n\nWhat could I have done wrong?"
] | [
"php",
"apache",
"laravel"
] |
[
"How do I conditionally uninstall shared object (Merge Module) files in WiX?",
"I have a common merge module as a part Wix installer MySetup1.msi, that should always deliver files and install service, but should only uninstall the merge module files/service when a condition is met. The condition is that common files should be uninstalled only when specific property is passed.\nThe merge module is also part MySetup2.msi.\nI understand this can be done by using same GUIDs across components or using merge modules, but\nMySetup1.msi should not uninstall merge module component, expectional case module can be uninstalled if specific FLAG is passed or else merge module should be uninstalled via MySetup2\nHere little complexity, as we have shared component with common GUID, MSI installer service keep reference for shared object\nIf we skip to uninstall in MySetup1.MSI, I think one ref count will be pending.\nAnd on MySetup2.msi uninstall this file will not deleted as there will be always refcount 1.\nAny hints clue really appreciated,\nI know reference counts kept at registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\Component\nbut bit skeptical about manipulating reg entries.\nHere is code snipped where I am merging this module in original installer, but unfortunately did not worked any help really appriciated.\n<Feature Id="MyMergedFeature" Title="My Merged Feature" Level="0" AllowAdvertise="no" Absent="disallow">\n<MergeRef Id='MyModule' />\n <Condition Level="0">\n <![CDATA[REMOVE ~<> "ALL"]]>\n </Condition>\n</Feature>"
] | [
"wix",
"windows-installer"
] |
[
"Is it appropriate to raise exceptions in stored procedures that wrap around CRUD operations, when the number of rows affected != 1?",
"This is a pretty specific question, albeit possibly subjective, but I've been using this pattern very frequently while not seeing others use it very often. Am I missing out on something or being too paranoid?\n\nI wrap all my UPDATE,DELETE,INSERT operations in stored procedures, and only give EXECUTE on my package and SELECT on my tables, to my application. For the UPDATE and DELETE procedures I have an IF statement at the end in which I do the following:\n\nIF SQL%ROWCOUNT <> 1 THEN\n RAISE_APPLICATION_ERROR(-20001, 'Invalid number of rows affected: ' || SQL%ROWCOUNT);\nEND IF;\n\n\nOne could also do this check in the application code, as the number of rows affected is usually available after a SQL statement is executed.\n\nSo am I missing something or is this not the safest way to ensure you're updating or deleting exactly what you want to, nothing more, nothing less?"
] | [
"sql",
"oracle",
"plsql"
] |
[
"how to parameterize imagestreamtag in openshift YAML",
"I have more than ten builds in my openshift project. Each build has a version in its build config. On a new sprint, I need to update the version in each build config individually which is tedious.\n\noutput:\n to:\n kind: ImageStreamTag\n name: my-app-3.11\n\nI'm looking for a way to store the version number as shared variable across all configs, and change it once for all."
] | [
"openshift",
"openshift-client-tools"
] |
[
"React Native take useState in class Error: Minified React error #321",
"I am newbie to react native and\nI would like to create a simple app.\nusing method function to create a TextInput\nand make TextInput intergrate to Class export default class App extends React.Component\nBut unfortunately, I get Error: Minified React error #321, any idea how to make it???\nThank you very much\nFull code:\nimport React, { useState } from 'react';\nimport { TextInput, Text, View, StyleSheet } from 'react-native';\n\nfunction Example() {\n const [text, setText] = useState('')\n return (\n <View>\n <TextInput\n value={text}\n style={{ fontSize: 42, color: 'steelblue' }}\n placeholder="Type here..."\n onChangeText={(text) => {\n setText(text)\n }}\n />\n <Text style={{ fontSize: 24 }}>\n {'\\n'}You entered: {text}\n </Text>\n </View>\n )\n}\n\nexport default class App extends React.Component{\n render(){\n return (\n <View>\n {Example()}\n </View>\n );\n }\n}"
] | [
"react-native",
"function",
"class"
] |
[
"Bringing in multiple field values using $.ajax",
"Currently Im trying to build a poll using JQuery. \n\n$('#next').click(function(){ \n\n$.ajax({ \n type:'POST',\n url: 'getNextPoll.php?pg=1',\n dataType: json,\n success: function() {\n $(\"#a .ui-btn-text\").text(data.answera);\n $(\"#b .ui-btn-text\").text(data.answerb);\n $(\"#c .ui-btn-text\").text(data.answerc);\n $(\"#d .ui-btn-text\").text(data.answerd);\n } // end of success callbac \n }); \n}); \n\n\nI have four buttons with id= a..d. What i was trying to do was bring in the four answer values and put each one in a button. For some reason though it only allows me to get one value $row[0] and nothing else? Can anyone tell me where am i doing wrong?\n\nThanks for your time. \n\nEDIT: Here's php code\n\n<?php \n require_once('connection.php');\n require_once('constants.php');\n\n $pg = isset($_GET['pg']) ? $_GET['pg'] : 0;\n $nxtPage = $pg++;\n $offset = (1 * $pg) - 1;\n $result = mysql_query(\"SELECT * FROM Questions ORDER BY pk_Id DESC LIMIT 1\" . \" OFFSET \" . $offset) or die(mysql_error());\n\n $row = mysql_fetch_array($result, MYSQL_ASSOC); \n\n echo json_encode($row); \n\n?>"
] | [
"php",
"ajax",
"jquery"
] |
[
"Can I use only certain numbers from data file in gnuplot title?",
"I have a data file with many columns of data and the first two lines look like this:\n\n#time a1 b1 c1 d1 a2 b2 c2 d2 \n1 2 3 4 5 6 7 8 9\n\n\nI would like to put a title on the graph which reads like this:\n\na1=2, a2=6, b1=3, b2=7, c1=4, c2=8, d1=5, d2=9\n\n\nSo, basically just taking the data from the first line and adding some text with it. Is this possible? \n\nThanks mgilson! Here is the script (the first part.)\n\n#filename = \"a6_a.txt\"\n\n//defining variables called ofac and residual\n\nunset multiplot\nset term aqua enhanced font \"Times-Roman,18\" \n\nset lmargin 1\nset bmargin 1\nset tmargin 1\nset rmargin 1\nset multiplot\nset size 0.8,0.37\n\nset origin 0.1,0.08 #bottom\n set xlabel \"time\" offset 0,1 #bottom\n\n set ylabel \"{/Symbol w}_i - {/Symbol w}_{i+1}\"\n set yrange [-pi:pi]\n plot filename using 1:(residual($7 -$14)) ti \"\" pt 1 lc 2, \\\n \"\" using 1:(residual($14-$21)) ti \"\" pt 1 lc 3, \\\n \"\" using 1:(residual($21-$28)) ti \"\" pt 1 lc 4\n\nset origin 0.1,0.36 #mid\n set format x \"\" #mid, turn off x labeling\n set xlabel \"\" #mid\n set ylabel \"P_{i+1}/P_i\" offset 2,0\n set yrange [*:*]\n plot filename using 1:(($10/ $3)**1.5) ti \"P_2/P_1\" pt 1 lc 2, \\\n \"\" using 1:(($17/$10)**1.5) ti \"P_3/P_2\" pt 1 lc 3, \\\n \"\" using 1:(($24/$17)**1.5) ti \"P_4/P_3\" pt 1 lc 4\n\n\nset origin 0.1,0.64 #top\n set ylabel \"semi-major axes\"\n set yrange [*:*]\n plot filename using 1:($3):($4*$3) with errorbars ti \"\" pt 1 lc 1, \\\n \"\" using 1:($10):($10*$11) with errorbars ti \"\" pt 1 lc 2, \\\n \"\" using 1:($17):($17*$18) with errorbars ti \"\" pt 1 lc 3, \\\n \"\" using 1:($24):($24*$25) with errorbars ti \"\" pt 1 lc 4\n\nunset multiplot\nunset format \nunset lmargin\nunset bmargin\nunset rmargin\nunset tmargin"
] | [
"gnuplot"
] |
[
"How to write another query in IN function when partitioning",
"I have 2 local docker postgresql-10.7 servers set up. On my hot instance, I have a huge table that I wanted to partition by date (I achieved that). The data from the partitioned table (Let's call it PART_TABLE) is stored on the other server, only PART_TABLE_2019 is stored on HOT instance. And here comes the problem. I don't know how to partition 2 other tables that have foreign keys from PART_TABLE, based on FK. PART_TABLE and TABLE2_PART are both stored on HOT instance.\n\nI was thinking something like this: \n\ncreate table TABLE2_PART_2019 partition of TABLE2_PART for values in (select uuid from PART_TABLE_2019);\n\n\nBut the query doesn't work and I don't know if this is a good idea (performance wise and logically).\n\nLet me just mention that I can solve this with either function or script etc. but I would like to do this without scripting."
] | [
"postgresql"
] |
[
"Manipulating ComboBoxes in wxPython",
"I'm using Python and wxPython to create an UI that lets the user select a XML file in the first combobox and all the components (i.e. buttons) in the XML appears as choices of another combobox below. It's clearly reading correctly as it prints out the right thing in the console as I go through all the XMLs, but I just can't seem to link it back to the combobox I'm looking for.\n\nHere's the code:\n\nimport wx\nimport os\nimport xml.dom.minidom\nfrom xml.dom.minidom import parse\n\n\n# get all xmls\npath = \"C:\\Users\\William\\Desktop\\RES\\Param\"\nfiles = os.listdir(path)\n\nclass Panel(wx.Panel):\n def __init__(self, parent):\n wx.Panel.__init__(self, parent)\n self.xmlList = files\n self.xmlPickerTitle = wx.StaticText(self, label=\"XML Picker\", pos=(20, 30))\n self.xmlPicker = wx.ComboBox(self, pos=(100, 30), size=(500, -1), choices=self.xmlList, style=wx.CB_DROPDOWN)\n\n self.elementsTitle = wx.StaticText(self, label=\"Elements Found\", pos=(20, 100))\n # labels\n self.buttonsPickerTitle = wx.StaticText(self, pos=(20,120), label=\"Buttons\")\n\n self.buttonList = []\n\n self.buttonsPicker = wx.ComboBox(self, pos=(100, 120), size=(250, -1), choices=buttonList, style=wx.CB_DROPDOWN)\n\n self.Bind(wx.EVT_COMBOBOX, self.XMLSelect,)\n\n\n def XMLSelect(self, event):\n xmlPicked = self.xmlList[event.GetSelection()]\n DOMTree = xml.dom.minidom.parse(xmlPicked)\n collection = DOMTree.documentElement\n\n buttons = DOMTree.getElementsByTagName(\"Button\")\n\n for button in buttons:\n if button.hasAttribute(\"name\"):\n buttonList.append(button.getAttribute(\"name\"))\n print button.getAttribute(\"name\")\napp = wx.App(False)\nframe = wx.Frame(None, title = \"Auto\", size = (800, 600))\npanel = Panel(frame)\nframe.Show()\napp.MainLoop()\n\n\nAny ideas?\n\nThanks in advance!"
] | [
"python",
"user-interface",
"combobox",
"wxpython"
] |
[
"Spark: Run through List Asyncronously and perform SparkContext Actions",
"In my application I am running through a list synchronously in order to process all hostnames in a list. \n\nWhile the application works, the problem is I want to now be able to run through that list asynchronously, however I am not entirely sure how to do this with spark since the SparkContext object is not serializable, meaning you can only have a single SparkContext object running at any given time, preventing you from doing multiple spark actions simultaneously. \n\nSo my question is, how do other people approach this problem? Maybe I am not thinking about it in the right way. \n\nPossible Solution: Map List(modelFilteredTopology) to a JavaRDD and then use JavaRDD.foreachAsync(Call MapProcessing with VoidFunction) in order to perform the actions asynchronously. However I may run into some head scratching issues if I do this. And I believe I will still be limited by the SparkContext as it wont execute the actions asynchronously anyways. \n\nSample of my code below:\n\nMainClass.java snippet - Loads some data from a SchemaRDD over to a LIST\n\n List<modelFilteredTopology> filteredList = FILTERED_TOPOLOGY.map(new Function<Row, modelFilteredTopology>() {\n public modelFilteredTopology call(Row row){\n modelFilteredTopology modelF = new modelFilteredTopology();\n\n modelF.setHOSTNAME(row.getString(0));\n modelF.setMODEL(row.getString(1));\n modelF.setCOMMIT_TS(new SimpleDateFormat(\"yyyy-MM-dd\").format(Calendar.getInstance().getTime()));\n\n return modelF;\n }\n }).collect();\n\n for(modelFilteredTopology f : filteredList) {\n MapProcessing2 map = new MapProcessing2(schemaTopology, sc, sqlContext);\n map.runApp(f.getHOSTNAME(),f.getMODEL(),f.getCOMMIT_TS());\n }\n\n\nMapProcessing2.class - This is a small snippet of the code that performs a TON of JAVARDD transformations, I have to make SparkContext static, otherwise it will obviously through a Serialization not allowed error. \n\npublic class MapProcessing2 implements Serializable {\n\nprivate static final Integer HISTORYDATE = 30;\nprivate static JavaSchemaRDD TOPO_EXTRACT;\nprivate static JavaSparkContext SC;\nprivate static JavaSQLContext sqlContext;\nprivate static final String ORACLE_DRIVER = Properties.getString(\"OracleDB_Driver\");\nprivate static final String ORACLE_CONNECTION_URL_PROD = Properties.getString(\"DB_Connection_PROD\");\nprivate static final String ORACLE_USERNAME_PROD = Properties.getString(\"DB_Username_PROD\");\nprivate static final String ORACLE_PASSWORD_PROD = Properties.getString(\"DB_Password_PROD\");\n\npublic MapProcessing2(JavaSchemaRDD TOPO_EXTRACT, JavaSparkContext SC, JavaSQLContext sqlContext) {\n this.TOPO_EXTRACT = TOPO_EXTRACT;\n this.SC = SC;\n this.sqlContext = sqlContext;\n\n}\npublic void runApp(String hostname, String model, String commits) throws Exception{\n if (String.valueOf(hostname).equals(\"null\")) {\n System.out.println(\"No Value Retrieved\");\n } else {\n try {\n //Retrieve Tickets for GWR\n JavaSchemaRDD oltint = getOLTInterfaces(TOPO_EXTRACT, hostname);\n System.out.println(\"Number of OLT's Found for \"+hostname+\": \" + oltint.collect().size());\n if (oltint.collect().size() < 1) {\n System.out.println(\"No OLT's found for: \" + hostname);\n } else {\n System.out.println(\"Processing Router: \" + hostname + \" Model:\" + model);\n\n System.out.println(\"Processing Tickets for: \" + hostname + \" \" + model);\n }\n\n } catch (Exception e) {\n System.out.println(\"Error Processing GWR: \" + hostname + \" \" + model + \" Stacktrace Error: \" + e);\n }\n }\n}"
] | [
"java",
"apache-spark",
"apache-spark-sql",
"spark-streaming",
"spark-dataframe"
] |
[
"is there a good example out there for XML Sign with XADES-EPES in Java?",
"I try to use xades4j but The documentation is a little generalized.\nin this moment I have a basic sign method but don't get the xml tags that I need.\n\nKeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE);\n\n ks.load(new FileInputStream(KEYSTORE_FILE), KEYSTORE_PASSWORD.toCharArray());\n\n PrivateKey privateKey = (PrivateKey) ks.getKey(PRIVATE_KEY_ALIAS, PRIVATE_KEY_PASSWORD.toCharArray());\n\n File signatureFile = new File(\"./invoice.xml\");\n\n String baseURI = signatureFile.toURL().toString(); // BaseURI para las URL Relativas.\n\n // Instanciamos un objeto XMLSignature desde el Document. El algoritmo de firma será DSA\n // Signature - Required DSAwithSHA1 (DSS)\n XMLSignature xmlSignature = new XMLSignature(document, baseURI, XMLSignature.ALGO_ID_SIGNATURE_DSA);\n\n // Añadimos el nodo de la firma a la raiz antes de firmar.\n // Observe que ambos elementos pueden ser mezclados en una forma con referencias separadas\n document.getDocumentElement().appendChild(xmlSignature.getElement());\n\n // Creamos el objeto que mapea: Document/Reference\n Transforms transforms = new Transforms(document);\n transforms.addTransform(Transforms.TRANSFORM_BASE64_DECODE); // TRANSFORM_ENVELOPED_SIGNATURE\n\n // Añadimos lo anterior Documento / Referencia\n // ALGO_ID_DIGEST_SHA1 = \"http://www.w3.org/2000/09/xmldsig#sha1\";\n xmlSignature.addDocument(\"\", transforms, Constants.ALGO_ID_DIGEST_SHA1);\n\n // Añadimos el KeyInfo del certificado cuya clave privada usamos\n X509Certificate cert = (X509Certificate) ks.getCertificate(PRIVATE_KEY_ALIAS);\n xmlSignature.addKeyInfo(cert);\n xmlSignature.addKeyInfo(cert.getPublicKey());\n\n // Realizamos la firma\n xmlSignature.sign(privateKey);"
] | [
"java",
"xml-signature",
"xades4j"
] |
[
"How to fix [unexpected token \"indent\"] error in pug?",
"Error: /home/user/Desktop/app/backend/views/register.pug:2:1\n 1| doctype html\n > 2| html\n-------^\n 3| head\n 4| title = title\n 5| body\n\nunexpected token \"indent\"\n at makeError (/home/user/Desktop/app/backend/node_modules/pug-error/index.js:32:13)\n at Parser.error (/home/user/Desktop/app/backend/node_modules/pug-parser/index.js:53:15)\n at Parser.parseExpr (/home/user/Desktop/app/backend/node_modules/pug-parser/index.js:264:14)\n at Parser.parse (/home/user/Desktop/app/backend/node_modules/pug-parser/index.js:112:25)\n at parse (/home/user/Desktop/app/backend/node_modules/pug-parser/index.js:12:20)\n at Object.parse (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:125:22)\n at Function.loadString [as string] (/home/user/Desktop/app/backend/node_modules/pug-load/index.js:45:21)\n at compileBody (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:86:18)\n at Object.exports.compile (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:242:16)\n at handleTemplateCache (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:215:25)\n at Object.exports.renderFile (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:427:10)\n at Object.exports.renderFile (/home/shivtaj/Desktop/app/backend/node_modules/pug/lib/index.js:417:21)\n at View.exports.__express [as engine] (/home/user/Desktop/app/backend/node_modules/pug/lib/index.js:464:11)\n at View.render (/home/user/Desktop/app/backend/node_modules/express/lib/view.js:135:8)\n at tryRender (/home/user/Desktop/app/backend/node_modules/express/lib/application.js:640:10)\n at Function.render (/home/user/Desktop/app/backend/node_modules/express/lib/application.js:592:3)"
] | [
"pug"
] |
[
"if months in a range of cells is less than or equal to today's month then sum the given range",
"My table looks like this:\n\nMonth No Of Flat\n\nApr-13 0.00\n\nMay-13 0.00\n\nJun-13 0.00\n\nJul-13 0.00\n\nAug-13 0.00\n\nSep-13 4.00\n\nOct-13 4.00\n\nNov-13 0.00\n\nDec-13 2.00\n\nJan-14 2.00\n\nFeb-14 3.00\n\nMar-14 2.00\n\nTotal 17\n\nNow what i want to do is add no of flats that are sold till today. i.e. answer should be: 0 + 0 + 0 + 0 + 0 + 4 + 4 + 0 + 2 + 2 = 12\n\nI used this formula: =SUM(IF(MONTH(N149:N160)<=MONTH(NOW()), 1, 0)*O149:O160) as an array\n\nbut the answer I am getting is 2 which is just for this month i.e. Jan 2014.\n\nPlease help"
] | [
"excel-formula"
] |
[
"Integrating more than one function error in python",
"Lets say i define my function G,\n\ndef G(k, P, W):\n return k**2*P*W**2\n\n\nWhere P and W are two functions that have independent variables of k and k is a defined number.\n\nI am trying to integrate this from 0 to infinity\n\nI = scipy.integrate.quad(G, 0, np.Inf)\n\n\ninputting this into my console gives me the error,\nG() takes exactly 3 arguments (2 given)\n\nI tried using the arg() command, but it does not seem to change it and code remains stubborn. What am i doing wrong and what am i missing?"
] | [
"python",
"scipy",
"ipython",
"integration",
"typeerror"
] |
[
"How to avoid UnsupportedOperationException while getting percent symbols?",
"I was trying to get the percent symbol specific to the locale. My crash logs show \"UnsupportedOperationException\" while trying to getPercent from DecimalFormatSymbols.\n\nI used NumberFormat instance for the given locale and got the percent symbol through DecimalFormatSymbols getPercent method.\n\n {\n DecimalFormat decimalFormat = (DecimalFormat)NumberFormat.getInstance(currentLocale);\n return String.valueOf(decimalFormat.getDecimalFormatSymbols().getPercent());\n } \n\n\nI was expecting the percent symbol specific to the locale, but for some locales, I am getting the following exception\n\n at java.text.DecimalFormatSymbols.getPercent(DecimalFormatSymbols.java:352\n\n\nI checked DecimalFormatSymbols class getPercent() method,\n\npublic char getPercent() {\n if (percent.length() == 1) {\n return percent.charAt(0);\n }\n throw new UnsupportedOperationException(\"Percent spans multiple characters: \" + percent);\n }\n\n\nLooks like percent symbol length != 1, it's happening for Arabic symbols."
] | [
"java",
"android",
"decimalformat"
] |
[
"Cannot share image to Facebook and messenger",
"I have implemented a UIActivityController that retrieves an image from UIPickerViewController. I am able to successfully share text and image via text message but I cannot share the same through Facebook or messenger.\n\n override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {\n let complete = UIContextualAction.init(style: .normal, title: \"Complete\") { (action, view, completion) in\n\n if UIImagePickerController.isSourceTypeAvailable(.camera) {\n self.picker.allowsEditing = false\n self.picker.sourceType = UIImagePickerController.SourceType.camera\n self.picker.cameraCaptureMode = .photo\n self.picker.modalPresentationStyle = .fullScreen\n self.present(self.picker,animated: true,completion: nil)\n } else {\n self.noCamera()\n }\n\n }\n // complete.image = //... Add an image\n complete.backgroundColor = #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)\n let action = UISwipeActionsConfiguration.init(actions: [complete])\n action.performsFirstActionWithFullSwipe = true //... Full swipe support\n return action\n}\n\n func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {\n\n guard let myImageView = info[.originalImage] as? UIImage else {\n return\n }\n print(myImageView)\n\n if myImageView != nil {\n self.dismiss(animated: true, completion: nil)\n let activityController = UIActivityViewController(activityItems: [self.completedTxt, myImageView as Any], applicationActivities: nil)\n\n present(activityController, animated: true, completion: nil)\n\n }else {\n return\n }\n}\nfunc imagePickerControllerDidCancel(_ picker: UIImagePickerController) {\n dismiss(animated: true, completion: nil)\n}\n\n\nWhen I print(myImageView) the size is {3024, 4032} which I am assuming is the resolution. If this is true I think the image may be too large to share. If this is correct, \n\nis there a way to reduce the resolution of the image?"
] | [
"ios",
"swift",
"uiactivityviewcontroller",
"facebook-share",
"uipickerviewcontroller"
] |
[
"Android: using toolbar with homeAsUpButton does call onCreate instead of onResume",
"I use toolbar in activity like this:\n\nToolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);\n setSupportActionBar(myToolbar);\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n\n\nAnd this code in AppCombatActivity:\n\n@Override\npublic boolean onSupportNavigateUp() {\n onBackPressed();\n return true;\n}\n\n\nIn Manifest I defined parent activity.\n\nIt works. But everytime I press the button 'onCreate' is called on parent activity. But thats not what I want. Whenn I press the back-button on the device it goes back to previous activity and just calls onResume. That is what it also should do when I press the back button in the toolbar. \n\nAny Ideas? \nThanks!"
] | [
"android"
] |
[
"Spark query difference in performance on same kind of data",
"I am new to Spark, so I was experimenting something like this \n\n val values1= sparkSession.range(1,1000000)\n val values2= sparkSession.range(1,1000000)\n val values3= sparkSession.range(0,100000,2)\n val values4= sparkSession.range(0,100000,2)\n\n private val frame1: DataFrame = values1.join(values3,\"id\")\n frame1.count()\n private val frame3: DataFrame = values2.join(values4,\"id\")\n frame3.count()\n\n\n\n\nMy question is why later task takes so less time though I am using different data (might be identical in content). ?"
] | [
"scala",
"apache-spark",
"apache-spark-sql"
] |
[
"pywin32 and excel. Exception when writing large quantities of data",
"I am currently trying to write a large amount of data to an excel spreadsheet using the pywin32 libraries. As a simple example of the problem that I am facing take the following code to generate a 1000 cell x 1000 cell multiplication table.\n\nimport win32com.client\nfrom win32com.client import constants as c\n\nxl = win32com.client.gencache.EnsureDispatch(\"Excel.Application\") \nxl.Visible = True\nWorkbook = xl.Workbooks.Add()\nSheets = Workbook.Sheets\n\ntableSize = 1000\n\nfor i in range(tableSize):\n for j in range(tableSize):\n Sheets(1).Cells(i+1, j+1).Value = i*j\n\n\nFor small values this works. However, for larger values the python program eventually crashes with the error:\n\nTraceback (most recent call last):\n File \".\\Example.py\", line 16, in <module>\n Sheets(1).Cells(i+1, j+1).Value = i*j\n File \"C:\\PYTHON27\\lib\\site-packages\\win32com\\client\\__init__.py\", line 474, in __setattr__\n self._oleobj_.Invoke(*(args + (value,) + defArgs)) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146777998), None)\n\n\nI've already admitted defeat due to the fact that this is significantly slower than xlwt but I am still curious as to what is happening to cause this error."
] | [
"python",
"excel",
"pywin32"
] |
[
"Flutter json_serializable models error: Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast",
"I'm trying to fetch data from server in flutter and I'm using json_serializable for my data model.\nI successfully get the data, but when it's time to convert the json in a data list I get this error: Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast.\nI don't know how to solve.\nHere's my fetch function\nFuture<List<Data>> getallNews() async {\n try {\n var response = await NewsAppApi.dio.get(ALL_NEWS);\n // If the server did return a 200 OK response,\n // then parse the JSON.\n List parsed = response.data['data'];\n List<Data> _news = [];\n parsed.forEach((element) {\n print(element);\n Data n = Data.fromJson(element);\n print(n);\n _news.add(n);\n });\n //List<Data> _news = parsed.map((json) => Data.fromJson(json)).toList();\n return _news;\n } on DioError catch (e) {\n throw showNetworkError(e);\n }\n}\n\nHere's my model\n@JsonSerializable(explicitToJson: true)\nclass Data {\n final int id;\n final int author;\n final String title;\n final String body;\n final String link;\n final DateTime? datePublished;\n final DateTime dateTobePublished;\n final int published;\n final int tobePublished;\n final int status;\n final DateTime? deletedAt;\n final DateTime createdAt;\n final DateTime updatedAt;\n final List<Tags> tags;\n\n Data(\n {\n required this.id,\n required this.author,\n required this.title,\n required this.body,\n required this.link,\n required this.datePublished,\n required this.dateTobePublished,\n required this.published,\n required this.tobePublished,\n required this.status,\n required this.deletedAt,\n required this.createdAt,\n required this.updatedAt,\n required this.tags});\n\n \n factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);\n\n \n Map<String, dynamic> toJson() => _$DataToJson(this);\n}\n\nAnd here's the data I get from server\n{\n "data": [\n {\n "id": 105,\n "author": 1,\n "title": "testLaura",\n "body": "asdadsdas",\n "link": "https:\\/\\/www.google.com\\/",\n "datePublished": null,\n "dateTobePublished": "2021-03-09 22:51:00",\n "published": 0,\n "tobePublished": 1,\n "status": 0,\n "deleted_at": null,\n "created_at": "2021-03-09T08:18:02.000000Z",\n "updated_at": "2021-03-09T08:18:02.000000Z",\n "tags": [\n {\n "id": 4,\n "title": "Studenti"\n }\n ]\n },\n {\n "id": 104,\n "author": 8,\n "title": "news",\n "body": "sdadasdasasdasddasads",\n "link": "https:\\/\\/www.google.com\\/",\n "datePublished": null,\n "dateTobePublished": "2021-03-09 08:11:20",\n "published": 0,\n "tobePublished": 1,\n "status": 0,\n "deleted_at": null,\n "created_at": "2021-03-09T08:12:36.000000Z",\n "updated_at": "2021-03-09T08:12:36.000000Z",\n "tags": [\n {\n "id": 2,\n "title": "Genitori"\n }\n ]\n },\n\nThanks for the help"
] | [
"flutter",
"dart",
"json-serializable"
] |
[
"tcl exec with cvs upd: why it exits?",
"My question is very simple. Take into consideration the code snippets below:\n\nset cvsPath \"C:/Program Files (x86)/cvsnt/cvs.exe\"\nputs [exec $::cvsPath log filename]\nputs \"------------- END OF SCRIPT ---------------------\"\n\n\nThis one prints the log and then \"------------- END OF SCRIPT ---------------------\".\n\nset cvsPath \"C:/Program Files (x86)/cvsnt/cvs.exe\"\nputs [exec $::cvsPath -n upd]\nputs \"------------- END OF SCRIPT ---------------------\"\n\n\nThis one prints the update messages and exits. Why? How to prevent exiting?\n\nP.S. The reason of exiting is exec with cvs -n upd input..."
] | [
"exec",
"tcl",
"cvs"
] |
[
"Displaying input character's binary value",
"I'm trying to understand why I keep getting an unexpected binary result. For example, if I were to write\n8\nI will get a result of\n00111000\nand not\n00001000\nI'm not trying to manipulate to get another result, I'm trying to see what the actual data is for my input and understand why it's giving that input.\nI'm using C++ in visual studio with a platform of Win32.\nThis is my code:\n#include <stdio.h>\n#include <bitset>\n#include <iostream>\n\nusing namespace std;\nint main() {\n char cl;\n\n cout << "The minimum value of char is " << CHAR_MIN << endl;\n cout << "The maximum value of char is " << CHAR_MAX << endl;\n\n cout << "The storage size in byte(s) of a char is " << sizeof(cl) << endl;\n cout << "Input hexadecimal number in the data type of char for example a" << endl;\n\n scanf_s("%c", &cl, sizeof(cl));\n bitset < 8 * sizeof(cl)>charBits(cl);\n\n cout << "The converted binary value is " << charBits << endl;\n printf("The converted decimal value is% i \\n", cl);\n}"
] | [
"c++",
"binary",
"ascii"
] |
[
"Google Chrome and Mac Localhost Issues",
"Odd and annoying issue. I have Apache up and running on My mac and I'm utilizing the virtual hosts capability. Though oddly enough, whenever I type in the local site, in this case: local.511, it just goes to search. If I do http://local.511, it seemed to have work. Though only after doing it at least 15 times. Also, even after getting that to work, I still can't navigate to other pages by simply typing them in. IE: local.511/lalaal/page1.\n\nIt works fine in Safari and Firefox.\n\nAny ideas for Chrome?\n\nOSX 10.6\nChrome 10.0.648.151"
] | [
"apache",
"google-chrome",
"localhost"
] |
[
"TensorFlow object detection module import issue",
"I started to learn object detection with TensorFlow from this tutorial but have some problems with trainer import module.\n\nI've downloaded Tensorflow models and protoc-3.4.0-win32 and already compiled object_detection\\protos for Python, also prepared images with labels and set enviroment variables.\n\nNow everything is fine but an error occurs while running 3_train.py script from this repo:\n\nFile \"C:\\Users\\Username\\Desktop\\TensorFlow\\TensorFlow_Tut_3_Object_Detection_Walk-through-master\\3_train.py\", line 11, in <module>\n from object_detection import trainer\nImportError: cannot import name 'trainer'\n\nI don't know how to fix this error. I'am using Python 3.6.6 on Win7x64.\n\nAny advice will be appreciated!"
] | [
"python",
"python-3.x",
"tensorflow",
"object-detection"
] |
[
"C# PayPal REST Api (.NET SDK)",
"I am using the .NET PayPal SDK (github.com/paypal/PayPal-NET-SDK) and am able to successfully create a paypal request, redirect the user, the user completes payment and all is well.\n\nFor the life of me, I can't figure out how to show the \"Credit Card / No Paypal Account\" screen instead of the \"Login with paypal ... or click here if you don't have paypal to pay with credit card\" screen.\n\nMost of my users don't have paypal and just want to pay with a credit card (and I'd like to process it all through paypal, directly through their site so that users never give me their credit card number).\n\nHere is the code I have that work for paying with paypal, but how can I tell it to show the \"credit card/guest checkout\" on paypal's landing page? \n\nstring PaypalRedirectURL(string returnURL, string cancelURL)\n {\n // create the transaction list\n var trans = new List<Transaction>();\n\n // make the actual transaction\n var t = new Transaction()\n {\n description = \"Payment For Something\",\n invoice_number = \"inv1234\",\n amount = new Amount()\n {\n currency = \"USD\",\n total = \"2.00\",\n details = new Details\n {\n tax = \"0\",\n shipping = \"0\",\n subtotal = \"2.00\"\n }\n }\n };\n\n t.item_list = new ItemList();\n t.item_list.items = new List<Item>();\n\n Item i = new Item();\n i.name = \"Something I charge for\";\n i.quantity = \"1\";\n i.sku = \"item0001\";\n i.currency = \"USD\";\n i.price = \"2.00\";\n\n // Add item to item list\n t.item_list.items.Add(i);\n\n //add transaction to transaction list\n trans.Add(t);\n\n // create the payment\n var payment = Payment.Create(GetAPIContext(), new Payment\n {\n intent = \"sale\",\n payer = new Payer\n {\n payment_method = \"paypal\"\n },\n transactions = trans,\n redirect_urls = new RedirectUrls\n {\n return_url = returnURL,\n cancel_url = cancelURL\n }\n });\n\n var links = payment.links.GetEnumerator();\n\n string paypalRedirectUrl = null;\n\n while (links.MoveNext())\n {\n Links lnk = links.Current;\n\n // get the payment redirect link\n if (lnk.rel.ToLower().Trim().Equals(\"approval_url\"))\n {\n //saving the payapalredirect URL to which user will be redirected for payment\n paypalRedirectUrl = lnk.href;\n }\n }\n return paypalRedirectUrl;\n\n }\n\n\nI've tried numerous variations of [payment_method = \"paypal\"] (like (=\"credit_card\", etc) but nothing seems to work. Again, I don't want to provide the credit card to this, I want the credit card \"guest checkout\" on paypal's site to show by default.\n\nThis is the screen the user gets on paypal (they can click the \"pay with credit card\" but I want to know if I can send them directly to the credit card screen without them having to click anything.\n\nCurrent Page they are sent to:\nDefault paypal screen\n\nPage I'd like the user to see by default (with the credit card fields displayed):\nDesired default paypal page\n\nAny help would be greatly appreciated .. thanks in advance"
] | [
"c#",
".net",
"paypal",
"sdk",
"express-checkout"
] |
[
"Firebase InitializeApp in Angular Typescript",
"I'm attempting to initialize my angular (typescript) app to use firebase. I have A FirebaseService class that has a method to initialize the app, i.e.,\n\nimport {Injectable} from \"@angular/core\";\nimport * as firebase from 'firebase';\n\nconst firebaseConfig = {\n apiKey: // my api key,\n authDomain: // my auth domain,\n databaseURL: // my database url,\n storageBucket: // my storage bucket,\n};\n\n@Injectable()\nexport class FirebaseService {\n\n start(): void {\n console.log(\"Starting firebase\");\n firebase.initializeApp(firebaseConfig);\n };\n}\n\n\nI call FirebaseService.Start when the application starts up, but I'm currently getting the following error in the browser console\n\nStarting firebase\ncore.umd.js:2837 EXCEPTION: Error in :0:0 caused by: firebase.initializeApp is not a functionErrorHandler.handleError @ core.umd.js:2837\ncore.umd.js:2839 ORIGINAL EXCEPTION: firebase.initializeApp is not a functionErrorHandler.handleError @ core.umd.js:2839\ncore.umd.js:2842 ORIGINAL STACKTRACE:ErrorHandler.handleError @ core.umd.js:2842\ncore.umd.js:2843 TypeError: firebase.initializeApp is not a function\n at FirebaseService.start (http://localhost:3000/app/services/firebase.service.js:24:18)\n at new AppComponent (http://localhost:3000/app/app.component.js:16:25)\n at new Wrapper_AppComponent (/AppModule/AppComponent/wrapper.ngfactory.js:7:18)\n at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:20:28)\n at CompiledTemplate.proxyViewClass.AppView.createHostView (http://localhost:3000/lib/@angular/core/bundles/core.umd.js:9147:25)\n at CompiledTemplate.proxyViewClass.DebugAppView.createHostView (http://localhost:3000/lib/@angular/core/bundles/core.umd.js:9407:56)\n at ComponentFactory.create (http://localhost:3000/lib/@angular/core/bundles/core.umd.js:5481:29)\n at ApplicationRef_.bootstrap (http://localhost:3000/lib/@angular/core/bundles/core.umd.js:6550:44)\n at eval (http://localhost:3000/lib/@angular/core/bundles/core.umd.js:6459:93)\n at Array.forEach (native)\n\n\nMy SystemJS config is set up as follows\n\n(function (global) {\n System.config({\n paths: {\n // paths serve as alias\n \"lib:\": 'lib/'\n },\n // map tells the System loader where to look for things\n map: {\n // our app is within the app folder\n\n // angular bundles\n '@angular/core': 'lib:@angular/core/bundles/core.umd.js',\n '@angular/common': 'lib:@angular/common/bundles/common.umd.js',\n '@angular/compiler': 'lib:@angular/compiler/bundles/compiler.umd.js',\n '@angular/platform-browser': 'lib:@angular/platform-browser/bundles/platform-browser.umd.js',\n '@angular/platform-browser-dynamic': 'lib:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',\n '@angular/http': 'lib:@angular/http/bundles/http.umd.js',\n '@angular/router': 'lib:@angular/router/bundles/router.umd.js',\n '@angular/forms': 'lib:@angular/forms/bundles/forms.umd.js',\n 'rxjs': 'lib:rxjs',\n 'firebase': 'lib:firebase'\n },\n // packages tells the System loader how to load when no filename and/or no extension\n packages: {\n app: {\n main: './main.js',\n defaultExtension: 'js'\n },\n rxjs: {\n defaultExtension: 'js'\n },\n firebase: {\n main: 'firebase.js',\n defaultExtension: 'js'\n }\n }\n });\n})(this);\n\n\nSo it should be able to load firebase.js from my lib folder. Looking in firebase.js there certainly appears to be a function called initializeApp, i.e.,\n\ninitializeApp:function(a,c){void 0===c?c=\"[DEFAULT]\":\"string\"===typeof c&&\"\"!....\n\n\nso i can't work out where I'm going wrong. Any ideas?\n\nI'm using angular v2.2.0 and firebase v3.6.1"
] | [
"angular",
"firebase",
"systemjs"
] |
[
"Is it possible to create a single link that always takes the person to their country's website?",
"I tried to find the answer to this on the web but as far as i can tell i don't even know how to ask the question correctly, but for example:\n\nLet's say i wanted to provide a link to Amazon, but i wanted the person who clicked the link to be taken to their country's website, such that those in the US would be taken to .com, those in the UK would be taken to .co.uk, etc.\n\nIs this possible (in HTML only)? If so, could you give me an example of how to do it? Or provide a source for more info?\n\nThanks."
] | [
"html",
"hyperlink",
"dns"
] |
[
"How to use backslash in PEP8 when there is a dot or comma?",
"Here is my dataframe:\n\nIn [1]: import pandas as pd\nIn [2]: df = pd.DataFrame({'col1':['A','A','A','B','B','B'], 'col2':['C','D','D','D','C','C'], \n 'col3':[.1,.2,.4,.6,.8,1]})\nIn [3]: df\nOut[4]: \n col1 col2 col3\n0 A C 0.1\n1 A D 0.2\n2 A D 0.4\n3 B D 0.6\n4 B C 0.8\n5 B C 1.0\n\n\nMy question is: When I want to wrap the long text, where shall I put the backslash? After the dot or before the dot? Which is correct?\n\n# option 1 backslash after dot or comma\ndf.groupby('col1').\\\n sum()\ndf['col1'],\\\n df['col2']\n\n# option 2 backslash before dot or comma\ndf.groupby('col1')\\\n .sum()\ndf['col1']\\\n ,df['col2']\n\n\nI also find that if I use parentheses I do not have to use the backslash. Then which option is correct?\n\n# option 1: no backslash and dot or comma in the new line\n(df.groupby('col1')\n .sum())\n(df['col1']\n ,df['col2'])\n\n# option 2: no backslash and dot or comma in the old line\n(df.groupby('col1').\n sum())\n(df['col1'],\n df['col2'])\n\n# option 3: backslash after dot or comma \n(df.groupby('col1').\\\n sum())\n(df['col1'],\\\n df['col2'])\n\n# option 4: backslash before dot or comma \n(df.groupby('col1')\\\n .sum())\n(df['col1']\\\n ,df['col2'])"
] | [
"python-3.x",
"backslash",
"pep8"
] |
[
"About Perl reading the webpage online via HTTP",
"I have a huge webpage, which is about 5G size. And I hope I could read the content of the webpage directly(remotely) without downloading the whole file. I have used the Open File Handler to open the HTTP content. But the error message given is No such files or directory. I tried to use LWP::Simple, but it was out of memory if I use get the whole content. I wonder if there is a way that I could open this content remotely, and read line by line. \nThank you for your help."
] | [
"perl",
"file",
"http",
"webcontent"
] |
[
"cannot modify the design of table it is in a read-only database",
"I am trying to export data into excel sheet i have written code but getting error i dont know where i am wrong please help \n\nIt is showing error \"cannot modify the design of table it is in a read-only database \"\n\n public override void ExportToExcel()\n {\n MModule objModule = new MModule();\n objModule.LoadModule(this.Data.MID);\n\n DatabaseObject objData = new DatabaseObject();\n\n string file = DateTime.Now.Ticks + \"_\" + objModule.Title + \".xlsx\";\n System.IO.File.Copy(Server.MapPath(\"/Excel/Export/template.xlsx\"), \n Server.MapPath(\"/Excel/Export/\" + file));\n string filename = Server.MapPath(\"/Excel/Export/\" + file);\n objData.Query = \"SELECT * FROM \" + objModule.TableName + \"\";\n DataTable dtReport = objData.GetTable();\n System.Data.OleDb.OleDbConnection con = new \n System.Data.OleDb.OleDbConnection(\"Provider=Microsoft.ACE.OLEDB.12.0;Data \n Source=\" + filename + \";Mode=ReadWrite;Extended Properties=\\\"Excel 12.0 \n Xml;HDR=YES\\\"\");\n\n con.Open();\n System.Data.OleDb.OleDbCommand cmd = con.CreateCommand();\n string tableString = \"\";\n string ColString = \"\";\n for (int i = 0; i < dtReport.Columns.Count; i++)\n {\n tableString += \"[\" + dtReport.Columns[i].Caption + \"] varchar(255),\";\n ColString += \"[\" + dtReport.Columns[i].Caption + \"],\";\n }\n tableString = tableString.Substring(0, tableString.Length - 1);\n try\n {\n ColString = ColString.Substring(0, ColString.Length - 1);\n\n cmd.CommandText = \"CREATE TABLE MySheet (ID char(255), Field1 char(255))\";\n cmd.ExecuteNonQuery();\n\n\n string ValString = \"\";\n for (int j = 0; j < dtReport.Rows.Count; j++)\n {\n ValString = \"\";\n for (int i = 0; i < dtReport.Columns.Count; i++)\n {\n ValString += \"'\" + dtReport.Rows[j][i] + \"',\";\n }\n ValString = ValString.Substring(0, ValString.Length - 1);\n cmd.CommandText = \"Insert Into \" + objModule.Title + \"(\" + ColString + \n \") Values (\" + ValString + \");\";\n cmd.ExecuteNonQuery();\n }\n\n\n cmd.Dispose();\n con.Dispose();\n con.Close();\n\n Microsoft.Office.Interop.Excel.Application excelApplication = new \n Microsoft.Office.Interop.Excel.Application();\n Microsoft.Office.Interop.Excel.Workbook workbook = \n excelApplication.Workbooks.Open(filename,\n Type.Missing, Type.Missing, Type.Missing, Type.Missing,\n Type.Missing, Type.Missing, Type.Missing, Type.Missing,\n Type.Missing, Type.Missing, Type.Missing, Type.Missing,\n Type.Missing, Type.Missing);\n\n excelApplication.DisplayAlerts = false;\n ((Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1]).Delete();\n workbook.Close(true, filename, null);\n excelApplication.DisplayAlerts = true;\n }\n catch (Exception ex)\n {\n\n }\n }"
] | [
"c#",
"excel"
] |
[
"I localized my app to China, England, Dutch, etc. How do I go to local iTunes Store and check local feedback?",
"recently I uploaded my app internationally. I found that the app is selling in China compared to other countries that I localized my app to. \n\nSo, I would like access to Chinese Apple App Store so that I can read their feed back if there is any. But I only have ID for North America, not China. \n\nI tried http://www.apple.com.cn/itunes/ but this page is for downloading iTunes for Chinese users.\n\nany ideas? many thanks."
] | [
"iphone",
"objective-c",
"localization",
"itunes",
"feedback"
] |
[
"Dynamics 365 for field service not showing “Editable Grid” option in the entity controls section",
"I wanted to enable le the grid options in Field Service App with Unified Interface. When I press "Add Control" on the entity view in solution. I can only see:\n> CC_Analytics_SuggestionsSettingsControl \n> CC_CardFeed_Name\n> CC_CardFeed_Name \n> CC_EstimatesGridControl\n\nNo "editable grid". Any help appreciated."
] | [
"dynamics-365"
] |
[
"Change default RandomForestClassifier's \"score\" function when fitting the model?",
"I perform the fitting operation using RandomForestClassifier from sklearn:\n\nclf.fit(X_train,y_train,sample_weight=weight)\n\n\nI don't know how to change the evaluation metric, which I assume it's simply accuracy here.\n\nI'm asking this because I've seen that with the XGBOOST package you can precisely specify this metric. Example:\n\nclf.fit(X_train, y_train, eval_metric=\"auc\", eval_set=[(X_eval, y_eval)])\n\n\nSo, my question is: could I do the same with RandomForestClassifier from sklearn. I need to base my performance on AUC metric."
] | [
"scikit-learn",
"random-forest"
] |
[
"Add service reference through code",
"How can I add a Service Reference (WCF) without use the Solution Explorer and \"Add Service Reference\".\n\nHi everyone, I've added a Service Reference using the Solution Explorer and it works perfectly but now I need to add the Service Reference by code in C# I don't want to use the App.config file, all to do by code. I looked for in many sites but all use the Solution Explorer.\n\nPlease, give me some help with this.\n\nThis is my code.\n\nBasicHttpBinding _enlace = new BasicHttpBinding();\n_enlace.Security.Mode = BasicHttpSecurityMode.None;\nEndpointAddress _direccion = new EndpointAddress(\"http://192.168.1.42/ServicioManejoArchivos.svc/ServicioManejoArchivos\");\nServicioManejoArchivosClient _servicio = new ServicioManejoArchivosClient(_enlace, _direccion);\nDocumento _archivoEnviar = new Documento();\nbyte[] _cadenaBytes = File.ReadAllBytes(m_direccionArchivoTemporal);\n_archivoEnviar.Archivo = _cadenaBytes;\n_archivoEnviar.CodigoEmpresa = m_global.CodigoEmpresa;\n_archivoEnviar.CodigoFacilidad = m_global.CodigoFacilidad;\n_archivoEnviar.CodigoTercero = m_codigoTercero;\n_archivoEnviar.Extension = \".zip\";\n_archivoEnviar.NombreArchivo = System.IO.Path.GetFileNameWithoutExtension(m_direccionArchivoTemporal);\n_archivoEnviar.TipoDocumento = cmbTipoDocumento.Text;\n_archivoEnviar.ModuloAfectado = m_global.CodigoArea;\n_archivoEnviar.ProcesoEfectuado = base.m_tipoActividad.ToString();\nvar resultado = _servicio.GuardarArchivo(_archivoEnviar);\n_servicio.Close();"
] | [
"c#",
"wcf",
"service",
"reference"
] |
[
"Cannot login from Chrome extension to another site",
"I am trying to login into an online shopping site from Chrome extension, then scrape it.\nThere are three steps that happens when you do this from a browser.\n\n\nVisit the site, the site gives you a cookie.\nGo to the login page, send the aforementioned cookie, and username and password as params in POST. The site gives you 5 more cookies.\ncall GET to a path within the site, along with five + one = total six cookies.\n\n\nNow that works well in browser. If I copy all the cookies from the browser into curl, the following call would work.\n\ncurl -X GET --header \"Cookie: cookie1=value1; cookie2=value2; cookie3=value3; cookie4=value4; cookie5=value5; cookie6=value6\" http://www.sitedomain.com/product_info.php?products_id=350799\n\n\nHowever, how can I repeat this behavior in Google Chrome extension? Nothing I do seems to be working, yes I added the domain to the manifest.json and I've tried request, requestify (both browserified) and XMLHttpRequest. The requests seem fine (do include cookies) but the response I get seems to be the one I get when the site any receiving cookie.\n\nmanifest.json\n\n{\n \"manifest_version\": 2,\n\n \"name\": \"Getting started example\",\n \"description\": \"This extension shows a Google Image search result for the current page\",\n \"version\": \"1.0\",\n\n \"browser_action\": {\n \"default_icon\": \"icon.png\",\n \"default_popup\": \"popup.html\"\n },\n\n \"permissions\": [\n \"activeTab\",\n \"cookies\",\n \"https://sitedomain.com/*\",\n \"http://sitedomain.com/*\",\n \"https://www.sitedomain.com/*\",\n \"http://www.sitedomain.com/*\"\n ]\n}\n\n\nThe code I use (request version):\n\nvar request = require('request');\nrequest = request.defaults({jar: true});\n\nvar jar = request.jar();\nvar cookie1 = request.cookie('cookie1=value1');\nvar cookie2 = request.cookie('cookie2=value2');\nvar cookie3 = request.cookie('cookie3=value3');\nvar cookie4 = request.cookie('cookie4=value4');\nvar cookie5 = request.cookie('cookie5=value5');\nvar cookie6 = request.cookie('cookie6=value6');\n\nvar url = \"http://www.sitedomain.com\";\njar.setCookie(cookie1, url);\njar.setCookie(cookie2, url);\njar.setCookie(cookie3, url);\njar.setCookie(cookie4, url);\njar.setCookie(cookie5, url);\njar.setCookie(cookie6, url);\n\nrequest({uri: http://www.sitedomain.com/product_info.php?products_id=350799, jar: jar}, function (error, response, html) {\n if (!error && response.statusCode == 200) {\n //breakpoint here and we did not receive the page after login\n }\n}\n\n\nAny help would be appreciated."
] | [
"cookies",
"google-chrome-extension",
"request",
"xmlhttprequest"
] |
[
"Variable exported from a module not accesible inside function of class in angular",
"I have a file (service file) in angular.I am exporting a variable from it and using it in other file(component.ts).\n\nWhen i am accessing its value outside the class ,it is working fine ,but when I am using it inside any function declare inside component class ,it is showing variable not defined.\n\nIn angular every module have its own scope ,and ts file converted into js and classes into function.\nSo according to my understanding of javascript,variable outside of function should be available.\nBut when i assign it to some declared variable outside the class it is working. \n\nWhere am i lacking to understand this behaviour?\n\n import {UserService ,b} from './services/user.service';\n console.log(b);// working\n //var t=b; working\n\n @Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n styleUrls: ['./app.component.css'],\n providers:[UserService]\n })\n export class AppComponent implements DoCheck , AfterContentInit,AfterContentChecked {\n title = 'project';\n a:any=\"joshi\";\n constructor(private vc: ViewContainerRef ,private user:UserService){\n console.log(\"parent constr\")\n\n }\n update(){\n //t=\"changed\"; working\n b=\"changed\" //not working\n this.user.setObservable();\n\n }\n}"
] | [
"javascript",
"angular",
"typescript",
"import",
"module"
] |
[
"Making it so a custom dialog pops up on notification icon click",
"I'm trying to make it so a custom dialog box pops up each time that I click my apps notification icon on the status bar. But I can't get it to work. Here's my notification icon code. I also don't want it to return to the main activity every time I click it.\n NotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);\n Notification notification=new Notification(R.smiley_face, "Lala", System.currentTimeMillis());\n Context context=MainActivity.this;\n PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), Notification.FLAG_ONGOING_EVENT); \n notification.flags = Notification.FLAG_ONGOING_EVENT;\n notification.setLatestEventInfo(this, "Smiley", "Touch for more options", contentIntent);\n Intent intent=new Intent(context,MainActivity.class);\n PendingIntent pending=PendingIntent.getActivity(context, 0, intent, 0);\n nm.notify(0, notification);\n\nAnd here is the custom dialog code. I've tried putting it in the notification icon code but it doesn't work.\n CustomDialogClass cdd = new CustomDialogClass(MainActivity.this);\n cdd.show();\n\n\nSolved\nWhat I ended up doing was just making the customdialog into a transparent activity and then starting it up as an intent."
] | [
"android",
"dialog",
"notifications",
"android-alertdialog",
"notificationmanager"
] |
[
"can i use DefaultRouter with CreateAPIView in django rest?",
"when I try to add my CreateAPIView to router.register it rise TypeError exception: \n\n File \"/home/denys/.virtualenvs/buddha_test/lib/python3.5/site-packages/rest_framework/routers.py\", line 281, in get_urls\n view = viewset.as_view(mapping, **route.initkwargs)\nTypeError: as_view() takes 1 positional argument but 2 were given\n\n\nBut if I add url directly to urlpatterns it works!\nThe resone is that I whant to see link in API Root:\n\nenter image description here\n\nSo quation is can I write something like this:\n\nurls.py\n\nfrom django.conf.urls import url, include\nfrom . import views\nfrom rest_framework import routers\n\nrouter = routers.DefaultRouter()\nrouter.register(r'clients-list', views.ClientList)\nrouter.register(r'managers-list', views.ManagerList)\nrouter.register(r'clients', views.CleintCreate, base_name='create')\n\n\nurlpatterns = [\n url(r'^', include(router.urls)),\n\n]\n\n\nviews.py\n\nfrom .models import Client, Manager\nfrom .serializers import ClientSerializer, ManagerSerializer\nfrom rest_framework import generics\nfrom rest_framework import viewsets\nfrom rest_framework.permissions import IsAuthenticated, AllowAny\nfrom rest_framework.generics import CreateAPIView\nfrom rest_framework.decorators import detail_route\n\nclass ClientList(viewsets.ModelViewSet):\n\n permission_classes = (IsAuthenticated, )\n\n queryset = Client.objects.all()\n serializer_class = ClientSerializer\n\n\nclass ManagerList(viewsets.ReadOnlyModelViewSet):\n\n permission_classes = (IsAuthenticated, )\n# \n queryset = Manager.objects.all()\n serializer_class = ManagerSerializer\n\n\nclass CleintCreate(CreateAPIView):\n\n model = Client\n serializer_class = ClientSerializer\n permission_classes = (AllowAny,)"
] | [
"django",
"django-rest-framework"
] |
[
"Bootstrap col-xs wrapping",
"I was testing out the col-xs to prevent stacking on smaller devices stated as follows:\n\n\n Don't want your columns to simply stack in smaller devices? Use the\n extra small and medium device grid classes by adding .col-xs-*\n .col-md-* to your columns.\n\n\nSo I did the following:\n\n<div class='container'>\n <div class='row'>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n <div class=\"col-xs-1\">.col-xs-1</div>\n </div>\n</div>\n\n\nAnd got the following:\n\n\n\n\n\nAny reason why this is happening and how to fix this?"
] | [
"css",
"twitter-bootstrap"
] |
[
"Compare two MySQL tables to filter results",
"I have a MySQL database with the following structure:\n\nTable1\n\n\nUniqueID (int) (PrimaryKey & AutoIncrement)\nTitleID (varchar) \nDescriptionID (varchar)\nContentRating (varchar)\n\n\nTable2\n\n\nUID (int) (PrimaryKey & AutoIncrement)\nActivity (varchar)\nContentLimit (varchar)\n\n\nWhat I want to do is take the value from ContentLimit (in Table2) and compare it against (ContentRating) in Table1, if they match then show all the rows that match. I'm using PHP and MySQL to achieve this.\n\nBelow is an Example:\n\nTable1\n\nUniqueID | TitleID | DescriptionID | ContentRating\n------------------------------------------------------\n1 | Hello | I Am Text | Universal\n2 | Again | Yet More Text | Universal\n3 | This | Yet More Text | Universal\n4 | Is | Yet More Text | Parental Guidance\n5 | Some | Yet More Text | Universal\n6 | Dummy | Yet More Text | Parental Guidance\n7 | Text | Yet More Text | Parental Guidance\n8 | I | Yet More Text | Parental Guidance\n9 | Think | Yet More Text | Parental Guidance\n\n\nTable2 \n\nUID | Name | Activity | ContentLimit\n---------------------------------------------\n1 | John Smith | IsActive | Universal\n2 | Jane Smith | IsActive | Universal\n3 | Felix Tiger | IsActive | Parental Guidance\n4 | Spring Load | InActive | Universal\n\n\nIf \"Felix Tiger\" was logged in then he would be able to see anything submitted with a \"Parental Guidance\" rating as well as anything with a \"Universal\" Rating.\n\nBut If \"Jane Smith\" was logged in then she would only be able to view anything submitted with a \"Universal\" rating\n\nI apologise if I am unclear and will make clear anything that may be mis-read or hard to understand.\n\nThank you in advance for any help given."
] | [
"php",
"mysql",
"comparison"
] |
[
"Difficulties using AJAX with the play framework",
"I have the following code in my scala.html file\n\n@(supports: List[Champion])\n\n<div id=\"supports\" class=\"champWrap\">\[email protected] { champion =>\n <a href=\"@routes.Application.champion(champion.getStringId)\">\n <div class=\"icon-wrap\">\n <img src=\"@routes.Assets.at(champion.getIcon)\" alt=\"@champion.getName\" title=\"@champion.getName\"/>\n <p>@champion.getWinm%</p>\n </div>\n </a>\n}\n</div>\n\n\nSo at the moment I am gathering a List from the Database in the Controller and sending it to the template when it is rendered.\n\nWhat I want to change:\n\nI want to have a control option within the page which changes the parameters which are used to gather the list. So after changing the control option, the list has to be gathered with different paramters and the part of the page, which iterates through the list has to be reloaded, also this setting has to be stored, f.ex. if the page is reloaded.\n\nI know that I have to do this with AJAX also have I read in the documentation that something like this is possible in Play:\n\nGET /hotels/list Hotels.list\n\n\nbut I can't quite figure out how I should do this, since I havn`t used Ajax with play before, also could I need some tips on how I should store the setting. I am thinking about doing it with a cookie, is this the right approach?\n\nI would appreciate if somebody could give me some help"
] | [
"jquery",
"ajax",
"scala",
"playframework",
"playframework-2.0"
] |
[
"Can't display the outputs of a MATLAB Function block in Simulink",
"I have a very simple MATLAB Function block in Simulink where I assign 2 input constants to 2 outputs (x1 to y1 and x2 to y2). Simulink runs without any complaints, however, I cannot see the constants on the displays I have connected to the block outputs (the displays constantly show 0). Any idea what I am missing here?\n\n\n\nfunction [y1,y2] = fcn(x1, x2)\n\nwhile true\n y1=x1\n y2=x2\nend\n\n\nUpdate: I have also used the Data Inspector to inspect the 2 outputs of the function block and it also reported a value of 0 for both."
] | [
"matlab",
"function",
"simulink",
"display"
] |
[
"Two different outputs of the same array",
"I have a question about some odd behaviour with my program.\nI have two arrays data and ind_array. Both arrays are initialized in main function. ind_array is filled with some values and data is filled with values using function loadData().\nBut output of the program depends on where I print values of data array. Before inputting values to ind_array or after.\nLook at the first tree numbers of output.\nThanks in advance.\nCode\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n\n#define FILE_NAME "DataValues.csv"\n#define NUM_ROWS 40\n#define NUM_COLUMS 2\n#define COMA " ,"\n\nvoid loadData(double (*data)[2]){\n\n //double data[NUM_ROWS][NUM_COLUMS];\n FILE* data_file = fopen(FILE_NAME, "r");\n char line[NUM_ROWS];\n int i = 0;\n\n while(fgets(line, sizeof(line), data_file)){\n char* tok = strtok(line, COMA);\n int j = 0;\n while(tok != NULL){\n\n char *ptr;\n data[i][j] = atof(tok); //const char to double\n tok = strtok(NULL, COMA);\n\n j++;\n }\n i++;\n }\n} \n\nint main(){\n double data[NUM_ROWS][NUM_COLUMS];\n double ind_array[0][5];\n loadData(data);\n for(int j = 0; j < NUM_ROWS; j++){\n printf(" %f\\n", data[j][0]);\n }\n printf("\\n");\n ind_array[0][0] = 2;\n ind_array[0][1] = 5;\n ind_array[0][2] = 0;\n ind_array[0][3] = 3;\n ind_array[0][4] = 0;\n for(int j = 0; j < NUM_ROWS; j++){\n printf(" %f\\n", data[j][0]);\n }\nreturn 0;\n}\n\nOutput\n 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000\n 9.000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000\n 16.000000 17.000000 18.000000 19.000000 20.000000 21.000000 22.000000\n 23.000000 24.00000025.000000 26.000000 27.000000 28.000000 29.000000\n 30.000000 31.000000 32.000000 33.000000 34.000000 35.000000 36.000000\n 37.000000 38.000000 39.000000 40.000000\n\n 2.000000 0.000000 0.000000 4.000000 5.000000 6.000000 7.000000\n 8.000000 9.000000 10.000000 11.000000 12.000000 13.000000 14.000000\n 15.000000 16.000000 17.000000 18.000000 19.000000 20.000000 21.000000\n 22.000000 23.000000 24.000000 25.000000 26.000000 27.000000 28.000000\n 29.000000 30.000000 31.000000 32.000000 33.000000 34.000000 35.000000\n 36.000000 37.000000 38.000000 39.000000 40.000000"
] | [
"arrays",
"c"
] |
[
"Wordpress - How to create custom post template",
"I'm developing a website with wordpress and I'm using underscores starter theme.\nI have 2 different categories and I need to create single templates for each one.\n\nI'm having problems with that because wordpress doesn't assume my custom single templates and I don't understand why.\n\nI already tried to put the single template in root theme directory, tried single-cat-categoryname.php or just single-categoryname.php, create a folder single but nothing works.\n\nHow can I create custom single posts templates with underscores?\n\nThank you"
] | [
"php",
"wordpress",
"underscores-wp"
] |
[
"How can I broadcast asyncio StreamReader to several consumers?",
"I'm trying to use aiohttp to make a sort of advanced reverse proxy.\n\nI want to get content of HTTP request and pass it to new HTTP request without pulling it to memory. While there is the only upstream the task is fairly easy: aiohttp server returns request content as StreamReader and aiohttp client can accept StreamReader as request body.\n\nThe problem is that I want to send origin request to several upstreams or, for example, simultaneously send content to upstream and write it on disk.\n\nIs there some instruments to broadcast content of StreamReader?\n\nI've tried to make some naive broadcaster but it fails on large objects. What do I do wrong?\n\nclass StreamBroadcast:\n async def __do_broadcast(self):\n while True:\n chunk = await self.__source.read(self.__n)\n if not chunk:\n break\n for output in self.__sinks:\n output.feed_data(chunk)\n for output in self.__sinks:\n output.feed_eof()\n\n def __init__(self, source: StreamReader, sinks_count: int, n: int = -1):\n self.__source = source\n self.__n = n\n self.__sinks = [StreamReader() for i in range(sinks_count)]\n self.__task = asyncio.create_task(self.__do_broadcast())\n\n @property\n def sinks(self) -> Iterable[StreamReader]:\n return self.__sinks\n\n @property\n def ready(self) -> Task:\n return self.__task"
] | [
"python",
"python-asyncio",
"aiohttp"
] |
[
"Create Data Studio Report Table with Date and Time Column from Unix Time in Big Query",
"I have IOT data with a Unix time. I need to show this to the second in a Data Studio table report. Cannot make this work. In the PubSub function I have:\n\n d = new Date();\nd.setTime(res[0] * 1000); // 1000 is for JS time\nconsole.log( d.toISOString());\n\n\nand later set the field with:\n\ntimestamp:d.toISOString(),\n\n\nUsing BigQuery the table shows the field as:\n\n2018-07-06 23:44:49 UTC\n\n\nwhich is correct. The 'timestamp' field in Data Studio appears in the table as just:\n\nJuly 6, 2018\n\n\nI need to get more resolution, down to the second, for the table and eventually graphs. I've tried custom queries for the data source but cannot get Data Studio to show better resolution.\n\nI tried creating a new field using TODATE(timestamp, 'RFC_3339', \"%Y%m%d%H\") but cannot that also just shows the July 7, 2018 format. Cannot get it to go to greater resolution. \n\nYes, I've tried all the other approaches suggested in other questions but none match what I am trying, or they don't succeed."
] | [
"unix-timestamp",
"google-data-studio"
] |
[
"NDB cluster7.5(MySQL 5.7) is taking more time in fetching data, if number of rows in table is large(2 million)",
"I am trying to setup NDB cluster(MYsql 5.7) for one of my real time application(with a high volume of read and write concurrency).\n\nMy Setup -\n\n3 Data Nodes\n1 Management Node\n1 MySQL node \n\nAll nodes are of amazon EC2 r3.4xlarge type.\nOS - centos 7\n\ni created one table and partioned by primary key to make sure same primary key data goes in single node.\n\nTable Schema -\nCREATE TABLE ContactsAgentContacts(\n uniqueid integer not null,\n did varchar(32) not null,\n nId varchar(50),\n companyname varchar(50),\nprimary key (uniqueid,did)\n) \n\n\nENGINE=NDBCLUSTER\nPARTITION BY KEY(did);\n\nNow i populated my table with 2 million of record in such a way that Each did contains 1K record.\n\nQuery Fired - SELECT DISTINCT ContactsAgentContacts.companyname AS 'fullname' from ContactsAgentContacts where did='xyz';\n\nperformance getting -\n\nwith single concurrency - \nfetching 1k record of one did \n\n**with 1 read concurrency - 800 ms\nwith 25 read concurrency - 1.5 sec\nwith 50 read concurrency - 3 sec**\n\n\nAs i am trying to develop a real time system any value more then 300 ms is too much for me and this time is increaasing as number of rows are increasing in table.\nPlease let me know how to optimize my solution.\n\nMy configiration .\nconfig.ini\n\n[tcp default]\nSendBufferMemory=2M\nReceiveBufferMemory=2M\n\n[ndb_mgmd default]\n# Directory for MGM node log files\nDataDir=/var/lib/mysql-cluster\n\n[ndb_mgmd]\n#Management Node db1\nHostName=10.2.25.129\nNodeId=1\n\n[ndbd default]\nNoOfReplicas=1\nDataMemory=2000M\nIndexMemory=300M\nLockPagesInMainMemory=1\n#Directory for Data Node\nDataDir=/var/lib/mysql-cluster\nNoOfFragmentLogFiles=300\nMaxNoOfConcurrentOperations=100000\nSchedulerSpinTimer=400\nSchedulerExecutionTimer=100\nRealTimeScheduler=1\nTimeBetweenGlobalCheckpoints=1000\nTimeBetweenEpochs=200\nRedoBuffer=32M\n\n[ndbd]\n#Data Node db2\nHostName=10.2.18.81\nNodeId=2\n#LockExecuteThreadToCPU=1\nLockMaintThreadsToCPU=0\n\n[ndbd]\n#Data Node db3\nHostName=10.2.20.15\nNodeId=3\n#LockExecuteThreadToCPU=1\nLockMaintThreadsToCPU=0\n\n[ndbd]\n#Data Node db4\nHostName=10.2.24.28\nNodeId=4\n#LockExecuteThreadToCPU=1\nLockMaintThreadsToCPU=0\n\n[mysqld]\n#SQL Node db5\nHostName=10.2.29.42\nNodeId=5"
] | [
"mysql",
"database",
"distributed-computing",
"rdbms",
"mysql-cluster"
] |
[
"How to add TextView and EditText using default AlertDialog programmatically",
"I've been trying to add two elements in a default AlertDialog but I can't seem to make it work. Here's my code:\n\n// START Dialog\n AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);\n\n TextView tv = new TextView(this);\n tv.setText(title);\n tv.setPadding(40, 40, 40, 40);\n tv.setGravity(Gravity.CENTER);\n tv.setTextSize(20);\n\n EditText et = new EditText(this);\n etStr = et.getText().toString();\n\n alertDialogBuilder.setView(et);\n alertDialogBuilder.setTitle(title);\n alertDialogBuilder.setMessage(\"Input Student ID\");\n alertDialogBuilder.setCustomTitle(tv);\n\n if (isError)\n alertDialogBuilder.setIcon(R.drawable.icon_warning);\n // alertDialogBuilder.setMessage(message);\n alertDialogBuilder.setCancelable(false);\n\n // Setting Negative \"Cancel\" Button\n alertDialogBuilder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int whichButton) {\n dialog.cancel();\n }\n });\n\n // Setting Positive \"Yes\" Button\n alertDialogBuilder.setPositiveButton(\"OK\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n if (isError)\n finish();\n else {\n Intent intent = new Intent(\n ChangeDeviceActivity.this,\n MyPageActivity.class);\n startActivity(intent);\n }\n }\n });\n\n AlertDialog alertDialog = alertDialogBuilder.create();\n\n try {\n alertDialog.show();\n } catch (Exception e) {\n // WindowManager$BadTokenException will be caught and the app would\n // not display the 'Force Close' message\n e.printStackTrace();\n }\n\n\nFor now, this is only an EditText with a message set by alertDialogBuilder.setMessage(\"Input Student ID\"); but I want to make this a TextView so I can center-justify it. How do I do this?"
] | [
"android",
"android-edittext",
"textview",
"android-alertdialog",
"android-dialog"
] |
[
"Eliminating duplicate items in an Azure functions workflow?",
"I have a function app that monitors swappa.com and sends an SMS if there's a phone listing that matches my criteria. A timer trigger function checks swappa every 15 minutes, and a queue trigger function sends a text message for each matching listing. I use bindings exclusively to access storage and twilio to keep things extra \"functiony\".\n\nWhat's the best function pattern to maintain state and avoid sending duplicate text messages about the same listings? Even if I can check the age of listings, the price can be lowered on older listings, making them a new match. So I need to track individual listings already processed."
] | [
"azure",
"binding",
"duplicates",
"azure-functions"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.