texts
sequence
tags
sequence
[ "Deploy Coldfusion to Heroku", "Is there any way to deploy a Coldfusion app to Heroku using Windows or Mac? I just found the following way, but unfortunately it's already deprecated.\n\nAny idea would help me a lot!\n\nRegards" ]
[ "heroku", "coldfusion" ]
[ "How to get original image name from Microsoft Custom Vision API?", "I'm unsure how to associate the tagged regions with my original image file names.\n\nFollowing the Custom Vision API documentation for GetTaggedImages request, I'm able to get a response with information about iteration id, created date, width, tagged regions, etc. However, there's no mention of the original image name. \n\nIf it's not possible to associate the original file name with the tagged regions, then I'll have to do my labeling offline (LabelImg for instance) and use the API to upload the tagged images - not the workflow I'm hoping for.\n\nThanks for any insights!" ]
[ "microsoft-custom-vision" ]
[ "small size scrollbar not able to Drag more content in Ubuntu chrome", "here more line text available inside the box. but not able to drag. only able to inside mouse scroll or click arrow. not able to drag the scroll bar. \n\nthis work fine in windows system. this issue only in ubuntu browsers." ]
[ "html", "css" ]
[ "How does a client share a secret with an Intel SGX enclave instance, without letting the server hosting the enclave knowing it?", "I am aware that there are SSL libraries available for SGX. But How to establish a secret between the SGX and the clients without letting the host knows it? Trivial methods fail, like: \n\nHave a public-private key pair built-in the SGX, then the client sends the session key to the SGX. The session key is encrypted by the public key of SGX. \n\nThis doesn't work because the host can get the private key directly from the compiled SGX enclave executable.\n\nRunning an https server in the SGX can neither do the trick, also because there is no authentication nor pre-shared secret between the SGX and clients." ]
[ "security", "encryption", "intel", "sgx", "enclave" ]
[ "Unable to open SSIS dtproj in Visual Studio 2015", "Visual Studio 2015, latest SQL Server Data Tools (16.5) and Dac Framework (16.5) from here and SQL Server 2014. \n\nWhen opening a solution containing the project, the project fails to open with \"invalid project\" error message in a popup. The details given are:\n\n===================================\n\nInvalid project. (Microsoft Visual Studio)\n\n------------------------------\nProgram Location:\n\n at Microsoft.SqlServer.Dts.Runtime.Project.OpenProject(IProjectStorage storage, String projectPassword, IDTSEvents events)\n at Microsoft.DataTransformationServices.Project.DataTransformationsProjectLoader.<>c__DisplayClass1.<LoadProject>b__0(String password, IDTSEvents events)\n at Microsoft.DataTransformationServices.Controls.ProjectProtectionUtils.LoadProjectWithPassword(Boolean askedPasswordOnce, ProjectLoader loader, IWin32Window dialogParent, String& password, ProjectProtectionEvents errorListener)\n at Microsoft.DataTransformationServices.Project.DataTransformationsProjectLoader.LoadProject(XmlNode manifestNode, String& projectPassword, ProjectProtectionEvents errorListener)\n at Microsoft.DataTransformationServices.Project.DataTransformationsProjectLoader.DeserializeManifestInProjectMode(XmlNode manifestNode)\n at Microsoft.DataTransformationServices.Project.DataTransformationsProjectLoader.ConstructProjectHierarchyFrom(ProjectSerialization projectSerialization)\n at Microsoft.DataTransformationServices.Project.DataTransformationsProjectLoader.Deserialize(TextReader reader)\n at Microsoft.DataWarehouse.VsIntegration.Shell.Project.Serialization.BaseProjectLoader.Load(IFileProjectHierarchy projectHierarchy)\n at Microsoft.DataWarehouse.VsIntegration.Shell.Project.FileProjectHierarchy.Load(String pszFilename, UInt32 grfMode, Int32 iReadOnly)\n\n\nThe dtproj file has targeting ProductVersion 13.0.1400.361 (is that right?) and each project configuration (Debug/Release) has TargetServerVersion SQLServer2014\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <DeploymentModel>Project</DeploymentModel>\n <ProductVersion>13.0.1400.361</ProductVersion>\n <SchemaVersion>9.0.1.0</SchemaVersion>\n <!-- \n etc... \n -->\n<Configurations>\n <Configuration>\n <Name>Debug</Name>\n <Options>\n <OutputPath>bin</OutputPath>\n <ConnectionMappings />\n <ConnectionProviderMappings />\n <ConnectionSecurityMappings />\n <DatabaseStorageLocations />\n <TargetServerVersion>SQLServer2014</TargetServerVersion>\n <ParameterConfigurationValues>\n\n\nI'm at a loss how to debug this further - I've upgraded every package and component I can think of. Any ideas what to do next?" ]
[ "visual-studio-2015", "ssis", "sql-server-2014", "sql-server-data-tools" ]
[ "How to reverse the Y axis range in dygraphs (R - shiny)?", "I am trying to reverse the Y axis scale in dygraphs embedded in a shiny app.\n\nMy code - \n\n output$rainintensity <- renderDygraph({\n withProgress(message = 'Loading graphs',{\n dygraph(rain_data(), group = \"sync\") %>%\n dyAxis(\"y\", \"Rainfall intensity (Inches/Hr)\", valueRange = c(NULL, 0)) %>%\n dySeries(input$rainguage,label=\"Rainfall intensity (Inches/Hr)\") %>%\n dyOptions(includeZero = TRUE, retainDateWindow = TRUE, colors = \"blue\", plotter = \n \"function barChartPlotter(e) {\n var ctx = e.drawingContext;\n var points = e.points;\n var y_bottom = e.dygraph.toDomYCoord(0); // see http://dygraphs.com/jsdoc/symbols/Dygraph.html#toDomYCoord\n\n // This should really be based on the minimum gap\n var bar_width = 2/3 * (points[1].canvasx - points[0].canvasx);\n ctx.fillStyle = e.color;\n\n // Do the actual plotting.\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n var center_x = p.canvasx; // center of the bar\n\n ctx.fillRect(center_x - bar_width / 2, p.canvasy,\n bar_width, y_bottom - p.canvasy);\n ctx.strokeRect(center_x - bar_width / 2, p.canvasy,\n bar_width, y_bottom - p.canvasy);\n }\n }\")\n })\n })\n\n\nI get the following output graph -\n\n\n\nIt works when I set a definite valueRange as following:\n\noutput$rainintensity <- renderDygraph({\n withProgress(message = 'Loading graphs',{\n dygraph(rain_data(), group = \"sync\") %>%\n dyAxis(\"y\", \"Rainfall intensity (Inches/Hr)\", valueRange = c(1, 0)) %>%\n dySeries(input$rainguage,label=\"Rainfall intensity (Inches/Hr)\") %>%\n dyOptions(includeZero = TRUE, retainDateWindow = TRUE, colors = \"blue\", plotter = \n \"function barChartPlotter(e) {\n var ctx = e.drawingContext;\n var points = e.points;\n var y_bottom = e.dygraph.toDomYCoord(0); // see http://dygraphs.com/jsdoc/symbols/Dygraph.html#toDomYCoord\n\n // This should really be based on the minimum gap\n var bar_width = 2/3 * (points[1].canvasx - points[0].canvasx);\n ctx.fillStyle = e.color;\n\n // Do the actual plotting.\n for (var i = 0; i < points.length; i++) {\n var p = points[i];\n var center_x = p.canvasx; // center of the bar\n\n ctx.fillRect(center_x - bar_width / 2, p.canvasy,\n bar_width, y_bottom - p.canvasy);\n ctx.strokeRect(center_x - bar_width / 2, p.canvasy,\n bar_width, y_bottom - p.canvasy);\n }\n }\")\n })\n })\n\n\nResult -\n\n\n\nIs there any way I can reverse the Y axis range without setting a definite valueRange on the Y axis?\n\nI tried giving a reactive upper bound in the valueRange based on zooming. sort of like this - valueRange = c(max(react_rain_data()*1.10, na.rm = TRUE), 0) but it re renders the graphs every time the user zooms in.\n\nNote - According to the documentation for dyAxis fucnction :\n\n\n valueRange: Explicitly set the vertical range of the graph to c(low, high). This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. c(NULL, 30) to automatically calculate just the lower bound).\n\n\nThanks!" ]
[ "r", "plot", "shiny", "dygraphs" ]
[ "displaying comma in csv file using php", "I have name,address and images stored in my database.on clicking \"GENERATE EXCEL\" button a .csv file will be generated.I am using comma as a separator.\n\nmy actual o/p should be like this:\n\nname address images\n\npeter \"house no#2\",uk img1.png,img2.png,img3.png\n\n\nbut currently i am getting the values with comma in different columns.how can i do this? please help.\n\nthis is my code fetching the values from the database:\n\n $sep = \",\";\n $csv_hdr = \"Name\".$sep.\"Address\".$sep.\"Images\";\n $csv_output=\"\"; \n for($i=$start;$i<$match;$i++)\n {\n $csv_output .=$ARRAY[$i]['source_name'].$sep;\n $i_add=str_replace('\"',\"\",$ARRAY[$i]['source_address']);\n $csv_output.=$ARRAY[$i]['source_address'].$sep;\n $csv_output.=$ARRAY[$i]['source_img'].\"\\n\";\n }\n\n\nthis is my 'GENERATE_EXCEL' button with 2 hidden fields csv header and data.\n\n<div id=\"btnexcel\">\n <input type=\"submit\" name=\"Generate Excel\" value=\"Generate Excel\" id=\"btnreport\" formaction=\"export_to_excel.php\"/></div>\n <input type=\"hidden\" value=\"<?php echo $csv_hdr; ?>\" name=\"csv_hdr\">\n <input type=\"hidden\" value=\"<?php echo $csv_output; ?>\" name=\"csv_output\">\n\n\nthis is my export_to_excel.php:\n\n<?php\n\n$out = '';\n $filename_prefix = 'csv';\n if (isset($_GET['csv_hdr'])) {\n $out .= $_GET['csv_hdr'];\n $out .= \"\\n\";\n}\n\nif (isset($_GET['csv_output'])) {\n$out .= $_GET['csv_output'];\n}\n$filename = $filename_prefix.\"_\".date(\"Y-m-d_H-i\",time());\n\n//Generate the CSV file header\nheader(\"Content-type: application/vnd.ms-excel\");\nheader(\"Content-Encoding: UTF-8\");\nheader(\"Content-type: text/csv; charset=UTF-8\");\nheader(\"Content-disposition: csv\" . date(\"Y-m-d\") . \".csv\");\nheader(\"Content-disposition: filename=\".$filename.\".csv\");\necho \"\\xEF\\xBB\\xBF\"; // UTF-8 BOM\n//Print the contents of out to the generated file.\nprint $out;\n\n//Exit the script\nexit;\n?>" ]
[ "php", "csv" ]
[ "Need clarity on Camel Timer component timely processing", "In Apache Camel, I have configured the timer component to fire the job for every 15 mins. Suppose if any job which is taken more than 15 mins due to data load to complete it task, will it be affected by the next job since we have configured to run job for every 15 mins." ]
[ "java", "apache-camel", "spring-camel" ]
[ "d3.js and dashcode: anyone tried and won?", "I'd like to build OSX widgets to rapidly prototype streaming-data-based viz dashboard components. I'd like to use d3.js to do that displaying, but the most basic things I try get stuck with errors I have no ability / patience to parse.\n\nBefore I start wasting time on this, I was wondering if anyone's already trod this ground and won or lost? If you won, how did you do it? If you lost, did you understand why?" ]
[ "macos", "d3.js", "dashcode" ]
[ "Sort Meteor Collection First By Specific Value", "I am building an application where I want to filter a returned collection based on a specific name, where the current Meteor.user().username always shows first in the returned list. I want to do something like this:\n\n Lists.find({}, {sort : {user: Meteor.user().username}});" ]
[ "javascript", "mongodb", "meteor" ]
[ "Cross-domain bypass?", "I am currently trying to obtain this JSON array from\n\nhttp://d.yimg.com/aq/autoc?query=goo&region=US&lang=en-US\n\nHowever, which ever I use, it does not seem to work.\n\nUsing\n\n$.ajax({\n type: 'GET',\n url: 'http://d.yimg.com/aq/autoc?query=goo&region=US&lang=en-US',\n cache : false,\n dataType : 'json',\n success: function(data){\n alert('got it!');\n }\n\n}\n\n\nAnd also tried \n\n$.getJSON(\"http://d.yimg.com/aq/autoc?query=goo&region=US&lang=en-US, function(data) {\n });\n\n\nAs well as looking into a bypass for cross domain, and I tried using a proxy, not did not work, Maybe I am implementing it wrong? I can not seem to properly obtain the data (nothing return to data).\n\nEDITED\n\nI used this bypass php proxy to try and bypass the missing CORS and JSONP, and it does not seem to return the data correctly either (I followed an example). The php is within my directory.\n\n$(document).ready(function() {\n $(\"#tickBox\").on(\"input\", function(e) {\n 'use strict';\n var tick = document.getElementById(\"tickBox\").value;\n $.ajax({\n type: 'GET',\n url: 'http://d.yimg.com/aq/autoc?query=goo&region=US&lang=en-US',\n crossOrigin : true,\n //dataType : 'json',\n context: {},\n success: function(data){\n alert(data.ResultSet.Result[0].name);\n }\n });\n });\n});" ]
[ "javascript", "json" ]
[ "Export 2D javascript array to Excel sheet", "I know, there are hundreds of questions on this topic on here, but I still could not find satisfactory answers after a day of searching:\n\nI have a 2D javascript array, which I want to download as an Excel sheet.\n\nHere is a fiddle with the code I got so far:\n\nhttps://jsfiddle.net/3an24jmw/7/\n\nThe download works, but there are several issues, which I could not solve after days of trying:\n\n\nAll items end up in the first column of the Excel sheet, because Excel interprets the \",\" separating the elements as part of the data. How can I separate the elements in a way Excel understands?\nThe file name is some cryptic code. How can I set the file name?\nThe downloaded file has a double .xls ending (.xls.xls). How can get a single .xls ending?\nExcel tells me every time the file could be corrupted or unsafe. How do I prevent this?\n\n\nAny help for any of these questions would be appreciated.\n\nexportToCsv = function() {\n var CsvString = \"\";\n Results.forEach(function(RowItem, RowIndex) {\n RowItem.forEach(function(ColItem, ColIndex) {\n CsvString += ColItem + ',';\n });\n\n CsvString += \"\\r\\n\";\n });\n\n window.open('data:application/vnd.ms-excel,' + encodeURIComponent(CsvString));\n}\n\n\nUPDATE \n\nI just found out by chance, that 1. 2. and 4. can be solved by replacing vnd.ms-excel with csv.\n\nThe file will not be .xls anymore, but the csv can be opened by Excel without problems and behaves like intended.\n\nOnly problem remaining is the file name!\n\nUPDATE 2 \n\nFinally after 2 full workdays of searching and trying, I found the solution, which I would like to share here, to help anybody with the same problem:\n\nSimply include an invisible <a> element, which defines the file an useful name using its download=\"somedata.csv\" attribute.\n\nHere is my final and fully functional fiddle:\n\nhttps://jsfiddle.net/3an24jmw/25/" ]
[ "javascript", "html", "excel", "export-to-excel", "window.open" ]
[ "Quiz system score php", "I was working on a quiz page where I need some assistance to count the marks.\n\n\n 1 Correct Answer = 1 mark\n \n 3 Wrong Answers = -1 mark \n \n Unanswered Answer = 0 mark\n\n\nI have code to count all answers as correct, wrong, or unanswered.\n\n$response = mysql_query(\"select qus_id, qus_cans from question where qus_id IN ($order) ORDER BY FIELD(qus_id,$order)\", $kpsctuts->connect) or die(mysql_error()); \nwhile($result=mysql_fetch_array($response)){\n if($result['qus_cans']==$_POST[$result['qus_id']])\n {\n $right_answer++;\n }\n else if($_POST[$result['qus_id']]==5)\n {\n $unanswered++;\n }\n else\n {\n $wrong_answer++;\n }\n // Enter Code Here\n}\n\n\nOutputting the marks:\n\n<p>Total no. of right answers : <span class=\"answer\"><?php echo $right_answer;?></span></p>\n<p>Total no. of wrong answers : <span class=\"answer\"><?php echo $wrong_answer;?></span></p>\n<p>Total no. of Unanswered Questions : <span class=\"answer\"><?php echo $unanswered;?></span></p>" ]
[ "php" ]
[ "programmatically passing FineUploader the location of the file to upload", "We have prototyped a client-side program that lets users select a local folder, creates a zip, then lets the local browser know about the zip file location via a local web socket. The intention is to then tell fineUploader about this new zip file location, so that it can immediately start the upload process.\n\nBut I'm not clear how to make this last part of the handoff. I just saw this post which sounds concerning.\n\nIs there any way? If not, how might we make an acceptable user experience given that the user has selected a dir, it has been zipped for them, and we want the fineUploader component to process the upload?\n\nThanks!\n\nStu" ]
[ "fine-uploader" ]
[ "HTML Showing 5 items in dropdown", "I am trying to show 5 items in dropdownlist and add a scroll bar after that records. I tried adding height etc to select and could not succeed. Even size property is not what I am looking for. Do we have any property to set height of dropdown list and add scroll after showing certain number of records?\n\ndropdown list \n\n<select>\n <option>1</option>\n <option>2</option>\n <option>3</option>\n <option>4</option>\n <option>5</option>\n <option>6</option>\n <option>1</option>\n <option>2</option>\n <option>3</option>\n <option>4</option>\n <option>5</option>\n <option>6</option>\n <option>1</option>\n <option>2</option>\n <option>3</option>\n <option>4</option>\n <option>5</option>\n <option>6</option>\n</select>" ]
[ "html", "css", "height", "html-select" ]
[ "Issue when compare a value in column with number", "I have a issue, i do not know this is bug or not, could you please help to analyze problem.\nMy table hs a column ‘contents’ with type ‘varchar’.\nwhen i insert value to this column (ex: xyz x#1, y, z can be any number) then i do query \n\n$this->find()->where([‘content >’ => ‘20’])->toArray();\n\n\nThe query will return xyz for me. that is my expectation.\nbut when i insert value like 1yz (y, z can be any number) then i do query \n\n$this->find()->where([‘content >’ => ‘20’])->toArray();\n\n\nThe query will return empty array.\nI have tried with many value like 123; 145; 134; 1678 but it returned same result.\nDo you had the same situation? please give me an advice.\nThank you very much.\n(Ps: i have tried with cakephp 3.6 and cakephp 1.2)" ]
[ "cakephp", "cakephp-3.0" ]
[ "HTML Language to highlight letters on a website", "Is it better to use strong or h1 to h6 to bring out the letters on a website? I have seen strong but was taught to use h1 through h6. What's the difference?" ]
[ "html" ]
[ "FreeRTOS vTaskDelayUntil() finishes immediately", "I have a problem with vTaskDelayUntil() function not making a delay but finishing immediately. Here is the code:\n\nTickType_t xLastWakeTime = xTaskGetTickCount();\nwhile(1){\n if (xSemaphoreTake(xSemaphoreRS485, portMAX_DELAY) == pdTRUE) {\n printf(\"S display data %d\\n\", xTaskGetTickCount());\n sendDisplayData();\n printf(\"E display data %d\\n\", xTaskGetTickCount());\n xSemaphoreGive(xSemaphoreRS485);\n printf(\"W display data %d\\n\", xLastWakeTime);\n vTaskDelayUntil(&xLastWakeTime, 2000);\n }\n}\n\n\nFrom this I get following output:\n\nS display data 29928\nE display data 30534\nW display data 3919\nS display data 30534\nE display data 31140\nW display data 5919\nS display data 31140\nE display data 31746\nW display data 7919\nS display data 31746\nE display data 32352\nW display data 9919\n\n\nThe function sendDisplayData() takes about 670 ms to execute and xTaskGetTickCount() confirms it. Then the task should wait around 1230 ms so the whole iteration could take 2000 ms. But vTaskDelayUntil() finishes immediately. First execution ended at 30534 and the second one starts at 30534 too. Value returned by xTaskGetTickCount() proves there was no delay introduced by vTaskDelayUntil(). I can also see it by frequency of output of sendDisplayData().\n\nThe second funny thing is that xLastWakeTime shows totally different values and those values are in fact incremented by 2000. Shouldn't it store similar value as returned by xTaskGetTickCount()?" ]
[ "c", "freertos", "stm32f4" ]
[ "Javascript. I can't change CSS of the timer", "I have a code of a simple timer. After I press the button, it calls a function (with 2 variables = id of the div where to place the timer after creation, and amount of seconds), that writes timer using innerHTML. I want to change style of the timer outside of HTML in a separate CSS file. But it doesn't work, even if I enclose timer code into div and call it's id in CSS.So so far I can chenge it only inside the function.\nWhy does it happening, and how can I solve this problem ?\n\n\r\n\r\n.button {\r\n display: inline-block;\r\n border-radius: 4px;\r\n background-color: #f4511e;\r\n border: none;\r\n color: #FFFFFF;\r\n text-align: center;\r\n font-size: 28px;\r\n padding: 20px;\r\n width: 200px;\r\n transition: all 0.5s;\r\n cursor: pointer;\r\n margin: 5px;\r\n}\r\n\r\n\r\n\r\n.button span {\r\n cursor: pointer;\r\n display: inline-block;\r\n position: relative;\r\n transition: 0.5s;\r\n}\r\n\r\n.button span:after {\r\n content: '»';\r\n position: absolute;\r\n opacity: 0;\r\n top: 0;\r\n right: -20px;\r\n transition: 0.5s;\r\n}\r\n\r\n.button:hover span {\r\n padding-right: 25px;\r\n}\r\n\r\n.button:hover span:after {\r\n opacity: 1;\r\n right: 0;\r\n\r\n \r\n<script>\r\n//Timer function\r\nfunction timer(tag,sec){ \r\ndocument.getElementById(tag).innerHTML= \"<div id= 'inTime'; style='color: #ffffff; border-radius: 5px; background-color: #f4511e; padding: 20px; text-align: center; position: fixed; width: 200px; '>\" + \r\n(sec / 60 >>0) + 'min ' + sec % 60 + 'sec' + '<br>' + \"</div>\";\r\n\r\n\r\n\r\nif ((sec / 60 >>0)!=0 || (sec % 60)!=0) {\r\nsetTimeout(function() { timer(tag, sec); },1000);\r\nsec -= 1;\r\n}\r\nelse {\r\ndocument.getElementById(tag).innerHTML= \"Time is over!\";}\r\n}\r\n\r\n</script> \r\n\r\n<div id=\"timerPlace\"></div> \r\n<br><br><br><br>\r\n<!-- Write number of seconds here: onclick=\"timer('str',...here!...) -->\r\n\r\n<button class=\"button\" onclick=\"timer('timerPlace',3600)\"> <span>Start Test</span> </button>\r\n<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>\r\n<!-- Place this div where you whant timer to be. -->\r\n\r\n\r\n\n\nHere are version with separate CSS (which isn't working)\n\n\r\n\r\n.button {\r\n display: inline-block;\r\n border-radius: 4px;\r\n background-color: #f4511e;\r\n border: none;\r\n color: #FFFFFF;\r\n text-align: center;\r\n font-size: 28px;\r\n padding: 20px;\r\n width: 200px;\r\n transition: all 0.5s;\r\n cursor: pointer;\r\n margin: 5px;\r\n}\r\n\r\n\r\n\r\n.button span {\r\n cursor: pointer;\r\n display: inline-block;\r\n position: relative;\r\n transition: 0.5s;\r\n}\r\n\r\n.button span:after {\r\n content: '»';\r\n position: absolute;\r\n opacity: 0;\r\n top: 0;\r\n right: -20px;\r\n transition: 0.5s;\r\n}\r\n\r\n.button:hover span {\r\n padding-right: 25px;\r\n}\r\n\r\n.button:hover span:after {\r\n opacity: 1;\r\n right: 0;\r\n\r\n #inTime {\r\n color: red;\r\n font-color: red;\r\n }\r\n<script>\r\n//Timer function\r\nfunction timer(tag,sec){ \r\ndocument.getElementById(tag).innerHTML= \"<div id= 'inTime';>\" + \r\n(sec / 60 >>0) + 'min ' + sec % 60 + 'sec' + '<br>' + \"</div>\";\r\n\r\n\r\n\r\nif ((sec / 60 >>0)!=0 || (sec % 60)!=0) {\r\nsetTimeout(function() { timer(tag, sec); },1000);\r\nsec -= 1;\r\n}\r\nelse {\r\ndocument.getElementById(tag).innerHTML= \"Time is over!\";}\r\n}\r\n\r\n</script> \r\n<!-- Place this div where you whant timer to be. -->\r\n<div id=\"timerPlace\"></div> \r\n<br><br><br><br>\r\n\r\n<!-- Write number of seconds here: onclick=\"timer('str',...here!...) -->\r\n<button class=\"button\" onclick=\"timer('timerPlace',3600)\"> <span>Start Test</span> </button>" ]
[ "javascript", "html", "css", "timer" ]
[ "Project dependency in Ant", "I have 2 projects \n\n\nA test project say A which has some test cases.\nA application project which is to be tested, say B\n\n\nNow, my test project A uses some of the resource files present in the application project B.\nI can build my project using eclipse by adding the B reference in java build path->Projects tab for the A project.\n\nNow i want to build the same project A using command line through Ant. What should I specify in the build.xml so that it refer the B project resource files.\n\nWhen I build the A project without any reference added in build.xml it gives me error \"symbols not found\" in the java files." ]
[ "ant" ]
[ "Plotting 2D Kernel Density Estimation with Python", "I would like to plot a 2D kernel density estimation. I find the seaborn package very useful here. However, after searching for a long time, I couldn't figure out how to make the y-axis and x-axis non-transparent. Also, how to show the values of the density on the contour? I would be very appreciated if someone could help me out. Below please see my code and graph. \n\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.pyplot as pl\n\nY = np.random.multivariate_normal((0, 0), [[0.8, 0.05], [0.05, 0.7]], 100)\nax = sns.kdeplot(Y, shade = True, cmap = \"PuBu\")\nax.patch.set_facecolor('white')\nax.collections[0].set_alpha(0)\nax.set_xlabel('$Y_1$', fontsize = 15)\nax.set_ylabel('$Y_0$', fontsize = 15)\npl.xlim(-3, 3)\npl.ylim(-3, 3)\npl.plot([-3, 3], [-3, 3], color = \"black\", linewidth = 1)\npl.show()" ]
[ "python", "matplotlib", "plot", "kernel", "seaborn" ]
[ "Django query: Sort objects by the number of occurrences of a value?", "I'm trying to use Django to return a list of objects with duplicate values, sorted from most-duplicated to least-duplicated.\n\nFor example, let's say I have the following model:\n\nclass Person(models.Model):\n id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)\n name = models.CharField(max_length=128)\n\n\nI want to return a list of Persons, sorted from those with the most common name to those with the least common name.\n\nI know that I can use values and annotate to create a sorted list of name values like this:\n\nPerson.values('name').annotate(Count('id')).order_by('id__count')\n\n\nBut I don't want a list of names; I want a list of Person objects. Is there a way to accomplish this?" ]
[ "django" ]
[ "Pagination in Oracle with dynamic query", "I have a query that returns large amount of data. When users search for data in larger date ranges It can come up to 5 millions records, and when that happens app freezes for certain amount of time.\n\nSo I decided to do a pagination of query result, but I'm trying to do that without any DB changes. Let me explain:\n\nI have a stored procedure for retrieving all data, with dynamic SQL. Input parameters are 3 :\n\n\nVarchar for number of Select case (to choose which select should be executed),\nand 2 other Varchar parameters that select fields and condition of query, in other words - one before FROM and one after WHERE clause. These two parameters matter in this question.\n\n\nIn example, my procedure for calling query looks like this:\n\n\n first_parameter || ' FROM (...here is my query where all possible fields are selected with joins, db links etc.... ) WHERE ' ||\n second_parameter\n\n\nSo, I can modify start and end of query, and now I would like to modify It to enable pagination too, for let's say max 1.000 records at a time.\n\nI have tried to modify It in C# by adding a rownum in first_parameter along with selected fields \n\n\n (Select rownum, field1,field2 etc...)\n\n\n, and using \n\n\n rownum < 1000 in a WHERE clause\n\n\n. This actually works, but for a pagination I would need also to tell what row for start and end, like \n\n\n WHERE rownum > 1000 AND rownum < 2000\n\n\n, but this doesn't work. \n\nHow can I do this in Oracle 11g, where OFFSET is not available, can somebody show me ? I would prefer a solution without changing query inside of parameters If possible, since I can send everything I want into both parameters in question from C# in code (Varchar values ofcourse).\n\nP.S. : I have never done a pagination so forgive me If I wrote some silly things ;)" ]
[ "oracle", "dynamic-sql" ]
[ "How to set custom rules like difficulty level for GameCenter to find match", "Need to set dynamically some rules of game and inform possible players (while GC searches for players/automatch) about those rules before the player connects. Lets say I want to host/start a game and i want to set some starting amount of betting units (10...1000), level of difficulty(0...10), scoring system (0..3) etc. I imagine this like a table with cells providing this information so player decides if he/she wants to join and play game with such rules. How to implement it?\nAFAIK GKMatch uses only min and max number of players while searches for players and thats all. I could provide such information in invite but I need it for other players who r looking for game by themselves, like browsing existing games including rules. My game doesn't allow to join players since game is started but I need somehow to fill needed amount of players for session. Like if I want to play with only one player I start a game with number of players=2 (and some custom rules) so I need the GC to help me to find opposite player. And that player should be informed about my rules set before joining me." ]
[ "iphone", "ios", "ipad", "game-center" ]
[ "Reduce file size with DotNetZip", "I want to backup my database using SMO and zip a backup file then upload it to my server. here is my code\n\n // Backup\n var conn = new SqlConnection(sqlConnectionString);\n var server = new Server(new ServerConnection(conn));\n var backupMgr = new Backup();\n backupMgr.Devices.AddDevice(file.FullName, DeviceType.File);\n backupMgr.Database = dictionary[StringKeys.Database];\n backupMgr.Action = BackupActionType.Database;\n backupMgr.SqlBackup(server);\n\n // Compress\n using (var zip = new ZipFile())\n {\n zipFile = string.Format(\"{0}\\\\{1}.zip\", directoryName, DateTime.Now.ToString(\"yyyyMMddHHmm\"));\n zip.AddFile(outputPath, \"\");\n\n zip.Save(zipFile);\n }\n\n // uploading code\n\n\nSize of a backup file can be more than 100MB. But after i zip this using above code, it doesn't reduce the size.\nSo I cannot upload larger zip files. Is there way to reduce the file size with DotNetZip?" ]
[ "c#", "asp.net", "compression", "smo", "dotnetzip" ]
[ "ViewModel that Observes another ViewModel", "I have a DAO that returns this:\n\n @Query(value = \"SELECT * FROM users\")\n fun getUsers(): LiveData<List<User>>\n\n\nI need to observe this and transform User objects into People objects. People does not implement or extend User, but I have a method that can convert them. This is a requirement I cannot change. \n\n fun convert(user: User): Person {...}\n\n\nThis is how I am trying to observe the data.\n\nclass UserViewModel : ViewModel {\n private lateinit var people: MutableLive<List<People>>\n\n init {\n db.getUsers().observe(this, Observer { userList ->\n if(userList != null)\n // here I need to do some sort of transformation.\n }\n }\n\n // what activity will observer\n fun getPeople() : MutableLive<List<People>> {\n return people\n }\n}\n\n\nSo I would love it if the Activity could observe the people: MutableLive<List<People>> and be unaware that this transformation is happening.\n\nPlease help." ]
[ "android", "kotlin", "android-livedata" ]
[ "VBA export PDF via ExportAsFixedFormat Type:=xlTypePDF", "I try to save an excel sheet using the following code:\n\nSub save_as_PDF()\n\nDim strPath As String, strName As String, strSaveName As String\n\nstrPath = \"C:\\Users\\xxx\\Documents\" strName = \"Test.pdf\" strSaveName =\nstrPath & strName\n\nActiveSheet.ExportAsFixedFormat Type:=xlTypePDF,\nFilename:=strSaveName, Quality:= _\n xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _\nOpenAfterPublish:=True\n\nEnd Sub\n\n\nOn my old pc - having Excel 2010 and the free Adobe Acrobat Reader, the pdf is created.\n\nHowever, on my new pc having Excel 2016 and also the free Adobe Acrobat Reader, the pdf is not created.\nThe following error is thrown:\nError 430 - Runtime Error Class Does Not Support Automation Or Does Not Support Expected Interface.\n\nI tried to install the test version of Adobe 11 Pro, which did not help.\nAlso, I'm able to create a PDF via the manual print command." ]
[ "vba", "pdf", "excel-addins" ]
[ "Jenkins API: EnvVars.overrideAll not overriding existing environment variables in Pipeline job.", "I am trying to set Jenkins environment variables at runtime via the EnvironmentContributor.buildEnvironmentFor() method. Suppose I set an environment variable named \"existingKey\" with value \"oldValue\" in the Jenkins configure page. If I set existingKey to any other value by using EnvVars.overrideAll it doesn't take. New key/value pairs persist. Here's my code:\n\n@Extension\npublic class MyEnvironmentContributor extends EnvironmentContributor {\n Logger log...\n\n @Override\n public void buildEnvironmentFor(@Nonnull Job j, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException {\n log.fine(\"pre: existingKey=\"+envs.get(\"existingKey\"));\n\n HashMap<String, String> newEnvVars = new HashMap<String, String>();\n newEnvVars.put(\"newKey\", \"newValue\");\n newEnvVars.put(\"existingKey\",\"newValue\");\n envs.overrideAll(newEnvVars);\n\n log.fine(\"post: existingKey=\"+envs.get(\"existingKey\"));\n }\n}\n\n\nI have tested the above with both buildEnvironmentFor(Job,...) and buildEnvironmentFor(Run,...) with the same result. I have also tried EnvVar.override() and envVar.overrideExpandingAll(), none seem to work. \n\nI have also extended RunListener, which allows me to monitor if my env variables get set. \n\n@Extension\npublic class MyRunListener extends RunListener<Run> {\n Logger log.....\n\n public MyRunListener(){\n //lazy loaded class\n }\n\n @Override\n public void onStarted(final Run run, final TaskListener listener) {\n log.fine(\"Build Started: \" + run.getUrl() + \", \" + run.getDisplayName());\n try{\n EnvVars env = run.getEnvironment(listener);\n for (Entry<String, String> entry : env.entrySet()) {\n log.fine(entry.getKey() + \"=\" + entry.getValue());\n }\n }catch(){//trivial}\n }\n}\n\n\nThe resulting logs look like this:\n\nBuild Started: job/Test/job/EnvTest/20/, #20\npre: existingKey=oldValue\npost: existingKey=newValue\nnewKey=newValue\nexistingKey=oldValue\n\n\nI am also printing out the env in my build container and it shows the same pattern. Any ideas how to actually override existing variables and not just set new ones?" ]
[ "java", "jenkins", "jenkins-plugins" ]
[ "SIM900 module not responding on hardware COM port", "I've got my sim900 module working with arduino by using their software serial library, however, I want to eliminate arduino from the equation and have serial communication directly to sim900 module.\n\nI'm using putty as my terminal emulator. It's serial is configured to COM1 19200 8 N 1 the same as device manager configuration for this port.\n\nI connect straight from hardware serial on my PCs motherboard into serial-to-ttl interface board which connects to sim900 module. The board has 4 pins - VCC GND TX RX. They're all connected to my sim900 hardware serial as follows: VCC=5V GND=GND TX=TX RX=RX (Yes I know that it's always actually TX=RX and RX=TX, but when I connect it that way my interface board doesn't blink any led to indicate a transfer whereas it does when I connect TX=TX and RX=RX). The switch on the module is set to hardware serial pins as well.\n\nSo the only thing that happens when I send AT commands such as AT or ATI and press enter is that puttys cursor comes back to the beginning of command that I typed. No response.\n\nI'm thinking that I'm not doing something that the arduinos software serial port is doing when it sends commands to sim900.\n\nCan anyone help please ? It's literally been days of trying different configurations with no results.\n\nIn that time besides getting sim900 working with arduino software serial I verified that the hardware serial port on my motherboard is working correctly and the interface board is working correctly as well." ]
[ "serial-port", "at-command", "sim900" ]
[ "Checking files size from current directory", "Below function read directory and insert files name (by push_back()) into vector\n\n#include <dirent.h>\n\nvoid open(string path){\n\n DIR* dir;\n dirent *pdir;\n\n dir = opendir(path.c_str());\n while (pdir = readdir(dir)){\n vectorForResults.push_back(pdir->d_name);\n }\n}\n\n\nQuestion: How can I check size of each file (from current directiory) using boots library?\n\nI found method described on http://en.highscore.de/cpp/boost/filesystem.html\n\nIt's e.g.:\n\nboost::filesystem::path p(\"C:\\\\Windows\\\\win.ini\"); \nstd::cout << boost::filesystem::file_size(p) << std::endl; \n\n\nCould someone please help how to implement boost it in my open() function? Especially how to assign current directory path name into variable p and then iterate through files names." ]
[ "c++", "boost" ]
[ "How to remove duplicate rows from csv which is having key and value pairs?", "Sample test.csv is:\n\n2176=150MG , 2178=I01 , 1011=1000210 , 1012=1, 1636=KG, 1638=Active\n\n2176=150MG , 2178=I02 , 1011=1034669 , 1012=2 , 1636=KG , 1638=Active \n\n2176=200MG , 2178=I03 , 1011=1034670 , 1012=3 , 1636=KG , 1638=Active\n\n2176=150MG , 2178=I01 , 1011=1000210 , 1012=1 , 1636=KG , 1638=Active\n\n2176=277MG . 2178=I05 , 1011=1000535 , 1012=5 , 1636=KG , 1638=Active\n\n2176=200MG , 2178=I03 , 1011=1034670 , 1012=3 , 1636=KG , 1638=Active\n\nExpected Result:\n\n2176=150MG , 2178=I01 , 1011=1000210 , 1012=1, 1636=KG, 1638=Active\n\n2176=150MG , 2178=I02 , 1011=1034669 , 1012=2 , 1636=KG , 1638=Active \n\n2176=200MG , 2178=I03 , 1011=1034670 , 1012=3 , 1636=KG , 1638=Active\n\n2176=277MG . 2178=I05 , 1011=1000535 , 1012=5 , 1636=KG , 1638=Active" ]
[ "java", "csv" ]
[ "Issue with PDO Connection", "i am new to this so dont be rude :D\n\nI have 3 file: database.php, init.php and user.php\n\nHere the init.php:\n\n<?php\nini_set('display_errors', 1);\nini_set('display_startup_errors', 1);\nerror_reporting(E_ALL);\n\nsession_start();\n\nrequire 'database.php';\nrequire 'functions/user.php';\n$errors = array();\n\n\nHere the database.php:\n\n<?php\n$db_host = \"localhost\";\n$db_name = \"xxxx\";\n$db_user = \"xxxx\";\n$db_pw = \"xxxx\";\n\ntry {\n $conn = new PDO(\"mysql:host=$db_host;dbname=$db_name;\", $db_user, $db_pw);\n} catch(PDOException $e) {\n die(\"Verbindung fehlgeschlagen: \" . $e->getMessage());\n}\n\n\nAnd here the user.php:\n\n<?php\nfunction userExists($user) {\n $sql = \"SELECT * FROM user WHERE email = :email\";\n $stmt = $conn->prepare($sql);\n $stmt->bindParam(':email', $user);\n $stmt->execute();\n $results = $stmt->fetch(PDO::FETCH_ASSOC);\n if(count($results) > 0) return true;\n return false;\n}\n\n\nSo the error message: \n\nNotice: Undefined variable: conn in /mnt/web109/b2/35/57848035/htdocs/includes/functions/user.php on line 4 Fatal error: Call to a member function prepare() on null in /mnt/web109/b2/35/57848035/htdocs/includes/functions/user.php on line 4 \n\n\nThe function userExists() is called in another file named login.php. In login.php i have already required init.php. The error message appears when i want to login.\n\nSo i hope you can help me.\n\nThx" ]
[ "php", "mysql", "pdo" ]
[ "Comments on my design v3", "Well, after taking into consideration all the helpful comments I got on v1 and v2 of my class diagram for the space invader game, I updated my class diagram once again to implement all the changes.\n\nWith no further ado, I present v3:\n\n\n\nThe Move and Update methods in the abstract Bullet class are doing nothing, the implementations of the methods are in the concrete classes that inherit from bullet. Each of these concrete classes will also inherit the Speed property from the IMovable interface, and each will have their own speed set. The whole abstract Bullet class and their concrete class derivatives is the strategy pattern.\n\nSome things I want to ask: The Ship and Invader class can only have one bullet at a time - but the Invader class can also have no bullets. This is e.g. when all the rows of aliens are still intact, then only the first row of aliens can fire bullets. The rows above them are not able to shoot. But how would I implement this in the Invader class? Should the bullet variable in the Invader class of the invaders who are not able to shoot be set or left to null? Or is there a better option?\n\nI hope I am getting closer and closer to getting the right design, all your comments are welcome!" ]
[ "design-patterns", "architecture", "class-diagram" ]
[ "Open bat file does not start it but opens it in editor", "Since some time, when I click on BAT file in Windows Explorer (Windows 7) the BAT file is not started. Instead, the BAT file is opened in Notepad. I tried to repair this, by using Right-click to use Open With... . No luck, because this function is forbidden for system files (exe, com, bat ...). Now my question is: how to repair this odd behaviour?" ]
[ "windows", "batch-file", "explorer", "file-association" ]
[ "Statically typed Lua", "I am looking for a Lua front-end compiler that is type-checked at compile time, but outputs standard Lua 5.1 byte-code (that has only run-time types). What I want is a decent amount of static, compile-time syntactic analysis and optional typing, to detect trivial errors sooner than run-time. The resulting byte-code would have to play nicely with existing Lua byte-code that was compiled with the standard LoadString().\n\nTo be clear -- any difference would only occur at byte-compilation time. At runtime, the byte code would have no idea that anything different/unusual happened to it during the compile phase.\n\nWhat I have in mind sounds a lot like ActionScript; I wouldn't even mind an ActionScript compiler that outputs Lua byte code!\n\nHas anyone heard of such an effort? I've seen some references to using MetaLua to do this, but honestly I am not bright enough to make heads of tails of their documentation" ]
[ "compiler-construction", "lua", "static-typing" ]
[ "Wrong list size on deserialize list in xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<renditions type=\"array\">\n <rendition>\n <id>1</id>\n </rendition>\n <rendition>\n <id>2</id>\n </rendition>\n</renditions>\n\n\nthis. is my mapped Rendition class :\n\n@JsonIgnoreProperties(ignoreUnknown = true)\n@JacksonXmlRootElement(localName = \"rendition\")\npublic class Rendition {\n\n @JacksonXmlProperty\n private String id;\n\n // Getter and setter\n}\n\n\nTo deserialize my xml I do this :\n\nJacksonXmlModule module = new JacksonXmlModule();\nmodule.setDefaultUseWrapper(false);\nXmlMapper mapper = new XmlMapper(module);\n\nList<Rendition> renditions = mapper.readValue(inputStream,\n TypeFactory.defaultInstance().constructCollectionType(List.class, Rendition.class));\n\nrenditions.stream().map(ReflectionToStringBuilder::toString).forEach(System.out::println);\n\n\nAnd I don't understand why I get 3 item instead of 2:\n\nOutput:\nRendition@38093ffe[id=<null>]\nRendition@4713b631[id=1]\nRendition@7a0d2c80[id=2]\n\n\nSo I want to know why I get a null item in first place, because the two other items are good.\n\nI used jackson 2.10.1 version.\n\nAfter many tests, if I delete attribut type=\"array\", it's working. But life is not easy and the xml that I deserialize provided by an external service.\n\nIs it possible to solve my problems without make String replacement or create Renditions class (that only have a rendition list)?" ]
[ "java", "xml", "jackson", "deserialization" ]
[ "ASP/MySQL - Parameterized Query(s)", "In my example code below, you can see that I have been trying to suss-out parameterized queries in ASP and MySQL.\n\nI am doing something wrong here and would like to know what it is. In my example, you can see two queries. If I leave off the last query (under the '//////// line), this script works. As soon as I add the last query, I get the following error:\n\n\n \"Multiple-step OLE DB operation generated errors. Check each OLE DB\n status value, if available. No work was done.\"\n\n\nI'm really not sure what I am doing wrong. I googled the error and it said something about data types but it didn't register in my empty head!\n\nAm I declaring the parameters (.createParameter) in the right place, as I'm processing multiple queries? Do they have to be declared before all the queries?\n\nMy Code\n\nSet connContent = Server.CreateObject(\"ADODB.Connection\") \nconnContent.ConnectionString=\"...blah..blah..blah...\"\nconnContent.Open\n\nSet cmdContent = Server.CreateObject(\"ADODB.Command\")\nSet cmdContent.ActiveConnection = connContent\n\ncmdContent.Prepared = True\n\nConst ad_varChar = 200\nConst ad_ParamInput = 1\nConst ad_Integer = 3\nConst ad_DBDate = 133 \nConst ad_DBTimeStamp = 135\n\ntheNumber = 23\ntheText = \"Hello there!\"\ntheDate = \"2011-10-15\"\n\nSQL = \" INSERT INTO testTable (integerCol) VALUES (?); \"\n\nSet newParameter = cmdContent.CreateParameter(\"@theNumber\", ad_Integer, ad_ParamInput, 50, theNumber)\ncmdContent.Parameters.Append newParameter\n\ncmdContent.CommandText = SQL\ncmdContent.Execute\n\n' ////////////\n\nSQL = \" INSERT INTO testTable (varCharCol) VALUES (?); \"\n\nSet newParameter = cmdContent.CreateParameter(\"@theText\", ad_varChar, ad_ParamInput, 50, theText)\ncmdContent.Parameters.Append newParameter\n\ncmdContent.CommandText = SQL\ncmdContent.Execute\n\n\nUPDATE:\n\nWell I got both queries to work but I had to set another command object and active connection, shown below. Although it works, is this the right thing to do with my type of connection? Do I need to set the command object to nothing after each query then?\n\n' ////////////\n\nSet cmdContent = Server.CreateObject(\"ADODB.Command\")\nSet cmdContent.ActiveConnection = connContent\n\nSQL = \" INSERT INTO testTable (varCharCol) VALUES (?); \"\n\nSet newParameter = cmdContent.CreateParameter(\"@theText\", ad_varChar, ad_ParamInput, 50, theText)\ncmdContent.Parameters.Append newParameter\n\ncmdContent.CommandText = SQL\ncmdContent.Execute" ]
[ "mysql", "sql", "asp-classic" ]
[ "Foreign key constraints missing from SHOW CREATE TABLE output", "I'm finding that SHOW CREATE TABLE is not showing foreign key constraints as I would expect.\n\nTo demonstrate, here’s an example from the MySQL manual:\n\nCREATE TABLE parent (\n id INT NOT NULL,\n PRIMARY KEY (id)\n) ENGINE=INNODB;\nCREATE TABLE child (\n id INT, parent_id INT,\n INDEX par_ind (parent_id),\n FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE\n) ENGINE=INNODB;\n\nmysql> SHOW CREATE TABLE child\\G\n*************************** 1. row ***************************\n Table: child\nCreate Table: CREATE TABLE \"child\" (\n \"id\" int(11) default NULL,\n \"parent_id\" int(11) default NULL,\n KEY \"par_ind\" (\"parent_id\")\n) ENGINE=InnoDB DEFAULT CHARSET=utf8\n1 row in set (0.00 sec)\n\n\nIn that output I would have expected to see something like:\n\nCONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`)\nREFERENCES `parent` (`id`) ON DELETE CASCADE\n\n\nin that create table output but clearly it's not there.\n\nThe constraint does however appear to exist:\n\nmysql> SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema=database()\\G\n*************************** 1. row ***************************\n CONSTRAINT_CATALOG: NULL\n CONSTRAINT_SCHEMA: test_fk\n CONSTRAINT_NAME: child_ibfk_1\n TABLE_CATALOG: NULL\n TABLE_SCHEMA: test_fk\n TABLE_NAME: child\n COLUMN_NAME: parent_id\n ORDINAL_POSITION: 1\nPOSITION_IN_UNIQUE_CONSTRAINT: 1\n REFERENCED_TABLE_SCHEMA: test_fk\n REFERENCED_TABLE_NAME: parent\n REFERENCED_COLUMN_NAME: id\n*************************** 2. row ***************************\n CONSTRAINT_CATALOG: NULL\n CONSTRAINT_SCHEMA: test_fk\n CONSTRAINT_NAME: PRIMARY\n TABLE_CATALOG: NULL\n TABLE_SCHEMA: test_fk\n TABLE_NAME: parent\n COLUMN_NAME: id\n ORDINAL_POSITION: 1\nPOSITION_IN_UNIQUE_CONSTRAINT: NULL\n REFERENCED_TABLE_SCHEMA: NULL\n REFERENCED_TABLE_NAME: NULL\n REFERENCED_COLUMN_NAME: NULL\n2 rows in set (0.01 sec)\n\nmysql> SELECT * FROM information_schema.TABLE_CONSTRAINTS WHERE table_schema=database()\\G\n*************************** 1. row ***************************\nCONSTRAINT_CATALOG: NULL\n CONSTRAINT_SCHEMA: test_fk\n CONSTRAINT_NAME: child_ibfk_1\n TABLE_SCHEMA: test_fk\n TABLE_NAME: child\n CONSTRAINT_TYPE: FOREIGN KEY\n*************************** 2. row ***************************\nCONSTRAINT_CATALOG: NULL\n CONSTRAINT_SCHEMA: test_fk\n CONSTRAINT_NAME: PRIMARY\n TABLE_SCHEMA: test_fk\n TABLE_NAME: parent\n CONSTRAINT_TYPE: PRIMARY KEY\n2 rows in set (0.01 sec)\n\n\nI get the same results with examples of my own design.\n\nAny idea what's going on?\n\n\n\nUPDATE 2011-01-08: I think this has something to do with the sql_mode variable. But at the moment I don't know which mode setting excludes constraints from SHOW CREATE TABLE output." ]
[ "mysql" ]
[ "Filter TCP Packets in C#", "I am writing an application where all the request to the internet should go from it like in firewall. so that i can block the request for a particular website. In my case the program will be running on the same machine. I have tried the promiscous method but using that we can only capture all the packets comming and going from the machine," ]
[ "c#", "tcp" ]
[ "Best way to split an unsigned 64-bit integer to its bytes", "I have an uint64 (what would be an unsigned long long in C) which I want to convert in an array of bytes.\n\nThis is how I'm doing it right now (in Nim code):\n\n\nValue is typedef'd as unsigned long long \nByte is typedef'd as unsigned char \nCD is an array of Bytes\n\n\n proc writeValue(v:Value) =\n CD.add(Byte(v shr 56))\n CD.add(Byte(v and Value(0x00ff000000000000)))\n CD.add(Byte(v and Value(0x0000ff0000000000)))\n CD.add(Byte(v and Value(0x000000ff00000000)))\n CD.add(Byte(v and Value(0x00000000ff000000)))\n CD.add(Byte(v and Value(0x0000000000ff0000)))\n CD.add(Byte(v and Value(0x000000000000ff00)))\n CD.add(Byte(v and Value(0x00000000000000ff)))\n\n\nAnd this is how I'm reading it back (get an uint64 starting from a specific position in the array: IP)\n\ntemplate readValue():Value =\n inc(IP,8); (Value(CD[IP-8]) shl 56) or (Value(CD[IP-7]) shl 48) or (Value(CD[IP-6]) shl 40) or (Value(CD[IP-5]) shl 32) or (Value(CD[IP-4]) shl 24) or (Value(CD[IP-3]) shl 16) or (Value(CD[IP-2]) shl 8) or Value(CD[IP-1])\n\n\n\n\n\nIs there a more efficient way? Am I wasting performance the way I'm doing it?" ]
[ "integer", "bit-manipulation", "nim-lang" ]
[ "Passing an Array of Numbers via Soap", "I’m fairly new to programming and I’m in need your help.\n\nI need to pass an array containing numbers to a Web Service using C# and Soap. And have the Sum of these numbers returned to the console application.\n\nI understand that Array within Soap web services do not work well but I need a solution" ]
[ "c#", "xml", "web-services", "soap" ]
[ "HTML - calling javascript by clicking on image", "I'm trying to call javascript by clicking on the image but it's not working.\nPlease refer below for my code.\n\nJavascript\n\n<script type=\"text/javascript\">\n<!--\nvar image1=new Image()\nimage1.src=\"images/Image_1.png\"\nvar image2=new Image()\nimage2.src=\"images/Image_2.png\"\nvar image3=new Image()\nimage3.src=\"images/Image_3.png\"\n//-->\n\n function login(showhide){\n if(showhide == \"show\"){\n document.getElementById('popupbox').style.visibility=\"visible\";\n }else if(showhide == \"hide\"){\n document.getElementById('popupbox').style.visibility=\"hidden\"; \n }\n }\n </script>\n\n\nmy code\n\n<div id=\"apDiv21\"><img src=\"images/Login_OnOut.png\" width=\"71\" height=\"44\" \nonmouseover=\"this.src='images/Login_OnRollover.png'\" \n onmouseout=\"this.src='images/Login_OnOut.png'\" onclick=\"login('show');\" />\n\n <div id=\"popupbox\"> \n<form name=\"login\" action=\"\" method=\"post\" style=\"background-color:#C7C7C7\">\n<center>Username:</center>\n<center><input name=\"username\" size=\"14\" /></center>\n<center>Password:</center>\n<center><input name=\"password\" type=\"password\" size=\"14\" /></center>\n<center><input type=\"submit\" name=\"submit\" value=\"login\" /></center>\n</form>\n<center><a href=\"login('hide');\">close</a></center> \n</div>" ]
[ "javascript", "html" ]
[ "install mod_php71u for Apache 2.4 in Rhel7 Enterprise", "I am having a hard time to figure out how to install the PHP7 modules for Apache 2.4 (httpd) in RedHat7. I've been looking in google and different sites, however is kind of hard to find documentation since this seems to be a weird issue due to my OS version. \n\nphp7 is already installed and running in my computer, and i am able to interpret php code via CLI. \n\nI found this website that explains in details how install the module i need:\n\nhttps://centos.pkgs.org/7/ius-x86_64/mod_php71u-7.1.28-1.ius.centos7.x86_64.rpm.html\n\nIt seems to be very clear that using the method indicated should work: \n\nInstall mod_php71u rpm package:\n\nyum install mod_php71u\n\n\nThis is what i get after running yum. \n\nNo package mod_php71u available.\nError: Nothing to do\n\nOS:\nNAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.6 (Maipo)\"\n\n\nAny help is highly appreciated." ]
[ "php", "apache", "rhel7" ]
[ "Making python library available to rqworker", "I have this module foo from which I want to import foo.jobs, the file structure is this.\n\nfoo\n | - __init__.py\n | - jobs.py\n | - ...\n\n\nthe problem is, I want to import it from outside of my program in a rqworker running on another folder.\n\nI've tried adding this to my code:\n\nimport sys\nsys.path.insert(0, \"/path/to/foo\")\n\n\nand I've tried adding this to ~/.profile\n\nexport PYTHONPATH=$PYTHONPATH:/path/to/foo\n\n\nLike I've seen here: https://askubuntu.com/questions/470982/how-to-add-a-python-module-to-syspath\n\nbut nothing works. Any idea on what could be happening? I'm using Ubuntu 16" ]
[ "python", "ubuntu", "redis" ]
[ "Django Login form Using AD", "I'm trying to create an App which has a log in page where user should be authenticated using azure AD. Basically the App has a log in form where user puts his id and password from ad and django should check with ad and allow him in or not. Later on ofc would like to add permission depending on AD group.\nSo far I searched a lot on the internet and found nothing. Could you guys help with some example or link to documentation what I could use." ]
[ "django", "authentication", "azure-active-directory" ]
[ "JQuery slideToggle() Method", "I've written a simple code for an FAQ list; each question is opened on click event and must be manually closed. Is there a way re-work this code so that in the event of clicking on a question to open (slidedown), ones that have been previously been open, automatically slideup to close? \n\n{% javascript %}\n(function() {\n $('body').on('click', '.shopify_explorer_faq__question', function() {\n $(this).next('.shopify_explorer_faq__answer').slideToggle(250).toggleClass('active');\n $(this).toggleClass('active');\n });\n\n $(document).on('shopify:block:select', '#shopify-section-page-shopify_explorer_faq-template', function(event) {\n $(event.target).find('.shopify_explorer_faq__answer').slideDown(250);\n });\n\n $(document).on('shopify:block:deselect', '#shopify-section-page-shopify_explorer_faq-template', function(event) {\n $(event.target).find('.shopify_explorer_faq__answer').slideUp(250);\n });\n}());\n{% endjavascript %}" ]
[ "javascript", "jquery", "slidetoggle" ]
[ "How can I make this function work with recursion?", "Output:\n\n3\n3 4\n3 4 5\n3 4 5 6\n3 4 5 6 7\n3 4 5 6 7 8\n\n\n\n\nfunction Triangle ($begin, $end) {\n if ($begin < 0 || $end < 0) {\n return;\n }\n if ($begin == $end) {\n return $a;\n }\n else {\n // non recursive\n for ($i = 1; $i <= $end; $i++) {\n for ($j = $begin; $j <= $i; $j++) {\n\n echo $j . \" \";\n }\n echo \"<br>\";\n }\n }\n}\n\n\nThis is what I made so far." ]
[ "php", "recursion" ]
[ "TypeError: Cannot read property 'emoji' of undefined", "I am trying to make emoji reaction for my discord bot , everything is okay until I click "❌" emoji but when i click "❌" emoji i am getting this error: TypeError: Cannot read property 'emoji' of undefined\nand the error shows this line : if (reaction.emoji.name === '❌')\nconst Discord = require("discord.js");\nconst ayarlar = require("../ayarlar.json");\n\nmodule.exports.run = async (bot, message, args) => {\n\n let gonderenKisi = message.author;\n let mesaj = args.slice(0).join(" ");\n if(!mesaj) return message.reply("**➤ Mesaj Atabilmek İçin Bir Mesaj Yazmalısın!**").then(message => {\n message.delete({ timeout: 5000 });\n });\n \n const filter = (reaction, user) => {\n return ['❌'].includes(reaction.emoji.name) && user.id === message.author.id;\n };\n \n const sEmbed = new Discord.MessageEmbed()\n .setDescription(`➤ ` + mesaj)\n .setAuthor(`➤ Yeni Bir Fotoğraf Paylaşıldı !`)\n .setThumbnail(message.guild.iconURL())\n .setColor('RANDOM')\n .setFooter(`➤ Fotoğraf Atan: ${message.author.username}`, message.author.displayAvatarURL())\n .setTimestamp(message.createdAt)\n message.delete();\n message.channel.send(sEmbed).then(e => \n e.react("❤️")).then(e =>\n e.message.react("❌")).catch(e => {\n\n console.error('Emojiler De Sorun Var.');\n });\n\nmessage.awaitReactions(filter, { max: 1 })\n .then(collected => {\n \n const reaction = collected.first();\n \n if (reaction.emoji.name === '❌') {\n\n collected.on('collect', () => {\n \n message.delete();\n\n var s2Embed = new Discord.MessageEmbed()\n\n .setTitle(`${message.author.username} Mesajın Silindi.`)\n\n .setColor('RANDOM')\n\n .setDescription(`Mesajı Silen : ${message.author.username}`, message.author.displayAvatarURL())\n \n message.channel.send(s2Embed)\n });\n }\n \n\n }).catch(e => {\n console.error(e)\n})\n};\n\n\nmodule.exports.config = {\n name: 'instagram',\n aliases: ['i']\n}" ]
[ "javascript", "node.js", "discord.js", "bots" ]
[ "How would one mock an axios.all request?", "I've came across this wall while i was mocking my project.\n\nI make an axios.all request with 10 requests within it. How the hell do i mock it?\n\nI'm currently using moxios to mock my axios http requests but it doesn't seem to have the functionality to deal with this problem.\n\nExample:\n\naxios.all([\n axios.get(url1),\n axios.get(url2),\n axios.get(url3)\n ])\n .then(axios.spread(function (r1, r2, r3) { \n ...\n }))\n.catch(err => {\n console.error(err, err.stack);\n});\n\n\nHas anyone come accross this problem and have they found a solution?\n\nUpdate:\n\nI've just mocked each request invidually but it's a slow and painful process, is there a quicker more efficient way to do this?" ]
[ "javascript", "unit-testing", "mocking", "axios", "moxios" ]
[ "Pantheios write to extenal file", "I looked around and I couldn't find the answer to how exactly to do this. I am trying to use Pantheios for logging and I want to write to an external file (otherwise whats the point). I am following one of the examples provided but It doesn't seem to be making the log file anywhere. Here is the code:\n\nEdit: Also pantheios_be_file_setFilePath is returning -4 (PANTHEIOS_INIT_RC_UNSPECIFIED_FAILURE) so thats.....not helpful\n\n #include \"stdafx.h\"\n #include <pantheios/pantheios.hpp> \n #include <pantheios/implicit_link/core.h>\n #include <pantheios/implicit_link/fe.simple.h> \n #include <pantheios/implicit_link/be.WindowsConsole.h>\n #include <pantheios/implicit_link/be.file.h>\n #include <pantheios/frontends/fe.simple.h>\n #include <pantheios/backends/bec.file.h>\n #include <pantheios/inserters/args.hpp>\n\n PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING(\"LogTest\");\n\n int _tmain(int argc, _TCHAR* argv[])\n {\n try\n {\n pantheios_be_file_setFilePath(PANTHEIOS_LITERAL_STRING(\"testlogforme.log\"), PANTHEIOS_BE_FILE_F_TRUNCATE, PANTHEIOS_BE_FILE_F_TRUNCATE, PANTHEIOS_BEID_ALL);\n\n\n pantheios::log(pantheios::debug, \"Entering main(\", pantheios::args(argc,argv, pantheios::args::arg0FileOnly), \")\");\n\n pantheios::log_DEBUG(\"debug yo\");\n pantheios::log_INFORMATIONAL(\"informational fyi\");\n pantheios::log_NOTICE(\"notice me!\");\n pantheios::log_WARNING(\"warning!!\");\n pantheios::log_ERROR(\"error omg\");\n pantheios::log_CRITICAL(\"critical!!!\");\n pantheios::log_ALERT(\"alert mang\");\n pantheios::log_EMERGENCY(\"EMERGENCY!!!!!\");\n\n pantheios_be_file_setFilePath(NULL, PANTHEIOS_BEID_ALL);\n\n system(\"pause\");\n return EXIT_SUCCESS;\n }\n catch(std::bad_alloc&)\n {\n pantheios::log_ALERT(\"out of memory\");\n }\n catch(std::exception& x)\n {\n pantheios::log_CRITICAL(\"Exception: \", x);\n }\n catch(...)\n {\n pantheios::puts(pantheios::emergency, \"Unexpected unknown error\");\n }\n\n return EXIT_FAILURE;\n }\n\n\nMaybe I'm not calling a method or maybe its not being saved to a good location?" ]
[ "c++", "logging", "pantheios" ]
[ ".Datatable is not a function", "I try this table feature\nhttps://datatables.net/examples/basic_init/scroll_xy.html\n\ni have dropdown and date picker so i add links for table and datetime picker links then i add table and also i use script for this but when i select datetime picker then calendar is not display then when i check console this show error \n\nI try to export table data in excel \n\nWebForm1.aspx:34 Uncaught TypeError: $(...).Datatable is not a function\n\n\nCODE\n\n <%--for tabledata--%>\n<script type=\"text/javascript\" src=\"//code.jquery.com/jquery-1.12.3.js\"></script>\n <script type=\"text/javascript\" src=\"https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js\"></script>\n\n <link rel=\"stylesheet\" href=\"https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css\" />\n\n\n <link href=\"Styles/stylechart.css\" rel=\"stylesheet\" />\n <!--for date--%>-->\n <link rel=\"stylesheet\" href=\"https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css\" />\n <script type=\"text/javascript\" src=\"https://code.jquery.com/jquery-1.12.4.js\"></script>\n <script type=\"text/javascript\" src=\"https://code.jquery.com/ui/1.12.0/jquery-ui.js\"></script>\n\n <script type=\"text/javascript\">\n $(document).ready(function () {\n $(\"#tabledata\").Datatable({\n dom: 'Bfrtip',\n buttons: [\n 'excelHtml5'\n\n ]\n });\n });\n\n </script>\n\n <table id=\"tabledata\" cellspacing=\"0\" class=\"display nowrap inner_table\">\n\n </table>\n\n\nupdated:\n\n success: function (result) {\n var final = JSON.parse(result.d).response;\n console.log(JSON.parse(result.d).response);\n $(\"#tabledata\").empty();\n if (final.length > 0) {\n $(\"#tabledata\").append(\n \"<thead><tr><th>RegNo</th></tr></thead>\");\n for (var i = 0; i < final.length; i++) {\n\n if (final[i] !== null) {\n $(\"#tabledata\").append(\"<tbody><tr><td>\" + \n final[i][0] + \"</td> </tr></tbody>\");\n\n }\n } \n }" ]
[ "javascript", "jquery", "datetime", "datatable" ]
[ "grunt-contrib-less creates the app.css file during launch but not during live reload", "Basically, at the beginning all is ok but after modifications, CSS are not updated.\n\nFirst, my package details:\n\n\"node\" : \"0.10.21\" \n[...]\n\"grunt\": \"~0.4.1\",\n\"grunt-contrib-uglify\": \"~0.2.7\",\n\"grunt-contrib-jshint\": \"~0.7.1\",\n\"grunt-contrib-concat\": \"~0.3.0\",\n\"grunt-contrib-watch\": \"~0.5.3\",\n\"grunt-contrib-less\": \"~0.8.1\"\n\n\nNext, my gruntfile.js\n\nmodule.exports = function(grunt) {\n\ngrunt.initConfig({\n pkg: grunt.file.readJSON('package.json'),\n concat: {\n options: {\n separator: ''\n },\n dist: {\n src: [ 'src/js/libs/jquery-2.0.3.min.js',\n 'src/js/libs/**/*.js',\n 'src/js/app/**/*.js'],\n dest: 'public/js/combo.js'\n }\n },\n uglify: {\n options: {\n banner: '/*! <%= pkg.name %> <%= grunt.template.today(\"dd-mm-yyyy\") %> */\\n'\n },\n dist: {\n files: {\n 'public/js/combo.min.js': ['public/js/combo.js']\n }\n }\n },\n less: {\n compile: {\n options: {\n compress:true\n },\n files: {\n 'public/css/application.css': ['src/css/application.less']\n }\n }\n },\n jshint: {\n files: ['gruntfile.js', 'src/js/**/*.js','src/css/**/*.less','public/index.html'],\n options: {\n globals: {\n jQuery: true,\n console: true,\n module: true,\n document: true\n }\n }\n },\n watch: {\n files: ['<%= jshint.files %>'],\n tasks: ['default']\n }\n});\n\ngrunt.loadNpmTasks('grunt-contrib-concat');\ngrunt.loadNpmTasks('grunt-contrib-uglify');\ngrunt.loadNpmTasks('grunt-contrib-less');\ngrunt.loadNpmTasks('grunt-contrib-jshint');\ngrunt.loadNpmTasks('grunt-contrib-watch');\n\ngrunt.registerTask('default', ['concat','uglify','less','watch']);\n\n};\n\n\nExplanations\n\nAt first, all works perfectly, all the files are created:\n\nRunning \"concat:dist\" (concat) task\nFile \"public/js/combo.js\" created.\n\nRunning \"uglify:dist\" (uglify) task\nFile \"public/js/combo.min.js\" created.\n\nRunning \"less:compile\" (less) task\nApp runnning on http://localhost:3000\nFile public/css/application.css created.\n\nRunning \"watch\" task\nWaiting...\n\n\nBut, if I make a modification in my *.less files:\n\nOK\n>> File \"src\\css\\application.less\" changed.\n\nRunning \"concat:dist\" (concat) task\nCompleted in 2.039s at Tue Nov 12 2013 11:44:53 GMT-0500 (Eastern Standard Time) - Waiting...\n\n\nSo, modifying is detected by watch but my CSS file is not updated and I just can't figure why. I tried several contrib-less implementations and it keeps the same way. I guess I'm doing something wrong but what ?\n\nPS: concat and uglify are working very well." ]
[ "node.js", "less", "grunt-contrib-watch" ]
[ "CKEditor (4). Loosing paragraph align when using font plugin", "I am using CKEditor (4), and recently we added the plugin "font" for customers to be able to select the fond style and size. It works great, but today we realized when we activate that plugin, for what ever reason we are loosing the alignment (justify plugin) so customers can align their text. Like the option just disappears. It seems to loose which ever is added first. So if we add "font" then "justify" in that order, we loose the ability to select font. If we add it "justify" then "font" we loose the ability to justify or align the text. Can not figure out why they do not seem to play nicely together.\nCKEDITOR Config\nCKEDITOR.editorConfig = function( config ) {\n config.toolbarGroups = [\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },\n { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },\n { name: 'links' },\n { name: 'insert' },\n { name: 'forms' },\n { name: 'tools' },\n { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },\n { name: 'others' },\n '/',\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },\n { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },\n { name: 'styles' },\n { name: 'colors' }\n ];\n\n config.extraPlugins = 'panel';\n config.extraPlugins = 'floatpanel';\n config.extraPlugins = 'listblock';\n config.extraPlugins = 'richcombo';\n config.extraPlugins = 'font';\n config.extraPlugins = 'justify';\n config.allowedContent = true;\n config.extraAllowedContent = 'script;div(*)';\n config.height = "250";\n\n config.font_style = {\n element: 'span',\n styles: { 'font-family': '#(family)' },\n overrides: [{ element: 'font', attributes: { 'face': null } }]\n };\n\n config.removeButtons = 'Underline,Subscript,Superscript';\n config.format_tags = 'p;h1;h2;h3;pre;div';\n config.removeDialogTabs = 'image:advanced;link:advanced';\n};\n\nIts that config.extraPlugins section. Which ever is second, removes the other? I am stumped!" ]
[ "ckeditor" ]
[ "Is there better way to simulate standard input?", "I just write one bash script this afternoon. It's quite ugly. So i think there must exists better way to implement echo $x here.\n\nfor x in $(ls); do \n cp $x $(echo $x | sed s/\\\\./_holo_light./) \n cp $x $(echo $x | sed s/\\\\./_holo_dark./) \ndone" ]
[ "linux", "bash", "shell", "sed" ]
[ "Redefining keys in Emacs on Windows", "I use my command keys as extra control keys on Mac OS X (and I believe the space cadet keyboards had this configuration). I want to emulate this on my Windows machines by switching Alt to Ctrl and the Windows key to Alt within Emacs. Is this possible? I found this post which suggests something like\n\n(setq w32-pass-lwindow-to-system nil \n w32-pass-rwindow-to-system nil \n w32-pass-apps-to-system nil \n w32-lwindow-modifier 'super ;; Left Windows key \n w32-rwindow-modifier 'super ;; Right Windows key \n w32-apps-modifier 'hyper) ;; Menu key\n\n\nto get super and hyper keys upon pressing the windows key. When I try to remap this to 'control to test it out (but eventually I want it to be meta and Alt as Ctrl, as mentioned), windows-e still gets intercepted by Windows (XP) and opens Explorer, but seems like a good place to start? I would appreciate any suggestions." ]
[ "windows", "emacs", "elisp" ]
[ "What would be the most efficient or useful way to store attendance data?", "I want to move my schools attendance records away from excel sheets and into python, but I'm not sure what the best way to store that data would be.\n\nMethod 1\nCreate a dictionary with student names as keys, and the dates they attended as items in a list. Or perhaps a list of the days they were absent would be more efficient.\n\nattendance = {}\nattendance[\"student_1\"] = [2018-08-10, 2018-08-15, 2018-08-20]\n\n\nMethod 2\nCreate a dictionary of dates and append a list of students who were present on that day:\n\nattendance = {}\nattendance[\"2018-08-10\"] = [student_1, student_2, student_3]\n\n\nMethod 3\nCreated nested dictionaries. Students names as the outer keys. All dates as inner keys with a boolean as a value.\n\nattendance = {}\nattendance[\"student_1\"]= {}\nattendance[\"student_1\"][\"1018-08-10\"] = 'True'\n\n\nAll of these would probably work, but there must be a better way of storing this data. Can anyone help?\n\nI should add that I want to be able to access the student's attendance record from name and retrieve all the student names that were present given a particular date." ]
[ "python" ]
[ "How to avoid a double copy when implementing get API methods", "I Want to optimize a thread-safe "get" function for a variable globalBig that looks like the following\nextern struct big *globalBig; // points to a big struct defined elsewhere\n\nstruct big getGlobalBig(void) {\n // lock globalBig here...\n struct big ret = *globalBig; // <------ copy #1 (into stack of getGlobalBig)\n // unlock globalBig here...\n return ret; // <------ copy #2 (into stack of caller)\n}\n\nWhen I look at the assembly, I see that there are two invocations of memcpy, one into the stack of the get method, and the second into the stack of the calling function caused by the return. I DO NOT want to have to pass in a pointer argument into getGlobalBig() because I want a function that returns an rvalue so that I could do stuff like:\nif(getGlobalBig().someField == 9) {\n // yay\n}\n\nI am also aware that I could do a single copy by skipping the unlocking of the variable, leaving that to the caller as a cleanup activity, but this is undesirable as I want to spend as little time as possible with the lock on.\nstruct big getGlobalBig(void) {\n // lock globalBig here...\n return *globalBig; // <------ copy #1 (directly into stack of caller, caller is responsible for unlocking)\n}\n\nSo based on those needs, is there a way to avoid the two copies? For example, I envision something like "returning in advance":\nstruct big getGlobalBig(void) {\n // lock globalBig here...\n // single copy directly into the destination struct allocated in the stack area of the caller\n *(struct big*)SOMEHOW_GET_THE_ADDR_THAT_THIS_FUNCTION_COPIES_TO_WHEN_RETURNING = *globalBig; \n // unlock globalBig here...\n return; // return nothing, you already "did" (?)\n}" ]
[ "c", "rvalue" ]
[ "workBook.write(fileoutputstream); writes empty excel file", "I am trying to write a excel workbook to a file. Using Apache POI. I debug and found out my workbook have data . Once i write this workbook to FileOutputStream, it successfully writes without any errors. but the generated file have nothing in it. that's a blank file. This is my code for writing the file :\n\n public void generateOutputSheet(String outputPath)\n{\n try\n {\nHSSFWorkbook outputWrkBook = mapBuilder.BuildOutputWorkBook(); // this have two sheets and each sheet have data\n //( one has 800 rows and another 6000 rows , i verified\nFileOutputStream outputFilestream = new FileOutputStream(outputPath);\n\noutputWrkBook.write(outputFilestream);\noutputFilestream.flush();\noutputFilestream.close();\n }\n catch(Exception ex)\n {\n ex.printStackTrace();\n }\n System.out.println(\"the output file is available at location:\"+outputPath);\n\n}" ]
[ "java", "excel", "apache-poi", "fileoutputstream" ]
[ "HTTP Error 405.0 - Method Not Allowed while Form Post", "I posted a request to payu server via form submit using angularjs now once payment is completed payu will return a response with hash.But when it hits my success page i get \"HTTP Error 405.0 - Method Not Allowed\".I found many solutions online but none of that solved my issue.What i understood is that static html do not allow post by default.But my staticFile in IIS is like below\n\n\n \n Request Path : *\n \n Module : StaticFileModule\n Name : staticFile\n Request Restriction >Verb > All Verbs & Access > Script & Invoke > Files and folders\n \n\n\nMy question now in how to allow POST method for html page.I am using angular and if i change my success url to other than mine it works fine.I think there is some changes to be made to the web config but i tried my best but failed.Any help would be much appreciated.Also lets assume that the page successfully redirects to my success page how to capture the response that payu sends me online.\n\nThanks in advance if more input is needed from my side kindly ask in reply." ]
[ "iis", "iis-express" ]
[ "Display two specified Activity when the specified user's first time login", "I'm a very beginner in Android development. I got a problem here, For example :\nuser1 register successfully then he click on btnLogin to login the first time . then Activity1,Activity2 display to let user1 insert his detail information.\nthen user1 logout while user1's information is saved in somewhere. then user1 login the second time, in this second time, Activity1,Activity2 are not displayed but directly go on MainActivity.\n\nuser2 register successfully then he click on btnLogin to login the first time . then Activity1,Activity2 display to let user2 insert his detail information.\nthen user2 logout while user2's information is saved in somewhere. then user2 login the second time, on that time, Activity1,Activity2 are not displayed but directly go on MainActivity.\nI want to apply this user's session management for any user who login and logout from my app, but I don't know how exactly step by step to implement it.\nplease help me :(" ]
[ "android", "android-activity", "sharedpreferences", "android-sqlite" ]
[ "Executing commands from command line to socket.io server", "I've been experimenting with socket.io nd got it working pretty well! But I would like to be able to do some maintenance work from my command line, so I can command my server.\n\nIs there a way to have the socket server (server.js) listen to commands coming from bash/command line/terminal aswell?" ]
[ "javascript", "command-line", "socket.io" ]
[ "firestore recyclerView get field and delete data", "I saved the data to the firestore and finished printing on the screen.\nI printed out each index using recyclerView.\nEach index content has a Delete button and I want to delete the data when I click the Delete button.\nHowever, when you click the Delete button, all documents in the field are deleted.\nHow do I delete only the index contents where the button is located?\n\nAdapter\n\npublic void onBindViewHolder(@NonNull final MainViewHolder holder, final int position) {\n final FirebaseFirestore db = FirebaseFirestore.getInstance();\n Delete.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n db.collection(\"medicinday\").document(mDataset.get(position).getId())\n .delete()\n .addOnSuccessListener(new OnSuccessListener<Void>() {\n @Override\n public void onSuccess(Void aVoid) {\n Toast.makeText(activity,\"success\",Toast.LENGTH_SHORT).show();\n }\n }) \n ... \n }\n });\n TextView nameTextView = cardView.findViewById(R.id.name_medicin_text);\n nameTextView.setText(mDataset.get(position).getName());\n ...\n\n\nActivity\n\nDocumentReference documentReference = FirebaseFirestore.getInstance().collection(\"medicinday\").document(FirebaseAuth.getInstance().getCurrentUser().getEmail());\n documentReference.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {\n @Override\n public void onComplete(@NonNull Task<DocumentSnapshot> task) {\n if (task.isSuccessful()) {\n DocumentSnapshot document = task.getResult();\n if (document != null) {\n if (document.exists()) {\n List list = (List) document.getData().get(\"add_day\");\n for (int i = 0; i < list.size(); i++) {\n Log.i(\"TEST\", \"data[\" + i + \"] > \" + list.get(i).toString());\n HashMap map = (HashMap) list.get(i);\n addDayList.add(new AddDayInfo(\n map.get(\"Name\").toString(),\n ...\n document.getId()));\n }\n\n } \n ..." ]
[ "android", "android-recyclerview", "google-cloud-firestore" ]
[ "Wordpress show theme version to user dynamically", "I have two themes \"axijas\" and \"axijas v2\". I want to show first user version 1, second user version 2, third user version 1 etc. \n\nI write a code, that look in database, which version was showed last, change the value and show the other version. Of course, I store this version in session, beause I want, if user has selected version 2, next few click he/she should see only version 2.\n\nProblem is, that I'm using function \"switch_theme()\" and it's not working as I expected. It change theme completly for everybody, sometimes I have even problem to switch it manually in dashboard. \n\nHow can I have activated version1, and it will be ignored, and only theme will be included by the rule? Is there any hook for it or something? I only want, that if user click on page, call function, that control if he has set session and if not, get version for show in database, change value and include theme folder for that user.\n\nThank you very much for your help\n\nP.S.:hope you understand my bad english" ]
[ "php", "database", "wordpress", "themes" ]
[ "How to share github pages to facebook? I tried sharing my blog but it didn't work", "I have just created a github page and written a blog. I tried sharing with Disqus's share option to Facebook but it's not loading preview and also says following.\n\nEven though I copy the link and directly paste it, it's not working. But if I do the same (copy the link and paste) in LinkedIn it preview is generated finely. What could be the problem? I'm using Flexible-Jekyll theme. You can find the link to flexible-jekyll theme here and here's a link to my github repo." ]
[ "jekyll", "github-pages", "jekyll-theme" ]
[ "Is it possible to collapse variable List of Objects to specific depth in IntelliJ IDEA 2016 debugger with one click?", "Is it possible to collapse variable list of objects in IntelliJ IDEA 2016 debugger to specific depth or fully with one click or shortcut?\n\nHere is an example of what I need to do with one button/click:\n\nBEFORE collapsion:\n\n\nAFTER collapsion:\n\n\nIt would be much more comfortable, to be able to do such list collapsion, without clicking on each item in list individually, but just with one click on list (or other data structure with nested objects)." ]
[ "java", "debugging", "intellij-idea", "jetbrains-ide" ]
[ "What does sizeof without () do?", "The author of this question just made fun on me when I asked him what \nsizeof * q does...\nHe told me that's a really basic C question and I should check it out.\nBut as I looked around on SO and haven't seen some one asking before, I'll do it now by my self:\n\nWhat does sizeof in C do when it is used without parentheses and/or type?" ]
[ "c", "sizeof" ]
[ "transpose column into rows through delimiter", "I have data in the following format. The values are in one column. I need to transpose them keeping the delimiter. I tried replacing the values using regular expression '\\r\\n' but it does nothing. \n\n653\n|110\n|1 January 2016\n|Default\n|Automatically identified, customer dialed\n|None\n|NPA dialed by customer\n|000-380-5414\n|03:59:57.5\n|4:01.9\n|CIC = 0000 |1 January 2016\n|03:59:35.5\n|4:23.9\n|10\n|SS7 from IC to AT, SS7 to EO |Tandem\n|104\n|Routing Indicator = Direct - Incoming Different network |104\n|Routing Indicator = Direct - Outgoing Different network |119\n|Trunk Group Number - Interoffice = 9056 |Network Interface Description = Feature Group D\n|Administrative Domain = 0 |Final module\n|\n625\n|119\n|1 January 2016\n|Default\n|Automatically identified, customer dialed\n|None\n|000-000-0000\n|NPA dialed by customer\n|000-380-5084\n|04:04:26.6\n|0:00.0\n|CIC = 0000 |1 January 2016\n|04:04:24.6\n|0:01.9\n|01\n|SS7 from IC to AT, SS7 to EO |Tandem\n|CAC not dialed, station not presub, no presub ind\n|Neither ANI nor CPN provided\n|104\n|Routing Indicator = Direct - Incoming Different network |104\n|Routing Indicator = Direct - Outgoing Different network |119\n|Trunk Group Number - Interoffice = 9056 |Network Interface Description = Feature Group D\n|Administrative Domain = 0 |Final module\n|\n\n\nHow do i convert this to the following structure \n\n653|110|1 January 2016|Default|...\n652|119|1 January 2016|Default|...\n\n\nI have textpad and notepad++. Any assistance is much appreciated..." ]
[ "text", "notepad++", "transpose", "textpad" ]
[ "Setting initial values in Django Form", "I have a Django form:\n\nclass PlayerForm(forms.Form):\n OPTIONS = MyUser.objects.all()\n players = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple,\n queryset=OPTIONS)\n\n\nI want the initial values of the players to be checked if MyUser.player = True. How do I set these initial values?" ]
[ "python", "django", "django-models", "django-forms" ]
[ "Is there a shortcut in Visual Studio to move down multiple lines but keep the cursor in the same place?", "CTRL+down arrow does this, but only 1 line at a time. Is there a shortcut to skip multiple lines but keep the cusor in the same place? You'd expect CTRL+page down to do it, but this just puts the cursor at the bottom of the screen." ]
[ "visual-studio" ]
[ "\"Application\" global variable not recognized", "I work on a large project in Delphi 5.\nToday, after merging two branches of the app together, one of the hundreds of units, UnitMain (the main form's unit, would you guess) stopped recognizing the Application global.\n\nThis is a rather bizarre problem - I could get the program to compile by defining Application: TApplication in UnitMain, and setting that to the Application from our .dpr project file, but that leads to an access violation, which isn't much of a surprise with Application being the special thing it is.\n\nI'm hoping someone has faced the same problem before, or knows enough of Delphi VCL's inner workings to help me out here.\n\nunit UnitMain;\n\ninterface\n\nuses\n Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,\n Menus, ComCtrls, StdCtrls, cxButtons, ExtCtrls, IniFiles, ShellAPI,\n LMDControl, LMDBaseControl, LMDBaseGraphicControl, LMDGraphicControl,\n LMDScrollText, cxControls, cxContainer, cxListBox, Psock, NMFtp, db, DBTables,\n FileCtrl, Configs, cxHint, DSetFunc, OleCtrls, DsInformation,\n InterAppComm, ActnList, ADODB, OleServer, CRAXDRT_TLB;\n\n\nThe exact error is that the compiler does not recognize Application in this unit.\nFor example, for a Application.ProcessMessages; call, the error is \"Object or class type required\".\nNone of the other units has this problem." ]
[ "delphi", "delphi-5" ]
[ "\"event\" object is recognized without passing it, in javascript function?", "on pressing a link, I am calling a javascript function\n\n <a id=\"eventFiringLink\" href=\"javascript:functionName()\">\n\n\nand in another place of the code for a button I am binding the functionName() function as a listener for a click event.\n\n <button id=\"someButton\">\n\n\nbinding click event by jquery\n\n$(\"#someButton\").bind('click',functionName);\n\n\nand the function description is exactly like below., \n\n functionName(e)\n {\n if(event.target.id== \"eventFiringLink\")\n {\n console.log(\"do this\");\n }\n else\n {\n console.log(\"do that\");\n }\n }\n\n\nwhen I clicked the link, I thought that I would get \n\n\n \"TypeError: Cannot read property 'target' of undefined\",\n\n\nbut to my surprise the code got executed and printed \n\n\n \"do this\"\n\n\nin the console.\n\nHow is that possible.?" ]
[ "javascript", "events", "target" ]
[ "Leaflet remove GeoJSON layer(s)", "I'm coloring areas on the map by creating GeoJSON layers in leaflet. First I create an empty layer:\n\nvar layerPostalcodes=L.geoJSON().addTo(map);\n\n\nThen I create a geojson element containing the shape information and add it to the layer:\n\nlayerPostalcodes.addData(geojson);\n\n\nThis displays the areas on the map correctly. Now, onclick of a button I'd like to remove all the shapes from the map. This is not working. I've tried several approaches:\n\nlayerPostalcodes.clearLayers();\n\n\nor via a LayerGroup, by adding the GeoJSON layer to it so I can use removeLayer(). But, this does not even display the shapes let alone remove them.\n\nvar layerGroup = new L.LayerGroup();\nlayerGroup.addLayer(layerPostalcodes);\nlayerGroup.addTo(map);\nlayerGroup.removeLayer(layerPostalcodes);\n\n\nWhat am I doing wrong?" ]
[ "javascript", "leaflet", "geojson" ]
[ "How to Fix \"Mark Occurrences\" in Eclipse?", "Eclipse is a great editor, and among it's many wonderful features one of my favorites is the Mark Occurrences feature. However, I recently installed the Aptana plug-in, and in trying to configure it I somehow managed to break Mark Occurrences in my Eclipse installation.\n\nThe feature still works somewhat, but instead of highlighting all occurrences of a given object, it now only highlights the occurrence where it is first created. In other words, in:\n\n1. Dog dog = new Dog();\n2. dog.bark();\n3. dog.bark();\n\n\nOnly the \"dog\" in line 1 would be highlighted, not the \"dog\" in 2 or 3.\n\nHowever, before I know I had things configured such that all three \"dog\" references would be highlighted by Eclipse. Does anyone know what configuration option I changed to \"break\" the marking of occurrences like this?" ]
[ "eclipse" ]
[ "Umbraco Database Query", "I want to add a property for a document type in Umbraco. After that, I want to add content using the newly edited document type. Finally, I want to edit the property value of the content and save it into the database. I want to do this using a SQL command in SQL Server Management Studio, given that I have installed Umbraco and I can access the Umbraco database." ]
[ "umbraco" ]
[ "git clone: Authentication failed for", "Trying to access private corporate tfs.\nThey gave me access by giving appropriate rights to windows user (domain\\login).\n\nI'm fine with accessing web interface of tfs, browse repository and stuff.\n\nBut when I try to run \n\n git clone https://tfs.somehostname.com/tfs/somefolder/_git/therepository\n\n\nIt fails with \n\nCloning into 'therepository'...\n\nfatal: Authentication failed for 'https://tfs.somehostname.com/tfs/somefolder/_git/therepository/'\n\n\nTried with home pc without corporate network stuff - same error.\n\nTried in PowerShell, Git Bash, Clone via VisualStudio - same error.\n\nSSH is closed (gave request timeout).\n\nWeb & Git both ask for credentials once (tried deleting in Credentials Manager - asks again, after submitting web is fine, git fails)\n\nCorporate helper tried to help, but all he gave is tfs logs.\nHe says, my username doesn't come with requests (tracked by syncing my attempts timestamps with logs).\n\n2018-07-19 07:04:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.3.9600.0;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 401 2 5 62\n2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 2 5 62\n2018-07-19 07:23:00 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 - ANOTHERIP git/2.18.0.windows.1 - 401 1 3221225581 187\n\n\nwhile others include it\n\n2018-07-19 05:44:27 SOMEIP GET /tfs/SOMEFOLDER/_git/REPOSITORY/info/refs service=git-upload-pack 443 DOMAIN\\LOGIN ANOTHERIP git/2.12.2+(Microsoft+Windows+NT+6.1.7601+Service+Pack+1;+Win32NT+x64)+CLR/4.0.30319+VS15/15.0.0 - 200 0 0 265" ]
[ "windows", "git", "tfs", "credentials" ]
[ "How do I choose antecedent for apriori function?", "How can I set the antecedent for the apriori function? I would like to recommend products for any given antecedent using the apriori rule." ]
[ "r", "arules" ]
[ "mpirun was unable to find the specified executable file, with java", "I want to run the two java examples Hello.java and Ring.java from this website.\nI compiled them with \n\n ./configure --enable-mpi-java\n\n\nthis line worked without any problem.\n\nthen I called this line: \n\nmpirun -np 2 Hello.java\n\n\nBut I get this error:\n\nmpirun was unable to find the specified executable file, and therefore\ndid not launch the job. This error was first reported for process\nrank 0; it may have occurred for other processes as well.\n\nNOTE: A common cause for this error is misspelling a mpirun command\n line parameter option (remember that mpirun interprets the first\n unrecognized command line token as the executable).\n\nNode: alliance\n\nExecutable: Hello.java\n\nthe same occured when I call \n\nmpirun -np 2 Ring.java\n\n\nCan any one help me to solve problem?\n\nPS: this question is not a duplicate with this question, because my question is in java, but the other in c++." ]
[ "java", "mpi", "openmpi" ]
[ "Custom components not being matched using react-router", "I am trying to separate concerns with my Routes, keep my react code more organized. I am currently using react-router-dom v5.\nI have an Application Routes component that has 3 children as components\n\nAuthenticatedRoutes\nPublicRoutes\nError404Route\n\nEach component renders different routes/components, but only the first component (AuthenticatedRoutes) is being matched.\nApplication Routes\nexport const ApplicationRoutes = () => (\n <Switch>\n <AuthenticatedRoutes />\n <PublicRoutes />\n <Error404Route />\n </Switch>\n);\n\nAuthenticated Routes\nexport const AuthenticatedRoutes = () => (\n <Switch>\n <Route exact path='/dashboard'>\n <Dashboard />\n </Route>\n <Route exact path='/profile'>\n <Profile />\n </Route>\n </Switch>\n);\n\nPublic Routes\nexport const PublicRoutes = () => (\n <Switch>\n <Route exact path='/about'>\n <About />\n </Route>\n <Route exact path='/'>\n <Home />\n </Route>\n </Switch>\n);\n\nError Route\nexport const Error404Route = () => (\n <Switch>\n <Route>\n <Error404 />\n </Route>\n </Switch>\n);\n\nSo, was I was saying only the AuthenticatedRoutes (/dashboard and /profile) are being matched, the public routes and error404 route are not.\nI thought that if you used a Switch the route will try to match the location pathname, if not, then the Error404Route will display.\nAm I missing something? (sure I am)\nThanks!" ]
[ "javascript", "reactjs", "typescript", "react-router", "react-router-dom" ]
[ "How can I get a button's outline to fill the span in which it is contained?", "The blue in the following image is the button, and the green represents the span in which it is enclosed.\n\n\n\nWhen I click, I want the button's color change and click effect to fill up the entire span. Right now, it only fills up the blue area.\n\nI have tried button-block on the button, as well as width:100%. This is all taking place in my nav bar, by the way. \n\nEDIT:\nCode:\n\n\r\n\r\n <ul class=\"nav nav-tabs\">\r\n <li><img src=\"assets/mylogo.png\" class=\"logo-small\"></li>\r\n\r\n <div class=\"input-group\" style=\"width:80%;\">\r\n <input type=\"text\" class=\"form-control\" style=\"height: 60px; border: 0; outline:none; box-shadow: none;\" placeholder=\"Search here\" onsubmit=\"do()\"/>\r\n <span type=\"button\" class=\"input-group-addon\" id=\"shade\" style=\"background-color: transparent; border-color: white;\">\r\n <button class=\"btn search-button\" type=\"submit\" onclick=\"this.blur();\" style=\"display: block; box-sizing: border-box; width:100%;\">\r\n <i class=\"fa fa-2x fa-search\"></i>\r\n </button>\r\n </span>\r\n </div>\r\n </ul>" ]
[ "jquery", "html", "css", "twitter-bootstrap", "twitter-bootstrap-3" ]
[ "What are all the types of NSNotifications?", "Do you know of a comprehensive list of all possible NSNotifications? Please let me know.\nThanks." ]
[ "iphone", "objective-c", "cocoa-touch", "xcode", "ios" ]
[ "Passing a value from my .click() function to an if statement", "I have this html code \n\n<p id = \"line1\"> You are in a field </p>\n<button id = \"btn1\"> [ Go to cave ] </button>\n\n\nand this javascript code using jQuery\n\nvar bar = 0; \n$(document).ready(function(){\n $(\"#btn1\").click(function(){\n console.log(\"Going to cave entrance\");\n bar = 1;\n });\n if (bar){\n console.log(\"At entrance\");\n $(\"#line1\").html(\"Go into cave?\");\n $(\"#btn1\").html(\"Yes!!\");\n }\n else{\n console.log(\"I am error\");\n }\n });\n\n\nAs you can see I have a button that sets the variable bar to 1 and an if statement that is waiting for bar to be 1. However, when I click on the button, the if statement never executes. \n\nThe variable bar is set to 1 and console.log(\"Going to cave entrance\") prints, but nothing else is executed.\n\nIt is like the execution is stuck in the .click() function." ]
[ "javascript", "jquery", "html" ]
[ "How can I prove that the posterior of the variance of a linear regression model follows an Inverse Gamma distribution with a flat prior?", "Assume I have a linear regression model Y = X*alpha + e and a flat prior with P(sigma^2) prop to 1. I know that the posterior is proportional to likelihood * prior. The e here follows a multivariate normal distribution. How can I prove that under these assumptions the posterior P(sigma^2 | y = (y1, y2, ....., yn)) follows Inverse Gamma distribution?\nI know that,\nP(sigma^2 | y = (y1, y2, ....., yn)) = L(y | sigma^2) * P(sigma^2) = L(y|sigma^2)\nFrom here how can I prove the rest? Some hints will be appreciable." ]
[ "statistics", "probability" ]
[ "Submit values with link_to in Rails 5.1", "So currently i have a link_to, where signed in users can click on: \n\n<%= link_to \"Enroll\", [@task.project, @task] %>\n\n\nThe user has an association with the project, through subscription. To create a new subscription for a user with a project, i wrote some simple form for it.\n\n<%= form_for([@project, @subzz]) do |f| %>\n\n\n\n <%= f.hidden_field :project_id, :value => @project.id %>\n <%= f.hidden_field :user_id, :value => current_user.id %>\n\n <div class=\"actions\">\n <%= f.submit %>\n </div>\n<% end %>\n\n\nWhich works fine and creates the association. However, i want that the user is able to create the subscription whenever he clicks on 'enroll' instead of a second, extra submit button. \n\nAny ideas how to approach this? I thought about using jQuery, but not sure how to inject the ids with it and if its the 'right' way to do it. \n\nThanks in advance everyone!\n\nEDIT:\n\nWhen using the method posted as answer, i get:\n\nparam is missing or the value is empty: sub\n\n\nMy updatet form:\n\n <%= form_for([@project, @subzz], html: {role: \"form\", id: \"project_form\"}) do |f| %>\n\n <%= hidden_field_tag :project_id, :value => @project.id %>\n <%= hidden_field_tag :user_id, :value => current_user.id %>\n\n\n <%= link_to \"Enroll\", [@task.project, @task], :onclick => \"$('#project_form').submit() \"%>\n\n <% end %>\n\n\nsubs_controller.rb\n\nclass SubsController < ApplicationController\n\n def create\n @subz = Sub.create(sub_params)\n project = @subz.project\n\n redirect_to root_path\n end\n\n\n\n\n\n private\n\n\n def sub_params\n params.require(:sub).permit(:project_id, :user_id)\n end\n\nend" ]
[ "ruby-on-rails" ]
[ "'Promise' only refers to a type, but is being used as a value here", "Error:\n[js] 'Promise' only refers to a type, but is being used as a value here.\n\nI have set \"checkJS\": true and \"jsx\": \"react\" in jsconfig.json. This is not for ts.\n\nasync function readAsArrayBuffer(blob) {\nreturn new Promise((resolve, reject) => {\n let reader = new FileReader();\n // @ts-ignore\n reader.addEventListener('load', e => resolve((e.target).result));\n // @ts-ignore\n reader.addEventListener('error', e => reject((e.target).error));\n reader.readAsArrayBuffer(blob);\n });\n}\n\n\nScript ofcourse working good.\n\nHow do I fix this unnecessary error?" ]
[ "javascript", "visual-studio-code", "create-react-app" ]
[ "rails 5 form_with not processing nor permitting nested attributes", "A parent class 'model'\n\nhas_many :modelbodycontacts\nhas_many :bodycontacts, through: :modelbodycontacts\naccepts_nested_attributes_for :modelbodycontacts, allow_destroy: true\n\n\nmodelbodycontacts being a join table for model and bodycontact.\nThe related controller permits\n\nparams.require(:model).permit(:name, :modelbodycontact_attributes)\n\n\nHowever, using form_with \n\n<%= form_with(model: model, local: true) do |form| %>\n <%= form.fields(:modelbodycontact) do |bodycontact_fields| %>\n <% @bodycontacts.each do |bodycontact| %> \n <%= bodycontact_fields.check_box :bodycontact_id %><%= bodycontact.name %>\n <% end %> \n <% end %>\n\n\ngenerates the following HTML \n\n<input name=\"model[modelbodycontact][bodycontact_id]\" type=\"hidden\" value=\"0\" /><input type=\"checkbox\" value=\"1\" name=\"model[modelbodycontact][bodycontact_id]\" id=\"model_modelbodycontact_bodycontact_id\" /> Seat\n<input name=\"model[modelbodycontact][bodycontact_id]\" type=\"hidden\" value=\"0\" /><input type=\"checkbox\" value=\"1\" name=\"model[modelbodycontact][bodycontact_id]\" id=\"model_modelbodycontact_bodycontact_id\" /> Back\n\n\nsubmitting data leads to Unpermitted parameter: :modelbodycontact\n\nThere are a few errors here: \n\n\nthe bodycontact_id is not being generated in the HTML code, only the checked/unchecked values, thus a child record cannot be properly created\nthe parameters are not being permitted; particularly, the reference is to the model name, not its attribute(s)\nDocumentation indicates that \"The form_with method automatically includes the model id as a hidden field in the form.\" Well, it ain't there... But possibly Rails handles that internally knowing it is a nested\n\n\nOne could revert to form_for and its tried and tested ways, but that will be eventuall be deprecated. How can form_with be properly used here?" ]
[ "ruby-on-rails" ]
[ "Install Redis Cache in Library Project", "We have an MVC 5 WebApp and several class libraries all part of the same solution.\n\nThe WebApp is in Azure and we are using the StackExchange Redis as our caching.\n\nWe wanted to know if it is ok to add the Exchange Redis package to one of our class libraries instead of the WebApp. Will the connection string that is added to our Web.config file in the WebApp be accessible from our Library.\n\nMany thanks" ]
[ "azure-redis-cache" ]
[ "How should i implement flat app templates custom date field in my php file?", "How can I get the date values when datepicker is getting generated by div class ?\n\n<div id=\"example-advanced-daterangepicker\" class=\"item\">\n <i class=\"fa fa-calendar\"></i>\n <span id=\"date_custom\"></span>\n <b class=\"caret\"></b> \n</div>\n\n\nso how can i get the value from it?" ]
[ "javascript", "php", "jquery" ]
[ "simple android calculator returning too many zeros and wrong decimal point", "So the output \"H\" in this gives me too long of a number with the decimal point in the wrong spot, but otherwise the whole number is correct. Example:\n\n333433.33333 is what gets displayed\n333.43 should be displayed\n\nI suspect the culprint is \n\n `h = (double) Math.round(h * 100000) / 100000;`\n\n\nBut when I change it to h = (double) Math.round(h * 1000) / 1000; it doesn't seem to help.\n\npublic class DoFCalculator extends Fragment {\n\nEditText txtF;\nSpinner aSpinner, cSpinner;\n\n@Override\npublic View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View rootView = inflater.inflate(R.layout.calculators_fragment_dof, container, false);\n\n\n Button button = (Button) rootView.findViewById(R.id.btn_Cal);\n aSpinner = (Spinner) rootView.findViewById(R.id.aSpinner);\n txtF = (EditText) rootView.findViewById(R.id.focal_length);\n cSpinner = (Spinner) rootView.findViewById(R.id.coc);\n final TextView txtAnswer = (TextView) rootView.findViewById(R.id.txt_H);\n\n\n\n button.setOnClickListener(new OnClickListener() {\n @Override\n public void onClick(View v) {\n String F = txtF.getText().toString();\n String A = aSpinner.getSelectedItem().toString();\n String C = cSpinner.getSelectedItem().toString();\n if (!F.isEmpty() ) {\n txtAnswer.setText(\"H = \" + Calcullate_H(F, A, C) + \"\");\n } else {\n Toast.makeText(getActivity(), \"All data Required\", Toast.LENGTH_LONG).show();\n }\n }\n });\n\n\n return rootView;\n}\n\nprivate double Calcullate_H(String txtF, String txtA, String txtC) {\n double f = Double.parseDouble(txtF.toString());\n double A = Double.parseDouble(txtA.toString());\n double C = Double.parseDouble(txtC.toString());\n double h = ((f * f) / (A * C)) + f;\n h = (double) Math.round(h * 100000) / 100000;\n return h;\n}\n\n\n}" ]
[ "java", "android", "math", "calculator" ]
[ "my app is not running still in my phone but is not showing any error", "It Shows no error on Android Studio but app even not starting on phone.Is there any problem with the code.I feel like there may be any mistakes in syntax but i am not able to find one.Please help me. \n\nimport android.content.Intent;\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.Button;\n\npublic class MainActivity extends AppCompatActivity {\n private Button bDriver,bCustomer;\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n Button bDriver=(Button)findViewById(R.id.driver);\n Button bCustomer=(Button)findViewById(R.id.customer);\n bDriver.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent intent=new \n Intent(MainActivity.this,DriverLoginActivity.class);\n startActivity(intent);\n finish();\n }\n\n });\n bCustomer.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View view) {\n Intent ryt=new \n Intent(MainActivity.this,CustomerLoginActivity.class);\n startActivity(ryt);\n finish();\n\n }\n });\n }\n }\n\n\nAnd activity_main.xml is this and please explain if there is any problem related to SDK version also upload the detail.\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:paddingBottom=\"@dimen/activity_vertical_margin\"\nandroid:paddingLeft=\"@dimen/activity_horizontal_margin\"\nandroid:paddingRight=\"@dimen/activity_horizontal_margin\"\nandroid:paddingTop=\"@dimen/activity_vertical_margin\"\ntools:context=\"com.trillcore.uber.MainActivity\">\n\n<Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:id=\"@+id/driver\"\n android:layout_below=\"@+id/customer\"\n android:text=\"I am a Driver\"/>\n\n<Button\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:text=\"I am a Customer\"\n android:layout_above=\"@+id/driver\"\n android:id=\"@+id/customer\"/>\n </RelativeLayout>" ]
[ "android", "runtime-error" ]
[ "Unable to set margin of item in ListView using custom Adapter", "I am attempting to set variable left margins for items in my ListView. The problem occurs in my custom Adapter in the getView method:\n\n public View getView(int position, View convertView, ViewGroup parent) {\n if(convertView == null){\n Comment c = comments.get(position);\n convertView = inflater.inflate(R.layout.list_item, null); \n (TextView)convertView.findViewById(R.id.story)).setText(c.message);\n\n\n }\n RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);\n lp.setMargins(0, c.getDepth() * 5, 0, 0); \n convertView.setLayoutParams(lp);\n\n return convertView;\n }\n\n\nWe inflate the list_item layout which is a RelativeLayout with some textViews inside. I then attempt to set the margins using a RelativeLayout.LayoutParams. I get a class cast exception on this, but the normal LayoutParams type has no method for setting the margins.\n\nWhat is the best way to go about setting the margin?\n\nHere is the error\n\njava.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams\nat android.widget.ListView.setupChild(ListView.java:1779)\nat android.widget.ListView.makeAndAddView(ListView.java:1748)\nat android.widget.ListView.fillDown(ListView.java:670)\nat android.widget.ListView.fillFromTop(ListView.java:727)\nat android.widget.ListView.layoutChildren(ListView.java:1598)\nat android.widget.AbsListView.onLayout(AbsListView.java:1273)\nat android.view.View.layout(View.java:7192)\nat android.widget.FrameLayout.onLayout(FrameLayout.java:338)\nat android.view.View.layout(View.java:7192)\nat android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)\nat android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)\nat android.widget.LinearLayout.onLayout(LinearLayout.java:1047)\nat android.view.View.layout(View.java:7192)\nat android.widget.FrameLayout.onLayout(FrameLayout.java:338)\nat android.view.View.layout(View.java:7192)\nat android.view.ViewRoot.performTraversals(ViewRoot.java:1145)\nat android.view.ViewRoot.handleMessage(ViewRoot.java:1865)\nat android.os.Handler.dispatchMessage(Handler.java:99)\nat android.os.Looper.loop(Looper.java:130)\nat android.app.ActivityThread.main(ActivityThread.java:3835)\nat java.lang.reflect.Method.invokeNative(Native Method)\nat java.lang.reflect.Method.invoke(Method.java:507)\nat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)\nat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)\nat dalvik.system.NativeStart.main(Native Method)" ]
[ "android", "android-listview", "custom-adapter" ]
[ "Event MyEvent has ID 2 which is already in use", "I am implementing event tracing using EWT in a Service Fabric application and are faced with these errors\n\nERROR: Exception in Command Processing for EventSource MyCompany-ServiceFabricApplication-LiveDataReader: Event OnCommandMessageReceived has ID 2 which is already in use\n\nThe \"OnCommandMessageReceived\" is my custom event \n\n[Event(2, Level = EventLevel.Verbose, Message = \"Queue client created '{0}'\")]\n public void OnQueueClientCreated(string queueClientName)\n {\n if (IsEnabled())\n {\n WriteEvent(2, queueClientName);\n }\n }\n\n\nI have multiple/many of these errors and I have tried to messing around with numbers but ...\n\nIs there some Powershell command or else that can tell what IDs are in use or is there a safe range or something?\n\nPS: When that event is fired i can see it in visual studio diagnostic events viewer but the Message is empty. It would be cool if it displayed the message from the payload. Is that possible?" ]
[ "powershell", "azure-service-fabric", "etw" ]
[ "Converting Text to varchar(MAX)", "I'm working currently on a SQL Server project that has been built for SQL Server 2000. In some tables of this project, the Text Datatype was used. Because have to do some bigger changes on this database(s), it would be a good occasion to change these fields to VARCHAR(MAX). All SQL Servers are now 2005 and 2008.\n\nAre there any problems to be expected when I change all the Text datatypes to VARCHAR(MAX) or are all features that are supported by the Text datatype also supported by VARHCHAR(MAX).\n\nAs an additional information, the data from the database is queried mostly from a .net application, besides this, also excel, access and some statistical tools access the database directly via odbc/ole-db." ]
[ "sql-server", "sql-server-2005", "ado.net" ]
[ "How to read hdmi Input frame buffer using Directx?", "I am trying to capture hdmi Input frame buffer using DirectX in windows. I have been able to find the examples to capture the video frame or stream from a camera using DIRECT X. However I have not been able to find any resource that can help me to read the HDMI IN frame buffer using DIRECT X. Moreover, I know that HDMI content is HDCP protected. It cannot be decoded without a capture card. I have one with me from startech.com but I don't know how to use the video capture card in DIRECT X and capture the frames and process them. Any suggestions to achieve this will be really appreciated." ]
[ "directx", "framebuffer", "hdmi" ]
[ "Cursor to select max date without MAX function or subqueries", "I am required to use an explicit cursor with a parameter that accepts car registration to find the most recent reservation made on the car. I cannot use the \nMAX function. I have to compare all the relevant dates to find the most recent one.\n\nThis is what I have so far\"\n\nDeclare\n v_rec_date DATE; \n Cursor date_cur (v_reg VARCHAR2) IS \n SELECT * FROM i_booking\n WHERE registration = v_reg;\n v_date date_cur%ROWTYPE;\n Begin\n FOR v_date IN date_cur LOOP \n DBMS_OUTPUT.PUT_LINE('Recent Rental Date:'|| ' '||v_rec_date); \n END LOOP;\n End;\n\n\nHowever this is giving me the error:\n\nFOR v_date IN date_cur LOOP\n *\nERROR at line 8: \nORA-06550: line 8, column 15: \nPLS-00306: wrong number or types of arguments in call to 'DATE_CUR' \nORA-06550: line 8, column 1: \nPL/SQL: Statement ignored \n\n\nWhere am I going wrong here?" ]
[ "sql", "oracle" ]
[ "Error while connecting to sqlite. Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied", "I am trying to make a connection to my (pysqlcipher) encrypted sqlite database but I am failing because PRAGMA key input is incorrect. I have my correct password 'test' in a separate .env file.\nEven though everything should be correct I get the following ERROR message: Error while connecting to sqlite. Incorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied.\nHow can I solve this? I think it is syntax error.\n.env file\nDATABASE_SECRET_KEY = test\n\nPYTHON SCRIPT\nimport sqlite3\nimport os\nfrom flask import Flask, render_template, jsonify, request, flash, redirect, url_for, session\nfrom pysqlcipher3 import dbapi2 as sqlite3\n\nsqliteConnection = sqlite3.connect('./database/test.db')\ncursor = sqliteConnection.cursor()\n\nPRAGMA_key = os.environ.get("DATABASE_SECRET_KEY")\ncursor.execute("PRAGMA key = \\'%s\\';", [PRAGMA_key])\n\nprint("Successfully Connected to SQLite")\n\n\nERROR\nError while connecting to sqlite.\n\nIncorrect number of bindings supplied. The current statement uses 0, and there are 1 supplied." ]
[ "python", "sqlite", "sqlcipher", "pysqlite", "pysqlcipher" ]
[ "Do something if opening Activity from notification", "I'm trying to make my activity do something if it's opened from a notification. In my BroadcastReceiver, I have this:\n\nBundle extras = intent.getExtras();\nIntent startServiceIntent = new Intent(context, MainActivity.class);\nstartServiceIntent.putExtra(\"fromNotification\", true);\nstartServiceIntent.putExtras(extras);\ncontext.startService(startServiceIntent);\n\n...\n\nPendingIntent myIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);\n\n\nAnd in my main activity, I try to call it:\n\nBundle extras = getIntent().getExtras();\nif(extras != null) {\nif(extras.getBoolean(\"fromNotification\")) {\nToast.makeText(this, \"from notification\", Toast.LENGTH_LONG).show();\n}\n} else {\nToast.makeText(this, \"extras = \" + extras, Toast.LENGTH_LONG).show();\n}\n\n\nProblem is that the else statement always fires, saying extras is null.\n\nWhat am I missing here?\n\nUPDATE:\n\nBroadcastReceiver\n\nIntent startServiceIntent = new Intent(context, MainActivity.class);\nstartServiceIntent.putExtra(\"fromNotification\", true);\ncontext.startService(startServiceIntent);\n\n\nMainActivity\n\nboolean fromNotification = getIntent().getBooleanExtra(\"fromNotification\", false);\nif (fromNotification) {\nToast.makeText(this, \"from notification\", Toast.LENGTH_LONG).show();\n} else {\nToast.makeText(this, fromNotification + \" elsewhere\", Toast.LENGTH_LONG).show();\n}" ]
[ "java", "android" ]
[ "Tasks or Actions for Plugins?", "I've noticed that many of the current plugins that have return values or multiple results use actions. For example, PictureChooserTask.TakePicture takes in an Action<Stream> for success and an Action for canceled.\n\nWhat I want to know is why not have PictureChooserTask.TakePicture return a Task<Stream>? Are Tasks not supported cross platform?\n\nSorry if this is a noob question but I'm coming from Windows and haven't taken any of my mvvmcross projects to other platforms yet. I prefer to use Tasks but I want to make sure I'm following the right pattern before I write my first plugin.\n\nThanks!" ]
[ "mvvmcross" ]
[ "how to read /dev/ttyUSB0 device in Linux?", "I have connected a USB RFID in serial port and use to read RFID tags. So I need to read the data from the device and process the output.\nI am getting the data with screen command from Linux command line but I was not able to take the value from screen and cannot pass to my application.\nIs there any other way to read from /dev/ttyUSB0?\nI have used the code shown below but it shows currently the resource is unavailable (even though I have given chmod permissions)\n\n#include <stdio.h> // standard input / output functions\n#include <stdlib.h>\n#include <string.h> // string function definitions\n#include <unistd.h> // UNIX standard function definitions\n#include <fcntl.h> // File control definitions\n#include <errno.h> // Error number definitions\n#include <termios.h> // POSIX terminal control definitions\n\nint main()\n{\n /* Open File Descriptor */\n int USB = open( \"/dev/ttyUSB0\", O_RDWR| O_NONBLOCK | O_NDELAY );\n\n /* Error Handling */\n if ( USB < 0 )\n {\n //cout << \"Error \" << errno << \" opening \" << \"/dev/ttyUSB0\" << \": \" << strerror (errno) << endl;\n perror(\"USB \");\n }\n\n /* *** Configure Port *** */\n struct termios tty;\n memset (&tty, 0, sizeof tty);\n\n /* Error Handling */\n if ( tcgetattr ( USB, &tty ) != 0 )\n {\n //cout << \"Error \" << errno << \" from tcgetattr: \" << strerror(errno) << endl;\n perror(\"tcgerattr \");\n }\n\n /* Set Baud Rate */\n cfsetospeed (&tty, B9600);\n cfsetispeed (&tty, B9600);\n\n /* Setting other Port Stuff */\n tty.c_cflag &= ~PARENB; // Make 8n1\n tty.c_cflag &= ~CSTOPB;\n tty.c_cflag &= ~CSIZE;\n tty.c_cflag |= CS8;\n tty.c_cflag &= ~CRTSCTS; // no flow control\n tty.c_lflag = 0; // no signaling chars, no echo, no canonical processing\n tty.c_oflag = 0; // no remapping, no delays\n tty.c_cc[VMIN] = 0; // read doesn't block\n tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout\n\n tty.c_cflag |= CREAD | CLOCAL; // turn on READ & ignore ctrl lines\n tty.c_iflag &= ~(IXON | IXOFF | IXANY);// turn off s/w flow ctrl\n tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw\n tty.c_oflag &= ~OPOST; // make raw\n\n /* Flush Port, then applies attributes */\n tcflush( USB, TCIFLUSH );\n\n if ( tcsetattr ( USB, TCSANOW, &tty ) != 0)\n {\n //cout << \"Error \" << errno << \" from tcsetattr\" << endl;\n }\n\n /* *** WRITE *** */\n\n unsigned char cmd[] = {'I', 'N', 'I', 'T', ' ', '\\r', '\\0'};\n //int n_written = write( USB, cmd, sizeof(cmd) -1 );\n\n /* Allocate memory for read buffer */\n char buf [256];\n memset (&buf, '\\0', sizeof buf);\n\n /* *** READ *** */\n int n = read( USB, &buf , sizeof buf );\n\n /* Error Handling */\n if (n < 0)\n {\n //cout << \"Error reading: \" << strerror(errno) << endl;\n perror(\"read error \");\n }\n\n /* Print what I read... */\n //cout << \"Read: \" << buf << endl;\n printf(\"%s\",buf);;\n\n close(USB);\n}" ]
[ "c++", "c", "linux", "sockets", "rfid" ]
[ "I have HTML code embedded in an XML file displaying as code in browser", "I have HTML code in entity form, such as \n\n<zh_tw shortText=\"\"> </zh_tw> \n\n\nembedded in an XML file. I would for that text to be rendered as HTML when I view the XML text in a browser. I have a simple XSLT created for the XML file to be transformed into a table format, but I don't want the HTML code to display as code.\n\nHere is a sample of the code in XML:\n\n<?xml-stylesheet type='text/xsl' href='Simple.xslt'?>\n<Projects>\n <Project>\n <Text Type=\"surveyitem\" SubType=\"intro\" TranslationGroupID=\"46675\">\n <zh_tw shortText=\"\"> </zh_tw>\n </Text>\n <Scale Type=\"scaletext\" ScaleTextID=\"23501\">\n <en_us>to translate</en_us>\n <zh_tw>to translate</zh_tw>\n </Scale>\n </Text>\n </Project>\n</Projects>\n\n\nHere is the XSLT I am using:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n\n<xsl:output method=\"html\" indent=\"yes\" version=\"4.0\"/>\n\n\n<xsl:template match=\"/\">\n\n <html>\n <body>\n <table border=\"1\">\n <tr bgcolor=\"#9acd32\">\n <th>Translation</th>\n </tr>\n <xsl:for-each select=\"Projects/Project/Text\">\n <tr>\n <td><xsl:value-of select=\"zh_tw\"/></td>\n </tr>\n </xsl:for-each>\n <xsl:for-each select=\"Projects/Project/Text/Scale\">\n <tr>\n <td><xsl:value-of select=\"zh_tw\"/></td>\n </tr>\n </xsl:for-each>\n </table>\n </body>\n </html>\n\n </xsl:template>\n</xsl:stylesheet>" ]
[ "html", "xml", "xslt" ]
[ "Error during passing data from parent to child component with input binding", "I am trying to pass data from parent component to child component using input binding. It is a simple boolean field. I followed this Angular tutorial to accomplish it but I am still not able to get anything from parent to child component. \n\nAlso I dont know if its worth mentioning, at first I was getting the below error then I added schemas: [NO_ERRORS_SCHEMA] in my app module and it went away. \n\n\nBelow is my parent component.ts code for the variable I want to pass:\n\n public isAnAuthorizedUser: boolean = true;\n\n ngOnInit(): void {\n\n if (test != null) {\n console.log(\"Inside NGOnInit on page 1\");\n this.route.params\n .switchMap((params: Params) => this._Service.getRequestById(+params['id']))\n .subscribe(\n data => {\n this.Model = data;\n if (this.Model.isAuthorizedToView != true)\n {\n this.isAnAuthorizedUser = false;\n this._router.navigate(['/dashboard']);\n }\n }\n\n\nHere is my parent component html that I am trying to pass.\n\n <div>\n <isAnAuthorizedUser [data]=\"isAnAuthorizedUser\"></isAnAuthorizedUser>\n </div>\n\n\nBelow is my child component TS file code:\n\n import { Component, OnInit, Input, Injectable, ViewChild } from '@angular/core'\nimport {\n FormsModule,\n ReactiveFormsModule,\n FormGroup,\n FormControl\n} from '@angular/forms';\nimport { HttpModule } from '@angular/http';\n\n@Component({\n moduleId: module.id,\n selector: 'ReservationFormPage1',\n templateUrl: './ReqDashboard.html'\n ,\n providers: [ReqFormService, CompleteRequestService, IncompleteRequestService]\n})\n\nexport class ReservationDashboardComponent implements OnInit {\n\n @Input()\n isAnAuthorizedUser: boolean;\n ngOnInit(): void {\n console.log(this.isAnAuthorizedUser);\n }\n\n}\n\n\nBelow is the HTML code where I am testing to access my pass in varianble:\n\n <div *ngIf =\"isAnAuthorizedUser\">\n <span>{{this.isAnAuthorizedUser}}</span>\n </div>" ]
[ "angular" ]