texts
sequence
tags
sequence
[ "Is Angular string binding safe for xss prevention?", "I have recently started using Angular. I am normally used to purify any html that is stored in my database. My backend uses php I use HTMLpurifier to purify html. But when I use angular string binding html entities for example don't display correctly:\ndata = '<data'\n\n//template string binding:\n<div>{{data}}</div>\n\nOutput on website: <data\n\nSo I saw in another question that I should use:\n[innerHTML]='data'\nDisplay HTML special characters in Angular 2 bindings?\nMy question is: Is it necessary to purify my html at all? Since it seems like angular string binding does prevent XSS from happening. That would be nice since that will speed up the performance of my server because it doesn't have to purify the html." ]
[ "javascript", "html", "angular", "xss", "htmlpurifier" ]
[ "How do I make my layout look the same in all resolutions?", "I'm just learning here and have tried all the different types of divs (absolute, relative, fixed, etc.) but I'm really having trouble figuring this out. \n\nThis is the website I'm working on: http://www.chelseyburch.com\n\nOn my computer, at 1366 x 768, it looks exactly how I want it to. But when I try on any other resolution or change the browser size there is a huge amount of space between the header and the slider. Also, with the gallery carousel sliders (on the people, places, things links) there is a lot of space in between the images. \n\nI'm sorry if this seems like a stupid question, but I'm really having difficulty figuring out how to make it look the same across all resolutions. \n\nThis is what it looks like. I know it's all over the place, this is why I'm asking for help. Thanks in advance.\n\n#header {\n float: left;\n position: relative;\n margin: 30px;\n}\n\n#social {\n float: right;\n position: fixed;\n top: 30px;\n right: 0;\n margin: 5px;\n}\n\n#slidy-container {\n width: 100%; \n overflow: hidden;\n position: absolute;\n left: 0;\n bottom: 0;\n}\n\n.jcarousel-wrapper {\n height: 480px;\n width: 100%;\n position: fixed;\n left: 0;\n bottom: 0;\n}" ]
[ "jquery", "html", "css", "positioning" ]
[ "RewriteRule in .htaccess to rewrite query parameters like path/X to script.php?parameter=X", "This is my htaccess code:\n\nRewriteRule ^profiles/([a-zA-Z0-9_-]+)$ index.php?page=profile&c=search&min=$1 [L,NC]\n\n\nWhen I request:\n\nprofiles/0\n\n\nWhat should I do to get the result as follows:\n\nprofiles?min=0&max=100\n\n\nor \n\nprofiles/?min=0&max=100" ]
[ ".htaccess" ]
[ "Informatica PIM-Server installation", "I am getting an error, when trying to install Informatica PIM 7.1.03(Product Information Management) core server on Windows Server 2012 R2, as below\n\nCould not initialize persistence layer\n\njava.lang.IllegalArgumentException: No PersistenceMetamodel available for platform datasource: XXX\n\n\nat com.heiler.ppm.persistence.db.internal.DataSourceRegistryImpl.getMetamodel(DataSourceRegistryImpl.java:241)\n\nAnyone who've already done the installation of Informatica PIM-server, please help me." ]
[ "informatica" ]
[ "ASP IF Logic not fully functioning", "I have a login form that checks for roles and when the credentials are met, the user is directed to a specific page. My issue is that when the username or password is incorrect, my logic fails to prompt the user via a label that I have in the design. I even tried implementing it via a Try/Catch and still the same result. \n\nThe Design: \n\n<div><asp:Label ID=\"lblinfo\" runat=\"server\" Width=\"374px\" CssClass=\"blktext\"></asp:Label></div>\n\n\nThe code in behind the (button event-handler):\n\n Try\n Dim con As New SqlConnection(GetConnectionString())\n con.Open()\n\n Dim cmd As New SqlCommand(\"Check_Users\", con)\n cmd.CommandType = CommandType.StoredProcedure\n\n Dim p1 As New SqlParameter(\"Login_name\", username.Text)\n Dim p2 As New SqlParameter(\"Login_Pwd\", password.Text)\n\n cmd.Parameters.Add(p1)\n cmd.Parameters.Add(p2)\n Dim rd As SqlDataReader = cmd.ExecuteReader()\n\n 'check the Role of the user logging in'\n While (rd.Read())\n Session(\"numrecord\") = rd.GetValue(0).ToString()\n rd.GetValue(11).ToString()\n\n If rd.HasRows Then\n If rd.GetValue(11).ToString() = 1 Then\n rd.Read()\n lblinfo.Text = \"You are Authorized.\"\n FormsAuthentication.RedirectFromLoginPage(username.Text, True)\n Response.Redirect(\"securepages/SecurePage.aspx\")\n Else\n lblprompt.Text = \"Invalid username or password.\"\n End If\n If rd.GetValue(11).ToString() = 2 Then\n rd.Read()\n FormsAuthentication.RedirectFromLoginPage(username.Text, True)\n Response.Redirect(\"securepages/newShipment.aspx\")\n Else\n lblprompt.Text = \"Invalid username or password.\"\n End If\n End If\n End While\n Catch ex As Exception\n lblprompt.Text = \"Invalid username or password.\"\n End Try\n\n\nCould I get some help as to what am failing to do here?" ]
[ "asp.net", "vb.net" ]
[ "PHP - How to serialize data with special characters from database?", "i have a string with special characters, like:\n\n$text = \"NÃO\";\n\n\nWhen i use serialize($text), returns\n\na:1:{i:0;s:4:\"NÃO\";}\n\n\nbut when i use a string that i get from my database, like:\n\n$query = SELECT special_text FROM ...\n(...)\n$text = $row->\"special_text\"\nserialize($text);\n\n\nreturns\n\na:1:{i:0;s:3:\"NÃO\";}\n\n\n, what is crashing my script.\n\nwhat i have to do when i serialize data from database?\nThx, and sorry for my english" ]
[ "php", "database", "serialization" ]
[ "Multiple users of RStudio on virtual machine gives fatal error", "We use an installation of RStudio on a virtual machine, accessible by multiple users. With version 0.98.501 this was no problem. Lately we installed version 0.99.447 and now RStudio gives an error as soon as somenone tries to open RStudio as a second user. Also we changed R version from 3.1.1 to 3.2.1, but this doesn't seem to cause the problem because opening of R without RStudio by multiple users is still possible.\nThis is the error:\n\nHas anyone an idea what's going wrong here? Many thanks in advance!\nEDIT The dutch error message says something like: "the path to the storage place(?) is invalid"." ]
[ "r", "rstudio" ]
[ "Add input controls to jQuery DataTables dynamically", "Let me begin by saying I am not an expert frontend (jQuery/JavaScript) developer. I am using the jQuery DataTables plugin in my current project and rendering a Bootstrap timepicker control in all the cells of table (all rows and columns except headers).\n\n<tr>\n<td>\n\n<div id =\"abc\">\n<div class=\"times-div\">\n<div class=\"time-label col-sm-6 \">Time</div>\n<div class=\"time-view col-sm-6 bootstrap-timepicker\">\n\n\n<input id=\"open\" type=\"text\" value=\"\" class=\"timepicker\" style=\"border: 0px; padding: 0px; margin: 0px; width: 100%;\">\n</div>\n</div>\n</td>\n</tr>\n\n\nfollowed by an action link \n\nadd time\n\nThe requirement is that when I click on action link , add Time, the new input control should appear in the same cell. i.e. another div with id(\"abc\") should be created in the same cell.\n\nI want to know if that is possible using any plugin of datatable? I tried myself using a dirty way by manipulating html like\n\nvar element = document.getElementById(\"abc\");\nvar parent = element.parentNode;\nvar newdiv = document.createElement('div');\nnewdiv.innerHTML = '<div class=\"times-div\"> \n\n\n(full html div block then)\n\nparent.appendChild(newdiv);\n\n\nthis is adding control but timepicker events are not working. I know its not a good way but still tried :). I am also using a couple of data attributes that i removed from code to simplify the code. \n\nI am looking forward for a nice and cleaner way to add the input controls while clicking add time link and I am saving the data on change event of timepicker control." ]
[ "javascript", "jquery", "html", "twitter-bootstrap", "datatables" ]
[ "Can I call batch geocoder request with XmlHttpRequest?", "I'm trying to make a batch geocoding call to here.com API using XmlHttpRequest, and I'm getting no results\n\nAccording to HERE.COM documentation, I can make a batch geocoding call to\n\nhttps://batch.geocoder.api.here.com/6.2/jobs?app_id={YOUR_APP_ID}&pp_code={YOUR_APP_CODE}&mailto=<your_email_address>&outdelim=|&outcols=displayLatitude,displayLongitude,locationLabel, houseNumber,street,district,city,postalCode,county,state,country&outputcombined=false\n\n\nand then, in POST body \n\nrecId|searchText|country\n0001|Invalidenstraße 116 10115 Berlin|DEU\n0002|Am Kronberger Hang 8 65824 Schwalbach|DEU\n0003|425 W Randolph St Chicago IL 60606|USA\n\n\nI'm trying to get some response using XmlHttpRequest from JavaScript, using this code:\n\ngeocode = function() {\n var xhttp = new XMLHttpRequest();\n\n var osmURL=\"https://batch.geocoder.api.here.com/6.2/jobs\"\n +\"?app_id=0aApOideNwpiPyzejpFk\"\n +\"&app_code=Hz7Rz_PodmUhdG8KCDSgk_g\"\n +\"&[email protected]\"\n +\"&outdelim=|\"\n +\"&outcols=recId,displayLatitude,displayLongitude\"\n +\"&outputcombined=false\" \n +\"&language=de-DE\"\n\n xhttp.onreadystatechange = function() {\n alert(xhttp.responseText);\n if (this.readyState == 4 && this.status == 200) {\n alert(xhttp.responseText);\n }\n };\n\n xhttp.onload = function() {\n alert(xhttp.responseText);\n alert(this.status);\n if (this.readyState == 4 && this.status == 200) {\n alert(xhttp.responseText);\n }\n };\n\n var postToSend = \n \"recId|searchText|country\" + \"\\r\\n\" +\n \"0001|Invalidenstraße 116 10115 Berlin|DEU\" + \"\\r\\n\" + \n \"0002|Am Kronberger Hang 8 65824 Schwalbach|DEU\" + \"\\r\\n\" +\n \"0003|425 W Randolph St Chicago IL 60606|USA\";\n\n xhttp.open(\"POST\", osmURL, true);\n xhttp.send(postToSend);\n}\n\n\nI expect the output to be something similar to:\n\n<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<ns2:SearchBatch xmlns:ns2=\"http://www.navteq.com/lbsp/Search-Batch/1\">\n <Response>\n <MetaInfo>\n <RequestId>qr9jVjuoFe1mULUvBlXr7UK4dM8BpAkO</RequestId>\n </MetaInfo>\n <Status>submitted</Status>\n <TotalCount>0</TotalCount>\n <ValidCount>0</ValidCount>\n <InvalidCount>0</InvalidCount>\n <ProcessedCount>0</ProcessedCount>\n <PendingCount>0</PendingCount>\n <SuccessCount>0</SuccessCount>\n <ErrorCount>0</ErrorCount>\n </Response>\n</ns2:SearchBatch>\n\n\nbut no results are returned, even no status. I've done individual calls without problems, so the URL must be reachable.\n\nHave you tried something like this?\n\nThanks in advance,\nJoan.\n\nEDIT: Investigating a bit more, I'm getting a \"XMLHttpRequest: Network Error 0x80070005, Access is denied\" error, and something related to CORS. How can I present valid credentials so Access is allowed? Thanks." ]
[ "here-api" ]
[ "Synchronization in Silverlight", "I have two user controls in Silverlight application containing textboxes(1), how can i synchronize these textboxes when i start writing in one of those textboxes." ]
[ "silverlight", "synchronization" ]
[ "react leaflet vector layers (polygon) with unknown amount of points", "I want to create polygon like that: https://react-leaflet.js.org/docs/example-vector-layers\nbut here coordinates are hardcoded, In my example i dont know how much coordinates i will have. I tried to use map function like this but it doesn't work:\n\r\n\r\nconst polygon = data.map( el => {\n return '['+el.coordinates[0]+ ','+el.coordinates[1]+'],'\n })\n\n const multiPolygon = [\n [\n polygon\n ]\n ]\r\n\r\n\r\n\ndoes somebody has any suggestion?" ]
[ "reactjs", "react-leaflet" ]
[ "Objective-C + JSON Parse objectForKey for Google Places API", "I've got this:\n\n //request stuff\nNSString *searchString = [NSString stringWithFormat:@\"Sydney\"];\nNSString *urlString = [NSString stringWithFormat:@\"https://maps.googleapis.com/maps/api/place/textsearch/json?query=%@&sensor=true&key=mykeynotyours!\",searchString];\n\nNSURL *requestURL = [NSURL URLWithString:urlString];\nNSURLRequest *request = [NSURLRequest requestWithURL:(requestURL)];\n\n//response\nNSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];\nNSError *jsonParsingError = nil;\nNSDictionary *locationResults = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError];\n\nNSLog(@\"%@\",locationResults);\n\n\nWhich is spitting out a few results, the first of which is the one I want, but I can't get the lat and lng like I could with other API's by saying:\n\nNSString *stringLatitude = [locationResults objectForKey:@\"lat\"];\n\n\nI suspect that key it's looking for is a subset of the \"results\" key which I don't know how to tell it :-(\n\nResults:\n\n 2013-04-12 18:47:49.784 Test[26984:c07] {\n\"html_attributions\" = (\n);\nresults = (\n {\n \"formatted_address\" = \"Sydney NSW, Australia\";\n geometry = {\n location = {\n lat = \"-33.8674869\";\n lng = \"151.2069902\";\n };\n viewport = {\n northeast = {\n lat = \"-33.4245981\";\n lng = \"151.3426361\";\n };\n southwest = {\n lat = \"-34.1692489\";\n lng = \"150.502229\";\n };\n };\n };\n\n\nAppreciate any guidance!" ]
[ "ios", "objective-c", "xcode", "json", "parsing" ]
[ "VBA Excel Error Run-Time error 53-file not found", "this code used to run perfectly now is having time error 53, file not found. Not sure what is wrong\n\n Sub printxxx()\n' Print_quote XXX Macro\n\nActiveSheet.PageSetup.Orientation = xlLandscape\nWorksheets(\"Quote\").PageSetup.PrintArea = \"$H$6:$Z$133\"\n strFile = ThisWorkbook.Path & \"\\\" & strFile \n ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _\nThisWorkbook.Path & \"\\\" & CreateObject(\"Scripting.FileSystemObject\").GetFile(ThisWorkbook.FullName).ParentFolder.Name & \" XXXQuote \", _\nQuality:=xlQualityStandard, IncludeDocProperties:=True, _\nIgnorePrintAreas:=False, OpenAfterPublish:=True \nActiveSheet.PageSetup.Orientation = xlPortrait \nEnd Sub" ]
[ "excel", "vba" ]
[ "Get up-to-date GPS Location", "To get the location i'm doing this:\n\nif (isGPSEnabled) {\n if (locatTeste == null) {\n locationManager.requestLocationUpdates(\n LocationManager.GPS_PROVIDER,\n MIN_TIME_BW_UPDATES,\n MIN_DISTANCE_CHANGE_FOR_UPDATES, this);\n\n if (locationManager != null) {\n locatTeste = locationManager\n .getLastKnownLocation(LocationManager.GPS_PROVIDER);\n\n }\n }\n}\n\n\nbut sometimes it gives me an out-of-date location... How can i get the up-to-date location?" ]
[ "android", "gps", "location", "locationmanager" ]
[ "Cross domain access to iframe using window.name", "I implemented a script that monitors the iframe name as I understood was OK from various sources on the net. However it seems I must have gotten something wrong - I get \n\nError: Permission denied to access property 'name'\nSource File: http://plungjan.name/test/testwindowname.html\nLine: 16\n\nPlease visit http://plungjan.name/test/testwindowname.html\n\nI would prefer just to fix my script and not use jQuery or DOJO or some other framework. Thanks" ]
[ "iframe", "cross-domain" ]
[ "Intel XDK Cordova and Crosswalk issues", "I made an app with crosswalk optimization. I tried to build my app without the cloud based cordova system. So I followed these steps (indicated in the tutorial):\n\n1- Generate a Package (zip), with all plugins needed. (crosswalk 19 (embeded), minimum android api 14, target android api 21)\n\n2- Created a cordova project (cordova --version ==> 7.0.1)\n\n3- Added android platform\n\n4- Cordova build andoroid.\n\nBut, the build fails. It's give me an error when generates Java code form Crosswalk Web Engine. This is the error:\n\nError: cmd: Command failed with exit code 1 Error output:\nNote: Some input files use or override a deprecated API.\nNote: Recompile with -Xlint:deprecation for details.\nNote: Some input files use or override a deprecated API.\nNote: Recompile with -Xlint:deprecation for details.\nC:\\Users\\pablo\\Desktop\\MyApp\\platforms\\android\\src\\org\\crosswalk\\engine\\XWalkWebViewEngine.java:55: error: XWalkWebViewEngine is not abstract and does not override abstract method evaluateJavascript(String,ValueCallback) in CordovaWebViewEngine\npublic class XWalkWebViewEngine implements CordovaWebViewEngine {\n ^\nNote: Some input files use or override a deprecated API.\nNote: Recompile with -Xlint:deprecation for details.\n1 error\n\nFAILURE: Build failed with an exception.\n\n\nWhat went wrong:\nExecution failed for task ':compileDebugJavaWithJavac'.\n\n\n Compilation failed; see the compiler error output for details.\n\nTry:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\nPicked up _JAVA_OPTIONS: -Xmx512M\n\n\nI dont understand way this error, maybe versions issues? \n\nThanks!" ]
[ "cordova", "cordova-plugins", "intel-xdk", "crosswalk" ]
[ "Not-equal to character in R", "What is the command for printin the string that are not equal to a specific character? From the data below I would like to print the number of rows where the t5-column does not start with d-. (In this example that is all the rows)\n\nI tried\n\ndim(df[df$t5 !=\"d-\",])\n\ndf: \n\n name freq mir start end mism add t5 t3 s5 s3 DB ambiguity\n6 seq_10002_x17 17 hsa-miR-10a-5p 23 44 5GT 0 d-T 0 TATATACC TGTGTAAG miRNA 1\n19 seq_100091_x3 3 hsa-miR-142-3p 54 74 0 u-CA d-TG 0 AGGGTGTA TGGATGAG miRNA 1\n20 seq_100092_x1 1 hsa-miR-142-3p 54 74 0 u-CT d-TG 0 AGGGTGTA TGGATGAG miRNA 1\n23 seq_100108_x5 5 hsa-miR-10a-5p 23 44 4NC 0 d-T 0 TATATACC TGTGTAAG miRNA 1\n26 seq_100113_x1219 1219 hsa-miR-577 15 36 0 0 u-G 0 AGAGTAGA CCTGATGA miRNA 1\n28 seq_100121_x1 1 hsa-miR-192-5p 25 45 1CT u-CT d-C d-A GGCTCTGA AGCCAGTG miRNA 1" ]
[ "r" ]
[ "Xamarin Forms - How to animate modal from right to left using PushModalAsync?", "How to animate modal from right to left using PushModalAsync in Xamarin Forms?\n\nBy default, the animation is from bottom to top." ]
[ "xamarin.forms" ]
[ "How to correctly use the linear-gradient?", "I am pretty new in CSS3 and I have the following style in a CSS file of my project:\n\n.headerDiv {\n background-image: linear-gradient(#04519b, #044687 60%, #033769);\n ............................\n ............................\n ............................\n}\n\n\nIt is pretty clear to me what \nlinear-gradient(#04519b, #044687 60%, #033769); \nshould do (it creates a vertical gradient as a background of a div with the class name headerDiv.\n\nI have to change it the colors of the gradient, so I found on Google this documentation: http://www.w3schools.com/css/css3_gradients.asp\n\nThe problem is that I can't find the syntax used in my CSS file.\n\nSo related to my:\n\nlinear-gradient(#04519b, #044687 60%, #033769);\n\n\nwhat exactly represent the:\n\n1) First value (#04519b)\n\n2) Second value (#044687 60%), what does 60% mean?\n\n3) Third value (#033769)\n\nI know that these are changing the gradient color but I don't know the exact ordered and what 60% means." ]
[ "html", "css", "linear-gradients" ]
[ "IIS virtual directory pointing to wordpress blog hosted on another computer", "I have a windows box (which hosts www.example.com) and a linux box (which hosts wordpress blog).\n\nIs there a way I can create a virtual directory on the windows box - so that when a user accesses www.example.com/blog, it gets the content from the linux server? ( I want the url in the browser to remain www.example.com/blog )\n\nThanks" ]
[ "iis", "iis-7", "iis-6", "virtual-directory" ]
[ "Passed parameter form to cycle a bash variable name to c/c++ back to bash", "to demonstrate the problem i better preresented it in code quoted.c\n#include <unistd.h>\n\nint main(int argc, char **argv) {\n char *args [] = {"/bin/bash", "-p", "./print.sh", argv[1], NULL};\n execve(args[0], args, NULL);\n return 0;\n}\n\nwhere print.sh is just\n#!/bin/bash\n\nNAME=Zerin\necho ${1}\n\nusing the command line to run compiled code as follows\n./quoted '"$NAME"'\n\nthis just prints $NAME, i need it to print the value.\nEdited\nthe guideline is that the script is fixed, i need to hack it! even to hack the code, i can only change the parameters!\nthe followings were tested:\n./quoted '"$NAME"'\n./quoted "'$NAME'"\n./quoted '\\"$NAME\\"'\n./quoted '\\"\\$NAME\\"'\n./quoted "\\$NAME"\n\ndidn't help!" ]
[ "c", "linux", "string", "bash" ]
[ "How to calculate the size of a file?", "I have uploaded a file to my web server using a web script. So If I need to get the size of that, how can I get it through the php ?\n\n<?php\nsession_start();\ndefine('incall', true);\ninclude(\"connection.php\");\n\nif(!@include_once('config.php'))\n{\n header('HTTP/1.0 404 Not Found');\n exit;\n}\n\n$to=$_POST['to'];\n$message = str_replace('{link}', $download_path.$_POST['filename'].'.mp3', $email_body);\necho $fname.\" size\";\ndie;\n$fname=$download_path.$_POST['filename'].'.mp3';\n$headers = \"From: \".$_POST['from'];\n$subject=$_POST['subject'];\n$date=date(\"Y/m/d\");\n$time=date('h:i:s A');\n$size=filesize('$fname');\n$username=$_SESSION['username'];\nif(mail($to, $subject, $message, $headers))\n{ \n $query=mysql_query(\"INSERT INTO sent values('$username', '$to','$date', '$time', '.mp3', '$size' )\");\n header(\"location:mailsent.php?\");\n}\nelse\n exit('Error! VoiceMail not be send.');\n?>\n\n\nI'm getting the download link in the email. But still the $fname is not existing. I wonder why ??" ]
[ "php", "size" ]
[ "How do I debug a jQuery Ajax request?", "My code is:\n\nvar test = \"it isn't working\";\nvar response = $.ajax({\n type: 'GET',\n url: 'jquerydemo.php', //This is in the same site as the page calling this request, so it's not a same-domain error.\n success: function(){\n test = \"it's working\";\n },\n error: function(){\n alert(\"Error detected\");\n }\n }).responseText;\nalert(test);\n\n\nI tested the status code and it came out to a 200 and the error function never goes off, but neither does the success function. Like I said in my comment, it isn't a same-origin policy error. It just stays saying \"it isn't working\". What's going on here?" ]
[ "javascript", "jquery", "ajax" ]
[ "How to count only letters in a string?", "At the next code I'm splitting text to words, inserting them into a table separately and counting the numbers of letters in each word.\nThe problem is that counter is also counting spaces at the beginning of each line, and give me wrong value for some of the words.\nHow can I count only the letters of each word exactly?\n\nvar str = reader1.ReadToEnd();\n\nchar[] separators = new char[] {' ', ',', '/', '?'}; //Clean punctuation from copying\nvar words = str.Split(separators, StringSplitOptions.RemoveEmptyEntries).ToArray(); //Insert all the song words into \"words\" string\nstring constring1 = \"datasource=localhost;port=3306;username=root;password=123\";\n\nusing (var conDataBase1 = new MySqlConnection(constring1))\n{\n conDataBase1.Open();\n for (int i = 0; i < words.Length; i++)\n {\n int numberOfLetters = words[i].ToCharArray().Length; //Calculate the numbers of letters in each word \n var songtext = \"insert into myproject.words (word_text,word_length) values('\" + words[i] + \"','\" + numberOfLetters + \"');\"; //Insert words list and length into words table\n MySqlCommand cmdDataBase1 = new MySqlCommand(songtext, conDataBase1);\n try\n { \n cmdDataBase1.ExecuteNonQuery(); \n }\n catch (Exception ex)\n {\n MessageBox.Show(ex.Message); \n }\n }\n }" ]
[ "c#", "mysql" ]
[ "Searching YouTube with React", "I have a simple app to search YouTube. When I run it I get no errors, but nothing actually happens when I click the search button!\n\nBelow is the relevant code:\n\nclass App extends React.Component{\n constructor() {\n super();\n this.state = {\n searchResults: []\n }\n this.search = this.search.bind(this);\n this.showResults = this.showResults.bind(this);\n }\n\n showResults(response) {\n this.setState({\n searchResults: response.results\n })\n console.log(response)\n }\n\n search(searchTerm) {\n fetch(\"www.googleapis.com/youtube/v3/search\", {\n type: \"GET\",\n part: 'snippet',\n url: \"www.googleapis.com/youtube/v3/search\",\n key: \"my key\",\n q: searchTerm,\n success: function(response) {\n this.showResults(response);\n }.bind(this)\n });\n }\n\n render() {\n return (\n <div>\n <Searchbox search={this.search}/>\n <Mapresults searchResults={this.state.searchResults} />\n </div>\n )\n }\n}\n\nclass Searchbox extends React.Component{\n createAjax(){\n var url = 'https://www.googleapis.com/youtube/v3/search';\n var key = 'AIzaSyCBPX-gonEMREh2OyT3S9Q7oaxBFaxkBZs';\n var searchresult = ReactDOM.findDOMNode(this.refs.query).value;\n var fullUrl = url + key + searchresult;\n this.props.search(fullUrl);\n }\n render(){\n return(\n <div>\n <form id=\"search-term\">\n <input ref=\"query\" type=\"text\"/><button id=\"search-term\" onChange=\n {() => this.createAjax.bind(this)}/>\n </form>\n <h2 id= \"root\">test</h2>\n <h2 id=\"demo\"></h2>\n </div>\n )\n }\n}\n\n\nI've tried to fix it it and added react developer tools but it just doesn't seem to render." ]
[ "javascript", "reactjs", "youtube" ]
[ "NODE_PATH or any module alias with node-server on zeit/now.sh", "Using @​now/node-server, I'm trying to achieve this:\n\nconst myLocalLibrary = require('@src/lib/myLocalLibrary');\n\n\nInstead of \n\nconst myLocalLibrary = require('../../../lib/myLocalLibrary');\n\n\nThe problem is that I have tried multiple things that won't work, including:\n\nSetting NODE_PATH=src and using require('src/...\n\nDoes not work because setting NODE_PATH as env has no effect\n\nPatching require using module-alias (https://www.npmjs.com/package/module-alias)\n\nWorks locally, fails on Zeit because node can't find any files using the module.\n\nI used:\n\nrequire(\"module-alias\").addAlias(\"~\", __dirname);\n\n\nIs there any way of achieving this?" ]
[ "vercel" ]
[ "jQuery Traversing Dynamically generated DOM (next(), prev())", "I have an HTML table and jQuery handlers to move rows up and down, using .next() and .prev(), but I also want to add new rows and after adding new row and trying to move old rows up or down they move more positions than expected. Here is an example on jsfiddle http://jsfiddle.net/3CQYN/\n\n$(function() {\n\n initControls();\n\n $('.new').click(function() {\n\n $('<tr><td>TEST</td><td><a href=\"#\" class=\"up\">Up</a> <a href=\"#\" class=\"down\">Down</a></td></tr>').appendTo($('table tbody'));\n\n initControls();\n\n });\n\n});\n\nfunction initControls()\n{\n $('.down').click(function() {\n var parentRow = $(this).closest('tr'); \n\n parentRow.insertAfter(parentRow.next());\n});\n\n$('.up').click(function() {\n var parentRow = $(this).closest('tr'); \n\n parentRow.insertBefore(parentRow.prev());\n });\n}\n\n\nTry to move rows up and down, then add few new rows and move the OLD rows up and down again and you'll see the problem." ]
[ "javascript", "jquery", "html", "dom", "traversal" ]
[ "The return value for bind is not an int?", "I am trying to learn c/c++ socket programming but the bind function working properly or is not returning what it should return, instead of \"int\" its returning \"__bind \" i don't know whats wrong and i have searched for what to do and no out come\n\nplease help\n\nServer::Server()\n: sock_fd(0)\n{\n // number used as index in to the vector of client fd\n num = 0;\n clino.reserve(10);\n clientfd.reserve(10);\n if( (sock_fd = socket(AF_INET,SOCK_STREAM,0) ) < 0)\n {\n perror(\"Server constructor : cannot open socekt\");\n }\n bzero(&servaddr, sizeof(servaddr));\n servaddr.sin_family = AF_INET;\n servaddr.sin_port = htons(TCP_PORT);\n servaddr.sin_addr.s_addr = htonl(INADDR_ANY);\n //error returning __bind<int&, sockaddr*, unsigned long> \n int b = bind(sock_fd,(sockaddr *)&servaddr, sizeof(servaddr));\n\n\n\n //this bind function is acting up, dosent want to let me check for errors lol\n\n\n\n printf(\"printing..\\n\");\n}\n\n\n\n\nint Server::waitforconnections()\n{\n\n printf(\"listening....\\n\");\n\n if(listen(sock_fd, 5) < 0)\n {\n perror(\"Server constructor : listen error\");\n }\n\n for(;;)\n {\n clino[num] = num + 1;\n printf(\"accepting.. \\n\");\n clientfd[clino[num]] = accept(sock_fd, (sockaddr *)&cliaddr, clilen);\n clisocktoaddr[clientfd[num]] = cliaddr;\n if(clientfd[num] < 0)\n {\n perror(\"waitforconnections: accept error\");\n }\n //no client number 0\n if(do_service() < 0)\n {\n perror(\"waitforconnections: cannot do service, !!FATAL ERROR!!\");\n _exit(-1);\n }\n //if i am going to use kids then they must be some inter processing communication don't forget !!\n\n\n num++;\n }\n\n\n\n\n return (0);\n}" ]
[ "c++", "sockets" ]
[ "Bean validation specification prioritizing", "I am using bean validation specification to validate my form on spring-boot thymeleaf project. \nMy entity property is as follow. \n\n@NotEmpty(message = \"{Password should not be empty}\")\n@Pattern(regexp = //Pattern for range 1-20, message = \"{Wrong Input}\")\nprivate String password;\n\n\nWhen I run and inputed to password field of my form with empty value, both of Validation Error Messages were shown. \n\nMy expectation is, while empty value is inputed, only @NotEmpty annotation should work and on the other hand, only @Pattern should be shown upon user input is wrong. \n\nHow can I do with Bean Validation Specification for that? \n\nRegards." ]
[ "java", "spring", "spring-boot", "thymeleaf", "bean-validation" ]
[ "D3.js v5 - Creating a relative, zoomable timeline-like axis on a linear scale", "I need to create a relative timeline-like axis in D3 (v5) that is zoomable and changes units and tick intervals on zoom change.\nIt will be used for planning certain activities in time relative to the baseline - value 0.\nExample Timepoints: at -8 days, 2 hrs, 10 & 20 days, 2 & 4 & 6 weeks, 4 months and so on (stored in millisecond offsets).\nWhen zoomed out, the ticks would be formatted as years, and as the user begins to zoom in, these turn to months, then weeks, days, hours, down to the minutes.\n\nCodePen Example\nThe example shows the approximate effect that I am going for (use the mousewheel scroll to zoom in or out on the axis).\nI decided to use a linear scale with integer units - representing milliseconds.\nI am using tickFormat() where I find the distance among the ticks and calculate different tick formats based on that.\nI probably cannot use D3’s scaleTime() because that’s based on real calendar dates (with variable months, gap years, etc). I need a fixed scale of offsets - 24-hour days, 7-day weeks, 30-day months, 365-days years.\nThe scale in the example is wrong - D3 generates the ticks automatically in nicely rounded values - and I need the tick intervals to be variable based on the zoom level. Meaning, when showing ticks in the format of months, the distance between 2 ticks should be one month (in ms) and when zooming down to hours, the distance between 2 ticks should be exactly one hour (in ms) and so on.\nI guess I will need to create some algorithm that generates the variable ticks but I am not sure how would it look like, and what are the limitations of the D3 API because I haven't found any methods that would allow for something like this.\nI couldn't find any examples of this effect anywhere and I was hoping that someone here could point me in the right direction or give some tips on how to achieve it." ]
[ "javascript", "d3.js", "timeline" ]
[ "Node.js - MongoDB find().forEach() Not Pushing to Array", "I am currently able to run .find().forEach(function(result)) and use console.log to see what was returned from my MongoDB server using Node.js. Yet when I attempt to do array.push(result.name) the array is not updated. Below is the script that I am using:\n\n// Create temp array to store orders\nvar orderArray = [];\n// Connect to Orders\nMongoClient.connect('mongodb://10.254.17.115:27017/Orders', function(err, db) {\n // Handle errors\n assert.equal(null, err);\n\n var found = db.collection('Orders').find().forEach(function (result) {\n orderArray.push(result.OrderID);\n console.log(result.OrderID);\n });\n\n //socket.emit('GetOrders', orderArray);\n});\n// Return order array\nconsole.log(\"Array used for debug \" + orderArray);\n\n\nI would assume that the script I used would work since the scope of orderArray[] is able to reach inside and outside the .find() function. Would anybody know a fix for this?" ]
[ "javascript", "arrays", "node.js", "mongodb" ]
[ "What happens if I'll call limit() after filter() from Stream API?", "Will the following code filter elements until it find 3 elements that pass the filtering method, or filter all elements?\n\nmanyItems.stream()\n .filter(it -> it.getValue > 100)\n .limit(3)\n ..." ]
[ "java", "java-stream" ]
[ "Change legend entry order and legend title in scale_color_manual", "I have the following data set\n\nset.seed(10)\nstart_date <- as.Date('2000-01-01') \nend_date <- as.Date('2000-01-10') \n\nData <- data.frame(id = rep((1:1000),10), \n group = rep(c(\"0\",\"1\"), 25),\n IV = sample(1:100),\n DV = sample(c(\"1\", \"0\"), 10, replace = TRUE),\n date = as.Date(\n sample(as.numeric(start_date):\n as.numeric(end_date), 1000,\n replace = T), origin = '2000-01-01'))\n\n\nWith that, I create the following plot:\n\nData %>% mutate(group = factor(group), date = as.POSIXct(date)) %>% \n group_by(group, date) %>% #group\n summarise(prop = sum(DV==\"1\")/n()) %>% #calculate proportion \n ggplot()+ theme_classic() + \n geom_line(aes(x = date, y = prop, color = group)) +\n geom_point(aes(x = date, y = prop, color = group)) +\n geom_smooth(aes(x = date, y = prop, color = group), se = F, method = 'loess') +\n scale_color_manual(values = c('0' = 'black', '1' = 'darkgrey'),\n labels = c('0' = 'Remaining sample', '1' = 'Group 1'))\n\n\nEverything works fine but I'm now trying to change the order of the legend entries (so \"Group 1\" comes first and then \"remaining sample\") and the title (to \"Legend\") and can't figure out how." ]
[ "r", "ggplot2" ]
[ "AndroId MediaPlayer prepareAsync method", "I have a strange problem. I use the prepareAsync method with the MediaPlayer, but the listener that I declared just never gets fired. I try to stream a live .mp3 feed from the Internet (radio station). I use an inline method for the listener, but I also tried implementing the interface without any success. Here's a portion of my code :\n\nIn the member section :\n\nString url = \"http://<my_url>.mp3\";\nMediaPlayer mediaPlayer = new MediaPlayer();\n\n\nIn Activity onCreate() :\n\nToggleButton playButton = (ToggleButton) findViewById(R.id.playToggleButton);\nplayButton.setOnClickListener(this);\nplayButton.clearFocus();\nplayButton.setClickable(false);\n\nmediaPlayer.setOnPreparedListener(new OnPreparedListener() {\n public void onPrepared(MediaPlayer mp) {\n ToggleButton playButton = (ToggleButton) findViewById(R.id.playToggleButton);\n playButton.setClickable(true);\n mp.start();\n }\n});\n\npreparePlayer();\n\n\nThen, here's the preparePlayer() method :\n\nprivate void preparePlayer() {\n if (mediaPlayer == null) {\n mediaPlayer = new MediaPlayer();\n }\n mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);\n try {\n mediaPlayer.setDataSource(url);\n mediaPlayer.prepareAsync();\n\n } catch (IllegalArgumentException e) {\n Toast.makeText(\n MyStreamActivity.this,\n getResources().getString(R.string.erreurIllegalArgument),\n Toast.LENGTH_LONG).show();\n e.printStackTrace();\n } catch (IllegalStateException e) {\n Toast.makeText(\n MyStreamActivity.this,\n getResources().getString(R.string.erreurIllegalState),\n Toast.LENGTH_LONG).show();\n e.printStackTrace();\n } catch (IOException e) {\n Toast.makeText(\n MyStreamActivity.this,\n getResources().getString(R.string.erreurIO),\n Toast.LENGTH_LONG).show();\n e.printStackTrace();\n }\n}\n\n\nAnd (just for the record), the onDetroy() where I do the cleaning :\n\nprivate void releaseMediaPlayer() {\n if (mediaPlayer != null) {\n if(mediaPlayer.isPlaying()) {\n mediaPlayer.stop();\n }\n mediaPlayer.release();\n mediaPlayer = null;\n }\n}\n\n@Override\nprotected void onDestroy() {\n super.onDestroy();\n releaseMediaPlayer();\n}" ]
[ "android", "asynchronous", "android-mediaplayer", "prepare" ]
[ "C# WebApi - Json serialize bring a property to higher level", "I have a class with following structure\n\nclass Model\n{\n public int Id {get;set;}\n public Dictionary<string, List<ComplexType>> Values {get;set;}\n}\n\n\nutilized in an Dotnetcore webApi project and returned from my controller as the following object\n\nOk(new List<Model>() { \nnew Model{\n Id = 1,\n Values = new Dictionary<string, List<ComplexType>>() { {\"Item1\", new List<ComplexType>()} }\n} } )\n\n\nwhich would produce Json output as :\n\n[\n {\n \"Id\": \"1\"\n \"Values\": {\n \"Item1\": [{}]\n }\n }\n]\n\n\nSo my question is any way possible, to bring the Dictionary property name to a higher level in output Json structure. \nBasically Omitting the property name \"Values\" in \"Model\" class and merging lower object so it would look something like this:\n\n[\n {\n \"Id\": \"1\"\n \"Item1\": [{}]\n }\n]" ]
[ "c#", "json", "serialization", "json.net", "webapi" ]
[ "faces-redirect uses http and not https", "Regarding the use of faces-redirect=true and redirecting to https, I've seen various techniques here on how to solve that, but can someone provide the explanation of why it redirects to http instead of https ?" ]
[ "jsf", "https" ]
[ "Does a JDBC driver's version and a DB's version have to match exactly?", "Say I have postgresql 9.1 running on a server, yet I choose to use a 9.2 driver to access it. Would this work? If not, are these version checks always enforced, or does it depend on your DBMS?" ]
[ "postgresql", "jdbc", "version" ]
[ "Can't build static boost-filesystem", "I've this example code.\n\n#include <iostream>\n#include <boost/filesystem.hpp>\nusing namespace std;\n\nint main()\n{\n return 0;\n}\n\n\nIt can be correctly build with: g++ -lboost_system-mt -lboost_filesystem-mt 1.cpp\n\nBut if I add -static, then it complains:\n\n/tmp/cc1JEbRQ.o: In function `__static_initialization_and_destruction_0(int, int)':\n1.cpp:(.text+0xb0): undefined reference to `boost::system::get_system_category()'\n1.cpp:(.text+0xba): undefined reference to `boost::system::get_generic_category()'\n1.cpp:(.text+0xc4): undefined reference to `boost::system::get_generic_category()'\n1.cpp:(.text+0xce): undefined reference to `boost::system::get_generic_category()'\n1.cpp:(.text+0xd8): undefined reference to `boost::system::get_system_category()'\ncollect2: ld returned 1 exit status\n\n\nHow do I fix that? Thanks" ]
[ "boost" ]
[ "Code First EF: Enum Id not being added to database during database generation", "I just changed my datamodel, I want to have some default items in data table when the database is generated by EF for the first time. Previously, I did that from seed method. But Now I found that it would be more useful and the amount of codes I have to write would be less If I use enum (with default values).\n\nThis is my current model after adding enum\n\npublic partial class License\n{ \n public int LicenseId { get; set; }\n public LicenseTypes Licensetype { get; set; }\n}\n\npublic enum LicenseTypes\n{\n Trial = 0,\n Paid = 1\n}\n\n\nand this is my DbContext class\n\npublic partial class InfoBridgeSmartDatePickerDbContext : IdentityDbContext\n{\n public InfoBridgeSmartDatePickerDbContext():base(\"DefaultConnection\")\n {\n }\n\n public DbSet<License> Licenses { get; set; }\n\n}\n\n\nwhen I run the application, the database is generated but the table Licenses doesn't contain the values or Id of enum. Shouldn't it be holding the values or Id of enum?\n\nThe EF version I'm using is: 6.0.2" ]
[ "c#", "asp.net-mvc", "entity-framework", "ef-code-first" ]
[ "Writing and reading to and from a file for integers and strings", "I am trying to save a file (and then read it later) in java (android) using the following \n\nFileInputStream fis = openFileInput(filename);\n\n\nand then maybe use BufferedReader/writer. Anyways, I am trying to save String and numbers and I was wondering what would be the best method to write and read from I/O for such case?\nI was about to do the following for reading \n\nFileInputStream fis = openFileInput(filename);\nInputStreamReader inputStreamReader = new InputStreamReader(fis);\nBufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n\n\nand for writing\n\nFileOutputStream fos = openFileOutput(filename, 20);\nOutputStreamWriter outStreamReader = new OutputStreamWriter(fos);\nBufferedWriter bufferedWriter = new BufferedWriter(outStreamReader);\n\n\nbut I noticed that the readLine will always return string of the line. so I have to go throught the conversion of Strings to Integer for some lines. Is this an efficient way of doing it (or correct way)? I feel I am missing something\nThank you" ]
[ "java", "android" ]
[ "related to mdf files", "I found the following code in a Linq to Sql tutorial, from where Northwnd class come from? Is it generated automatically\n\nNorthwnd db = new Northwnd(@\"c:\\northwnd.mdf\");\n\n// Query for customers in London.\nIQueryable<Customer> custQuery =\n from cust in db.Customers\n where cust.City == \"London\"\n select cust;" ]
[ "asp.net", "linq-to-sql" ]
[ "onNotificationOpened method not getting called in react native firebase", "i am using react-native-firebase for notification in my react native project and i am trying to call onNotificationOpened and getInitialNotification from componentDidMount method but these two methods not getting called, any suggestion will be appreciated\n\nthis.removeNotificationOpenedListener = firebase.notifications().onNotificationOpened((notificationOpen: NotificationOpen) => {\n console.log('onNotificationOpened AppJS :', notificationOpen)\n const { action, notification } = notificationOpen\n let item = JSON.parse(notification.data.body)\n console.log('onNotificationOpened AppJS : body ', item)\n\n console.log('onNotificationOpened AppJS : action ', action)\n\n})\n\nfirebase.notifications().getInitialNotification()\n .then((notificationOpen: NotificationOpen) => {\n if (notificationOpen) {\n console.log('getInitialNotification AppJS : Shoeb ########: ')\n // App was opened by a notification\n // Get the action triggered by the notification being opened\n const { action, notification } = notificationOpen\n let item = JSON.parse(notification.data.body)\n console.log('getInitialNotification AppJS : item ', item)\n console.log('getInitialNotification AppJS : action ', action)\n\n }\n })" ]
[ "react-native", "react-native-firebase" ]
[ "Why i can not access the variable \"total_clients\"?", "How to access this variable that is out of escope? \n\nexport class ClientsComponent implements OnInit {\n title: string = \"All Clients\"\n\nclients: Client[] = [];\nresponse: any;\ntotal_clients: number;\ntotal_pages: number;\npages: any[] = [];\n\nconstructor( private _clientService: ClientService ) {}\n\nngOnInit() {\n\n this._clientService.getData()\n .subscribe(\n data => this.response = data,\n err => console.error(err),\n () => {\n this.clients = this.response.data, \n this.total_clients = this.response.total\n }\n );\n\n\n console.log(this.total_clients); <- i can not access this\n\n\n}" ]
[ "angular" ]
[ "Permissions issue in SQL Server 2016 and R", "We’re very experienced with SQL Server as well as R (as a standalone product). We’ve setup SQL Server 2016 test server (production version from MSDN) with R also installed. The machine works fine, and we’ve tried some rudimentary R, and that works fine as well (which also means that we’ve referred to this article from Microsoft: https://msdn.microsoft.com/en-us/library/mt696069.aspx).\n\nSo, the issue we’re having is trying to load an R script from a location on our network. For example:\n\nsource(“\\\\\\\\MyServer\\\\MyRDirectory\\\\MyRScript.R”);\n\n\nJust in case UNC didn’t work, we tried mapping a network drive to a drive letter, but received the same, “No such file or directory” error message.\n\nThere seems to be a permissions issue accessing this file. If we copy that file to the local test server, it works fine. For example, we have no issue with this:\n\nsource(“C:\\\\Temp\\\\MyRScript.R”);\n\n\nFor this test, I am using SSMS 2016 and I am logged in as a Windows AD user with DBO permissions, and I have permissions to the remote folder. The SQL Server 2016 service accounts are also AD “users” with appropriate permissions. I read that R has its own user group (SQLRUserGroup) and 20 user accounts are in that group – all of this is assigned by SQL Server during the install; these are accounts that are local to the test machine. I suspect this is the issue: R/SQL Server must be trying to access that network folder/file as a local user – not an AD user with appropriate permissions.\n\nHas anyone run into this and found a resolution that you can share?\n\nFYI, as expected, running the following R script in SQL Server 2016 (SSMS):\n\nexecute sp_execute_external_script\n@language = N’R’\n, @script = N’ OutputDataSet<- data.frame(c(USERNAME=Sys.getenv(\"USERNAME\")),HOME=Sys.getenv(\"HOME\"))'\n, @input_data_1 = N''\nWITH RESULT SETS ((USERNAME varchar(200),HOME varchar(200)))\n\n\nReports that my script is running as \"MSSQLSERVER01\" with a local/home directory and GUID for that user. I'm sure that's the issue, but how do I change that to run as an AD user with proper permissions?\n\nI get the strong feeling that this is not going to be possible, but can anyone here verify?" ]
[ "sql-server", "r", "permissions", "sql-server-2016" ]
[ "How can I set a password for Visio files?", "I want to put a password on the files so no one can open without their permission" ]
[ "passwords", "visio" ]
[ "Convert ISO/Windows charsets to UTF-8 in Javascript", "I'm developing a firefox plugin and i fetch web pages to do some analysis for the user. The problem is when i try to get (XMLHttpRequest) pages that are not utf-8 encoded the string i see is messed up. For example hebrew pages with windows-1125 or Chinese pages with gb2312. \n\nI already tried the following:\n\nvar uDecoder=Components.classes[\"@mozilla.org/intl/scriptableunicodeconverter\"].getService(Components.interfaces.nsIScriptableUnicodeConverter);\nuDecoder.charset=\"windows-1255\";\nalert( xhr.responseText );\n\nvar decoder=Components.classes[\"@mozilla.org/intl/utf8converterservice;1\"].getService(Components.interfaces.nsIUTF8ConverterService);\n\nalert(decoder.convertStringToUTF8(xhr.responseText,\"WINDOWS-1255\",true)); \n\n\nI also tried escape/unescape/encodeURIComponent\n\nany ideas???" ]
[ "javascript", "utf-8", "character-encoding" ]
[ "One Drive API - How do I Find the correct Redirect URI", "I'm a beginner using the OneDrive API. I'm building an application where users can upload and view the files in OneDrive. I'm having trouble with the first step, authentication. \n\nI've already registered my application with the Microsoft's Application Registration Portal and using the OneDrive File Picker - Javascript SDK to start. \n\nMy javascript code looks like this: \n\n$('#resultsTable').on('click', 'tr > td > .view-onedrive', function(){\n var odOptions = { \n clientId: \"05xxxxxxxxxxxxx-xxxxx-xxxxx\",\n redirectUri: location.origin,\n action: \"query\",\n multiSelect: true,\n advanced: {},\n success: function(files) { \n var promise1 = Promise.resolve(files);\n\n promise1.then(function(value) {\n console.log(value);\n }); \n\n },\n cancel: function() { /* cancel handler */ },\n error: function(e) { \n function rejected(e) {\n console.log(e);\n }\n\n Promise.reject(new Error('fail'))}\n };\n OneDrive.open(odOptions);\n});\n\n\nUsing the above javascript code, this is the error message that appears in the web url: \n\nhttps://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.&state=http://mydevserver.com_m48KW\n\nFrom what I gathered, the error is saying that the redirect URI in my request does not match the registered redirect URI in the Developer's Portal. Although, it is registered as such in the my developer's portal, shown below.\n\n\n\nI used \"https://login.live.com/oauth20_desktop.srf\" because I have no idea what the redirect uri would be on my local machine. Localhost doesn't work. It's not live, I'm developing the site on my local machine. \n\nMy overall question is how can I obtain the correct redirect URI?" ]
[ "javascript", "onedrive" ]
[ "Memory occupied by my Application keeps increasing with time", "I have developed a Point of Sale system using C#, Winforms and Mysql. After its deployment, I observed that the memory size keeps on increasing with time. After evaluating my code, I felt my Data Layer might be the culprit. I have generalized database call using methods like these \n\n public static DataTable ExecQuery(string query, List<SqlParam> sp_params, string db)\n {\n\n MySqlConnection sCon = new MySqlConnection();\n sCon.ConnectionString = \"server=\" + server + \";port=\" + port + \";database=\" + db + \";uid=\" + user + \";pwd=\" + password + \";charset=utf8;\";\n\n\n MySqlCommand command = new MySqlCommand();\n command.CommandType = CommandType.Text;\n command.Connection = sCon;\n\n if (sp_params != null)\n {\n for (int i = 0; i < sp_params.Count; i++)\n {\n MySqlParameter sparam = new MySqlParameter();\n sparam.ParameterName = sp_params[i].Name;\n sparam.MySqlDbType = sp_params[i].Type;\n sparam.Value = sp_params[i].Value;\n command.Parameters.Add(sparam);\n }\n }\n command.CommandText = query;\n sCon.Open();\n MySqlDataReader sd = command.ExecuteReader();\n\n\n\n DataTable dt = new DataTable();\n\n for (int fc = 0; fc < sd.FieldCount; fc++)\n {\n if (dt.Columns.Contains(sd.GetName(fc)))\n {\n dt.Columns.Add(sd.GetName(fc) + \"1\", sd.GetFieldType(fc));\n }\n else\n {\n dt.Columns.Add(sd.GetName(fc), sd.GetFieldType(fc));\n }\n }\n\n while (sd.Read())\n {\n DataRow dr = dt.NewRow();\n for (int fc = 0; fc < sd.FieldCount; fc++)\n {\n dr[fc] = sd.GetValue(fc);\n }\n dt.Rows.Add(dr);\n }\n\n sCon.Close();\n return dt;\n\n }\n\n\nFor every database call, We use this method. The front end has to only specify parameters and query. Am I right in my suspicion that this static method is causing memory problems? \n\nUpdate:\n\nJust found another leak in my App: \n\nWherever reportviewer is used, LocalReport.ReleaseSandboxAppDomain() must be called in host form's formclosing event. Otherwise each invocation of Report, adds to memory size.\n\nUpdate 2\n\nFound the actual cause of Memory Leak in my system. I am Using a complex usercontrol which I add in a flowlayoutpanel.\n\nI was using a normal foreach loop to dispose each control.. but somehow only half objects were disposed. I nested this foreach loop inside a for loop with counter as number of controls.\n\n int count = flwControls.Controls.Count;\n for (int i = 0; i < count; i++)\n {\n foreach (Control c in flwControls.Controls)\n {\n c.Dispose();\n }\n }" ]
[ "c#", "mysql", "winforms", "memory" ]
[ "Django 1.8 and how to change migration order for apps", "In Django 1.8 using Postgres, how do I change the migration order? I have the following....\n\nAUTH_USER_MODEL = 'users.User'\nINSTALLED_APPS = [\n \"test.apps.users\",\n 'django_nose',\n 'django_coverage',\n 'oauth2_provider',\n 'rest_framework',\n 'django_extensions',\n]\n\n\nand no matter what order my apps are in oauth2_provider gives me the error...\n\n\n django.db.utils.ProgrammingError: relation \"users_user\" does not exist \n\n\nOperations to perform:\n Synchronize unmigrated apps: oauth2_provider, staticfiles, messages, django_extensions, django_coverage, django_nose, rest_framework, common\n Apply all migrations: users, sessions, admin, auth, contenttypes\nSynchronizing apps without migrations:\n Creating tables...\n Creating table oauth2_provider_application\n Creating table oauth2_provider_grant\n Creating table oauth2_provider_accesstoken\n Creating table oauth2_provider_refreshtoken\n Running deferred SQL...\n\n\nbecause its applying its own migrations before the apps.users table has been created.\n\nIf I removed oauth2_provider, apply migrations, then add back in oauth2_provider then apply migrations again, it works! However, there must be a way to force test.apps.users migrations to be created before oauth2_provider or anything else.\n\nWhat I noticed is that inside oauth2_provider they have:\n\n\n migrations.swappable_dependency(settings.AUTH_USER_MODEL)\n https://github.com/evonove/django-oauth-toolkit/blob/master/oauth2_provider/migrations/0001_initial.py#L14\n\n\nHowever, Django just ignores this and try's to apply the migration for oauth2_provider before my user model giving the error above error when ever I run tests and need to create a new test database." ]
[ "python", "django", "django-models", "django-nose" ]
[ "Unable to integrate docusign with third party application", "I have created Docusign Sandbox account for testing purposes . I want to integrate it with my third party application to check how the things will work . But when i am trying to integrate with my application by entering the username , password and account id then it shows an error message that \" Docusign denied access to its login api\" Can you please help me in this.\n\nDo i need a paid docusign account for integration ? Can i do it without paid account by using Docusign sandbox feature" ]
[ "docusignapi" ]
[ "CMake relative linking, executable fails to find shared libraries", "I am trying to learn CMake and for that purpose I am working with an example project of the structure shown below. I am trying to configure all the CMakeLists.txt files such that after make install I can copy the resulting build directory and copy-paste it around freely such that other people are able run the executable. \n\nProblem: after running make install (maxOS 10.14.6 (Darwin 18.7.0)) everything works if I run the executable inside build BUT if I move the build directory from its original location - for example to Desktop - the executable is unable to find the shared libraries. It seems that the reason for this is that the paths to the shared libraries are defined as absolute paths instead of relative paths with respect to the build directory.\n\nQuestion: How can I build the project such that the executable finds the shared libs? \n\nProject structure: \n\nmyapp\n |\n CMakeLists.txt (top-level)\n - build\n - app \n | CMakeLists.txt (app)\n | - inc\n | - app\n | app.h \n | - src\n | app.cpp\n | main.cpp\n | \n - external\n | \n - mylib\n CMakeLists.txt (mylib)\n - inc\n - mylib\n mylib.h\n - src\n mylib.cpp\n\n\nCMakeLists: \n\nCMakeLists.txt (top-level)\n\ncmake_minimum_required(VERSION 3.0)\n\nproject(myapp)\n\nadd_subdirectory(external/mylib)\nadd_subdirectory(app)\n\n\nCMakeLists.txt (app)\n\n# myapp program\n\ncmake_minimum_required(VERSION 3.0)\n\nproject(myapp_prog)\n\nset(SOURCES ./src/)\nset(HEADERS ./inc/app/)\n\nset(SOURCE_FILES\n ${SOURCES}/app.cpp)\n\nset(HEADER_FILES\n ${HEADERS}/app.h)\n\n\n# All sources that need to be tested in unit test go into a static library\nadd_library(myapp_lib SHARED ${HEADER_FILES} ${SOURCE_FILES})\ntarget_include_directories(myapp_lib PUBLIC ${HEADERS})\n\n# The main program\nadd_executable(prog ./src/main.cpp)\ntarget_include_directories(prog PUBLIC ./inc/)\n\n# Link the libraries\ntarget_link_libraries(prog PRIVATE myapp_lib mylib)\n\ninstall(TARGETS myapp_lib DESTINATION ${CMAKE_BINARY_DIR}/lib)\n\n\n\nCMakeLists.txt (mylib)\n\n# mylib\n\ncmake_minimum_required(VERSION 3.0)\n\nproject(mylib)\n\nset(SOURCES src/)\n\nset(HEADERS inc/mylib/)\n\nset(SOURCE_FILES\n ${SOURCES}/mylib.cpp)\n\nset(HEADER_FILES\n ${HEADERS}/mylib.h)\n\nadd_library(mylib SHARED ${HEADER_FILES} ${SOURCE_FILES})\n\ntarget_include_directories(mylib PUBLIC inc/)\n\ninstall(TARGETS mylib DESTINATION ${CMAKE_BINARY_DIR}/lib)\n\n\n\n\nC++ code: \n\nmylib.h\n\nvoid mylib_print_hello();\n\n\nmylib.cpp\n\n#include \"library.h\"\n\n#include <iostream>\n\nvoid mylib_print_hello() {\n std::cout << \"Hello from mylib!\" << std::endl;\n}\n\n\napp.h\n\nvoid myapp_hello();\n\n\napp.cpp\n\n#include <iostream>\n#include \"app.h\"\n\nvoid myapp_hello()\n{\n std::cout << \"Hello from myapp!\" << std::endl;\n}\n\n\nmain.cpp\n\n\n#include <iostream>\n#include \"app/app.h\"\n#include \"mylib/mylib.h\"\n\nint main()\n{\n myapp_hello();\n mylib_print_hello();\n\n}" ]
[ "c++", "cmake" ]
[ "iOS7 MPMusicPlayerController states incorrect", "I have an iOS7 application with music player.\nI'm using the following code to check playback state changes from the MPMusicPlayerController to update the UI. \nMore precisely I toggle the look of the play button between play and pause.\n\n[[NSNotificationCenter defaultCenter] addObserver: self\n selector: @selector (handle_NowPlayingItemChanged:)\n name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification\n object: self.musicPlayer];\n\n[[NSNotificationCenter defaultCenter] addObserver: self\n selector: @selector (handle_PlaybackStateChanged:)\n name: MPMusicPlayerControllerPlaybackStateDidChangeNotification\n object: self.musicPlayer];\n\n[self.musicPlayer beginGeneratingPlaybackNotifications];\n\n\nif I run the app on iOS7 on an iPad or iPhone, I get the following sequence instead of just one single callback:\n\n-[MyMediaPlayer handle_PlaybackStateChanged:] :: playbackState: 1\n-[MyMediaPlayer handle_PlaybackStateChanged:] :: playbackState: 2\n-[MyMediaPlayer handle_PlaybackStateChanged:] :: playbackState: 1\n-[MyMediaPlayer handle_PlaybackStateChanged:] :: playbackState: 2\n\n\nplaybackState 2 means MPMusicPlaybackStatePaused and causes my application to display the wrong state in the UI, while the song is actually being played back.\nIt doesn't make sense that the callback gets called 4 times, with alternating values.\n\nThis happens when changing the queue only. \nIt looks like the system is not clearing the queue properly.\n\nAny ideas on how to solve this ?" ]
[ "ios7", "mpmusicplayercontroller" ]
[ "Memory leak when setting cell data in UITableView", "When running my iPhone app code with memory leak tool it says that i have two memory leaks in this method. The first when calling cell.textLabel setText: and the second when calling cell.imageView setImage:\n\nI can't figure out what it's wrong, please can you help me?\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n\n static NSString *CellIdentifier = @\"IssuesCell\";\n\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];\n if (cell == nil) {\n cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];\n }\n\n // The issue object\n Issue *issue;\n issue = [issues objectAtIndexPath:indexPath];\n\n // Issue name\n [cell.textLabel setText:[issue name]];\n\n // Get a string from the issue date\n NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];\n [dateFormatter setDateFormat:@\"yyyy-MM-dd\"];\n [cell.detailTextLabel setText:[dateFormatter stringFromDate:[issue date]]];\n [dateFormatter release];\n [cell.imageView setImage:[UIImage imageNamed:[issue cover]]];\n\n return cell;\n}\n\n\nIssue definition:\n\n#import <CoreData/CoreData.h>\n\n@class Article;\n\n@interface Issue : NSManagedObject \n{\n}\n\n@property (nonatomic, retain) NSString * cover;\n@property (nonatomic, retain) NSString * name;\n@property (nonatomic, retain) NSDate * date;\n@property (nonatomic, retain) NSSet* articles;\n\n@end\n\n\n@interface Issue (CoreDataGeneratedAccessors)\n- (void)addArticlesObject:(Article *)value;\n- (void)removeArticlesObject:(Article *)value;\n- (void)addArticles:(NSSet *)value;\n- (void)removeArticles:(NSSet *)value;\n\n@end\n\n\nAnd implementation\n\n#import \"Issue.h\"\n\n#import \"Article.h\"\n\n@implementation Issue \n\n@dynamic cover;\n@dynamic name;\n@dynamic date;\n@dynamic articles;\n\n@end" ]
[ "iphone", "objective-c", "xcode" ]
[ "Word.InsertLocation.Replace is not working for content control", "In browser contentcontrol.inserttext("text", Word.InsertLocation.Replace) not working fine it always concatenate the string in the start ideally it should replace the old text inside the content control with the new text. Is there any other work-around to replace the text inside a content control. (specially for windows)" ]
[ "office365", "office-js", "word" ]
[ "Django how to preserve order when querying OneToMany relations?", "Two models (A report may contain many screenshots): \n\nclass Report(models.Model):\n ...\n\nclass Screenshot(models.Model):\n report = models.ForeignKey(Report, related_name='screenshots', on_delete=models.CASCADE)\n image = models.ImageField(upload_to=\"screenshots/%Y/\")\n order = models.IntegerField()\n\n class meta:\n ordering = ['order'] # output the correct order\n\n\nWhen querying all reports and there associated screenshots:\n\nreports = Report.objects.all()\nfor r in reports:\n screenshots = r.screenshots.all()\n for s in screenshots:\n print s.order # output is out of order like 4,1,2,3\n\n\nThe order of the screenshots are not preserved.\n\nIs there a better way to make queries like this but preserves OneToMany relations' order?" ]
[ "django" ]
[ "How to Serialize an Object Containing a System.Threading.Thread?", "System.Runtime.Serialization.SerializationException: \nType 'System.Threading.Thread' in Assembly 'mscorlib, Version=2.0.0.0,\nCulture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.\n\n\nIs there a way around that? ive added the Serializable attribute to all of my class's, but i cant add attributes to things like that, can i? and if i can, is there a way to get around that issue altogether? because i dont want to always have to add [Serializable] to everything.\n\nPS, in my project, im dynamically compiling C# code and including it in my application.\n\nedit one: Because of the nature of my application, everything, all events, etc, is managed my separate threads.. I cannot get away from that fact, because i need to be doing many tasks at the same time. Is there a way to get around that fact?" ]
[ "c#", "serialization", "attributes" ]
[ "Excel worksheet events won't fire on colleague's computer", "I have a macro-enabled workbook that runs fine on my machine, but when my colleague tries to use it, the worksheet events won't fire.\n\nI've done as much searching as I can and I'm still baffled. \n\nThe following conditions [all are causes/solutions in previous SO posts] are true:\n\n\nThe events are named correctly (I didn't change the names) and are in the correct location (worksheet code) (as mentioned, everything works correctly on my machine, so these must be true)\nApplication.EnableEvents = True (I tested this in the Immediate window while testing on my colleague's machine)\nSecurity settings: 'Enable all macros' and 'Trust access to the VBA project object model' are both selected on my colleague's machine\n\n\nI've put a MsgBox as the first line for each event handler. These don't appear, that's how I know the event isn't firing.\n\nIf I launch a MsgBox from the Immediate window, it does appear.\n\nEdit: We've tried re-launching Excel and rebooting the whole computer. These did not help.\n\nThis is the code for each of the handlers, including the MsgBox test lines:\n\nPrivate Sub Worksheet_Activate()\n MsgBox \"worksheet activate\"\n Me.Protect Password:=WORKSHEET_PASSWORD, UserInterfaceOnly:=True\nEnd Sub\n\nPrivate Sub Worksheet_Change(ByVal Target As Range)\n MsgBox \"worksheet change\"\n Application.ScreenUpdating = False\n FermDataWorksheetChange Target\n Application.ScreenUpdating = True\nEnd Sub\n\n\nI really hope someone can help me, as this is a business-critical application for my colleague.\n\nThank you!" ]
[ "excel", "vba", "events" ]
[ "What is the most secure method for uploading a file?", "The company I work for has recently been hit with many header injection and file upload exploits on the sites we host and while we have fixed the problem with respect to header injection attacks, we have yet to get the upload exploits under control.\n\nI'm trying to set up a plug-and-play-type series of upload scripts to use in-house that a designer can copy into their site's structure, modify a few variables, and have a ready-to-go upload form on their site. We're looking to limit our exposure as much as possible (we've already shut down fopen and shell commands).\n\nI've searched the site for the last hour and found many different answers dealing with specific methods that rely on outside sources. What do you all think is the best script-only solution that is specific enough to use as a reliable method of protection? Also, I'd like to keep the language limited to PHP or pseudo-code if possible.\n\nEdit: I've found my answer (posted below) and, while it does make use of the shell command exec(), if you block script files from being uploaded (which this solution does very well), you won't run into any problems." ]
[ "php", "security", "file-upload" ]
[ "How to retrieve comments from an owl file using Jena API?", "currently I am doing a project on Ontology Based Information Retrieval. I have created the base ontology using the ontology editor, Protege and obtained the file , say family.owl .Basically i want to perform a search function .The user provides the search term and then it is searched with the individuals in the ontology . If a match is found ,then print the comment associated with that individual .I have used the Jena API to parse the ontology .So far i am successful in obtaining the subject , predicate and object associated with each resource but i am not able to get the comment associate with each resource . A part of family.owl looks like this\n\n<!-- http://www.semanticweb.org/ontologies/2012/9/family.owl#Beth -->\n<owl:Thing rdf:about=\"#Beth\">\n <rdfs:comment>Beth is the Daughter of Adam . She is the Sister of Chuck . \n She is the Mother of Dotty & Edward . She is the Aunt of Fran & Greg.\n </rdfs:comment>\n <isChildOf rdf:resource=\"#Adam\"/>\n <isSiblingOf rdf:resource=\"#Chuck\"/>\n</owl:Thing>\n\n\nSo when i search for Beth ,I should get the comment associated with it ie.Beth is the Daughter of Adam . She is the Sister of Chuck.She is the Mother of Dotty & Edward . She is the Aunt of Fran & Greg.The code i have used to get the subject,predicate and object is as follows\n\n StmtIterator iter=model.listStatements(); \n while(iter.hasNext())\n {\n Statement stmt=iter.nextStatement();\n String subject=stmt.getSubject().toString; \n String predicate=stmt.getPredicate().toString(); \n String object=stmt.getObject().toString();\n ...\n }" ]
[ "rdf", "jena", "ontology", "owl", "protege" ]
[ "Window doesn't show up on Hotkey Action", "I finally implemented the ShortcutRecorder. When the user types in the chosen hotkey, a method called -(void)hitHotKey {} is called. I am 100% sure this method is called, because I tested it with NSLogs. So my problem is the following: I want to show a window, when the the user fires the hotkey, but the window doesn't show up. To make the window visible I use the makeKeyAndOrderFront option. Has anybody an idea, why my window doesn't show up ? Thanks" ]
[ "cocoa", "shortcut", "hotkeys", "makekeyandordertofront" ]
[ "Null value in v-model", "I have a Nativescript-Vue app where I make a REST call to return a response to be displayed. It may not always be fully populated, and when that happens I get an error such as:\n\n\n [Vue warn]: Error in render: \"TypeError: null is not an object\n (evaluating '_vm.office.address.addressLine1')\"\n\n\nHere is the REST response I get from the server:\n\n{\n \"officeId\":2,\n \"name\":null,\n \"beginDate\":[\n 2020,\n 4,\n 18\n ],\n \"endDate\":null,\n \"officeType\":null,\n \"address\":null\n}\n\n\nAnd here is the Vue code that has problems:\n\n<StackLayout class=\"nt-input\">\n <Label text=\"Address Line 1\" class=\"m-b-5\"/>\n <TextField :editable=\"!isViewOnly\" v-model=\"office.address.addressLine1\" v-shadow=\"2\" hint=\"Enter address line 1\" class=\"-border\"/>\n</StackLayout>\n\n\nBecause the address hasn't been established, it will be null for new records. Is there any way to get this to render so users can populate?" ]
[ "vue.js", "nativescript-vue" ]
[ "Deactivate tooltip in Altair", "I am looking at this example of a bar chart with error bars in Altair with Python. If one hovers over the errorbars one gets information about properties of the data. However, I'd like to deactivate this. How can I do this? The code is this one:\n\nimport altair as alt\nfrom vega_datasets import data\n\nsource = data.barley()\n\nbars = alt.Chart().mark_bar().encode(\n x='year:O',\n y=alt.Y('mean(yield):Q', title='Mean Yield'),\n color='year:N',\n)\n\nerror_bars = alt.Chart().mark_errorbar(extent='ci').encode(\n x='year:O',\n y='yield:Q'\n)\n\nalt.layer(bars, error_bars, data=source).facet(\n column='site:N'\n)" ]
[ "python", "altair" ]
[ "Schedule IIS configuration Back up", "I need a solution to fully backup my IIS configuration (all Parts of IIS like all sites and application pools) on windows 2016 server and 2019 server, and store them in a specific folder, do you have any idea in order to do that?\nthanks" ]
[ "iis", "windows-server-2016", "windows-server-2019" ]
[ "Resizing the background svg", "I want to resize the local svg using in background-image, but setting the width=100% and height=100% not working.\nI've even resized the svg image into 1425pixels x 835pixels\n\n\n\nmy css code: -\n\n#main-page #products-section {\ntext-align: center;\nbackground-image: url('/assets/images/product_background_img.svg');\nbackground-size: 100% 100%;\nbackground-repeat: no-repeat;\n}\n\n\nwhen using background-image: url('/assets/images/product_background_img.png');\n\nThe Output is: \n\nIt's working fine with .png Image, but I want to achieve same with svg file. Since png images are of greater file size, and it'll create my web-page heavy." ]
[ "css", "html", "svg" ]
[ "Allow app unpinning with pin even with device ownership set to this app", "I am setting device ownership for my app using dpm command (dpm set-device-admin) and in my MainActivity.java I have placed the code below :\n\nDevicePolicyManager myDevicePolicyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);\n // get this app package name\n ComponentName mDPM = new ComponentName(this, MyAdmin.class);\n\n if (myDevicePolicyManager.isDeviceOwnerApp(this.getPackageName())) {\n // get this app package name\n String[] packages = {this.getPackageName()};\n // mDPM is the admin package, and allow the specified packages to lock task\n myDevicePolicyManager.setLockTaskPackages(mDPM, packages);\n startLockTask();\n } else {\n Toast.makeText(getApplicationContext(),\"Unable to auto pin - not device owner\", Toast.LENGTH_LONG).show();\n }\n\n\nWhenever my app starts it auto pins itself, making it unable for users to leave. Without setting device ownership I am able to leave 'pinned' state by long pressing back button and providing the pin.\n\nWhen I set the ownership this actions is overrided - all I see is 'App is pinned : unpinning isn't allowed on this device'. Is there any way to enable unpinning by providing pin as without device ownership? I still need it to make sure it autopins without any prompts." ]
[ "java", "android" ]
[ "Using try catch exception handling in laravel", "In my app, this is the RegisterController,\n\n<?php\n\nnamespace App\\Http\\Controllers\\Auth;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Providers\\RouteServiceProvider;\nuse App\\User;\nuse Illuminate\\Foundation\\Auth\\RegistersUsers;\nuse Illuminate\\Support\\Facades\\Hash;\nuse Illuminate\\Support\\Facades\\Validator;\n\nclass RegisterController extends Controller\n{\n /*\n |--------------------------------------------------------------------------\n | Register Controller\n |--------------------------------------------------------------------------\n |\n | This controller handles the registration of new users as well as their\n | validation and creation. By default this controller uses a trait to\n | provide this functionality without requiring any additional code.\n |\n */\n\n use RegistersUsers;\n\n /**\n * Where to redirect users after registration.\n *\n * @var string\n */\n protected $redirectTo = RouteServiceProvider::HOME;\n\n /**\n * Create a new controller instance.\n *\n * @return void\n */\n public function __construct()\n {\n $this->middleware('guest');\n }\n\n /**\n * Get a validator for an incoming registration request.\n *\n * @param array $data\n * @return \\Illuminate\\Contracts\\Validation\\Validator\n */\n protected function validator(array $data)\n {\n return Validator::make($data, [\n 'name' => ['required', 'alpha','min:2', 'max:255'],\n 'last_name' => ['required', 'alpha','min:2', 'max:255'],\n 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],\n\n ]);\n }\n\n /**\n * Create a new user instance after a valid registration.\n *\n * @param array $data\n * @return \\App\\User\n */\n protected function create(array $data)\n {\n return User::create([\n 'name' => $data['name'],\n 'last_name' => $data['last_name'],\n 'email' => $data['email'],\n\n ]);\n }\n}\n\n\nI have done the basic validations here. \n\nBut now I would like to know how to use try catch exception handling to handle the controller errors and if an error occurred how to redirect user back to register blade? Can I use try catch exception handling here? Or is this secure enough?\n\nI'm using laravel 6" ]
[ "php", "laravel", "exception", "try-catch", "laravel-6" ]
[ "Flutter, How to get all the image file name from images folder?", "I want to load all the image file names in images/pets/ to List<String> animals. How can I do that?" ]
[ "flutter" ]
[ "Defining an extension for both the Swift and Objective-C classes", "I am trying to migrate my application to swift from Objective C.\nI was having couple of Objective C categories. Since Swift is having \"Extensions\", I have created it. But some how , I am not able to call it from existing Objective C.\n\nBelow code gives compilation error\n\nNo visible @interface for 'NSString' declares the selector 'myCategory'\n\n\nExtension class\n\nimport Foundation\n\n\n extension String {\n\n func myCategory() -> String {\n\n return \"I am From Swift\";\n\n }\n\n\n } \n\n\nMy ViewController\n\n#import <TestProject-Swift.h>\n\n\n@interface TestViewController ()\n\n@end\n\n@implementation TestViewController\n\n- (void)viewDidLoad {\n [super viewDidLoad];\n // Do any additional setup after loading the view, typically from a nib.\n\n NSString *str = @\"Testing\";\n\n NSLog(@\"Here is result %@\", [str myCategory]);\n}\n\n- (void)didReceiveMemoryWarning {\n [super didReceiveMemoryWarning];\n // Dispose of any resources that can be recreated.\n}\n\n@end\n\n\nAnd how it will be work with Swift class also?\nI have created Bridging header file also for above extension file.\n\nEDIT:\nI have tried making \"public\" but its not working." ]
[ "ios", "objective-c", "swift" ]
[ "Problems extracting data from array", "this code...\n\n$url = 'https://api.twitter.com/1.1/users/lookup.json';\n$getfield = '?screen_name=bvb';\n$requestMethod = 'GET';\n\n$twitter = new TwitterAPIExchange($settings);\n$response = $twitter->setGetfield($getfield)\n ->buildOauth($url, $requestMethod)\n ->performRequest();\n\n$twitter_array = json_decode($response);\n\nvar_dump($twitter_array);\n\n\ngives me this array:\n\nArray (\n [0] => stdClass Object (\n [id] => 14173315\n [id_str] => 14173315\n [name] => NBC News\n [screen_name] => NBCNews\n [location] => New York, NY\n [description] => The leading source of global news and information for more than 75 years. Facebook: https://anything Snapchat: https://anything\n [url] => http://anything\n [entities] => stdClass Object (\n [url] => stdClass Object (\n [urls] => Array (\n [0] => stdClass Object (\n [url] => http://anything\n [expanded_url] => http://NBCNews.com\n [display_url] => NBCNews.com\n [indices] => Array (\n [0] => 0\n [1] => 22\n )\n )\n )\n )\n [description] => stdClass Object (\n [urls] => Array (\n [0] => stdClass Object (\n [url] => https://anything\n [expanded_url] => https://www.facebook.com/NBCNews\n [display_url] => facebook.com/NBCNews... \n\n\nI am desperately trying to get this data saved into some variables, like $twitter_array[0]->name; without success. Can you tell me what I am doing wroing?" ]
[ "php", "arrays" ]
[ "how to use API when there's no binary", "Normally when I use an API I download the binary containing the JAR which I then add to the classpath. I want to try Curve API but there's no binary (and hence no JARs in the download). I'm using Eclipse and I have read that you can just add the zip file, but I tried this and it didn't work." ]
[ "api", "jar" ]
[ "XCode>Instruments>Leaks - Where is \"gather leaked memory contents\" data?", "When you check gather leaked memory contents in the Leaks instrument what does this do? I have a troublesome leak and thought maybe this \"memory content\" might be useful in tracking it down...but I can't find it!?!" ]
[ "cocoa", "xcode", "instruments", "memory-leaks" ]
[ "jQuery: How to check when all images in an array are loaded?", "I have an array of images (the exact number of images varies), and when they all load I want some code to execute. \n\nI tried this but it doesn't work:\n\nmyImgArray.load(function(){\n alert('loaded');\n});\n\n\nI get \n\n\n 33: Uncaught TypeError: Object [object Object],[object Object],[object Object],[object Object] has no method 'load'\n\n\nI don't think a for loop or something similar would work because the images might, and probably will, load in 'random' order." ]
[ "javascript", "jquery", "image", "load", "onload" ]
[ "How to detect neck with Face Detection API available in Core Image", "I am developing an application in which i have to detect a face with neck from image taken from gallery or camera. i am using the following link to detect the face\n\nFace detection tutorial link\n\nand its detecting the face very well but i can't find any solution how to detect neck. i have to set the detected face on another face of another image.\nplease suggest me how to do it with core image." ]
[ "ios" ]
[ "Unit testing for void methods and threads in jUnit", "I'm new to unit testing. I understood the principles of it, but I still can't figure out how to test my current project. I need to test void methods, operating with java.nio.SocketChannel. These methods are:\n- initSelector, where I open selector, bind new ServerSocketChannel and register it\n- read, which reads data and puts it to a queue (should i write extra method for verifying, if that data actually exists in queue? and in that case, should i write tests for that methods?)\n- write method, which takes data from a queue and writes it to a SocketChannel\n\nI can test this methods for not throwing IOException, but what else?\nAnd how should I test run() method of a Thread? Or is it not unit testing, but system or other?" ]
[ "java", "unit-testing", "testing", "junit" ]
[ "Function integrating besselk function", "I am trying to create a function that has the BESSELK function as a parameter. I found this code on fordom.free.fr :\n\nOption Explicit\n\nFunction F(ByVal Equation As String, Optional ByVal X As Variant = 0) As Double\n'Evaluates f(x) at position x\n\n'Uppercase\nEquation = UCase(Equation)\nWith WorksheetFunction\n'avoid mixing up EXP with exp and X\nEquation = .Substitute(Equation, \"EXP\", \"exp\")\n'set value X instead of letter X\nEquation = .Substitute(Equation, \"X\", X)\n'converts comas into points\nEquation = .Substitute(Equation, \",\", \".\")\n'Changes )( with )*(\nEquation = .Substitute(Equation, \")(\", \")*(\")\nEnd With\n\n'calculates expression\nF = Evaluate(Equation)\n\nEnd Function\n\n\nAnd modified it to take into account 2 parameters :\n\nOption Explicit\n\nFunction F(ByVal Equation As String, Optional ByVal X As Variant = 0, _\n& **Optional ByVal Y As Variant = 0**) As Double\n'Evaluates f(x) at position x\n\n'Uppercase\nEquation = UCase(Equation)\nWith WorksheetFunction\n'avoid mixing up EXP with exp and X\nEquation = .Substitute(Equation, \"EXP\", \"exp\")\n'set value X instead of letter X\nEquation = .Substitute(Equation, \"X\", X)\n**'set value Y instead of letter Y\nEquation = .Substitute(Equation, \"Y\", Y)**\n'converts comas into points\nEquation = .Substitute(Equation, \",\", \".\")\n'Changes )( with )*(\nEquation = .Substitute(Equation, \")(\", \")*(\")\nEnd With\n\n'calculates expression\nF = Evaluate(Equation)\n\nEnd Function\n\n\nWhen I try F(\"x+y\";5;2), it returns 7 which is alright. However, when i try\nF(\"BESSELK(x;y)\";5;1), it gives me a #VALUE error\n\nI checked in the documentation and the variable type or the two arguments from the Bessel function are indeed \"Variante\".\n\nI don't really understand why it going wrong here ! I also tried with an easier function F(\"POWER(x;y)\";5;2) but it also give me a #VALUE error.\n\nAny help is more than welcome ! Thank you very much." ]
[ "vba", "parameters", "double" ]
[ "Completion block for graphics animation", "My problem is that I've 2 graphics animation one after the other, but they are done together.\nI thought to write a method with completion block, but or I'm doing something wrong, or there is another way to do this.\n\nThe animation is a uiview that move out of the screen (closeView) and the default animation of viewcontroller closing. \nI want the viewcontroller closes when is over the animation of view.\n\nThis is what i've done\n\n- (void)closeViewWithCompletion:(void (^) (BOOL finish))handler {\n [self closeView];\n handler(YES);\n}\n\n-(void) closeView{\n [self.myview setFrame:CGRectMake(\n -self.myview.frame.size.width\n , self.myview.frame.origin.y\n , self.myview.frame.size.width\n , self.view.frame.size.height\n )];\n\n\n CATransition *animation = [CATransition animation];\n [animation setType:kCATransitionPush];\n [animation setSubtype:kCATransitionFromRight];\n [animation setDuration:.50];\n [animation setDelegate:self];\n [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];\n CALayer *layer = [self.myview layer];\n [layer addAnimation:animation forKey:nil];\n\n [UIView animateWithDuration:0.5 animations:^{\n [greyMask setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0]];\n } completion:^(BOOL finished) {\n [greyMask removeFromSuperview];\n }];\n}\n\n\nuse:\n\n[vc closeViewWithCompletion:^(BOOL finish) {\n [navController popViewControllerAnimated:true];\n }\n];" ]
[ "ios", "objective-c", "animation" ]
[ "c# - Find node value without root element", "This is my column value in sql:\n\n<ProductId>101</ProductId>\n<ProductName>TShirt</ProductName>\n<Description>UCB</Description>\n<Category>199</Category>\n<Weight>150</Weight>\n<Price>2500</Price>\n<images></images>\n\n\nSometimes it looks like this also:\n\n<ProductId xsi:nil=\"true\" ></ProductId> \n<ProductName>Toys</ProductName>\n<Description xsi:nil=\"true\" ></Description>\n<Category xsi:nil=\"true\" ></Category>\n<Weight xsi:nil=\"true\" ></Weight>\n<Price xsi:nil=\"true\" ></Price>\n<images></images>\n\n\nI want to extract 'ProductName' value i.e. TShirt from this column. It could be any node, How do I do this?\n\nThis is my c# code\n\nvar xml = XElement.Parse(xmlString);\n\nstring fieldValue = xml.Element(fieldToSearch).ToString();\n\n\nBut since it is not proper xml string it gives error so I wrote explicitly\n\nstring xmlString = \"<root>\" + columnValue + \"</root>\";\n\n\nWhat is the correct way to find the node value?\n\nEdit: The value can be extrtacted for Weight/Description/Price, any node. The error comes when xsi:nil is found." ]
[ "c#", "xml" ]
[ "javascript pop-up error", "I've an image column in an asp:repeater.\n\n<asp:Image ID=\"telImage\" runat=\"server\" ImageUrl=\"../../images/telefon.png\" />\n\n\nI add onClick attribute in rptList_ItemDataBound\n\ntelImage.Attributes.Add(\"onClick\", \"javascript: Redirect('\" + telImage.ToolTip + \"')\");\n\n\nand javascript method\n\n<script type=\"text/javascript\">\n function Redirect(url) {\n if (confirm('Do you want to call?')) {\n window.open(url, \"ekran\", location = 1, status = 1, scrollbars = 1, width = 900, height = 700); \n }\n }\n</script>\n\n\nWhen I click the image, a new window appears but it gives the following error: \"HTTP Eror 404.0 - Not Found\". How can I solve this?\n\nI only want to run that url address. Is there any basic way? I'm correctly taking the url address." ]
[ "c#", "javascript", "asp.net" ]
[ "Debugging Mixed mode (C# , C++) application", "I am debugging an issue with a mixed mode (managed and unmanaged) application.\n\nThe actual issue is within the unmanaged code. \n\nI have loaded SOS dll into Windebugger. But is shows me the call stack only upto managed mode since i have loaded SOS dll. How do I see the call stack of unmanaged code as well?" ]
[ "c#", "windbg", "crash-dumps", "sos" ]
[ "Django: Uploaded Filename Issue", "In my django app i'm trying to resize & compress an Image before saving it to the database.\n\nHere's how I did it inside the models\n\nclass Data(models.Model):\n image = models.ImageField(upload_to='all_images/', null=True, blank=True)\n\ndef save(self, *args, **kwargs):\n if self.image:\n img = Image.open(self.image)\n resize = img.resize((240, 240), Image.ANTIALIAS)\n new_image = BytesIO()\n resize.save(new_image, format=img.format, quality=80, save=False)\n temp_name = os.path.split(self.image.name)[1]\n self.image.save(temp_name, content=ContentFile(new_image.getvalue()), save=False)\n super(Data, self).save(*args, **kwargs)\n\n\nHere's the problem, I saved an image named tesla.jpg into the database, it compressed & resized it well, but it renamed it something like, tesla_CKBw0Kr_iWKC4Ry_ucPoh4b_BB2C8Ck_WrfWkPR_Tzig2T1_tdhst4b_3Bysn6k_i4ffhPR_yhig2T1.jpg\n\nI'm worried about the new name because normally it should be tesla_CKBw0Kr.jpg or something smaller, so what's the problem in my code & how can we fix that?" ]
[ "django", "django-models" ]
[ "Netty UDP, the reference count of a message is already 0 when I received it", "As the title said,the received message is an io.netty.channel.socket.DatagramPacket instance and the reference count of the \nmessage is 0 when it was received.I can't retain() it and can't release() it neither.I don't know why and how can I deal with this problem?\nMy handler extends ChannelInboundHandlerAdapter,as follows:\n\npublic class ActorMessageHandler extends ChannelInboundHandlerAdapter {\nprivate Logger logger = LoggerFactory.getLogger(ActorMessageHandler.class);\n\nprivate ActorRef messageHandlerActor;\n\npublic ActorMessageHandler(ActorRef handler) {\n this.messageHandlerActor = handler;\n}\n\n@Override\npublic void channelActive(ChannelHandlerContext ctx) throws Exception {\n logger.info(\"actor message handler connected-{}\", messageHandlerActor);\n}\n\n@Override\npublic void channelInactive(ChannelHandlerContext ctx) throws Exception {\n logger.info(\"disconnected...\");\n}\n\n@Override\npublic void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {\n logger.debug(\"get message {}\", msg);\n if (msg instanceof TransportMsg) {\n messageHandlerActor.tell(msg, ActorRef.noSender());\n return;\n }\n if (msg instanceof DatagramPacket) {\n //DatagramPacket recv = ((DatagramPacket) msg).retain();\n DatagramPacket recv = (DatagramPacket) msg;\n logger.info(\"recv refCnt: {}, {}\", recv.content().refCnt(), recv.refCnt());\n DatagramPacket rsp = new DatagramPacket(recv.content().retain(), recv.sender(), recv.recipient());\n messageHandlerActor.tell(msg, ActorRef.noSender());\n if (rsp.refCnt() <= 0) {\n rsp.retain();\n }\n ctx.writeAndFlush(rsp);\n return;\n }\n}\n\n@Override\npublic void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {\n logger.error(\"Connection error: \" + cause.getMessage());\n cause.printStackTrace();\n}\n\n\n}\n\nI logged the refCnt when I received the DatagramPacket and it came out 0 in the method channelRead().If I retain() or release(),IllegalReferenceCountException will be triggered.\n\nio.netty.util.IllegalReferenceCountException: refCnt: 0, increment: 1\nat io.netty.buffer.AbstractReferenceCountedByteBuf.retain(AbstractReferenceCountedByteBuf.java:63)\nat io.netty.buffer.WrappedByteBuf.retain(WrappedByteBuf.java:799)\nat com.boer.handler.ActorMessageHandler.channelRead(ActorMessageHandler.java:44)\nat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)\nat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)\nat io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)\nat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)\nat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319)\nat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787)\nat io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:92)\nat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)\nat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)\nat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)\nat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)\nat io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)\nat io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)\nat java.lang.Thread.run(Thread.java:745)" ]
[ "netty" ]
[ "Order rows by result of algorithm outside of db query", "I'm trying to order results of a db query based on an algorithm outside of the sql statement.\n\nFor example - each row has author_karma and pageviews columns. I'd like to order the result by an algorithm calculated in php after the rows are fetched...\n\nThe algorithm might look like this\n\n$score = intval($author_karma) + (intval($pageviews)/100) + intval($age)\n\nIn sites like hacker news is this calculated in the sql query? How do they make this work? If I try to store the score in the db, how often to I update it (especially when time is involved in the score)?" ]
[ "php", "mysql", "algorithm", "sql-order-by" ]
[ "JUnit - Use method in test from another class", "The scenario is the following:\n\nI have a class that executes tests for a section of a project. \n\npublic class section1 extends BaseTest {\n\n @Test\n public void test1() {\n //somecode\n }\n}\n\n\nThe thing is that in test1, I want to use a Method that's defined in another test class (we're not using Page Objects in the automation project).\n\npublic class section2 extends BaseTest {\n\n @Test\n public void test2() {\n //somecode\n methodOne();\n }\n\n void methodOne(){\n //somecode\n }\n}\n\n\nSo, I've tried creating an instance and access to the method through it\n\nsection2 sec2 = new section2();\n.\n.\n.\n@Test\n public void test1() {\n //somecode\n section2.methodOne();\n }\n\n\nBut it throws a NullPointerException as soon as it starts executing the method. \n\nThen, I tried just extending the class section1 to section2 and use the method, so here it executes the method but, as soon as test1 finishes, it starts executing the tests from the extended class, in this case, test2. \n\nHow can I do to prevent that, or is there another way to use the method without extending and not making the method public?" ]
[ "java", "selenium", "methods", "junit", "automation" ]
[ "AngularFire: How to update a denormalised array/ object?", "I am currently using Kato's gist ( https://gist.github.com/katowulf/f78d4a224c06a643ddfa ) to normalize my records with another Firebase path.\n\nThe issue I am facing is when I am trying to update my object back to the firebase database: the database does not update (no error message in the console).\n\nMy book table looks like this:\n\nbooks:\n -JyDpkQrUozE3L7flpo: {\n title: \"title1\",\n author: {-JyDpkQrUozE3L7fl1x: true}\n },\n -JyDpkQrUozE3L7flp1: {\n title: \"title2\",\n author: {-JyDptrrrezE3L7flKx: true}\n },\n -JyDpkQrUozE3L7flp2: {\n title: \"title3\",\n author: {-JyDpkQrUozE3L7f222: true}\n }\n\n\nMy author table looks like this:\n\nauthors:\n -JyDpkQrUozE3L7flKx: {\n firstname: \"jacques\",\n lastname: \"smith\"\n },\n -JyDptrrrezE3L7flKx: {\n firstname: \"bill\",\n lastname: \"halley\"\n },\n -JyDpkQrUozE3L7f222: {\n firstname: \"john\",\n lastname: \"ford\"\n }\n\n\nMy service for normalizedBook looks like this:\n\n.factory('NormalizedBook’, ['$firebaseObject', 'firebaseService', function($firebaseObject, firebaseService) {\n var service = $firebaseObject.$extend({\n $$updated: function(snap) {\n var self = this;\n var record = $firebaseObject.prototype.$$updated.call(this, snap);\n firebaseService.$getAuthor( self.authorId ).$loaded().then(function( authorData ) {\n self.authorFirstName = authorData.authorFirstName;\n self.authorLastName = authorData.authorLastName;\n });\n return record;\n }\n });\n return service;\n}])\n\n\nThe firebaseService is just a helper service to retrieve my data:\n\nvar service = {};\nservice.refAuthors = new Firebase(FBAuthors);\nservice.authors = $firebaseArray( refAuthors );\nservice.$getAuthor = function(id) {\n if( !service.authors.hasOwnProperty(id) ) {\n service.authors[id] = $firebaseObject(service.refAuthors.child(id));\n };\n return service.authors[id];\n};\n…….\nreturn service;\n\n\nMy controller looks like this:\n\n.controller('booksController', ['$scope', '$firebaseArray', 'normalizedBook', function($scope, $firebaseArray, normalizedBook) {\n $scope.bookSelected = new normalizedBook(firebaseService.refBooks.child(id); \n $scope.updateBookSelected = function(item) {\n $scope.bookSelected.$save(item);\n };\n});\n\n\nMy view renders the expected object (the book and author information within the same object) so everything is working fine. The only issue is really how to update my object back to the firebase database. Any idea on how to do this?" ]
[ "angularfire", "denormalized" ]
[ "Why there is compiler error: Cannot convert void to string, where as there is no casting happening", "I'm not sure why there is compiler error, Argument 1 Cannot convert 'void' to 'string', where as there is no casting happening. Below code creates a list of methods:\nvoid FunctionList(string srcBucket, List<List<string>> pdfFileList, IAmazonS3 s3client)\n{\n List<Action> actions = new List<Action>();\n foreach (var list in pdfFileList)\n list.Add(RenameFilesAsync(srcBucket, list, s3client).Wait()); // Getting error here\n}\n\npublic async Task RenameFilesAsync(string srcBucket, List<string> pdfFiles, IAmazonS3 s3client)\n{\n //Some code here\n}" ]
[ "c#", "asynchronous" ]
[ "How do you generate SQL using LINQ?", "I want to be able to take a LINQ statement like this.\n\nvar User = from u in Users\n where u.UserID == 7\n select u.UserName;\n\n\nAnd have it generate SQL like this.\n\nSELECT UserName FROM Users WHERE Users.UserID = 7\n\nI know LINQ TO SQL does this but I don't want all that added xml mapping and generated code.\nObviously this is possible since LINQ TO SQL does it but how does it do it?\n\nUpdate\n\nOther reason why I don't want to use LINQ to SQL is because I want to use it for PostgreSQL." ]
[ "sql", "linq", "postgresql" ]
[ "STL List adding and removing chosen element", "I'm coding simple program which uses lists. I've already created my list with all of its functions, but now I would like to convert it to STL. I've successfully done it a few of my functions but I'm stuck with a one which should add new element and also remove an element chosen by the user.\n\nThats my code:\n\nlist <Komputer> lista_komputerow_STL;\nlist <Komputer>::iterator it;\n///This should add an element:\nlista_komputerow_STL.push_back(Komputer(nazwa));\n///This should remove chosen element:\nint element;\n\nfor(int i=0;i<(element-1);i++)\n{it++;}\nlista_komputerow_STL.erase(it);\n\n\nI am completaly new to STL and it seems to be to much for me for now, but I hope that with your help I'll get it." ]
[ "c++", "list", "stl" ]
[ "Setting up Coverage Exclusion in sonarqube", "I want to set up coverage exlusion so that my test code is not reported as untested in my project overview.\n\nI am working with SonarQube Version 7.0 (build 36138) and Visual Studio 2015 Projects. The results are reported from a runner that runs on jenkins.\n\nI set up General Code Coverage rules on the SonarQube server using.\nAdministration -> Configuration -> General Settings -> Analysis Scope -> Code Coverage -> Code Exclusions where I set the rule to **/_Test*/**/*.*\n\nThe tool tip reads this would be the key sonar.coverage.exclusions which is what you are supposed to use according to Narrowing The Focus.\n\nMy expectation would be that the pattern I use matches.\n** zero or more directories, followed by directory starting with _Test*, followed by ** zero or more directories and finally matching all files *.*\n\nHowever even when I rerun the project this rule is not applied.\n\nThe File\n\nMySolution/_TestQ1/Component/MyComponentTest.cs\n\n\nstill makes it into the report.\n\nIs there a way how I can quickly test my rule?\nIs there something fundamentally wring with my rule?\nHow can I exclude the tests?" ]
[ "sonarqube", "automated-tests" ]
[ "HTML 5 Canvas and JS", "This solution works, the problem is when the user clicks on submit the item being drawn just keeps overlapping the last one. So I can click on the halfcircle radio button and then the quadratic curve and they just overlap one another.\n\nHow could I mkae it so the items dont overlap and only one is shown at a time\n\nHTML\n\n\n\n<!DOCTYPE html>\n<html>\n<head>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">\n</head>\n\n<body>\n <form>\n <input type=\"radio\" name=\"radio\" id=\"rd1\" value=\"Show Arc\" checked=\"checked\"/>Show Arc<br>\n <input type=\"radio\" name=\"radio\" id=\"rd2\" value=\"Show Half Circle\"/>Show Half Circle<br>\n <input type=\"radio\" name=\"radio\" id=\"rd3\" value=\"Show Circle\"/>Show Circle<br>\n <input type=\"radio\" name=\"radio\" id=\"rd4\" value=\"Show X\"/>Show X<br>\n <input type=\"radio\" name=\"radio\" id=\"rd5\" value=\"Show Quadratic Curve\"/>Show Quadratic Curve<br><br>\n <input type=\"submit\" id=\"button\" value=\"Submit\"/>\n </form>\n <canvas id=\"canvas\" width=\"500\" height=\"500\">\n Get a new browser\n </canvas>\n <script src=\"Lesson3.js\"></script>\n</body>\n</html>\n\n\nJS\n\n\n\nvar button = document.getElementById('button');\nvar rd1 = document.getElementById('rd1');\nvar rd2 = document.getElementById('rd2');\nvar rd3 = document.getElementById('rd3');\nvar rd4 = document.getElementById('rd4');\nvar rd5 = document.getElementById('rd5');\nvar canvas = document.getElementById('canvas');\nvar context = canvas.getContext('2d');\n\nbutton.addEventListener('click', function(){\nif(rd1.checked){\nshowArc();\n}\nelse if(rd2.checked){\nshowHalfCircle();\n}\nelse if(rd3.checked){\nshowCircle();\n}\nelse if(rd4.checked){\nshowX();\n}\nelse if(rd5.checked){\nshowQuadraticCurve();\n}\nelse{ alert('nothing to show');\n}\n}, false);\n\n\nfunction showArc(){\ncontext.beginPath();\ncontext.arc(250,250,200,Math.PI/180*90,Math.PI/180*270,false); \ncontext.stroke();\n}\n\nfunction showHalfCircle(){\ncontext.beginPath();\ncontext.arc(250,250,200,Math.PI/180*90,Math.PI/180*270,false);\ncontext.closePath();\ncontext.stroke();\n}\n\nfunction showCircle(){\ncontext.beginPath();\ncontext.arc(250, 250, 200, 0, Math.PI*2, true); \ncontext.closePath();\ncontext.fill();\n}\n\nfunction showX(){\ncontext.beginPath();\ncontext.moveTo(0,0);\ncontext.lineTo(500,500);\ncontext.stroke();\ncontext.moveTo(500,0);\ncontext.lineTo(0,500);\ncontext.stroke();\n}\n\nfunction showQuadraticCurve(){\ncontext.beginPath();\ncontext.moveTo(130,130);\ncontext.quadraticCurveTo(150.8, 130, 160.6, 150.5);\ncontext.quadraticCurveTo(190, 250, 210.5, 160.5);\ncontext.quadraticCurveTo(240, 100.5, 290, 70.5);\ncontext.stroke();\n}" ]
[ "javascript", "html", "canvas", "html5-canvas" ]
[ "Bidirectional Java clients/servers communication", "I am trying to design a distributed application in Java with a few servers and a few managers (applications monitoring and configuring the servers). Most of the traffic between the servers and the managers will be request from the managers to the servers, but the servers should be able to notify the managers when something happen. The managers don't care about each other, and the servers don't care about each other, but the managers should manage all the running servers and the servers should be managed by all the running managers.\nI don't want to have every request go through a central entity.\n\nWhat is the best way to implement the communication link between this?\n\nWhat I thought of:\n\n\nRESTful API: Unidirectional communication, so we need polling, which is less responsive and waste a lot of resources.\nOpening a Socket between each server/manager pair: Looks like the best way to me, but I feel like I would be re-inventing the wheel...\nJava RMI: Looks nice but it needs a central entity (rmiregistry). Plus, I'm stuck with Java if I use it, and it looks like it's more adapted for a point-to-point communication.\nJMS: Same thing, it needs a central entity (JMS Provider), and it's Java only...\n\n\nThanks!" ]
[ "java", "sockets", "communication", "distributed" ]
[ "Is there away that a dropdown data validation box can self populate an answer if a particular cells contains text?", "I have been working on a spreadsheet which a few people on this site have helped with, (Thank You).\nI have a series of dependent dropdown boxes.\nThese show the Type, Category, Product Type and finally description.\nFor example, Type could be 'Shopping', Category could give me a list of \"Fresh, Frozen, Cleaning\" and then Product Type could be \"Fruit\", Description would then provide me with a list of options.\n\nI have been asked by a colleague, that if we knew the item code of what we wanted, could it be placed in to a cell, and then all the dropdowns auto populate?\nDoes anyone know if this is possible?\n\nThanks" ]
[ "excel", "excel-formula" ]
[ "Xamarin.Forms (UWP and Android) directory selection outside of AppData", "I've been pulling my hair out all day. I'm converting my WPF app to Xamarin.Forms (UWP, IOS and Android). I'm currently focused on UWP and Android (don't have an apple devices yet) and I got a lot of the program running but I ran into a huge snag with reading files that are not in my sandbox directory. Currently, my app allows you to choose a folder with images and you can move through them. To test out the reading functionality, I've placed the images into the \"LocalState\" directory and bingo, my code is working beautifully. Now the program doesn't have a default folder and when I originally created it in WPF, the user would have a pop up and they would choose their own folder but I cannot for the life of me get a similar function for Xamarin. Every time I try something, I get an \"access denied\". I've seen Android apps allow you to pick a folder for emulators and I'm 100% sure that you can setup UWP to do permissions with StorageApplicationPermissions but I just cannot get this to work for Xamarin.Forms. Please help me!" ]
[ "android", "xamarin.forms", "directory", "uwp-xaml" ]
[ "how to adjust the weights in gradient descent", "I am currently trying to teach me something about neural networks. So I bought myself this book called Applied Artificial Intelligence written by Wolfgang Beer and I am now stuck at understanding a part of his code. Actually I understand the code I just do not understand one mathematical step behind it...\nThe part looks like this:\n\n for i in range(iterations):\n guessed = sig(inputs*weights)\n error = output - guessed\n adjustment = error*sig_d(outpus)\n #Why is there no learningrate?\n #Why is the adjustment relative to the error\n #muliplied by the derivative of your main function?\n weights += adjustment\n\n\nI tried to look up how the gradient descent method works, but I never got the part with ajusting the weights. How does the math behind it work and why do you use the derivative for it?\nAlo when I started to look in the internet for other solutions I always saw them using a learning rate. I understand the consept of it but why is this method not used in this book? It would realy help me if someone could awnser me these questions...\n\nAnd thanks for all these rapid responses in the past." ]
[ "neural-network", "gradient-descent" ]
[ "titlecase pipe does not work with ternary operator angular2", "I have this code in component.html\n\n<div class=\"dashboard-table-item row\"\n *ngFor=\"let item of itemArray\">\n <span>{{item.value == 'user' ? 'student' : item.value | titlecase}}</span>\n</div>\n\n\nitemArray can have one of this values: admin | editor | user\nI want without modifying the itemArray output: user --> student and then titlecase it.\n\nI know I could change 'student' for 'Student' and it works, but my question is why does pipe(| titlecase) not work with ternary operator(condition ? 'value1' : item.value) Value1" ]
[ "angular", "ternary-operator", "ngfor", "title-case" ]
[ "Get Array from XML web page using VBA", "I have this code:\n\nDim xmlOBject As Object\nSet xmlOBject = CreateObject(\"MSXML2.DOMDocument.6.0\")\nxmlOBject.async = False\nxmlOBject.Load (\"https://api.evemarketer.com/ec/marketstat?typeid=2268&typeid=2305&typeid=2267&typeid=2268&regionlimit=10000032\")' just example URL\n\n\nThe xmlOBject variable contain the XML resulte.\n\nIs there a way to convert a XML resulte to array, VBA only, without using the sheet to paste the XML resulte, also it should be dynamically, it means that no matter how many xml levels/nodes there are, so it will works with any given URL ? \n\nThe above URL should provide the this array(like the attached image without the titles):" ]
[ "excel", "xml", "vba" ]
[ "Robot Framework errors when running my maven-selenium-testNG java project", "I'm trying to set up a java project that uses Maven, Selenium 3 and TestNG in Eclipse. I did it successfully by creating a maven project and just adding selenium and testNG dependencies, then letting maven to do all the work of downloading libraries.\n\nBut now I want to add Robot Framework, so I grabbed the dependency info from https://mvnrepository.com/artifact/org.robotframework/robotframework/3.0.2 and plugin info, then created a \"robotframework/acceptance\" folder within src/test and a tests.robot file in src/test/robotframework/acceptance to write my tests (I only added an example test that opens a website, just to check if it works).\n\nThis is what my pom.xml looks like:\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n <modelVersion>4.0.0</modelVersion>\n <groupId>com.example.automation</groupId>\n <artifactId>automated_tests</artifactId>\n <version>0.0.1-SNAPSHOT</version>\n <dependencies>\n <dependency>\n <groupId>org.seleniumhq.selenium</groupId>\n <artifactId>selenium-java</artifactId>\n <version>3.4.0</version>\n </dependency>\n <dependency>\n <groupId>org.testng</groupId>\n <artifactId>testng</artifactId>\n <version>6.8</version>\n <scope>test</scope>\n </dependency>\n <dependency>\n <groupId>org.robotframework</groupId>\n <artifactId>robotframework</artifactId>\n <version>3.0.2</version>\n </dependency>\n </dependencies>\n <build>\n <plugins>\n <plugin>\n <groupId>org.robotframework</groupId>\n <artifactId>robotframework-maven-plugin</artifactId>\n <version>1.4.7</version>\n <executions>\n <execution>\n <goals>\n <goal>run</goal>\n </goals>\n </execution>\n </executions>\n </plugin>\n </plugins>\n </build> \n</project>\n\n\nAnd this is my test:\n\n*** Settings ***\nLibrary SeleniumLibrary\nTest Set Up Start Selenium Server\nTest Tear Down Stop Selenium Server\n\n*** Test Cases ***\nVisit google\n Open Browser https://www.google.com chrome\n Close Browser\n\n\nI also created a run configuration like this:\n\n\nIn the Run Configurations dialog, double clicked on the Maven Build\nClicked on the Browser Workspace button and selected my project as the base directory\nUnder \"Goals\" I entered robotframework:run\nChecked \"Resolve Workspace artifacts\" and \"Update Snapshots\"\n\n\nHowever, when I run it using this, I get the following error: \n\n[ ERROR ] Error in file 'C:\\Users\\myself\\automated_tests\\src\\test\\robotframework\\acceptance\\tests.robot': Importing test library 'SeleniumLibrary' failed: ImportError: No module named SeleniumLibrary\nTraceback (most recent call last):\n None\nPYTHONPATH:\n C:\\Users\\myself\\.m2\\repository\\org\\robotframework\\robotframework\\3.0.2\\Lib\n C:\\Users\\myself\\.m2\\repository\\org\\robotframework\\robotframework\\3.0.2\\robotframework-3.0.2.jar\\Lib\n __classpath__\n __pyclasspath__/\nCLASSPATH:\n /C:/eclipse/plugins/org.eclipse.m2e.maven.runtime_1.6.3.20160209-1444/jars/plexus-classworlds-2.5.2.jar\nAcceptance.Tests :: A resource file containing the application specific key...\n\n\nCan anyone tell me what I'm missing?" ]
[ "java", "eclipse", "maven", "selenium", "robotframework" ]
[ "How to use string frequencies list in Trie data structure?", "I am working on some performance test on various data structures. In my list I have HashMap and Trie data structure. I am done with HashMap but not sure how to use Trie for below problem -\n\nI have a text file which contains 2 million english words with their frequencies in this format -\n\nhello 100\nworld 5000\ngood 2000\nbad 9000\n...\n\n\nNow I am reading this file line by line and storing it in HashMap - First splitted string goes as the key in the HashMap and next splitted string goes as the value in the HashMap and so I am able to measure the insertion performance with the below code.\n\nMap<String, String> wordTest = new HashMap<String, String>();\n\ntry {\n fis = new FileInputStream(FILE_LOCATION);\n reader = new BufferedReader(new InputStreamReader(fis));\n\n String line = reader.readLine();\n while (line != null) {\n String[] splitString = line.split(\"\\\\s+\");\n // now put it in HashMap as key value pair\n wordTest.put(splitString[0].toLowerCase().trim(), splitString[1].trim());\n\n line = reader.readLine();\n }\n}\n\n\nNow how would I implement Trie data structure to load the same thing in Trie as I did for HashMap? And then do a lookup basis on String as well? This is my first time with Trie data structure so little bit confuse.\n\nUpdate:-\n\nBelow is my TrieImpl class\n\npublic class TrieImpl {\n\n //root node\n private TrieNode r;\n\n public TrieImpl() {\n r = new TrieNode();\n }\n\n public boolean has(String word) {\n return r.has(word);\n }\n\n public void insert(String word){\n r.insert(word);\n }\n\n public String toString() {\n return r.toString();\n }\n\n public static void main(String[] args) {\n\n TrieImpl t = new TrieImpl();\n\n System.out.println(\"Testing some strings\");\n t.insert(\"HELLO\"); // how do I pass string and its count\n t.insert(\"WORLD\"); // how do I pass string and its count\n\n }\n}\n\n\nAnd below is my TrieNode class - \n\npublic class TrieNode {\n\n // make child nodes\n private TrieNode[] c;\n // flag for end of word\n private boolean flag = false;\n\n public TrieNode() {\n c = new TrieNode[26]; // 1 for each letter in alphabet\n }\n\n protected void insert(String word) {\n int val = word.charAt(0) - 64;\n\n // if the value of the child node at val is null, make a new node\n // there to represent the letter\n if (c[val] == null) {\n c[val] = new TrieNode();\n }\n\n // if word length > 1, then word is not finished being added.\n // otherwise, set the flag to true so we know a word ends there.\n if (word.length() > 1) {\n c[val].insert(word.substring(1));\n } else {\n c[val].flag = true;\n }\n }\n\n public boolean has(String word) {\n int val = word.charAt(0) - 64;\n if (c[val] != null && word.length() > 1) {\n c[val].has(word.substring(1));\n } else if (c[val].flag == true && word.length() == 1) {\n return true;\n }\n\n return false;\n }\n\n public String toString() {\n return \"\";\n }\n}\n\n\nNow how would I extend this to passs a particular string and its count and then do a lookup basis on String?" ]
[ "java", "data-structures", "trie" ]
[ "How can I escape a single quote and a space in Python?", "I am having trouble with re.search finding the string \"Senders' Domains\" on my UI.\n\nword_check1 = 'Senders'\nword_check2 = \"Senders' Domains\"\npage_check1, page_check2 = mymessages_page.page_checker(word_check1, word_check2, 'chart-content-container')\n\n\nWhen I Debug, my page_checker method finds \"Senders//s Domains\" but then re.search returns \"Senders//sDomains\" (removing the space).\n\ndef page_checker(self, word_check1, word_check2, ids):\n container = self.driver.find_element_by_id(ids)\n content = container.text\n organized_container_content = content.split('\\n')\n for text in organized_container_content:\n if re.search(word_check1, text):\n check1 = text\n for text2 in organized_container_content:\n if re.search(word_check2, text2):\n check2 = text2\n return check1, check2\n break\n\n\nIs there any way I can escape the single quote (') and space characters so that I can find and match the string \"Senders' Domains\" on my UI?" ]
[ "python", "regex", "selenium-webdriver", "escaping" ]
[ "Cypress Get Attribute value and store in Variable", "I want to get the Attribute value and store in a variable how we can achieve this in cypress\n\nIn my case I want to get the complete class value and store it in variable.\n\nThis code just give me the attribute class value but how I can store the fetch value in variable\n\ncy.get('div[class*=\"ui-growl-item-container ui-state-highlight ui-corner-all ui-shadow ui-growl-message\"]').invoke('attr', 'class')" ]
[ "automation", "cypress" ]
[ "Swift 3: get color of pixel in UIImage (better: UIImageView)", "I tried different solutions (e.g. this one), but the color I get back looks a bit different than in the real image. I guess it's because the image is only RGB, not RGBA. May that be an issue?\n\nRelated issue: if the UIImage has contentMode = .scaleAspectFill, do I have to do a recalculation of the image or can I just use imageView.image?\n\nEDIT:\n\nI tried with this extension:\n\nextension CALayer {\n func getPixelColor(point: CGPoint) -> CGColor {\n var pixel: [CUnsignedChar] = [0, 0, 0, 0]\n\n let colorSpace = CGColorSpaceCreateDeviceRGB()\n let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)\n\n let context = CGContext(data: &pixel, width: 1, height: 1, bitsPerComponent: 8, bytesPerRow: 4, space: colorSpace, bitmapInfo: bitmapInfo.rawValue)\n\n context!.translateBy(x: -point.x, y: -point.y)\n\n self.render(in: context!)\n\n let red: CGFloat = CGFloat(pixel[0]) / 255.0\n let green: CGFloat = CGFloat(pixel[1]) / 255.0\n let blue: CGFloat = CGFloat(pixel[2]) / 255.0\n let alpha: CGFloat = CGFloat(pixel[3]) / 255.0\n\n\n let color = UIColor(red:red, green: green, blue:blue, alpha:alpha)\n\n return color.cgColor\n }\n}\n\n\nbut for some images it seems as if the coordinate system is turned around, for others I get really wrong values... what am I missing here?\n\nEDIT 2:\n\nI try with these images:\n\nhttps://dl.dropboxusercontent.com/u/119600/gradient.png\nhttps://dl.dropboxusercontent.com/u/119600/[email protected]\n\nbut I do get wrong values. They are embedded in a UIImageView but I convert the coordinates:\n\nprivate func convertScreenPointToImage(point: CGPoint) -> CGPoint {\n let widthMultiplier = gradientImage.size.width / UIScreen.main.bounds.width\n let heightMultiplier = gradientImage.size.height / UIScreen.main.bounds.height\n\n return CGPoint(x: point.x * widthMultiplier, y: point.y * heightMultiplier)\n}\n\n\nThis one\n\n\n\ngives me === Optional((51, 76, 184, 255)) when running on the iPhone 7 simulator, which is not correct..." ]
[ "uiimageview", "uiimage" ]