texts
list
tags
list
[ "Get Windows- Non-Drive MyDocuments Folder", "Accessing the \"MyDocuments\" folder in C# is easy with Environment.SpecialFolder.MyDocuments which returns the path:\nC:\\Users\\userName\\Documents\\\n\nBut if the user has OneDrive active, the method above brings me to the path:\nC:\\Users\\userName\\OneDrive\\Documents\n\nHow can I access the normal myDocuments folder if the user has OneDrive active?\n\nI could simply remove that part from the directory path manually, but I would prefer are more \"clean\" solution." ]
[ "c#", ".net", "windows" ]
[ "How to iterate over an arbitrary amount of lists as if using nested for loops?", "Assume I have the following lists, How to implement this:\n\nLIST1 LIST2 LIST3\n\n1 1 1\n\n2 2 2\n\n3 3 3\n\n. . .\n\n. . .\n\nI want the behavior of iteration as follows:\n\n1,1,1\n\n1,1,2\n\n1,1,3\n\n1,2,1\n\n1,2,2\n\n1,2,3\n\n1,3,1\n\n1,3,2\n\n1,3,3\n\n2,1,1\n\n.\n\n.\n\n.\n\nThis is a demonstration of what would happen for three lists, but in my actual use case I don't know the number of lists in advance." ]
[ "python", "algorithm" ]
[ "Change JSON File with JavaScript", "Does changing a JSON file with JS acutally affect the JSON file or does it only change the JSON file in temp memory?\nCode\nuser.properties[0].firstName = "Jane";\n\nThis is from Replacing a property value in JSON.\nEdit\nI am not using a server to develop my website, but will be using one when I post it." ]
[ "javascript", "json" ]
[ "How to map the provide product ID in to the mailchimp account list?", "This is my input json\n\n{\n\n\"id\": \"11378\",\n\n\"customer\": {\n \"id\": \"112\",\n \"email_address\": \"[email protected]\",\n \"opt_in_status\": true,\n \"company\": \"SKU projects\",\n \"first_name\": \"firstname\",\n \"last_name\": \"lastname\",\n \"orders_count\": 0,\n \"total_spent\": 0,\n \"address\": {\n \"address1\": \"675 Ponce de Leon Ave NE\",\n \"address2\": \"Suite 5000\",\n \"city\": \"Atlanta\",\n \"province\": \"GA\",\n \"province_code\": \"30033\",\n \"country_code\": \"\"\n }\n},\n\"campaign_id\": \"7d613b7b31\",\n\"checkout_url\": \"skuprojectsstg.prod.acquia-sites.com\\/cart\\/?checkout=11378\",\n\"currency_code\": \"USD\",\n\"order_total\": 260,\n\"tax_total\": 0,\n\"lines\": [{\n \"id\": \"45196\",\n \"product_id\": \"FWAX015\",\n \"product_title\": \"Waxed Canvas Bucket Bag\",\n \"product_variant_id\": \"FWAX015\",\n \"product_variant_title\": \"Waxed Canvas Bucket Bag\",\n \"quantity\": 1,\n \"price\": 0\n}]\n\n\n}\n\nThe following JSON is while running the php code that executes the curl curl_setopt($ch, CURLOPT_URL, 'https://us15.api.mailchimp.com/3.0/ecommerce/stores/SKU/carts');\n\n{\"type\":\"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/\",\"title\":\"Bad Request\",\"status\":400,\"detail\":\"A product with the provided ID does not exist in the account for this list.\",\"instance\":\"\"}\n\nPlease help!! How to resolve this? What needs to be added ?" ]
[ "mailchimp", "mailchimp-api-v3.0" ]
[ "No Reverse Match at /", "my template:\n\n<form action=\"{% url 'student:filter' %}\" method='get'>\n <select> \n <option value=\"00\">----</option>\n <option value=\"01\">Jan</option>\n <option value=\"02\">Feb</option>\n <option value=\"03\">Mar</option>\n <option value=\"04\">Apr</option>\n <option value=\"05\">May</option>\n <option value=\"06\">Jun</option>\n <option value=\"07\">Jul</option>\n <option value=\"08\">Aug</option>\n <option value=\"09\">Sept</option>\n <option value=\"10\">Oct</option>\n <option value=\"11\">Nov</option>\n <option value=\"12\">Dec</option>\n</select>\n</form>\n\n\nviews.py:\n\ndef filter(request, value):\n value = request.GET['value']\n att = Attendancename.objects.filter(date__hours=int(value))\n return render(request, 'listfilter.html', {'attend': att})\n\n\nurls.py:\n\nurl(r'^filter/(?P<value>\\d+)$', views.filter, name = 'filter'),\n\n\nWhat I want is to select a particular month from above html drop down, and its corresponding value needs to be passed in my views.py through url's argument, which then used in a look-up query.\n\nBut things are not working as I want. I'm doing something wrong with my templates, I don't know exactly how to trigger action corresponding to selected value in drop down.\n\nPlease! Can anybody tell me how to make it correct?\n\nThanks! in advance...." ]
[ "python", "html", "django", "django-templates" ]
[ "Cannot delete dynamically created SVG paths", "I have some dynamically created SVG paths which connect some div. And on clicking on the paths they are deleted. The problem is I am only able to delete the paths in a LIFO order because of the way the SVGs are styled. They are stacked on top of one another as they are added so I am unable to access the ones that were added before. How do I fix this?\n<div class="boundary">\n <div ng-repeat="edge in edges track by $index">\n <svg id="svg">\n <path id="boxPath_{{edge.id}}" class="boxPath" ng-click="deleteEdge(edge)"></path>\n </svg>\n </div>\n</div>\n\n#svg {\n position: absolute;\n width: 100%;\n height: 100%;\n }\n\n$scope.deleteEdge = function(edge){\n var index = $scope.edges.lastIndexOf(edge)\n $scope.edges.splice(index, 1);\n}" ]
[ "javascript", "html", "jquery", "css", "svg" ]
[ "Search mutlidimensional array for a value and return key in PHP", "I have an array looking like this:\n\n$user = array();\n$user['albert']['email'] = '[email protected]';\n$user['albert']['someId'] = 'foo1';\n$user['berta']['email'] = '[email protected]';\n$user['berta']['someId'] = 'bar2';\n\n\nNow I want to find out which user has a certain someId. In this example I want to know who has the someId bar2 and want the result berta. Is there a decent php function for this or would I have to create this on my own?" ]
[ "php", "arrays" ]
[ "How do I make a form submit with a LinkButton?", "My login usercontrol has two text boxes and a linkbutton.\n\n<asp:TextBox id=\"tbUserName\" runat=\"server\" size=\"10\" />\n<asp:TextBox id=\"tbPassword\" runat=\"server\" TextMode=\"Password\" size=\"10\" />\n\n<asp:LinkButton Text=\"login\" CssClass=\"submit\" runat=\"server\" ID=\"lbLogin\" OnClick=\"btnLogin_OnClick\" />\n\n\nI would like to call the \"btnLogin_OnClick function when someone pushes enter on tbUsername or tbPassword. \n\nHow do I do this?" ]
[ "asp.net", ".net", "html", "form-submit", "linkbutton" ]
[ "SQL Server 2008 R2 FILESTREAM using ASP.NET & Entity Framework", "I have been searching now for 2 days and still struggling! Any advise would be greatly appreciated!\n\nI am busy creating a web app - an online vehicle trader project.\n\nTech: VS2010, SQL Server 2008 R2, Entity Data Model 4 (EF), SQL Filestream For Images.\n\nI have my filestream setup correctly and can upload and download images (varbinary(MAX)). \n\nMy problems/questions are:\n\n\nI have link in a data grid that will download the image. I don't want to download, I need to display the actual image in the grid.\nAll of the above is done using ADO.NET, how can this be integrated into EF? My understanding is that EF does NOT support filestream? Has this changed in EF4?\n\n\nMaybe I have this whole thing backwards?\n\nAny advise, links to examples would be greatly appreciated!" ]
[ "asp.net", "sql", "entity-framework", "filestream" ]
[ "Trying to make PLY work for the first time", "I'm new to Python and I'm having some problems trying to make PLY works. For now, all I want is to successfully run the example from the PLY homepage.\n\nAt first I tried to just download PLY-3.8, put the ply folder in the same directory I saved the example (calc.py) and ran it. The calc.py file is at the C:\\Users\\...\\Python directory and the ply folder is the C:\\Users\\...\\Python\\ply, just to make it clearer. But I got an ImportError: No module named 'ply'.\n\nThen I searched for a while, tried to update something called distutils and install the modules through the Windows PowerShell and so on and so forth, but none of that worked and I just reset the whole thing (reinstalling Python and all of that). But then I finally got it to work by simply inserting into the sys.path the directory path where the script I was running (edit: in interactive mode) was, by doing this:\n\nimport sys\nsys.path.insert(0,'C:\\\\Users\\\\ ... \\\\Python')\n\n\nThis fixed the ImportError but, and this is where I am now, there are a bunch of other errors:\n\nTraceback (most recent call last):\n File \"C:\\Users\\...\\Python\\calc.py\", line 48, in <module>\n lexer = lex.lex()\n File \"C:\\Users\\...\\Python\\ply\\lex.py\", line 906, in lex\n if linfo.validate_all():\n File \"C:\\Users\\...\\Python\\ply\\lex.py\", line 580, in validate_all\n self.validate_rules()\n File \"C:\\Users\\...\\Python\\ply\\lex.py\", line 822, in validate_rules\n self.validate_module(module)\n File \"C:\\Users\\...\\Python\\ply\\lex.py\", line 833, in validate_module\n lines, linen = inspect.getsourcelines(module)\n File \"c:\\users\\...\\python\\python35\\lib\\inspect.py\", line 930, in getsourcelines\n lines, lnum = findsource(object)\n File \"c:\\users\\...\\python\\python35\\lib\\inspect.py\", line 743, in findsource\n file = getsourcefile(object)\n File \"c:\\users\\...\\python\\python35\\lib\\inspect.py\", line 659, in getsourcefile\n filename = getfile(object)\n File \"c:\\users\\...\\python\\python35\\lib\\inspect.py\", line 606, in getfile\n raise TypeError('{!r} is a built-in module'.format(object))\nTypeError: <module '__main__'> is a built-in module\n\n\nNow I have absolutely no idea what to do. I tried to search for a solution but had no luck. I appreciate if anyone can help me out.\n\nI'm on Windows 10, using Python 3.5.0 and iep as my IDE (www.iep-project.org) if these informations are of any importance.\n\nIn short: I just want to successfully run the example from the PLY homepage and then I think I can figure out the rest.\n\nEDIT: I found out that if I do:\n\nimport inspect\ninspect.getfile(__main__)\n\n\nI get the exact same (last) error from before:\n\nTraceback (most recent call last):\n File \"<console>\", line 1, in <module>\n File \"c:\\users\\...\\python\\python35\\lib\\inspect.py\", line 606, in getfile\n raise TypeError('{!r} is a built-in module'.format(object))\nTypeError: <module '__main__'> is a built-in module\n\n\nI think this is the culprit, but I still don't know how to fix it.\n\nEDIT 2: I got it to work and answered the question explaining how, but if someone have a more complete answer, I would love to hear it." ]
[ "python", "ply", "interactive-mode" ]
[ "grouping predicates in find", "This part \" ( -name *txt -o -name *html ) \" confuses me in the code:\n\nfind $HOME \\( -name \\*txt -o -name \\*html \\) -print0 | xargs -0 grep -li vpn\n\n\nCan someone explain the the brackets and \"-o\"? Is \"-o\" a command or a parameter? I know the brackets are escaped by \"\\\" , but why are they for?" ]
[ "find" ]
[ "Combine multiple lines in spreadsheet into one line based on customer name", "I've got an excel spreadsheet that contains multiple customers however there are multiple records for each customer depending on whether the information has come from the payments system, the ordering system, or the delivery system - the only thing that is constant on all of the lines is the customer name.\nAs an example\n Customer Name Order System Ref Payments Ref Delivery Ref \n Mrs Miggins 2222\n Mrs Miggins 6434\n Mrs Miggins 403\n Mr Bond 598 \n Mr Bond 293 \n Mr Bond 952\n\nWhat I would like to get to is a spreadsheet that combines these into the following\nCustomer Name Order System Ref Payments Ref Delivery Ref \nMrs Miggins 2222 6434 403\nMr Bond 293 598 952\n\nIs this possible? And if so, what do I need to do?" ]
[ "excel", "formula" ]
[ "Include results of a Paypal button generator in post without copy/paste", "I own a locally exclusive trade form for people to sell items to others locally. I want to have an option to include a Paypal "Buy Now" button in new posts but I'm stuck at how to include the button in a new post without having the user manually copy/past the HTML. I have made a simple Paypal button generator with a checkbox and jQuery to display form fields if checkbox is checked. Here it is on jsfiddle\nHTML\n<form>\n<input type="checkbox" id="checkme" /> Add a "Buy Now" Paypal button \n</form>\n<div id="extra">\n<form action="includes/paypal_button.php" method="post">\nPaypal account email: <input type="text" name="email" /><br />\nShort item description: <input type="text" name="item" /><br />\nPrice for item (all amounts are in USD): <input type="text" name="amount" /><br />\nTax amout: <input type="text" name="tax" /><br />\nShipping and handling: <input type="text" name="shipping" />\n<input type=submit value="Create Paypal button!">\n</form>\n</div>\n\njQuery\n<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.js"></script>\n<script type="text/javascript">\n $(document).ready(function(){\n \n //Hide div w/id extra\n $("#extra").css("display","none");\n // Add onclick handler to checkbox w/id checkme\n $("#checkme").click(function(){\n \n // If checked\n if ($("#checkme").is(":checked"))\n {\n //show the hidden div\n $("#extra").show("fast");\n }\n else\n { \n //otherwise, hide it \n $("#extra").hide("fast");\n }\n });\n \n });\n</script>\n\nThe controller form is in a separate php script, paypal_button.php\nHTML\n<form action="https://www.paypal.com/cgi-bin/webscr" method="post">\n<input type="hidden" name="cmd" value="_xclick">\n<input type="hidden" name="business" value="<?php echo htmlspecialchars(($_POST["email"]))?>" > \n<input type="hidden" name="lc" value="US">\n<input type="hidden" name="item_name" value="<?php echo htmlspecialchars(($_POST["item"]))?>">\n<input type="hidden" name="amount" value="<?php echo htmlspecialchars(($_POST["amount"]))?>">\n<input type="hidden" name="currency_code" value="USD">\n<input type="hidden" name="button_subtype" value="services">\n<input type="hidden" name="tax_rate" value="<?php echo htmlspecialchars(($_POST["tax"]))?>">\n<input type="hidden" name="shipping" value="<?php echo htmlspecialchars(($_POST["shipping"]))?>">\n<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">\n<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">\n<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">\n</form>\n\nSo should I include the controller(the button to print) in a php if statement that will print the button in new form posts? It would be highly appreciative if someone could point me in the right direction.\nThanks in advance" ]
[ "php", "jquery", "html", "paypal" ]
[ "SOAP WCF: Prevent deserialization to private fields", "I am trying to execute SOAP calls from SoapUI, against WCF, and when the XML is being deserialized, it is trying to deserialize to private fields. Why is that happening and how can I get around it? The code is listed below:\n\nI generated POCO classes from XSD files using the standard XSD.exe and the results look something like this:\n\n/// <remarks/>\n[System.CodeDom.Compiler.GeneratedCodeAttribute(\"xsd\", \"4.6.81.0\")]\n[System.SerializableAttribute()]\n[System.Diagnostics.DebuggerStepThroughAttribute()]\n[System.ComponentModel.DesignerCategoryAttribute(\"code\")]\n[System.Xml.Serialization.XmlTypeAttribute(Namespace = \"http://iec.ch/TC57/2011/MeterConfig#\")]\n[System.Xml.Serialization.XmlRootAttribute(Namespace = \"http://iec.ch/TC57/2011/MeterConfig#\", IsNullable = false)]\npublic partial class MeterConfig\n{\n\n private ComFunction[] comFunctionField;\n\n /// <remarks/>\n [System.Xml.Serialization.XmlElementAttribute(\"ComFunction\")]\n public ComFunction[] ComFunction\n {\n get { return this.comFunctionField; }\n set { this.comFunctionField = value; }\n }\n}\n\n\nI have a WCF SOAP endpoint as follows:\n\n[ServiceContract]\npublic class MyApi\n{\n [OperationContract]\n public void CreateMeterConfig2(MeterConfig Payload)\n {\n //do nothing\n }\n}\n\n\nI have a SoapUI test project where I provide the following XML:\n\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">\n <soapenv:Header/>\n <soapenv:Body>\n <tem:CreateMeterConfig2>\n <tem:Payload>\n\n </tem:Payload>\n </tem:CreateMeterConfig2>\n </soapenv:Body>\n</soapenv:Envelope>\n\n\nThe error I get is:\n\nExpecting element 'comFunctionField'\n\n\nOr in full:\n\n<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <s:Body>\n <s:Fault>\n <faultcode xmlns:a=\"http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher\">a:DeserializationFailed</faultcode>\n <faultstring xml:lang=\"en-ZA\">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:Payload. The InnerException message was 'Error in line 13 position 24. 'EndElement' 'Payload' from namespace 'http://tempuri.org/' is not expected. Expecting element 'comFunctionField'.'. Please see InnerException for more details.</faultstring>\n </s:Fault>\n </s:Body>\n</s:Envelope>" ]
[ "c#", "xml", "wcf", "soap" ]
[ "How to mock a module's method properly?", "I have a module that looks like this:\nimport {\n Request,\n Response,\n NextFunction,\n} from 'express';\n\nexport function checkAuthorization (req: Request, res: Response, next: NextFunction): void {\n if (req.user) {\n next();\n } else {\n res.status(401).send('Unauthorized');\n }\n}\n\n\nI want to mock the method checkAuthorization. The test file looks like this:\nimport * as authModule from '../check-authorization';\nimport { NextFunction } from 'express';\n\ndescribe('test', () => {\n\n const checkAuthorizationMock: jest.SpyInstance = jest.spyOn(authModule, 'checkAuthorization');\n checkAuthorizationMock.mockImplementation((req: Request, res: Response, next: NextFunction) => next());\n\n it('test case ...', async() => {\n // making HTTP request using **supertest**\n });\n});\n\nI get Unauthorized (code 401) as a response when I make the HTTP request in the it block, which means the mock doesn't apply. How can I solve this problem and use the mock instead of the real implementation of checkAuthorization method?" ]
[ "javascript", "node.js", "typescript", "express", "jestjs" ]
[ "SQL Many-to-Many Query Problem", "I have three tables: videos, videos_categories, and categories. \n\nThe tables look like this:\n\nvideos: video_id, title, etc...\nvideos_categories: video_id, category_id\ncategories: category_id, name, etc...\n\n\nIn my app, I allow a user to multiselect categories. When they do so, I need to return all videos that are in every selected category. \n\nI ended up with this:\n\nSELECT * FROM videos WHERE video_id IN (\n SELECT c1.video_id FROM videos_categories AS c1\n JOIN c2.videos_categories AS c2\n ON c1.video_id = c2.video_id\n WHERE c1.category_id = 1 AND c2.category_id = 2\n)\n\n\nBut for every category I add to the multiselect, I have to add a join to my inner select:\n\nSELECT * FROM videos WHERE video_id IN (\n SELECT c1.video_id FROM videos_categories AS c1\n JOIN videos_categories AS c2\n ON c1.video_id = c2.video_id\n JOIN videos_categories AS c3\n ON c2.video_id = c3.video_id\n WHERE c1.category_id = 1 AND c2.category_id = 2 AND c3.category_id = 3\n)\n\n\nI can't help but feel this is the really wrong way to do this, but I'm blocked trying to see the proper way to go about it." ]
[ "sql", "mysql", "many-to-many" ]
[ "Service Worker served from different port on a local machine", "I'm trying to develop a PWA for our sites. In production and staging, we serve everything from one domain. However, in development on a local machine we serve HTML from one port using Django server eg\n\nhttp://localhost:8000\n\nAnd the assets (including JS) using Grunt server from another port:\n\nhttp://localhost:8001\n\nThe problem is that the scope of the service workers is therefore only limited to assets, which is useless, I want to offline-cache pages on the 8000-port origin.\n\nI have somewhat been able to go around this by serving the service worker as a custom view in Django:\n\n# urls.py\n\nurl(r'^(?P<scope>.*)sw\\.js', service_worker_handler)\n\n# views.py\n\ndef service_worker_handler(request, scope='/'):\n return HttpResponse(render_to_string('assets/sw.js', {\n 'scope': scope,\n }), content_type=\"application/x-javascript\")\n\n\nHowever, I do not think this is a good solution. This code sets up custom routing rules which are not necessary for production at all.\n\nWhat I'm looking for is a local fix using a proxy, or something else that would let me serve the service worker with grunt like all the other assets." ]
[ "django", "proxy", "gruntjs", "localhost", "service-worker" ]
[ "Unable to load component properly from @fluentui/[email protected] in a spfx webpart", "I am using @fluentui/react-northstar carousal component link. it seems solution for my problem, but while loading it in spfx its not taking any default css or such. My webpart is simply showing images in vertical manner instead of showing proper carousel. Please find my code here\nI also tried react-material carousel but for this also I am facing same issue." ]
[ "reactjs", "sharepoint", "carousel", "spfx", "fluent-ui" ]
[ "Not able to update parent for all PortfolioItem/Feature which I copied for particular PortfolioItem/MMF", "I am trying to set parent for features which I copied for particular MMF, but parent is getting set for only last feature.\n\nBelow line of code to set the parent\nRecord is new feature object\n_newParent is the MMF object, where I am doing wrong\n\nrecord.set(\"Parent\", _newParent.get(\"_ref\")),\n\nNeed help please.Any suggestions?\n\nWhole is method is this\n\n _genericInnerCopy: function(_childObj) {\n that = this;\n model = that.model;\n var record = Ext.create(model, {\n Name: _childObj.get('Name'),\n //Parent: _newParent.get(\"_ref\");,\n });\n record.save({\n callback: function(result, operation) {\n if(operation.wasSuccessful()) {\n console.log(\"Done\");\n //that._copyChild();\n } else {\n console.log(\"error\");\n }\n }\n })\n that._all_pis.push(record);\n console.log(\"all pis values\", that._all_pis);\n var store = Ext.create('Rally.data.custom.Store', {\n data: that._all_pis,\n listeners: {\n load: that._updateAll,\n scope: that\n }, \n });\n //console.log(\"record values\", that._all_pis);\n }, \n _updateAll: function(store,data) {\n console.log(\"store values\", store);\n console.log(\"data values\", data);\n Rally.data.BulkRecordUpdater.updateRecords({\n records: data,\n propertiesToUpdate: {\n Parent: _newParent.get(\"_ref\")\n },\n success: function(readOnlyRecords){\n //all updates finished, except for given read only records\n },\n scope: that\n });\n //that._createNewItems(that._all_pis);\n }," ]
[ "javascript", "extjs", "extjs4", "rally" ]
[ "Display message if Javascript doesn't work?", "What is the simplest way to display a note in place of what the script would normally output?\n\nI currently have the following code:\n\n<p id=\"orderBy\">\n<script type=\"text/javascript\"> \n <!-- \n // Array of day names\n var dayNames = [\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\n \"Thursday\",\"Friday\",\"Saturday\"];\n var nextWorkingDay = [ 1, 2, 3, 4, 5, 1, 1 ];\n var now = new Date();\n document.write(\"Order by 5pm today for dispatch on \" +\n dayNames[nextWorkingDay[now.getDay()]]);\n // -->\n</script>\n</p>\n\n\n(as per Display tomorrow's name in javascript?)\n\nAs an example, the above code outputs the following:\n\nOrder by 5pm today for dispatch on Monday\n\n\nI would like to have the following if for any reason javascript is disabled:\n\nOrder by 5pm for next working day dispatch\n\n\nHow can I do this?" ]
[ "javascript" ]
[ "Display uploaded file using Node and Express", "I have some code written that takes a single image file from index.html through an HTML form, adds a border to it using the gm module and saves it on the server. Now I'm trying to find a way to display it back to the user, preferably on the same page it was uploaded.\n\nconst express = require('express');\nconst app = express();\nconst multer = require('multer');\nconst gm = require('gm').subClass({imageMagick: true});\n\napp.use(express.static(__dirname + '/public'))\napp.use(express.static(__dirname + '/output'))\n\nconst upload = multer({\n dest: 'temp/'\n }); \napp.get('/', (req, res) => {\n res.sendFile(__dirname + '/public/index.html');\n});\n\napp.post('/', upload.single('file-to-upload'), (req, res) => {\n var temp = req.file['path'];\n var output = __dirname + '/output/' + req.file['filename'] + '.png'\n console.log(req.file)\n gm(temp)\n .setFormat('png')\n .resizeExact(512,512)\n .composite(__dirname + '/masks/border.png')\n .write(temp, function() {\n gm(512, 512, 'none')\n .fill(temp)\n .drawCircle(256, 256, 256, 0)\n .write(output, function(err) {\n console.log(err || 'done');\n });\n });\n});\n\napp.listen(3000);" ]
[ "node.js", "express" ]
[ "Angular Storybook Subscribe Output", "How to subscribe to the component Output in Storybook for Angular?\nFor example, I have such component with its Output actions:\nimport { Component, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'app-task',\n template: `\n <div class="list-item">\n <input type="text" [value]="task.title" readonly="true" />\n </div>\n `,\n})\nexport class TaskComponent {\n @Input() task: any;\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onPinTask = new EventEmitter<Event>();\n\n // tslint:disable-next-line: no-output-on-prefix\n @Output()\n onArchiveTask = new EventEmitter<Event>();\n}\n\nAnd also I have the Storybook file for the component:\nimport { Story, Meta } from '@storybook/angular/types-6-0';\nimport { action } from '@storybook/addon-actions';\n\nimport { TaskComponent } from './task.component';\n\nexport default {\n title: 'Task',\n component: TaskComponent,\n excludeStories: /.*Data$/,\n} as Meta;\n\nexport const actionsData = {\n onPinTask: action('onPinTask'),\n onArchiveTask: action('onArchiveTask'),\n};\n\nconst Template: Story<TaskComponent> = args => ({\n component: TaskComponent,\n props: {\n ...args,\n onPinTask: actionsData.onPinTask,\n onArchiveTask: actionsData.onArchiveTask,\n },\n});\n\nexport const Default = Template.bind({});\nDefault.args = {\n task: {\n id: '1',\n title: 'Test Task',\n state: 'TASK_INBOX',\n updatedAt: new Date(2018, 0, 1, 9, 0),\n },\n};\n\nexport const Pinned = Template.bind({});\nPinned.args = {\n task: {\n ...Default.args.task,\n state: 'TASK_PINNED',\n },\n};\n\nexport const Archived = Template.bind({});\nArchived.args = {\n task: {\n ...Default.args.task,\n state: 'TASK_ARCHIVED',\n },\n};\n\nHow can I subscribe to the component Output in Storybook file and perform some actions for evens such as onPinTask or onArchiveTask?\nIt's needed to emulate a parent component." ]
[ "angular", "testing", "storybook", "angular-test", "angular-storybook" ]
[ "apache camel simple expression not giving string value", "I am using apache camel. I am trying to retrieve value from body using simple expression language. I need it as a String but simple returns SimpleBuilder object. So I have tried something like this\n\nsimple(\"${body.address.line}\").resultType(String.class).getResultType()\n\n\nbut it is returning me java.lang.String. please tell me how can I get this expression's result as String?" ]
[ "java", "apache-camel", "simple-el" ]
[ "How to check PDF/A conformance of existing document with iText 7?", "I'm trying to check the conformance (PDF/A-1B) of an existing PDF document with iText. Unfortunately it only checks the conformance for newly created elements in document but ignores existing parts of document.\n\nbyte[] pdf = ...; // pdf document which claims to be conform but is not conform (1 font is not embedded)\nfinal PdfADocument pdfADocument = new PdfADocument(new PdfReader(new ByteArrayInputStream(pdf)), \n new PdfWriter(new ByteArrayOutputStream()));\n\npdfADocument.close();\n\n\nIf I add something not conform to pdfADocument then the call to close() throws a PdfAConformanceException.\n\nI only find example about creating documents with PDF/A conformance but no example about just validating an existing document.\n\nIs there a way to check conformance with iText 7 for an existing document?" ]
[ "java", "pdf", "itext7", "pdfa" ]
[ "Convert XML to AVRO using convertRecord processor in NiFi", "I want to convert below XML file to AVRO format using convertRecord processor. Here i am not able to get the values of attributes in AVRO format.\n\nXML-\n\n<book id=\"b002\">\n <author>Brandon Sanderson</author>\n <title>Way of Kings</title>\n <genre>Fantasy</genre>\n <price>50</price>\n <pub_date>2006-12-17T09:30:47.0Z</pub_date>\n <sold>10</sold>\n</book>" ]
[ "apache-nifi" ]
[ "Mathjax: Change `textrm`, `textbf`, `texttt`, `textsf` fonts", "I have a GitHub page, and I use the default Kramdown to call Mathjax (with $$...$$ by default), where the textrm, textbf, texttt, textsf works for Latin alphabets.\nHowever, I would like to access more glyphs, such as Cyrillic alphabets.\nPresently, they are shown as fallback font, perhaps in Times new roman, in various height and weight, which looks undesired.\nWhat are the default font families that Mathjax uses for textrm etc?\nIs it possible to specify new fonts to overload them? In CSS or elsewhere?\nThere is some explanation here in Mathjax doc 2.7 and Mathjax doc 3.\nThere is no example, and they are not entirely consistent." ]
[ "css", "fonts", "latex", "mathjax" ]
[ "Looping through my array returns error chars[i] as \"undefined\", though console.log(chars[i].index) display the value", "I am looping through my dateIndex Array, but i get dateIndex[i] as undefined, but when i console.log the dateIndex[i].index, the value is displayed.\nlet dateIndex = {\n dateAndoutPutElements:[\n {"d_index": 3, "outPutElement": "1st"},\n {"d_index": 11, "outPutElement": "2nd"},\n {"d_index": 19, "outPutElement": "3rd"},\n {"d_index": 27, "outPutElement": "4th"},\n {"d_index": 35, "outPutElement": "5th"}\n ]\n}; \n\nlet chars = dateIndex.dateAndoutPutElements;\nconsole.log(chars);\nconsole.log("Index is " + chars[1].d_index);\nlet len=""; \nlet day=1; \nfor (let i = 0; len = chars.length; i++) {\n console.log("Index is " + chars[i].d_index); // Error occurs here apparently\n\n var date = data.list[chars[i].d_index].dt_txt;\n var tempValue = data.list[chars[i].d_index].main.temp;\n var descript = data.list[chars[i].d_index].weather[0].description;\n var icon = data.list[chars[i].d_index].weather[0].icon;\n\n console.log('Day:'+ day+ ' forecast');\n console.log(date);\n console.log(tempValue);\n console.log(descript);\n console.log(icon);\n console.log(chars[i].outPutElement);\n let ic = '<div> <img height="150" width="150" src="http://openweathermap.org/img/wn/'+icon+'@2x.png" ></img></div>'; \n\n day++;\n let output = \n '<p> Date: '+ date + \n '<br> '+ ic + \n '<br>Temperature: '+ Math.round(tempValue) +'&degC' \n '<br>Description: '+ descript + '</p>';\n\n document.getElementById(chars[i].outPutElement).innerHTML = output;\n\n\n //View.show5DayForecast(date, ic, tempValue, descript, chars[i].outPutElement); \n} \n\nERROR message:\n\nTypeError: chars[i] is undefined\nfiveDaysForecastCityWeatherLoad_Copy http://127.0.0.1:5501/model/reserByra-model.js:129\npromise callback*fiveDaysForecastCityWeatherLoad_Cop" ]
[ "javascript", "arrays", "loops" ]
[ "How To Create Google PageRank Checker By PHP", "I want a Google PageRank Checker for check pageRank a url that if was larger of 5, return (result) it is TRUE, else (less of 5) return (result) is FALSE. how is it by PHP or codeigniter?" ]
[ "php", "codeigniter", "pagerank" ]
[ "Scrapy issue when logging in and scraping all links", "I'm trying to get Scrapy to login to a website, and then being able to goto particular pages of it and then scrape information. I have the below code:\n\nclass DemoSpider(InitSpider):\n name = \"demo\"\n allowed_domains = ['example.com']\n login_page = \"https://www.example.com/\"\n start_urls = [\"https://www.example.com/secure/example\"]\n\n rules = (Rule(SgmlLinkExtractor(allow=r'\\w+'),callback='parse_item', follow=True),)\n\n # Initialization\n def init_request(self):\n \"\"\"This function is called before crawling starts.\"\"\"\n return Request(url=self.login_page, callback=self.login)\n\n # Perform login with the username and password\n def login(self, response):\n \"\"\"Generate a login request.\"\"\"\n return FormRequest.from_response(response,\n formdata={'name': 'user', 'password': 'password'},\n callback=self.check_login_response)\n\n # Check the response after logging in, make sure it went well\n def check_login_response(self, response):\n \"\"\"Check the response returned by a login request to see if we are\n successfully logged in.\n \"\"\"\n if \"authentication failed\" in response.body:\n self.log(\"Login failed\", level=log.ERROR)\n return\n\n else:\n self.log('will initialize')\n self.initialized(response)\n\n def parse_item(self, response):\n self.log('got to the parse item page')\n\n\nEverytime I run the spider, it logs in and gets to the initialize. However, it NEVER matches a rule. Is there a reason for this? I checked the below site regarding this:\n\nCrawling with an authenticated session in Scrapy\n\nThere're also a number of other sites including the documentation. Why is it that after initializing, it never goes through the start_urls and then scrapes each page?" ]
[ "python", "scrapy" ]
[ "How check the correctness of the month only after the second digit?", "I need JFormattedTextField which will format date ("dd.MM.yy"). Code:\nSimpleDateFormat format= new SimpleDateFormat("dd.MM.yy");\nDateFormatter formatter = new DateFormatter(format);\nformat.setLenient(false);\nformatter.setAllowsInvalid(false);\nformatter.setOverwriteMode(true);\nJForemattedTextField inputText = new JFormattedTextField(formatter);\ninputText.setValue(new Date());\n\nThe problem is: if the date is "11/06/12" for example and if I try to input 12 on month I can't do it because when I type 1 it understands the month as 16 and doesn't give me to input the next digit.\nI need that when I type for example 12 on month position then the JFormattedTextField will check the correctness of the month only after I typed the second digit, and if it is incorrect the month will return back to previous value. How can I solve this?" ]
[ "java", "swing", "date-format", "simpledateformat", "jformattedtextfield" ]
[ "how to set permission 777 to my document root while cloning a php repo in apache server?", "I'm trying to clone a git repo from github in the www folder of my apache server. it says \n\n\n fatal: could not create work tree dir 'myapp'.: Permission denied\n\n\nI think it's a permissions issue. I can neither set 777 on www, nor can I clone my repo into a subdirectory e.g. www/myapp/ because then my application will have to be accessed as such : www/myapp/myapp/index.html .. What is the common best practice in such scenario?" ]
[ "php", "git", "apache", "yii2", "vps" ]
[ "Enabel Excel Autofilter when export the data from gridview", "I really appreciate if anyone can help me on how can I enable the filter feature on Excel when exporting the data from gridview.( Excel Autofilter)\n\n public ActionResult ExportToExcel(List<EventViewModel> list)\n {\n try\n {\n // Main\n GridView gv = new GridView();\n gv.DataSource = list.ToList();\n gv.DataBind();\n\n Response.ClearContent();\n Response.Buffer = true;\n Response.Charset = \"\";\n Response.AddHeader(\"content-disposition\", \"attachment; filename=filename.xls\");//Response.AddHeader(\"content-disposition\", \"inline; filename=Excel.xls\");\n Response.ContentType = \"application/excel\";\n\n StringWriter sw = new StringWriter();\n HtmlTextWriter htw = new HtmlTextWriter(sw);\n gv.RenderControl(htw);\n Response.Output.Write(sw.ToString());\n Response.Flush();\n Response.End();\n\n return RedirectToAction(\"Index\");\n\n }\n catch (System.Exception e)\n { \n return View(\"Error\");\n }\n }" ]
[ "c#", "asp.net-mvc", "gridview", "export-to-excel" ]
[ "React dates-Datepicker does not filter in ag-grid react", "I was trying to implement a custom Date filter in ag grid using React. The link I followed is a link!\n\nI was able to create the component (SingleDatePicker) and able to render it on the cell. But I had tried a lot to make it filter the data with the selected date. It does not happen to filter. I have used the methods according to the documentation like updateAndNotifyAgGrid etc. but still no luck.\n\nI am using the agDateColumnFilter and my own custom component for rendering. \n\nCould anyone please help me point out where I am doing wrong for this to not filter the data." ]
[ "javascript", "reactjs", "ag-grid", "ag-grid-react" ]
[ "combine multiple DataViews into a single one?", "I have 4 different select statements which i sequently assign to an sqlDataSource like this:\n\nsqlNoutatiProduse.SelectCommand = select;\n\n\nand i keep the results in different DataViews like\n\nMySession.Current.dataViewNoutatiProduse1 = (System.Data.DataView)sqlNoutatiProduse.Select(DataSourceSelectArguments.Empty);\n\n\nand so on.\n\nIs it possible to combine into a single DataView the results of these queries?" ]
[ "c#", "asp.net" ]
[ "Difference in response time of Badboy and Jmeter", "I have created a script in Badboy tool for a site. Its response time is around 95 msec.\nBut if i export this same script file into JMeter and run this script in JMeter then the response time is around 600msec. \nI have not made any changes in the script nor within the network.\nCan anyone tell me why I am observing such difference in the response time?" ]
[ "jmeter", "badboy" ]
[ "How to test DatePickerIOS", "I need to enter a day using the native IOS DatePicker. How do I spin the control wheel to a certain value that might not be in the view, since this starts out with the current date?" ]
[ "detox" ]
[ "Excel Spreadsheet Manipulaltion using R program", "I was wondering is it possible for R to manipulate sheets in excel?\nFor example in an excel spreadsheet I have 3 different sheets...if I want to find the average/mean of each row of a particular column and place the output in a different sheet...would this be possible? How would I go about doing it?....Would it be wise to use XLConnect as the source of my functions or a different package?" ]
[ "r", "excel" ]
[ "FixedColumns extension of DataTables cause column duplicity", "I am using jQuery plugin DataTables https://datatables.net/ with extension Fixed Columns https://datatables.net/extensions/fixedcolumns/ \n\nthis is my javascript code\n\nvar datatable;\n\n $(document).ready(function () {\n\n datatable = $('#data-table').DataTable({\n \"scrollX\": true,\n \"scrollCollapse\": true,\n \"fixedColumns\": {\n \"leftColumns\": 3,\n \"rightColumns\": 1\n },\n stateSave: true,\n \"processing\": true,\n \"serverSide\": true,\n \"drawCallback\": function () {\n feather.replace();\n $('[data-toggle=\"tooltip\"]').tooltip();\n },\n \"ajax\":\n {\n \"url\": \"@Url.Action(\"GetDataTableData\",\"General\")\",\n \"type\": \"POST\"\n },\n \"columnDefs\": [\n {\n \"targets\": 33,\n \"data\": function (data) { return \"<a href=\\\"#\\\" onclick=\\\"edit(\" + data[33] + \")\\\">Edit</a> <a href=\\\"#\\\" onclick=\\\"deleteProject(\" + data[33] + \")\\\"><span color=\\\"red\\\" data-feather=\\\"x\\\"></span></a>\" },\n }\n ]\n });\n\n });\n\n\nBecause i have a lot of columns and \"scrollX\" property set to true i can see horizontal sidebar in my datatable.\n\nThis is result which can happen in two scenarios\n\n\n\nscenario 1 : hiding columns (https://datatables.net/examples/api/show_hide.html)\n\ncolumn.visible( ! column.visible() );\n\n\nand last fixed column is duplicated when there is no need for horizontal sidebar (because user hide most of the columns)\n\nscenario 2 : resize bootstrap page width\n\n$(\"#sidebar\").removeClass(\"sidebar-hidden\");\n\n\nI have similar hiding effect as is described in this example https://codepen.io/Xeoncross/pen/zxyWeW\n\nBecause i am also using property \"stateSave\": true the duplicity remain even i refresh the page.\n\nWhat is wrong here, how can i remove duplicity of the last action column ?\n\nFiddle example : https://jsfiddle.net/g7tdqm9h/32/" ]
[ "datatables" ]
[ "Joining many tables on same data and returning all rows", "UPDATE:\nmy orgional attempt to use FULL OUTER JOIN did not work correctly. I have updated the question to reflex the true issue. Sorry for presenting a classic XY PROBLEM.\n\nI'm trying to retrieve a dataset from multiple tables all in one query thats is grouped by year, month of the data.\nThe final result should look like this:\n\n| Year | Month | Col1 | Col2 | Col3 |\n|------+-------+------+------+------|\n| 2012 | 11 | 231 | - | - |\n| 2012 | 12 | 534 | 12 | 13 |\n| 2013 | 1 | - | 22 | 14 |\n\nComing from data that looks like this:\nTable 1:\n\n| Year | Month | Data |\n|------+-------+------|\n| 2012 | 11 | 231 |\n| 2012 | 12 | 534 |\n\n\nTable 2:\n\n| Year | Month | Data |\n|------+-------+------|\n| 2012 | 12 | 12 |\n| 2013 | 1 | 22 |\n\nTable 3:\n\n| Year | Month | Data |\n|------+-------+------|\n| 2012 | 12 | 13 |\n| 2013 | 1 | 14 |\n\nI tried using FULL OUTER JOIN but this doesn't quite work because in my SELECT clause because no matter which table I select 'Year' and 'Month' from there are null values.\nSELECT \n Collase(t1.year,t2.year,t3.year)\n,Collese(t1.month,t2.month,t3.month)\n,t1.data as col1\n,t2.data as col2\n,t3.data as col3\nFrom t1\nFULL OUTER JOIN t2\non t1.year = t2.year and t1.month = t2.month\nFULL OUTER JOIN t3\non t1.year = t3.year and t1.month = t3.month\n\nResult is something like this (is too confusing to repeat exactly what i would get using this demo data):\n\n| Year | Month | Col1 | Col2 | Col3 |\n|------+-------+------+------+------|\n| 2012 | 11 | 231 | - | - |\n| 2012 | 12 | 534 | 12 | 13 |\n| 2013 | 1 | - | 22 | |\n| - | 1 | - | - | 14 |" ]
[ "tsql", "join" ]
[ "Convert text to upper case in salesforce", "I have one custom object field name Flight_Request_c.Fields.From_c where\nFlight_Request is a custom object and From__c is a text field\n\nhow it possible that when user type in from field it changes to Upper case\n\nPlease help me.." ]
[ "salesforce" ]
[ "JavaFX - How to change default date of DatePicker when clicking Calendar Icon?", "I'm using JFXDatePicker extends DatePicker and want to change default date when clicking Calendar Icon. \n\n\nThe default is the current date and I want to change it to a specific date\nby code (It will save a little time when choosing a date in 195x for\nexample. I disable the Editable so can't type in textfield) And I\ndon't want to use .setvalue() because it will display that date when\nthe form was called.\nI've used this code but didn't work.\n\nbirthday = new JFXDatePicker(LocalDate.of(1980, Month.MARCH, 11));\n\n\n[http://i228.photobucket.com/albums/ee83/ThamVanTam/JFXDatePicker_zpscdgns2b6.png]" ]
[ "javafx" ]
[ "mysql groupconcat and a condition", "I need to get the bug_id s which satisfy the condition timediff(delta_ts,creation_ts) > \"00:01:00\"\n\nI created the query with this \n\nGROUP_CONCAT(\nDISTINCT \nbug_id \nfrom bugs \nwhere \ntimediff(delta_ts,creation_ts) > \"00:01:00\" \nSEPARATOR ' '\n)\n\n\nPlease help as I am getting error on this query:\n\nselect sum(IF(priority=\"P3\",1,0)) P3count,\nSUM(IF(priority=\"P2\",1,0)) P2count,\nsum(IF(timediff(delta_ts,creation_ts) > \"00:01:00\",1,0)) exeeded,\nGROUP_CONCAT(DISTINCT bug_id from bugs where priority=\"P2\") \nfrom bugs \nwhere bugs.product_id=237 \nand bugs.resolution='FIXED' \nand bugs.creation_ts >='2013-06-14 09:00:00' \nand bugs.creation_ts <= '2013-06-16 08:59:59' \nand bug_status=\"RESOLVED\";\n\n\nThrowing error:\n\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'from bugs where priority=\"P2\") from bugs where bugs.product_id=237 and bugs.res' at line 1" ]
[ "mysql", "group-concat" ]
[ "Removing \"almost duplicates\" using SAS or Excel", "I am working in SAS and I have a data-set with 2 columns and I want not only to remove the duplicates, but also the \"almost\" duplicates. The data looks like this:\n\n**Brand Product**\nCoca Cola Coca Cola Light\nCoca Cola Coca Cola Lgt\nCoca Cola Cocacolalight\nCoca Cola Coca Cola Vanila\n Pepsi Pepsi Zero\n Pepsi Pepsi Zro\n\n\ni do not know if it is actually possible, but what I would like the file to look like after removing the \"duplicates\", is like that:\n\n **Brand Product**\n Coca Cola Coca Cola Light\n Coca Cola Coca Cola Vanila\n Pepsi Pepsi Zero\n\n\nI don't have a preference if the final table will have e.g. \"Pepsi Zero\" or \"Pepsi Zro\" as long as there are no \"duplicate\" values.\n\nI was thinking if there was a way to compare the e.g. first 4-5 letters and if they are the same then to consider them as duplicates. But of course I am open to suggestions. If there is a way to be done even in excel I would be interested to hear it." ]
[ "excel", "sas" ]
[ "How do I create this FOREIGN KEY? - Postgres", "I have 2 tables. I am trying to create a FORIEGN KEY. Here is my first table:\n\nCREATE TABLE bills(\n id serial,\n name varchar(100),\n payment decimal(12, 2),\n payoff decimal(12, 2),\n type varchar(25)\n)\n\n\nWhen I try to create a second table:\n\nCREATE TABLE pay_dates(\n id serial,\n bill_id integer REFERENCES bills(id),\n due_date date,\n pay_date date,\n paid boolean\n)\n\n\nI get this error:\n\nERROR: there is no unique constraint matching given keys for referenced table \"bills\".\n\nWhat am I doing wrong?" ]
[ "postgresql" ]
[ "Propagation rules of touch/click events", "I've tried some variations of some code I'm trying to implement and I'm a bit confused as to why things are happening the way they are. I'm hoping someone can explain it to me.\n\nI have a layout file with various elements including a ListView. The layout file for the ListView item looks like this:\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"#ffffff\"\n android:orientation=\"vertical\">\n <LinearLayout android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"#ffffff\">\n <TextView android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_weight=\"1\"\n />\n <TextView android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_weight=\"1\"\n />\n </LinearLayout>\n <LinearLayout android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:background=\"#ffffff\">\n <TextView android:id=\"@+id/topicGoalsTextView\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_weight=\"1\"\n />\n <EditText android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n />\n <ImageView android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_gravity=\"center\"\n android:layout_marginRight=\"5dp\"\n android:src=\"@drawable/chevron\"\n />\n </LinearLayout>\n</LinearLayout>\n\n\nI set the ListView's OnItemClickListener() to listen for touch events to go to the next screen. However, when I click outside the EditText view, the onItemClick() method is not being called.\n\nI considered the fact that the EditText within the ListView item was causing the ListView events to be caught and not propagated. I took out the EditText from the above layout file and the onItemClick() method was called, as expected.\n\nThis would lead me to believe that the sibling TextViews of the EditText view could receive click events. This was correct. That worked. It also led me to believe that the ancestor LinearLayouts of the EditText would NOT receive click events if I clicked outside the EditText view. This is not the case. Both the parent LinearLayout holding the EditText AND the grandparent LinearLayout that holds the entire ListView item both received click events whenever I clicked outside the EditText view. Clicking inside the EditText view did not, however, propagate to its ancestors. That is what I had hoped.\n\nSo if the ancestor widgets are able to receive click events outside the EditText, why then, is the parent ListView not receiving the event to trigger the onItemClick() method? Why does the EditText prevent events from propagating back to the ListView?\n\nThank you in advance for your help." ]
[ "android", "listview", "onclick", "android-edittext" ]
[ "Extract picture from video blob recorded with VideoJS", "I have used VideoJS to record video on my website and send it to server where it will chop up the video into different images based on frame. But now I want to reduce server load, so I'm trying to modify my code to extract images directly after the video has been recorded but I have no idea how to do that. \n\nHere's my videojs source code:\n\n$(document).ready(function(){\n var player = videojs(\"myVideo\", {\n controls: true,\n fluid: true,\n width:250,\n loop: false,\n controlBar: {\n volumePanel: false,\n fullscreenToggle: true\n },\n plugins: {\n record: {\n audio: false,\n video: true,\n timeSlice: 2000,\n maxLength: 1.5,\n debug: true,\n mandatory: {\n minWidth: 1280,\n minHeight: 720,\n },\n video: {\n\n },\n // dimensions of captured video frames\n frameWidth: 1280,\n frameHeight: 720\n }\n }\n}, function() {\n // print version information at startup\n var msg = 'Using video.js ' + videojs.VERSION +\n ' with videojs-record ' + videojs.getPluginVersion('record') +\n ' and recordrtc ' + RecordRTC.version;\n videojs.log(msg);\n});\n// user completed recording and stream is available\nplayer.on('finishRecord', function() {\n // document.getElementById(\"fileupload\").value = player.recordedData;\n formData.delete(\"video-blob\")\n formData.set(\"video-blob\",player.recordedData)\n $(\"#video_rec\").rules('remove')\n $(\"#video_rec-error\").remove()\n $('.submit_btn').removeAttr(\"disabled\")\n});" ]
[ "javascript", "html", "html5-canvas", "video.js" ]
[ "FTP with AWS elastic Beanstalk", "I am quite newbie and trying to figure out how to configure sftp or ftp with aws elastic beanstalk. I am using filezila, and is wondering where I could grab the proper credentials to set it up.\n\nThanks" ]
[ "php", "mysql", "amazon-web-services", "ftp", "sftp" ]
[ "What is the proper way to use virtual environments?", "I am trying to learn how to use virtual environments in python. I got everything installed and I am able to create new environments via command prompt. I understand that venv allows you to install packages for each project without affecting other projects. But how often am I suppose to use these environments? Is a new environment suppose to be created for every project? Or how do I know the proper time to use a venv?" ]
[ "python-venv" ]
[ "Pynmea2 AttributeError `NoneType` object has no attribute `num_sats`", "When trying to create a conditional statement i get this error. I have tried many things over the last week to get this working but everything i try is failing.\nCan anyone shed some light if this is specific to pynmea nodule?\n\n\ndef parse_gps(incoming_data):\n\n if incoming_data.find(\"GGA\") > 0:\n data = pynmea2.parse(incoming_data)\n print(\"Timestamp: %s // Lat: %s // Lon: %s // Satellites: %s \" % (data.timestamp, data.latitude,\n data.longitude, data.num_sats))\n return data\n\n\nwhile True:\n gps_fix = ser.readline().decode('ascii')\n gps_data = parse_gps(gps_fix)\n if gps_data.num_sats > 7:\n break\n else:\n print(\"No data\")```\n\n\nShould find a fix of satellites greater than 7 in order to gain a valid fix then break." ]
[ "python" ]
[ "Passing parameter to window panel from grid panel in EXTJS4", "{\n icon: 'images/delete.png', \n tooltip: 'Edit',\n\n handler: function(grid, rowIndex, colIndex) {\n var edit = Ext.create('AM.view.user.Uploadfile').show();\n //here I want to pass parameters to get in window panel \n }\n}\n\n\nThe code that I have written and want the parameter to be passed like the row id where the icon is clicked on window panel." ]
[ "extjs", "extjs4" ]
[ "Get list of dlls in a directory with MSBuild", "The following gives me only 1 file, the exe:\n\n<ItemGroup>\n <AssembliesToMerge Include=\"$(MSBuildProjectDirectory)\\App\\bin\\Release\\*.*\" Condition=\"'%(Extension)'=='.dll'\"/>\n <AssembliesTomerge Include=\"$(MSbuildProjectDirectory)\\App\\bin\\Release\\App.exe\"/>\n</ItemGroup>\n\n\nIf I remove the Condition attribute, AssembliesToMerge contains all the files in the directory--dlls and otherwise. What am I doing wrong?\n\nI am testing this via the ILMerge MSBuildCommunityExtensions Task. If there is a way to directly print the items in the ItemGroup, then that might help to ensure it's an issue with the Condition attribute." ]
[ "msbuild" ]
[ "Can one Swift typealias be constrained to another in a protocol definition? If not, how else can I achieve something like component registration?", "I am writing a small inversion of control container for my own little framework in swift (mainly so I can learn more) and I have stumbled across a problem - well, several problems of which this is just the latest. \n\nI had hoped that swift would be flexible enough for me to port the core patterns of Castle.Core in C#. My first disappointment was in the weak reflection capabilities provided by Apple, which led me to do this ugliness...\n\npublic protocol ISupportInjection {\n\n}\n\npublic protocol IConstructorArguments {\n\n func toArgumentsDictionary() -> [String:AnyObject?]\n\n}\n\npublic protocol ISupportConstructorInjection: ISupportInjection {\n\n init(parameters:IConstructorArguments)\n\n}\n\n\n...the idea being that someday (soon) I could deal with it and remove any reference to these constraints in my services/components.\n\nNow I want to write IIocRegistration with two typealias: one for the TService and the other for the TComponent, ideally where TService is a protocol and TComponent is a concrete struct or class that implements TService:\n\npublic protocol IIocRegistration {\n\n typealias TService: Any\n typealias TComponent: TService, ISupportConstructorInjection\n\n}\n\n\nBut it seems that TComponent: TService is totally invalid according to the compiler, which says:\n\n\n Inheritance from non-protocol, non-class type '`Self`.TService'\n\n\nSo I am wondering how to make a typealias derive another typealias if it possible." ]
[ "swift", "typedef", "type-alias" ]
[ "What is the significance of i+1 in plt.subplot(3, 3, i + 1)?", "What is the significance of i+1 in plt.subplot(3, 3, i + 1) ? in the following code:\n\nfor i in range(9):\n plt.subplot(3, 3, i + 1)\n img = plt.imread(os.path.join(img_dir, random_images[i]))\n plt.imshow(img, cmap='gray')\n plt.axis('off')" ]
[ "matplotlib" ]
[ "What is the purpose of Embeded code under share tab in GDB", "In GDB online debugger, when I click on the "Share" tab,\n1st option is: shareable link\n2nd option is embedded code\nWhat is the purpose of the embedded code?" ]
[ "debugging", "hyperlink", "gdb", "gdb-python" ]
[ "Can I make a Linq join asynchronous?", "I have the following linq and I would like to make it async to improve performance. Is this possible? As this is a join, I thought it would be possible to make it async because of performance but the commands I am using do not seem to have an async equivalent. Is there an equivalent and why not?\nvar usersindomain = allUsers\n .Join(allUserStatus, usr => usr.EIN, us => us.EIN, (usr,us) => new { usr,us})\n .Where(result => result.us.DomainID == id)\n .OrderBy(order => order.us.Status)\n .Select (z => new { EIN = z.usr.EIN, FullName = z.usr.FullName, Status = z.us.Status });" ]
[ "c#", "linq", "asp.net-core", "asynchronous" ]
[ "accessing array values in view", "I have the following code in zend:\n\n $arrErrors=array();\n if (!empty($this->post['submit']))\n {\n // Each time theres an error, add an error message to the error array\n // using the field name as the key.\n if (empty($this->post['client_name']))\n $arrErrors['client_name'] = \"Please Enter Client's name as it appears in the carrier software\";\n }\n\n\nif i set $this->view->arrErrors=$arrErrors in the controller,\nCan I access it as $this->arrErrors['client_name'] in the view?" ]
[ "zend-form-element" ]
[ "Determine if all characters in a string are the same", "I have a situation where I need to try and filter out fake SSN numbers. From what I've seen so far if they are fake they're all the same number or 123456789. I can filter for the last one, but is there an easy way to determine if all the characters are the same?" ]
[ "c#", "string", "contains" ]
[ "How to add private members to external api", "Good afternoon all,\n\nI am attempting to create a function that will automatically create a membership through my external loyalty program (through Whisqr) for the current user on my Wix.com website. I am receiving an error message stating the public key is not found. \n\nHere is my backend code:\n\n import {fetch} from 'wix-fetch'; \nimport {wixData} from 'wix-data';\n\n\nexport function postLoyalty() {\n let options ={\n \"headers\": { \n \"X-Public\": \"pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76\"\n }\n }\n const url = 'https://whisqr.com/api/v1.2/user/customer/';\n const key = '<pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76>';\n console.log(\"Url: \");\n\n return fetch(url, {method: 'post'})\n .then(response => {\n return response.json();\n })\n .then((data) => {\n console.log(data);\n return data;\n });\n}\n\n\n\nHere is my page code:\n\nimport {postLoyalty} from 'backend/Loyalty.jsw';\nimport {wixData} from 'wix-data';\nimport wixLocation from \"wix-location\";\nimport {myFunction} from 'public/core.js';\nimport wixUsers from 'wix-users';\n\n\n$w.onReady(function () {\n let publickey = 'pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76';\n myFunction(publickey)\n .then( (response) => {\n console.log(response); //your base64 encoded string\n })});\n\nexport function page1_viewportEnter(event) {\n //Add your code for this event here: \n let email = wixUsers.currentUser.getEmail();\npostLoyalty(email)\n .then(LoyaltyInfo => {\n console.log(LoyaltyInfo)\n $w(\"#text1\").text = LoyaltyInfo.Results.Value;\n })\n}\n\n\n\n\nAny and all feedback is greatly appreciated!" ]
[ "api", "base64", "external", "velo" ]
[ "How should we classify full sequence?", "I want to classify fully sequence into two categories. I searched a lot in the web but found no result for this. My prefered way is to use LSTM model from keras to classify \"full\" sequence of varing rows into two categories. The problem with this approach is the different shape of X and y. This is a sample code I wrote to explain my problem.\n\nimport numpy as np\nfrom keras.layers import Dense,LSTM\nfrom keras.models import Sequential\n\n#(no of samples, no of rows,step, feature)\nfeat= np.random.randint(0, 100, (150, 250, 25,10))\n\n#(no of samples, binary_output)\ntarget= np.random.randint(0, 2, (150, 1))\n\n#model\nmodel = Sequential()\nmodel.add(LSTM(10, input_shape=(25, 10), return_sequences=True))\nmodel.add(LSTM(10,return_sequences=False))\nmodel.add(Dense(1, activation='softmax'))\nmodel.compile(loss='binary_crossentropy', optimizer='rmsprop')\nprint model.summary()\n\nfor i in xrange(target.shape[0]):\n X=feat[i]\n y=target[i]\n model.fit(X,y)\n\n\nHere I have 150 sample sequence which I want to classify into 0 or 1. The problem is this\n\n\n ValueError: Input arrays should have the same number of samples as target arrays. Found 250 input samples and 1 target samples.\n\n\nIf there is no way to carry out this in deep learning methods, can you suggest any other machine learning algorithms?\n\nEDIT\n\nMany have asked doubts regarding this\n\n#(no of samples, no of rows,step, feature)\nfeat= np.random.randint(0, 100, (150, 250, 25,10))\n\n\n150 is number of samples( consider this as 150 time series data).\n250 and 10 is a time series data with 250 rows and 10 columns.\n(250, 25,10) is additon of 25 time steps that way it can be passed to keras lstm input" ]
[ "python", "machine-learning", "classification", "keras", "lstm" ]
[ "Transfer of Large Stream from server to client fails", "All,\n\nI am working on a new datasnap project based on the example project located in C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\18.0\\Samples\\Object Pascal\\DataSnap\\FireDAC_DBX.\n\nI am trying to transfer a large stream (1,606,408 bytes) from datasnap server to client. I am running into what appears to be a common issue and that is that the entire stream does not make it to the client.\n\nHere is my server code:\n\n//Returns Customer Info\nfunction TServerMethods.GetBPInfo(CardCode : String): TStringStream;\nbegin\n Result := TStringStream.Create;\n try\n qBPInfo.Close;\n if CardCode.Trim = '' then\n qBPInfo.ParamByName('ParmCardCode').AsString := '%%'\n else\n qBPInfo.ParamByName('ParmCardCode').AsString := '%' + CardCode + '%';\n qBPInfo.Open;\n FDSchemaAdapterBPInfo.SaveToStream(Result, TFDStorageFormat.sfBinary);\n Result.Position := 0;\n // Result.SaveToFile('output.adb');\n except\n raise;\n end;\nend;\n\n\nHere is my client code:\n\nprocedure TdmDataSnap.GetBPInfo(CardCode : String);\nvar\n LStringStream : TStringStream;\nbegin\n dmDataSnap.FDStoredProcBPInfo.ParamByName('CardCode').AsString := CardCode;\n FDStoredProcBPInfo.ExecProc;\n LStringStream := TStringStream.Create(FDStoredProcBPInfo.ParamByName('ReturnValue').asBlob);\n //LStringStream.Clear;\n //LStringStream.LoadFromFile('Output.adb');\n try\n if LStringStream <> nil then\n begin\n LStringStream.Position := 0;\n try\n DataModuleFDClient.FDSchemaAdapterBP.LoadFromStream(LStringStream, TFDStorageFormat.sfBinary);\n except\n on E : Exception do\n showmessage(e.Message);\n end;\n end;\n finally\n LStringStream.Free;\n end;\nend;\n\n\nYou will see the stream save and load code; that is how I determined that the server was getting the entire result set into the stream, and that the client could handle the entire result set and display it properly.\n\nSo smaller streams transfer just fine, but this big one, when examined in the ide debugger, does not start with the 65,66,68,83 characters and the load fails with the error, '[FireDAC][Stan]-710. Invalid binary storage format'.\n\nI know from extended Googling that there are work-arounds for this, but I do not understand how to apply the workarounds to my case, with the use of Tfdstoredproc and TfdSchemaAdaptor components. I'm trying to stay with this coding scheme. \n\nHow do I adapt this code to correctly receive large streams?\n\nUpdate 1:\n\nOk, I tried strings and Base64 encoding. It didn't work.\n\nClient Code:\n\nprocedure TdmDataSnap.GetBPInfo(CardCode : String);\nvar\n LStringStream : TStringStream;\n TempStream : TStringStream;\nbegin\n dmDataSnap.FDStoredProcBPInfo.ParamByName('CardCode').AsString := CardCode;\n FDStoredProcBPInfo.ExecProc;\n try\n TempStream := TStringStream.Create;\n TIdDecoderMIME.DecodeStream(FDStoredProcBPInfo.ParamByName('ReturnValue').asString,TempStream);\n if TempStream <> nil then\n begin\n TempStream.Position := 0;\n try\n DataModuleFDClient.FDSchemaAdapterBP.LoadFromStream(TempStream, TFDStorageFormat.sfBinary);\n except\n on E : Exception do\n showmessage(e.Message);\n end;\n end;\n finally\n TempStream.Free;\n end;\nend;\n\n\nHere is my server code:\n\n//Returns Customer Info\nfunction TServerMethods.GetBPInfo(CardCode : String): String;\nvar\n TempStream : TMemoryStream;\n OutputStr : String;\nbegin\n Result := '';\n TempStream := TMemoryStream.Create;\n try\n try\n qBPInfo.Close;\n if CardCode.Trim = '' then\n qBPInfo.ParamByName('ParmCardCode').AsString := '%%'\n else\n qBPInfo.ParamByName('ParmCardCode').AsString := '%' + CardCode + '%';\n qBPInfo.Open;\n FDSchemaAdapterBPInfo.SaveToStream(TempStream, TFDStorageFormat.sfBinary);\n TempStream.Position := 0;\n OutputStr := IdEncoderMIMEBPInfo.EncodeStream(TempStream);\n Result := OutputStr\n except\n raise;\n end;\n finally\n TempStream.Free;\n end;\nend;\n\n\nThe result is the same." ]
[ "delphi", "datasnap", "firedac" ]
[ "Changing user folder collaborating type in box using Salesforce Toolbox", "I'm trying to change Box folder collaboration type for user from salesforce Apex trigger. The first thoughts were to use box.Toolkit but it looks like this class does not have updateCollaboration or changeCollaboration method, only create. I guess my only option is to use Box's Rest API. Is there any way I can get service account token in Apex so I can use it in a callout?" ]
[ "box", "boxapiv2" ]
[ "Entity Framework / Glimpse duration disparity", "I'm using the latest ASP.NET MVC and Entity Framework (MVC 5.2.2, EF 6.1.2), and latest of Glimpse. I'm working on improving query times to eagerly load an entity with several nested child objects, and have reduced the number of queries by using .Include(\"Object.Child\") to bring in navigation properties. At first, I thought I was getting a good result, seeing the \"Total query execution time\" in the SQL tab of Glimpse reduce significantly. Yet the \"Total connection open time\" stays high, and is very long for the resulting combined mega-query. See screenshot below.\n\nI'm wondering if anyone can help me understand what is going on with the differences in the two durations? Glimpse says my command takes <100 ms, but that the SQL connection takes >5 seconds. The query in this case is really messy with lots of joins etc, however it's not clear where the time goes if indeed the query itself finishes in 100 ms. \n\nNote: I've seen the answer about why two durations here, but it doesn't explain the nature of each." ]
[ "asp.net-mvc", "entity-framework", "glimpse" ]
[ "rails app use postgresql shows PG::Error", "I just started a new rails app using \n\nrails new myapp --database=postgresql\n\n\nThen I generate some static pages:\n\nrails g controller StaticPages home about\n\n\nWhen I started the server and visit localhost:3000/static_pages/home, the PG::Error shows up:\n\nPG::Error\n\ncould not connect to server: Connection refused (0x0000274D/10061)\nIs the server running on host \"localhost\" (::1) and accepting\nTCP/IP connections on port 5432?\ncould not connect to server: Connection refused (0x0000274D/10061)\nIs the server running on host \"localhost\" (127.0.0.1) and accepting\nTCP/IP connections on port 5432?\n\n\nI didn't change anything else\n\nAny idea how to make postgresql work?" ]
[ "ruby-on-rails", "postgresql" ]
[ "Postgres: select data from table based on few clauses on relationship table", "Let's say we have two tables:\n\nperson (\n id int,\n name varchar,\n surname varchar\n)\n\nvehicle (\n id int,\n make varchar,\n model varchar,\n has_gps boolean,\n has_ac boolean\n person_id\n)\n\n\nI want to select all persons who have at least one vehicle that has GPS (has_gps = true) and at least one vehicle that has AC (has_ac = true).\n\nSo basically person must have minimum of 2 vehicles, but there must be at least one vehicle that has GPS and at least one vehicle that has AC.\n\nI tried with exists, but I can't seem to figure out how I could do this in postgres.\n\nFor example:\n\nPerson (1, 'Michael', 'Jordan')\nPerson (2, 'Leo', 'Messi')\n\nVehicle (1, 'bmw', 'x5', true, false, 1)\nVehicle (2, 'ferrari', 'testarossa', false, true, 1)\nVehicle (3, 'mercedes', 's class', true, true, 2)\n\n\nIn the results I should only get Person with ID 1, because it has at least one vehicle with gps and at least one with ac." ]
[ "sql", "postgresql" ]
[ "Does PHP have the equivilant to Java 'synchronized' , or is this not required?", "I am familiar with Java and at the moment I am teaching myself PHP. To prevent race conditions and deadlocks, Java uses the keyword 'synchronized'.\n\nFrom Oracle docs:\n\npublic synchronized void increment() {\n c++;\n}\n\n\nI am using prepared statements within a separate class to access my database. I wish to avoid race conditions, deadlocks etc, but I cannot see how PHP handles this.\n\nDoes PHP have the equivalent to Java, and is it operating system specific? I am using Windows. What would best practices be?" ]
[ "php" ]
[ "Why isn't this C++ loop counting from 10 to -5?", "Alright, so I'm learning C++ and one of the challenges was to make a program that counts down from 10 to -5.. it's always going from 9 to 1, and it says Done!\n\nPlease help me in any way you can, and here's the code:\n\n\n/*\n*\n* Negative Example\n*\n*/\n#include <iostream>\n#include <string>\nint main()\n{\nsigned int i = 10;\n for(i <= 10 && i != (0 - 5); --i;) {\n using std::cout;\n cout << i << std::endl;\n }\n std::cout << \"Done!\" << std::endl;\n}\n\n\nThe output: \n9 \n8 \n7 \n6 \n5 \n4 \n3 \n2 \n1 \nDone!" ]
[ "c++", "loops", "for-loop", "counting", "negative-number" ]
[ "Get only the top 1 per non-unique column per row, per clientid, based on data in another table", "Let's say I have the table ClientStatusHistory\n\nThis contains the history of the status changes of a specific Client.\n\nThe table looks like this:\n\n(Dates in format: DD/MM/YYYY)\n\nClientStatusHistory:\n\n(There is an autoincrement PK column called ID)\n\nClientID | StatusID | DateStarted | DateEnded\n1 | 5 | 01/01/2000 | 01/01/2019\n1 | 7 | 01/01/2019 | 11/01/2019\n1 | 8 | 11/01/2019 | Null\n2 | 5 | 01/01/2000 | 01/01/2019\n2 | 7 | 01/01/2019 | 11/01/2019\n2 | 8 | 11/01/2019 | Null\n\n\nAll the rows/records that are reflective of their current status have Null in their DateEnded column.\n\nHow would I pull all of their status before their current one, and insert it into a temporary table?\n\nI was thinking of using top 1, but that will just pull out 1 record in the way I'm using it:\n\nselect top 1 clientid, statusid, datestarted, dateended\nfrom ClientStatusHistory\nwhere\ndateended is not null\norder by id desc \n\n\nThis will order them using desc from most recent to oldest, and then pull the one before that which is currently active as we ignore the nulls.\n\nHow would I expand the above query to pull all of the rows from ClientStatusHistory where the status is the one before the row with a null DateEnded field, for each ClientID?" ]
[ "sql", "sql-server", "sql-server-2008" ]
[ "Input validation in Swing", "I have made form in swing with 6 jTextFields. User should be able to input only numbers from 1 to 48 in each of Text fields. There should be also check to see if any of numbers repeat and app should check if any field is left blank.\n\nI know how to do this in VB.net but i'm new to java in general.\n\nIn VB.net i would put all textfields in array and then check to see if all text fields are filled in, are the numbers in range and check if there is a duplicate number in any field. If all criteria is met i would proceed to send inputs to database. \n\nI am fairly new to java so if anyone could help me or point me in right direction that would be awesome." ]
[ "java", "swing" ]
[ "AWS Secret Manager secret deleted without mandatory retention period", "I created a secret using CloudFormation template that looked like this:\n\n \"DBSecretCredentials\": {\n \"Type\": \"AWS::SecretsManager::Secret\",\n \"Properties\": {\n \"Name\": \"MyAwesomeSecret\",\n \"Description\": \"Something,\n \"GenerateSecretString\": {\n \"SecretStringTemplate\": \"{\\\"USER\\\":\\\"superman\\\"}\",\n \"GenerateStringKey\": \"PASSWORD\",\n \"PasswordLength\": 30,\n \"ExcludeCharacters\": \"\\\"@/\\\\\"\n },\n \"Tags\": [\n {\n \"Key\": \"AppName\",\n \"Value\": \"Something\"\n },\n {\n \"Key\": \"Environment\",\n \"Value\": {\n \"Ref\": \"Environment\"\n }\n }\n ]\n }\n }\n\n\nWhen I deleted CloudFormation stack, I was expecting the secret to be there in \"pending deletion\" status with 7 days retention policy as that is what AWS mandates.\n\nWhen I visited AWS Console, there was no secret with pending deletion mode. (Yes, i clicked on gear icon and checked \"Show secrets scheduled for deletion\" checkbox.\n\nI queried AWS Secrets Manager using CLI to list all the secrets but it did not return the secret that was deleted as a result of CFT Stack deletion.\n\nAm I missing something here?" ]
[ "amazon-web-services", "aws-secrets-manager" ]
[ "How to count number of elements in multidimensional array in Objective-C", "I create a multidimensional array like this:\n\nArray = [NSMutableArray arrayWithObjects:\n [NSMutableArray array],\n [NSMutableArray array],nil];\n\n[Array addObject:@\"0\"];\n[Array addObject:@\"1\"];\n[Array addObject:@\"2\"];\n\n[[Array objectAtIndex:0] addObject:@\"5\"];\n[[Array objectAtIndex:0] addObject:@\"6\"];\n[[Array objectAtIndex:1] addObject:@\"7\"];\n[[Array objectAtIndex:1] addObject:@\"8\"];\n[[Array objectAtIndex:1] addObject:@\"9\"];\n\n\nAnd I want to count the number of elements in the array of \"7\", \"8\", \"9\" (object at index 1).\nI wrote the code but it didn't work.\n\nNSInteger count = [Array[1] count];\n\n\nHow can I count the number of elements of only an array(index)?" ]
[ "ios", "objective-c", "nsmutablearray" ]
[ "How to pass array of stdlib list by reference", "I am a beginner in C++ stdlib. I learnt stdlib tutorials and I am implementing \"number of connected components in Graph\" using adjacency list created with stdlib lists. I wanted to know how to pass this array of list by reference to dfs function? Also, one of my frnd said that by default it will be passed by reference. Is it true? Please clarify. which of these is right?\n\nfor example:\n\n\nMy array of list: list<int> L[v];\nMy function call: dfs(L[v],k);\nMy function definition: void dfs(list<int> List, int index);\nMy function prototype: void dfs(list<int> L, int);\n\n\n(or)\n\n\nMy array of list: list<int> L[v];\nMy function call: dfs(L,k);\nMy function definition: void dfs(list<int> *L, int index);\nMy function prototype: void dfs(list<int> *, int);" ]
[ "c++", "std" ]
[ "Dynamic typealias Swift 3", "I'm trying to set a typealias with a conditional like this:\n\ntypealias dataType = (x == y ? ButtonTableCell : InputTableCell)\n\n\nWhere both ButtonTableCell and InputTableCell are classes, so later I can use dataType like this:\n\nlet cell = tableView.dequeueReusableCell(withIdentifier: \"buttonCell\", for: indexPath as IndexPath) as! dataType\n\n\nI don't know if this is possible in Swift" ]
[ "ios", "swift", "swift3" ]
[ "Pod Affinity in Skuber", "When creating Kubernetes Pods with Skuber, how do you define a Pod that has affinity with another Pod? \n\nEg:\n\nval podASpec = Pod.Spec( ..., affinity = podB )\nval podBSpec = Pod.Spec( ..., affinity = podA )" ]
[ "scala", "kubernetes" ]
[ "android facebook login button does not work", "I'm following this tutorial \"Facebook Login Flow for Android\" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.\n\nHowever, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?\n\nAlso, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.\n\nI've seen some people suggesting to use the \"keytool\" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the \"keytool\" in JDK 6.\n\nSo I've tried everything, but the problem still exists!\n\nIn that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:\n\nprivate void onSessionStateChange(Session session, SessionState state, Exception exception) {\n if (state.isOpened()) {\n Log.i(TAG, \"Logged in...\");\n } else if (state.isClosed()) {\n Log.i(TAG, \"Logged out...\");\n }\n}\n\n\nIn my case, no matter how many times I clicked Facebook Login Button, I always got \"Logged out...\" in my LogCat.\n\nAlso, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.\n\nI really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!" ]
[ "facebook", "facebook-login", "facebook-android-sdk" ]
[ "Android Camera App using CameraX to save images in YUV_420_888 format", "I want to save image stream (preferably 30fps) to the device. I came across this post.\n\nHow do I dump images in YUV_420_888 format using cameraX without encoding it in JPEG?\n\nAlso, I'll be glad if any one can suggest any direction in saving burst of images.\n\nTill now I'm only saving an image by onclick of button\n\nfindViewById(R.id.capture_button).setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n\n File file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES),\n \"Image_\" + System.currentTimeMillis() + \".jpg\");\n\n imageCapture.takePicture(file, new ImageCapture.OnImageSavedListener() {\n @Override\n public void onImageSaved(@NonNull File file) {\n Toast.makeText(CameraCaptureActivity.this, \"Photo saved as \" + file.getAbsolutePath(), Toast.LENGTH_SHORT).show();\n }\n\n @Override\n public void onError(@NonNull ImageCapture.ImageCaptureError imageCaptureError, @NonNull String message, @Nullable Throwable cause) {\n Toast.makeText(CameraCaptureActivity.this, \"Couldn't save photo: \" + message, Toast.LENGTH_SHORT).show();\n if (cause != null)\n cause.printStackTrace();\n }\n });\n }\n});" ]
[ "java", "android", "android-camera", "android-camerax" ]
[ "Using React with Next.js demo is not working", "My Package.js\n\n{\n \"name\": \"nextjs\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"dev\": \"next\",\n \"build\": \"next build\",\n \"prod_start\": \"NODE_ENV=production node server.js\",\n \"start\": \"next start\"\n },\n \"author\": \"\",\n \"license\": \"ISC\",\n \"dependencies\": {\n \"next\": \"^9.0.2\",\n \"react\": \"^16.8.6\",\n \"react-dom\": \"^16.8.6\"\n }\n}\n\n\nBelow is the error log.\n\nError: Could not find a valid build in the 'xxx/nextjs/.next' directory! Try building your app with 'next build' before starting the server.\n at Server.readBuildId (xxx/node_modules/next-server/dist/server/next-server.js:425:23)\n at new Server (xxx/node_modules/next-server/dist/server/next-server.js:43:29)\n at module.exports (xxx/node_modules/next-server/index.js:4:10)\n at module.exports.options (xxx/node_modules/next/dist/server/next.js:2:161)\n at start (xxx/node_modules/next/dist/server/lib/start-server.js:1:385)\n at nextStart (xxx/node_modules/next/dist/cli/next-start.js:22:125)\n at commands.(anonymous function).then.exec (xxx/node_modules/next/dist/bin/next:29:346)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:188:7)\n at Function.Module.runMain (module.js:695:11)\n\n\nWhile running npm start it is display error inside node_modules/next-server/dist/server/next-server.js" ]
[ "reactjs", "next.js" ]
[ "Dynamically generated opengraph meta content image width/height", "Facebook requires either preacaching a webpage (which I am unable to do) or specifying an images width and height for them to load the opengraph data properly when sharing. My site is pulling images from MLS (pages/images stored locally) so the image sizes are different. \n\nHow can I find the image height and width and create meta content based on the results?" ]
[ "javascript", "facebook", "metadata", "facebook-opengraph" ]
[ "Does ignoring a base type in Entity Framework Code First also ignore subclasses?", "I'm attempting to simulate a scenario in which I am inheriting from concrete base classes in a 3rd party library, then mapping my own classes using Entity Framework Code First. I would really prefer for my classes to have the same simple name as the base classes. I obviously can't change the class names of the base classes, nor can I change the base class to abstract. As expected, I get the following error:\n\n\n The type 'EfInheritanceTest.Models.Order' and the type\n 'EfInheritanceTest.Models.Base.Order' both have the same simple name\n of 'Order' and so cannot be used in the same model. All types in a\n given model must have unique simple names. Use 'NotMappedAttribute' or\n call Ignore in the Code First fluent API to explicitly exclude a\n property or type from the model.\n\n\nAs I understand it, in EF6 this is possible so long as only one of the classes is actually mapped. However, if I attempt to ignore the base class using the fluent API, I get the following error instead:\n\n\n The type 'EfInheritanceTest.Models.Order' was not mapped. Check that\n the type has not been explicitly excluded by using the Ignore method\n or NotMappedAttribute data annotation. Verify that the type was\n defined as a class, is not primitive or generic, and does not inherit\n from EntityObject.\n\n\n... which seems to indicate that by ignoring the base class, I ignore any subclasses as well. Full code below. Any way to work around this and \"unignore\" the subclass? Or is this a limitation of EF type mapping?\n\nnamespace EfInheritanceTest.Models.Base\n{\n public class Order\n {\n public virtual int Id { get; set; }\n public virtual string Name { get; set; }\n public virtual decimal Amount { get; set; }\n }\n}\n\nnamespace EfInheritanceTest.Models\n{\n public class Order : Base.Order\n {\n public virtual DateTime OrderDate { get; set; }\n }\n}\n\nnamespace EfInheritanceTest.Data\n{\n public class OrdersDbContext : DbContext\n {\n public OrdersDbContext() : base (\"OrdersDbContext\") { }\n\n public IDbSet<EfInheritanceTest.Models.Order> Orders { get; set; }\n\n protected override void OnModelCreating(DbModelBuilder modelBuilder)\n {\n base.OnModelCreating(modelBuilder);\n modelBuilder.Types<Models.Base.Order>().Configure(c => c.Ignore());\n modelBuilder.Types<Models.Order>().Configure(c => c.ToTable(\"order\"));\n modelBuilder.Entity<Models.Order>().Map(c =>\n {\n c.MapInheritedProperties();\n c.ToTable(\"order\");\n });\n\n }\n }\n}" ]
[ "c#", "entity-framework", "inheritance", "entity-framework-6.1" ]
[ "Alternative tag for center tag in html?", "<center>\r\n <img src=\"/images/perform.png\" width=\"40%\" class=\"img-responsive\" alt=\"Responsive image\">\r\n</center>\r\n\r\n\r\n\n\nHere i have used center tag..it shows image in center aligned but now i have to change center tag..is there any alternative tag for center tag?" ]
[ "html", "css" ]
[ "How to serialize a field of a non-primitive type (your own class) in a Storm topology?", "The following exception is thrown while I run my Storm project:\n\njava.lang.RuntimeException: java.io.NotSerializableException: com.youtab.dataType.id.GUID\nat backtype.storm.serialization.DefaultSerializationDelegate.serialize(DefaultSerializationDelegate.java:43)\nat backtype.storm.utils.Utils.serialize(Utils.java:85)\nat backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:111)\n\n\nAs part of my Storm project, I am trying to transmit an Object type Event from the first Spout to the first Bolt and then to use it.\nUnfortunately, after implementing all needed changes and commits in my configuration variable - as described in the Storm documentations, it is still failing to deserialize one private field of type \"GUID\" which is one field from my own private class Event.\n\nI have created the following serializing class:\n\npublic class GUIDSerializer extends Serializer<GUID> {\n @Override\n public void write(Kryo kryo, Output output, GUID guid) {\n output.write(guid.toString().getBytes());\n }\n\n @Override\n public GUID read(Kryo kryo, Input input, Class<GUID> aClass) {\n return GUID.of(input.readString());\n }\n}\n\n\nAnd I registered the serialize as needed:\n\nConfig conf = new Config();\nconf.registerSerialization(GUID.class, GUIDSerializer.class);" ]
[ "java", "serialization", "apache-storm", "kryo" ]
[ "File Reader is slow and not set state on React", "When converting a. pdf file to Base64, I need to be filled in my state, but for some reason my conversion is slower than my setstate, which when being seted is always empty.\n\nMy code\n\nasync transformBase64(inputFile) { \n return new Promise((resolve, reject) => {\n var fileReader = new FileReader();\n fileReader.readAsDataURL(inputFile)\n if (fileReader.result != undefined){\n resolve(this.setState({ Base64: fileReader.result }), () => {}); \n }else{\n reject(\"Err\")\n } \n });\n }\n\n\nWhat can I do to solve my problem?" ]
[ "javascript", "reactjs", "state", "filereader" ]
[ "Dynamic Multi Pivot in SQL Server", "I am new to SQL Server Pivot. I have an input table with data represented like the below. It has model data with three amount columns. The amounts are applicable for those models based on the date provided.\n\n\n\nI am trying to generate a report like the below in a dynamic fashion where distinct number of dates along with three amounts should be displayed in the report for each model.\n\n\n\nI have tried a Dynamic SQL like the below.\n\nSELECT @pivotcols = STUFF((\n SELECT ',' + QUOTENAME(DATE)\n FROM #table\n GROUP BY Date\n ORDER BY Date\n FOR XML PATH('')\n ,TYPE\n ).value('.', 'NVARCHAR(MAX)'), 1, 1, '')\n\nSET @query = N'SELECT Model,' + @pivotcols + N' from \n (\n SELECT Model\n ,Amount1\n ,Amount2\n ,Amount3\n ,[DATE] AS DATE1\n ,[DATE] AS DATE2\n ,[DATE] AS DATE3\n FROM #table\n\n ) x\n pivot \n (\n max(amount1)\n for Date1 in (' + @pivotcols + N')\n ) r\n pivot \n (\n max(amount2)\n for Date2 in (' + @pivotcols + N')\n ) p\n pivot \n (\n max(amount3)\n for Date3 in (' + @pivotcols + N')\n ) o '\n\nEXEC sp_executesql @query;\n\n\nWhen I try with this query I am getting the following error.\n\nThe column name \"2000-01-01\" specified in the PIVOT operator conflicts with the existing column name in the PIVOT argument.\n\nKindly show some light on this." ]
[ "sql", "sql-server", "sql-server-2012" ]
[ "SSMS : Unable to show XML in the SSMS Explorer", "We are getting below error msg in the pop-up windows, when trying to view the generated XML in SSMS - Sql Server. \n\n\n\n\n Microsoft SQL Server Management Studio\n \n Unable to show XML. The following error happened: Unexpected end of\n file while parsing Name has occurred. Line 1, position 2097154." ]
[ "sql-server", "xml", "ssms-2016" ]
[ "What's the best way to do a mapping application for the iPhone", "So I'm looking at writing an iPhone application that shows things on a map. What frameworks/methodologies are out there for doing this?\n\nSearching around on Google, I could only find this one:\nhttp://code.google.com/p/iphone-google-maps-component/\n\nWhich according to the issues list is slow, and stops working after a while. Does anyone know of something better, or have any experience with the library above?" ]
[ "iphone", "cocoa-touch", "maps" ]
[ "Strange SQL execution result in Oracle", "select unique owner \nfrom all_tables \nwhere sysdate-50 < (select last_analyzed from dual);\n\n\nI just wrote above code and it is strange the result is different with below code.\n\nselect unique owner from all_tables;\n\n\nHowever if I execute (select last_analyzed from dual) separately, an error will pop up.\n\nI am confused how the result is generated." ]
[ "sql", "oracle", "subquery" ]
[ "form.submit() not working in a EventListener function", "how would i make it so if .value is not equal, it submits through form. ive tried form.submit() and it does nothing. but it does work when you make it a window.location which i dont need. \n\nvar slim = document.getElementById(\"1\");\n var shady = document.getElementById(\"2\");\n var standup = document.getElementById(\"3\");\n var form = document.getElementById(\"form\");\n form.addEventListener(\"submit\", function(e) {\n e.preventDefault();\n if (\n standup.value === \"stand up\" &&\n shady.value === \"shady\" &&\n slim.value === \"slim\"\n ) {\n window.location = \"https://example.com\";\n } else {\n form.submit();\n }\n });\n\n\nelse: submit to this form\n\n<form id=\"form\" action=\"/eyerepeat\" method=\"get\">\n <label for=\"fname\">First name:</label>\n <input type=\"text\" id=\"1\" name=\"willthereal\" /><br /><br />\n <label for=\"lname\">Last name:</label>\n <input type=\"text\" id=\"2\" name=\"9\" /><br /><br />\n <label for=\"action\">Action:</label>\n <input type=\"text\" id=\"3\" name=\"please\" /><br /><br />\n <input id=\"submit\" type=\"submit\" value=\"Submit\" />\n </form>" ]
[ "javascript", "html", "forms", "input" ]
[ "Map data from other table in hibernate using annotations?", "I have Data Base Scheme like below:\n\n\n\nand in my Commande java class I have that (omited useless data for this question) :\n\n@Entity\n@Table(name = \"commande\")\npublic class Commande {\n private int id;\n private Timestamp date;\n private Person client;\n private Magasin shop;\n private HashMap<Article,Integer> detail;\n\n @Id\n @Column(name = \"id\")\n @GeneratedValue(strategy = GenerationType.IDENTITY)\n public int getId() {\n return id;\n }\n\n public void setId(int id) {\n this.id = id;\n }\n\n...\n\n public HashMap<Article,Integer> getDetail() {\n return detail;\n }\n\n public void setDetail(HashMap<Article,Integer> detail) {\n this.detail = detail;\n }\n...\n\n\nI want that when I read data, I got all my \"detail_commande\" data in a hashmap\n\ndetail_commande commande\n|id_commande|id_article|qqte_cmde| |id| date |id_person|id_shop|\n|===========|==========|=========| |==|========|=========|=======|\n| 0 | 0 | 15 | | 0|1-2-2019| 0 | 2 |\n| 0 | 2 | 5 | \n| 0 | 4 | 1 | \n\n\nIf I want to read data of the command number 0 it must be :\n\nid : 0\ndate : 1-2-2019\nperson : personData\nshop : shopData\ndatail : [articleData0 -> 15,\n articleData2 -> 5,\n articleData4 -> 1 ]\n\n\nBut I don't understand annotation to do that.\n\nI try this and this" ]
[ "java", "hibernate", "hashmap", "annotations" ]
[ "How to include hash tag in drupal_goto path?", "Is there any way to include # tag in drupal_goto?\n\n\r\n\r\nfunction a_first_init() {\r\n global $base_url;\r\n $node_id=arg(1);\r\n $url='/events#/$node_id';\r\n $path=$base_url.$url;\r\n if(!user_is_logged_in) {\r\n drupal_goto($path);\r\n }\r\n \r\n}\r\n\r\n\r\n\n\nI have tried above code,but it's not working.any idea?" ]
[ "php", "drupal-7" ]
[ "Migrate from Tomcat to WAS", "A few weeks ago I asked about Application Servers. It happens that my bosses are moving to WAS and my web application needs to move along. Problem is I have little idea of application servers. \n\nIn my application I used web.xml and tomcat-users.xml to define roles and users. I have to do this in the WAS server, so what do I need to do? I mean, I have read that it defines some security roles in the application.xml that binds with the WAS server, and that they need some ids that look through the ibm-application-bnd.xmi\n\nIt also seems that I need some kind of ibm-web-bnd.xmi to just reconfigure my web.xml with the same users (which gets me terribly confused).\n\nDo I need to create these files (I don't have a RAS, just an Eclipse Galileo (yeah, I also sometime think I am playing in hard mode), so I have no way to do this automatically) or can I just configure the application.xml and the web.xml correctly without these files? I have managed myself to more or less create these files and finally create an EAR that the WAS has deployed (correctly, it says). \n\nThis sounds a hell of lot complex for just a user validation, so I don't now if I am right or wrong. \nProbably wrong, since WAS keeps saying \"com.ibm.websphere.security.PasswordCheckFailedException: No user wasadmin found\".\n\nIs there any insightful documentation of how to do this?\n\nThanks!" ]
[ "java", "tomcat", "websphere" ]
[ "iOS NSURLSession with Wi-Fi Assist turned on results in crashing app", "I'm performing an HTTP request using iOS's NSURLSession. My code looks like this:\n\nlet session = NSURLSession.sharedSession()\n\nlet url = NSURL(string:\"www.example.com\")\n\nguard let url = url else {\n return\n}\n\nlet request = NSURLRequest(URL: url)\n\nvar task = session.dataTaskWithRequest(request){\n (data, response, error) -> Void in\n\n //do stuff with the data\n}\n\ntask.resume()\n\n\n(sorry if my code isn't 100% correct I just typed it real quickly inside my browser, you get the idea)\n\nWhen Wi-Fi Assist is turned off it works fine, but when Wi-Fi Assist is turned on the app crashes.\n\nI found this but the discussion never got an answer.\n\nApart from the fact that I want to fix the problem I am very curious WHY this is happening." ]
[ "ios", "swift", "nsurlsession" ]
[ "Spark Structured Streaming: howto achive same order on processing Kafka topic and its backup on S3", "Question\nHow to achieve idempotance (the same event order) between processing Kafka topic and it S3 backup with Spark Structured Streaming?\nSee # QUESTION: comment at Code Example below.\nUse case\nSuppose you have exactly the same use case as Uber - stream processing that is used for both: low-latency and historical analysis. For real-life example see "Motivation" section of Designing a Production-Ready Kappa Architecture for Timely Data Stream Processing:\nYou storing data in Kafka, archiving them to S3 with Kafka Connect AWS S3 Sink. And stream processing is done by Spark Structured Streaming. You decided to solve the issue with "Combined approach" section: run the code in background backfilling mode over S3 (Kafka backuped topics).\nCode example\ndef some_processing(spark: SparkSession, stream: DataFrame, backfilling_mode: bool):\n input_stream = read(spark, 'input_topic', backfilling_mode)\n processed_stream = input_stream \\\n .withWatermark('event_time', '10 seconds') \\\n .groupBy(window('event_time', '10 seconds', '10 seconds'), 'user_id') \\\n .agg(sum(col('price'))) \\\n .join(...)\n write(processed_stream, 'output_topic', backfilling_mode)\n\ndef read(spark: SparkSession, topic_name: str, backfilling_mode: bool) -> DataFrame:\n """Reads data from Kafka topic or its S3 backup"""\n # QUESTION: how Spark achieve the same order on backfilling_mode=True and backfilling_mode=False\n if backfilling_mode:\n stream = spark \\\n .readStream \\\n .schema(input_schema) \\ \n .format('com.databricks.spark.avro') \\\n .option('maxFilesPerTrigger', 20) \\\n .load('/s3_base_bath/{}'.format(topic_name)) \n else:\n stream = spark \\\n .readStream \\\n .format('kafka') \\\n .option('kafka.bootstrap.servers', 'host1:port1,host2:port2') \\\n .option('subscribe', topic_name) \\\n .load() \n\n\ndef write(stream: DataFrame, topic_name: str, backfilling_mode: bool):\n """Writes data to Kafka topic or its S3 backup"""\n if backfilling_mode:\n stream \\\n .writeStream \\\n .trigger(processingTime='60 seconds') \\\n .format('com.databricks.spark.avro') \\\n .option('path', '/s3_base_bath/{}'.format(topic_name)) \\\n .start() \\\n .awaitTermination()\n else:\n stream \\\n .writeStream \\\n .trigger(processingTime='10 seconds') \\\n .option('kafka.bootstrap.servers', 'host1:port1,host2:port2') \\\n .option('topic', 'output_topic')\n .format('kafka') \\\n .start() \\\n .awaitTermination()" ]
[ "apache-spark", "amazon-s3", "apache-kafka", "spark-structured-streaming" ]
[ "PHP: Properly Setting Cookies For Login", "if (strtolower($userDetail[\"username\"]) == strtolower($username) && \n $userDetail[\"password\"] == hash(\"sha256\", $password . $userDetail[\"salt\"])) { \n if ($remember == \"true\") { // Remember Me\n setcookie(\"logged\", \"$username\", time()+60*60*24*365); // 1 Year\n } else { \n setcookie(\"logged\", \"$username\", time()+43200); // 12 Hours\n }\n header(\"Location: \" . getenv(\"HTTP_REFERER\"));\n die();\n } else {\n echo \"Invalid login.\";\n }\n\n\nI'm trying to make the best possible login I possibly can. The major problem I'm seeing here is cookies. I'm no expert when it comes to this, so here are my main questions:\n\n\nWhat should I be setting my cookie as so someone can not easily duplicate the cookie?\nShould I be including the salt into the cookie?\nI've heard about tokens in addition to salts and having them change all the time. How is this supposed to work?\n\n\nAnd I'm wondering if this call for my cookie above is even valid? What's the right way to be doing this?\n\n$loginCheck = $_COOKIE[\"logged\"];\nif (isset($loginCheck)) {\n // logged in\n}" ]
[ "php", "cookies", "login" ]
[ "how to set box shadow in flutter", "I have a figma design and I need to set box shadow like this.\nDrop shadow\nx 0, y : 1, B: 5, S: 0, #000000 30%" ]
[ "android", "ios", "flutter", "user-interface", "figma" ]
[ "Javafx: Recovering the text of a label contained within a pane through pane.getChildren().get(index)", "This is a problem I've been trying to deal with for a good hour now, so I figured I might as well ask this question. My goal/question is about the behaviour of the list supplied by pane.getChildren(). To explain better, here's a bit of example code.\n\nVBox pane1 = new VBox();\nLabel label1 = new Label(\"a\");\nLabel label2 = new Label(\"b\");\npane1.getChildren().addAll(label1,label2);\nSystem.out.println(pane1.getChildren().size());\nfor (int i=0; i<pane1.getChildren().size(); i++) {\n System.out.println(i + pane1.getChildren().get(i).(??????????)\n}\n\n\nThe list pane1.getChildren() is of a size 2, but the pane1.getChildren().get(i) doesn't allow me to use Label related methods (such as getText(), which is the one I'm interested in accessing). What exactly is happening here, why isn't pane1.getChildren().get(i) acknowledged as a Label?\n\nAlso worth adding, that if i run \n\nfor (int i=0; i<pane1.getChildren().size(); i++) {\n System.out.println(i + pane1.getChildren().get(i).getClass().getName());\n}\n\n\nthe console output says, that the name of the class is \"javafx.scene.control.Label\".\n\nI'd love some clarification on this little problem, and thank you in advance!" ]
[ "java", "javafx" ]
[ "Receiving window keyword with JSON request using jQuery", "Client side javascript:\n\nvar headFiles = {\n Admin:{\n JS:\"/Path/to/file.js\",\n CSS:\"/Path/to/file.css\"\n }\n};\n\n$.getJSON(URL_TO_SERVER, function (data) {\n //My code here\n});\n\n\nServer side code:\n\nResponse.ContentType = \"text/json\"\n\n\nText been sent:\n\nResponse.Write(\"{\" &\n \"\"\"HTML\"\":\"\"/cms/includes/admin_content.aspx\"\", \" &\n \"\"\"CSS_JS\"\":[\" &\n \"{\"\"Admin_JS\"\": headFiles.Admin.JS },\" &\n \"{\"\"Admin_CSS\"\": headFiles.Admin.CSS }\" &\n \"]\" &\n \"}\")\n\n\n$.getJSON fails to receive response. I have tried $.ajax also. I have tried setting ContentType to \"text/plain\" also. \nThe issue is that I am using javascript variable \"headFiles\" in the JSON, which is not been parsed.\n\nAny idea how to send javascript variable as a part of JSON?" ]
[ "javascript", "json", "jquery", "getjson" ]
[ "BroadcastReceiver not being triggered when app is closed", "I'm attempting to make it so my app runs some code once per day at 6AM. This works just fine when the app is open and in the foreground, but if the app is closed by swiping it away, the code is never called at the appropriate time.\n\nAlarmReceiver.java (For testing purposes, I have it just trying to display a Toast to verify it runs)\n\npublic class AlarmReceiver extends BroadcastReceiver {\n\n public static final String intentAction = \"com.mpagliaro98.action.NOTIFICATIONS\";\n\n @Override\n public void onReceive(Context context, Intent intent) {\n if (intent.getAction().equals(intentAction)) {\n Toast.makeText(context, \"RECEIVER CALLED\", Toast.LENGTH_LONG).show();\n }\n }\n}\n\n\nMainActivity.java (Where the alarm is being set)\n\npublic class MainActivity extends AppCompatActivity {\n\n ...\n\n private void setRecurringAlarm() {\n // Set this to run at 6am\n Calendar updateTime = Calendar.getInstance();\n updateTime.setTimeZone(TimeZone.getDefault());\n updateTime.set(Calendar.HOUR_OF_DAY, 6);\n updateTime.set(Calendar.MINUTE, 0);\n updateTime.set(Calendar.SECOND, 0);\n updateTime.set(Calendar.MILLISECOND, 0);\n\n // Build the pending intent and set the alarm\n Intent i = new Intent(AlarmReceiver.intentAction);\n PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(),\n 0, i, PendingIntent.FLAG_CANCEL_CURRENT);\n AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);\n assert am != null;\n am.setRepeating(AlarmManager.RTC, updateTime.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);\n }\n}\n\n\nAndroidManifest.xml (Just the relevant parts)\n\n<uses-permission android:name=\"android.permission.SET_ALARM\" />\n\n<receiver\n android:name=\".AlarmReceiver\"\n android:enabled=\"true\"\n android:exported=\"true\">\n <intent-filter>\n <action android:name=\"com.mpagliaro98.action.NOTIFICATIONS\" />\n </intent-filter>\n</receiver>\n\n\nI've read through dozens of similar problems to this on this site and elsewhere and I'm seriously at a loss for why this won't work. Any help would be appreciated." ]
[ "android", "notifications", "broadcastreceiver", "alarmmanager" ]
[ "How to count rows and pull maximum in sqlite3 firefox", "I am using SQLite Manager on Firefox. Can I use count and max commands together? I want to calculate the number of rows of data, and then pull the row with the maximum number of rows.\nExample:\n\nI have data with names and each class they took. I want to calculate the number of classes taken for each name, and then find the person with the most classes.\n\nRight now, I am using:\nselect name, count(class) from tablename;\n\nIs there a way I can use the max function in this to pull the person with the highest number of count(class)?\n\nThanks" ]
[ "firefox", "sqlite", "firefox-addon" ]
[ "Unexpected behaviour with using STM32 QSPI over HAL", "I am using the QSPI (or dual-SPI) interface of the STM32L452 to create instructions for an LED driver using the HAL. I have managed to get it to work but I have to set quite absurd configuration options for the command to make it work.\nHere's my initialization code:\n hqspi.Instance = QUADSPI;\n hqspi.Init.ClockPrescaler = 31;\n hqspi.Init.FifoThreshold = 1;\n hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;\n hqspi.Init.FlashSize = 31;\n hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;\n hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;\n hqspi.Init.FlashID = QSPI_FLASH_ID_1;\n hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;\n HAL_QSPI_Init(&hqspi);\n\nHere's the code I'm using to set up the command\n qspiCommand.InstructionMode = QSPI_INSTRUCTION_NONE;\n qspiCommand.AddressMode = QSPI_ADDRESS_NONE;\n qspiCommand.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;\n qspiCommand.DataMode = QSPI_DATA_2_LINES;\n qspiCommand.DummyCycles = 0;\n qspiCommand.NbData = 81;\n qspiCommand.DdrMode = QSPI_DDR_MODE_DISABLE;\n qspiCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY; // I have to set this\n qspiCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD; // I have to set this\n\nThen I send it off using HAL_QSPI_Command and HAL_QSPI_Transmit.\nHere's the output that I expect and that I can achieve using the code above:\n\nMind that this is a one-off transfer, and is only output when I call the two functions above.\nThe weird thing is that I have to set\nqspiCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;\n\n(which should not have an effect when DdrMode is disabled)\nand\nqspiCommand.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;\n\n(which should not have an effect when InstructionMode is none).\nIf I do not set both of them, weird things happen. This is the output if I remove the DdrHoldHalfCycle parameter:\n\nMind that this is a continuous signal, which starts and won't stop after I called the transmit function.\nWhat am I missing here? I really shouldn't need those parameters to make it work." ]
[ "c++", "arm", "embedded", "stm32", "hal" ]
[ "How to combine multiple lists using LINQ lambda", "I have two lists:\n\nlist1 = [a,b,c,4]\nlist2 = [1,23,5,6]\n\n\nNow I need to create an anonymous object using linq lambda.\n\nSomething like.\n\nlist1 = DataTable.AsEnumerable().toList();\nlist2 = DataTable.AsEnumerable().toList();\n\nvar result = list1.Where(x => x.Field<int>(1) == 2018).Select(x => new[] {\nnew {x = \"XYZ\", y = x[0], z = list2[0]},\n....}\n\n\n\n}\n\n\nHow do I go about doing this?" ]
[ "c#", "linq" ]
[ "Passing Json Data To Another ViewController Table On Button Click", "I am developing an ios app..On Button Click Json Data To Pass Another ViewController...But TableView Not Show Json Data..TableView Show Empty\n\n BBAdsViewController *BBAuthorDetail =[[UIStoryboard storyboardWithName:@\"Main\" bundle:nil]instantiateViewControllerWithIdentifier:@\"AdsViewController\"];\n\n [BBAuthorDetail setDelegate:self];\n [BBAuthorDetail setSelectionType:BBSelectionAuthorName];\n _serverObj = [[Server alloc]init];\n [_params setObject:_adDetailsObj.authorDetail forKey:@\"author\"];\n [_serverObj BBAuthorNameWithParams:_params];\n [BBAuthorDetail setManagedObjectContext:self.managedObjectContext];\n [self.navigationController pushViewController:BBAuthorDetail animated:YES];\n\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n NSString *cellIdentifier = [NSString stringWithFormat:@\"Cell-%li\", (long)indexPath.row];\n BBAdsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];\n\n\n Ad *adObj = (Ad *)[self.adsFilteredArray objectAtIndex:indexPath.row];\n\n if (cell == nil) {\n cell = [[BBAdsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];\n cell.row = indexPath.row;\n [cell setDelegate:self];\n }\n\n if (![adObj.gallery isEqual:[NSNull null]]) {\n NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:adObj.gallery]];\n [cell.adImageView setImageWithURLRequest:imageRequest placeholderImage:[UIImage imageNamed:@\"ship_placeholder.png\"] success:nil failure:nil];\n }\n else\n {\n [cell.adImageView setImage:[UIImage imageNamed:@\"ship_placeholder.png\"]];\n }\n if (_serverCallType == ServerCallTypeAdvancedSearch || _serverCallType == ServerCallTypeSearch ) {\n [cell.phoneButton setHidden:NO];\n [cell.categoryLabel setHidden:YES];\n [cell.authorLabel setHidden:YES];\n [cell.addressLabel setHidden:YES];\n [cell.favButton setCenter:CGPointMake(CGRectGetMaxX(cell.phoneButton.frame) + 25.0f, CGRectGetMidY(cell.phoneButton.frame))];\n } else\n {\n [cell.phoneButton setHidden:YES];\n [cell.favButton setCenter:CGPointMake(CGRectGetWidth(cell.frame) - 30.0f, 65.0f)];\n }\n\n if (_selectionType == BBSelectionBoat || _selectionType == BBSelectionOtherBoat || _selectionType == BBlatestBoat )\n {\n if (adObj.price && ![adObj.price isEqualToString:@\"\"]) {\n [cell.priceLabel setHidden:NO];\n [cell.priceLabel setText:adObj.price];\n }\n [cell.categoryLabel setCenter:CGPointMake(CGRectGetMidX(cell.authorLabel.frame), CGRectGetMinY(cell.authorLabel.frame) - 7.0f)];\n\n if (_serverCallType == ServerCallTypeAdvancedSearch || _serverCallType == ServerCallTypeSearch)\n {\n [cell.authorLabel setHidden:YES];\n [cell.addressLabel setHidden:YES];\n\n }\n\n else\n {\n cell.authorLabel.text = adObj.authorName;\n cell.addressLabel.text = adObj.address;\n [cell.authorLabel setHidden:YES];\n [cell.addressLabel setHidden:NO];\n }\n }\n else\n {\n [cell.priceLabel setHidden:YES];\n [cell.authorLabel setHidden:YES];\n [cell.addressLabel setHidden:YES];\n\n [cell.categoryLabel setCenter:CGPointMake(CGRectGetMidX(cell.addressLabel.frame), CGRectGetMidY(cell.addressLabel.frame))];\n }\n\n [cell.favButton setSelected:adObj.isFavorite];\n NSRange range = [adObj.title rangeOfString:@\",\"];\n cell.titleLabel.text = range.location == NSNotFound ? adObj.title : [adObj.title substringToIndex:range.location];\n [cell.titleLabel setNumberOfLines:0];\n cell.categoryLabel.text = adObj.category;\n return cell;\n}" ]
[ "ios", "json", "uitableview", "storyboard", "cell" ]