texts
sequence | tags
sequence |
---|---|
[
"Play Youtube Video Full Screen in Browser",
"My question: Is iOS the only OS that will play an embedded Youtube video at fullscreen by default? If so, is it possible to safely display a youtube video at fullscreen (or close) in a non-iOs device?\n\nThe situation is that I have a group of webpages that contain a youtube video on each page. The idea is to keep the User inside the group of webpages (until they \"Exit\" out of the group), so therefore I am not showing any related videos, and the only other links on the page are links to the other pages within the group (and the \"Exit\" button).\n\nThe problem is that I can't deliver a consistent cross device experience. As far as I can tell, the only way to play a Youtube video fullscreen is to the open up the Youtube App. I do not want to do that because I don't want to break the experience of my quasi-app.\n\nI found this thread, which seemed hopeful, but linking to a watch_popup url triggers the Youtube App on Droid devices. \n\nI could embed the video using the Youtube API, then display that video in a modal when the user wants to play the video. But doing this disturbs the experience on iOS devices since the video already plays at fullscreen by default.\n\nFrom my perspective, it seems I need to detect the userAgent, and if the userAgent is Not iOS, then display video in a modal window. Detecting userAgent seems so 2001, so is there a better way?"
] | [
"javascript",
"responsive-design",
"youtube"
] |
[
"An invalidated form does not get its validity recalculated when offending element removed from DOM",
"I use ctrl.$setValidity within one of my directives to invalidate a form. However, there is a method residing elsewhere which could remove this element from the DOM under a different set of conditions. What happens when I invalidate the form with $setValidity and then remove the offending element is that the form remains invalid, while what I would like it to do is to recalculate its validity based on its new Inputfield set.\n\nPlease note that I am not simply looking for a ctrl.$setValidity true, (other input fields in the form may or may not be valid), I simply want the form to recalculate.\n\nBelow is the directive code:\n\n app.directive('dir', function() {\n return {\n restrict: 'C',\n require: \"ngModel\",\n link: function(scope, element, attrs, ctrl) {\n someValue = scope.someValue;\n someField = element.find(\".some-class\");\n\n monitorField = function(newValue, oldValue){\n console.log(\"whee\");\n scope.someFunction(newValue);\n if(newValue ==\"Invalidate NOW!\"){\n ctrl.$setValidity('someClass', false); \n } else if (oldValue == \"Invalidate NOW!\"){\n angular.element(document.querySelector('.some-class')).remove();\n } else {\n ctrl.$setValidity('someClass', true); \n }\n } \n scope.$watch(\"someValue\", monitorField, true);\n }\n }\n});\n\n\nWhich operates on:\n\n <FORM class=\"dir\" ng-model=\"someValue\">\n <INPUT type=\"text\" class=\"some-class\" ng-model=\"someValue\"/>\n <INPUT type=\"text\" class=\"some-other-class\"/>\n </FORM>\n\n\n(Yes it is a somewhat contrived example). \n\nThe problem is reproduced here: http://jsfiddle.net/kTuAY/\n\nIn my actual code, I populate the input fields based on an array of objects, which gets populated via Service, and remove elements via array.splice. The example given in the jsfiddle is merely there for simplicity.\n\nAnother interesting condition of failure can be seen in this fiddle:\n\nhttp://jsfiddle.net/JACAv/\n\nSpecifically, if one of the inputs depends on non collision of value with the other, and is thusly invalidated, whereafter the other fields value is changed, validity remains incorrect.\n\nTemporary not quite functioning fiddle while I go to work:\n\nhttp://jsfiddle.net/yQpHL/\n\nThanks!"
] | [
"jquery",
"forms",
"dom",
"validation",
"angularjs"
] |
[
"Change innerHTML based on ID using Javascript didn't work",
"How do I change the text (innerHTML) of an element by its ID. I'm pretty sure my code is right, read some examples online but somehow it didn't work.\nCode as shown in image...\n\n\n\nAnother thing, I want to create if statement for it to change OFF to ON and vice versa.\nif text = State: ON, text = State: OFF else text = State: ON."
] | [
"javascript",
"html",
"css",
"web"
] |
[
"What's a good way to generate a random number for a valid credit card?",
"I am developing a set of tools in Java for validating and working with credit cards. So far I have support for:\n\n\nLUHN validation.\nDate validation (simple expiration).\nCard code length validation (CVV, CVC, CID) based on the brand (Visa, MasterCard, etc).\nCredit card number length validation (based on the brand).\nBIN/IIN validation (against a database of valid numbers).\nHiding the digits (425010 * * * * * * 1234)\n\n\nTo make the tool set a bit more complete, I would like to create a credit card random number generator based on the different card brands. This functionality will (hopefully) make my test cases a bit more reliable.\n\nBasically, I would like to be able to generate numbers which are:\n\n\nLUHN valid\nValid based on the brand prefixes\nValid based on the BIN/IIN prefix numbers\n\n\nFor BIN/IIN valid card numbers, I am thinking of looking up a random BIN/IIN number from the database (based on the brand of course) and then appending the remaining digits using Random. Obviously, that would not be valid most of the time and I will have to increment one of the digits until it passes the LUHN validation.\n\nI can't seem to be able to think of a better way. Perhaps someone could suggest something a little smarter...?\n\nLooking forward to your suggestions! Thanks in advance! :)"
] | [
"java",
"credit-card"
] |
[
"Refactor method to throw at most one checked exception instead of ExecutionException and InterruptedException",
"I have a method like\n\npublic void methodName() throws ExecutionException, InterruptedException {}\n\n\nSonarQube raises an issue on this method, suggesting to refactor this code.\n\nIf I replace those exceptions with Exception (which both of them extend), then it says throwing Exception is too generic.\n\nHow can I resolve this issue?\n\nExact sonarQube message: Refactor this method to throw atmost one checked exception instead of ExecutionException , InterruptedException\n\nDetailed Hint by sonarQube: https://sbforge.org/sonar/rules/show/squid:S1160?layout=false"
] | [
"java",
"sonarqube"
] |
[
"Can clang format add braces to single line if statements etc",
"Is there an option for clang-format to add braces to all if()/do/while statements etc?\n\neg\n\nif( i == 42 )\n std::cout << \"You found the meaning of life\\n\";\nelse\n std::cout << \"Wrong!\\n\";\n\n\nto\n\nif( i == 42 )\n{\n std::cout << \"You found the meaning of life\\n\";\n}\nelse\n{\n std::cout << \"Wrong!\\n\";\n}\n\n\nUsing\n\n$ clang-format --version\nclang-format version 3.6.0"
] | [
"c++",
"clang",
"clang-format"
] |
[
"FPDF Library replaces ' with '",
"I am not sure if anybody else has noticed this. but i am using FPDF library to generate PDF documents. But I just noticed if I pass a value with a ' in it, the ' is replaced with &#039;\n\nFor example the one value being passed is CD's but it is shown after the output as CD&#039;s anybody have an idea on what is causing this?\n\nI use $pdf->Cell(0,4,\"Name: \".$name,0,1,\"C\"); to add the string, but I have also tried using $pdf->Cell(0,4,\"Name: \".htmlspecialchars_decode($name),0,1,\"C\"); aswell but still getting the same result.\n\nAny ideas are welcome & appreciated. :)"
] | [
"php",
"pdf",
"fpdf"
] |
[
"Pandas dataframe replace NaN with a nearest minimum value in column",
"I have a pandas dataframe with column named as 'A_col', and I would like to create new column called 'A_col_fill', which will replace NaN in 'A_col' with a minimum value just prior to it if there is one. The sample output looks like below.\n A_col A_col_fill\n0 NaN NaN\n1 NaN NaN\n2 NaN NaN\n3 NaN NaN\n4 NaN NaN\n5 NaN NaN\n6 NaN NaN\n7 -0.3400 -0.3400\n8 NaN -0.3400\n9 NaN -0.3400\n10 -0.1900 -0.1900\n11 NaN -0.1900\n12 -0.3700 -0.3700\n13 -0.4100 -0.4100\n14 -0.3300 -0.3300\n15 NaN -0.4100\n16 NaN -0.4100\n17 NaN -0.4100\n18 NaN -0.4100\n19 NaN -0.4100\n20 -1.6500 -1.6500\n21 -1.8000 -1.8000\n22 -1.5300 -1.5300\n23 -1.3500 -1.3500\n24 NaN -1.8000\n25 -0.1900 -0.1900\n26 -0.1400 -0.1400\n28 -0.2100 -0.2100\n\nLooks like Dataframe 'fillna' function don't work with case, How can I implement this, any code snippet are highly appreciated!"
] | [
"python",
"pandas",
"dataframe",
"nan"
] |
[
"Get Data For Java Script Code",
"I have a piece of code in javascript which calculates something , \n\nThere is a label in asp.net application , How can I get the value of it from javascript ? \n\nhere is i have tried :\n\n<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Default.aspx.cs\" Inherits=\"WebApplication1.Default\" %>\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head runat=\"server\">\n <title>JASP</title>\n <script type=\"text/javascript\">\n var x = document.getElementById(\"Label1\").innerHTML;\n alert(x);\n </script>\n</head>\n<body>\n <form id=\"form1\" runat=\"server\">\n <asp:Label ID=\"Label1\" runat=\"server\" Text=\"My Text\"></asp:Label>\n </form>\n</body>\n</html>"
] | [
"asp.net"
] |
[
"Should I check the return value of fseek() when calculating the length of a file?",
"I have this idiomatic snippet for getting the length of a binary file:\n\n fseek(my_file, 0, SEEK_END);\n const size_t file_size = ftell(my_file);\n\n\n…I know, to be pedantic fseek(file, 0, SEEK_END) has undefined behavior for a binary stream [1] – but frankly on the platforms where this is a problem I also don't have fstat() and anyway this is a topic for another question…\n\nMy question is: Should I check the return value of fseek() in this case?\n\n if (fseek(my_file, 0, SEEK_END)) {\n\n return 1;\n\n }\n\n const size_t file_size = ftell(my_file);\n\n\nI have never seen fseek() been checked in a case like this, and I also wonder what kind of error fseek() could possibly ever return here.\n\nEDIT:\n\nAfter reading Clifford's answer, I also think that the best way to deal with fseek() and ftell() return values while calculating the size of a file is to write a dedicated function. However Clifford's good suggestion could not deal with the size_t data type (we need a size after all!), so I guess that the most practical approach in the end would be to use a pointer for storing the size of the file, and keep the return value of our dedicated function only for failures. Here is my contribution to Clifford's solution for a safe size calculator:\n\nint fsize (FILE * const file, size_t * const size) {\n\n long int ftell_retval;\n\n if (fseek(file, 0, SEEK_END) || (ftell_retval = ftell(file)) < 0) {\n\n /* Error */\n *size = 0;\n return 1;\n\n }\n\n *size = (size_t) ftell_retval;\n return 0;\n\n}\n\n\nSo that when we need to know the length of a file we could simply do:\n\nsize_t file_size;\n\nif (fsize(my_file, &file_size)) {\n\n fprintf(stderr, \"Error calculating the length of the file\\n\");\n return 1;\n\n}"
] | [
"c",
"c99",
"fseek",
"ftell",
"c-standard-library"
] |
[
"Error on MySQL Syntax",
"I'm trying to teach myself MySQL while working on a project at the same time. I'm using phpMyAdmin. \n\nI'm getting the error: \"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''ps_category' ('id_category', 'id_parent', 'id_shop_default', 'level_depth', 'nl' at line 1\"\n\nMy code:\n\nINSERT INTO 'ps_category' \n ('id_category', 'id_parent', 'id_shop_default',\n 'level_depth', 'nleft', 'nright', 'active', \n 'date_add', 'date_upd', 'position', 'is_root_category')\n VALUES (6,2,1,0,0,0,1,'2012-04-12 15:12:54','2012-04-12 15:12:54',1,0)\n\n\nUPDATE:\n\nI took off the single quotes and still getting the same error:\n\n INSERT INTO ps_category \n ('id_category', 'id_parent', 'id_shop_default', \n 'level_depth', 'nleft', 'nright', 'active', \n 'date_add', 'date_upd', 'position', 'is_root_category')\n VALUES (6,2,1,0,0,0,1,'2012-04-12 15:12:54','2012-04-12 15:12:54',1,0)"
] | [
"mysql",
"phpmyadmin"
] |
[
"jQuery on handling virtual keyboard click events",
"In this link he is makin a virtual keyboard using jQuery. I am making a virtual keyboard by using the foundation this tutorial. But I noticed a problem in this tutorial's keyboard. When I enter a character to the text area using my physical keyboard and after trying to enter a character via the virtual keyboard, virtual keyboard is not working. I have to refresh the page to get it work. It works properly until I enter something directly to the textarea from my physical keyboard.\n\nI would like to implement some customized keyboard by using this keyboard's logic. But the \"bug\" I mentioned above blocks my path. Could someone help me with what is going on there? Thank you.\n\nMy code to add button's content to textarea:\n\n<textarea id='tx'></textarea>\n<div class='key'>1</div>\n<div class='key'>2</div>\n<div class='key'>3</div>\n\n\njQuery:\n\n$(document).ready(function() {\n $('.key').click(function() {\n $('#tx').html( $(this).html() );\n });\n});"
] | [
"javascript",
"jquery"
] |
[
"Wait only 5 second for user input",
"I want to write a simple c program in turbo c++ 4.5 editor such that in only wait 5 seconds for user input. As an example,\n\n#include <stdio.h>\n\nvoid main()\n{\n int value = 0;\n printf(\"Enter a non-zero number: \");\n\n // wait only 5 seconds for user input\n scanf(\"%d\",&value);\n if(value != 0) {\n printf(\"User input a number\");\n } else {\n printf(\"User dont give input\");\n }\n}\n\n\nSo, what will be the code for 5 seconds wait for 'scanf' functionality and otherwise execute if-else part."
] | [
"c"
] |
[
"list of states with the total number of units that have been sold to that state",
"I am still new to SQL, and have to complete the tasks at hand. The task is:\nA \"fake\" user has made a few orders. DELETE the user account along with all of their orders.\nThis means delete from 3 tables:\nORDERDETAIL\nORDERS\nCUSTOMERS\n\nORDERDETAIL and ORDERS have a FK of ORDERID, and ORDERS and CUSTOMERS share a FK of CUSTOMERID. I started to use this code:\n\nDELETE ORDERDETAIL.ORDERID\nFROM ORDERDETAIL\nINNER JOIN ORDERS\nON ORDERDETAIL.ORDERID = ORDERS.ORDERID\nWHERE ORDERS.CUSTOMERID = '12341';\n\n\nJust to start, but even this fails. \n\nWhat code can I use to delete all rows that share the same ORDERID in ORDERDETAIL and ORDERS as well as CUSTOMERID from CUSTOMER and ORDERS?\n\nThanks for any assistance!"
] | [
"sql",
"oracle",
"sql-delete",
"delete-row"
] |
[
"check and compare two table and update the table 2 how that be possible in access database",
"I have 2 tables in Access database. Both tables have the same column but data is old. I have to update data. There is no unique id. How do I update my data? But the email is same. I want to check if the email is not there it update and if the email is there check other data from it to update.\n\nFile1 File2\nC1 C2 C3 C1 C2 C3\nU1 a b U1 a ?\nU2 a b U3 a \nU3 b"
] | [
"database",
"ms-access"
] |
[
"How to avoid permanent particle trails on html5 canvas?",
"There are thousands of moving particles on an HTML5 canvas, and my goal is to draw a short fading trail behind each one. A nice and fast way to do this is to not completely clear the canvas each frame, but overlay it with semi-transparent color. Here is an example with just one particle:\n\n\r\n\r\nvar canvas = document.getElementById('display');\r\nvar ctx = canvas.getContext('2d');\r\nvar displayHeight = canvas.height;\r\n\r\nvar backgroundColor = '#000000';\r\nvar overlayOpacity = 0.05;\r\n\r\nvar testParticle = {\r\n pos: 0,\r\n size: 3\r\n};\r\n\r\nfunction render(ctx, particle) {\r\n ctx.globalAlpha = overlayOpacity;\r\n ctx.fillStyle = backgroundColor;\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n ctx.globalAlpha = 1.0;\r\n \r\n ctx.fillStyle = '#FFF';\r\n ctx.fillRect(particle.pos, displayHeight / 2, particle.size, particle.size);\r\n}\r\n\r\nfunction update(particle) {\r\n particle.pos += 1;\r\n}\r\n\r\n// Fill with initial color\r\nctx.fillStyle = backgroundColor;\r\nctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\nfunction mainLoop() {\r\n update(testParticle);\r\n render(ctx, testParticle);\r\n requestAnimationFrame(mainLoop);\r\n}\r\n\r\nmainLoop();\r\n<canvas id=\"display\" width=\"320\" height=\"240\"></canvas>\r\n\r\n\r\n\n\nThere is an apparent problem: with low opacity values, the trail never fades away completely. You can see the horizontal line that (almost) does not fade in my single-particle example. I understand why this happens. ColorA overlayed by semi-transparent ColorB is basically a linear interpolation, and ColorA never fully converges to ColorB if we repeatedly do the following:\n\nColorA = lerp(ColorA, ColorB, opacityOfB)\n\n\nMy question is, what can I do to make it converge to the background color, so that trails don't remain there forever? Using WebGL or drawing trails manually are not valid options (because of compatibility and performance reasons respectively). One possibility is to loop over all canvas pixels and manually set pixels with low brightness to background color, although it may get expensive for large canvases. I wonder if there are better solutions."
] | [
"javascript",
"html",
"canvas",
"graphics",
"colors"
] |
[
"pass 2 values to a javascript function",
"i am trying to pass 2 values to a javascript xmlHttp request; THE values are being passed to the javascript function. i was successfully passing a single value to the javscript function, but now i need to pass 2 values. the bold values is a string name i want in the javascript.\n\n echo \"<a href='#' class='thumb'><img class='thumb-img' value = \".$row->aid.\" onclick='getVote(\".$row->aid.\", **\".$row->atitle.\"**)' src='images/roadies/th\".$row->aid.\".jpg' /> </a>\";\n\n\none is a int and the other is a string\n\nin the javascript, i am not sure how to receive these values. earlier i used to:\n\nfunction getVote(int)\n{\n xmlhttp=GetXmlHttpObject();\n if (xmlhttp==null)\n {\n alert (\"Browser does not support HTTP Request\");\n return;\n }\n value = int;\n\n\nfor a single value. but now since there are 2 values to process, i dont know how to write the function for it;\ni am currently (unsuccessfully) trying this:\n\nfunction getVote(int, name)\n{\n xmlhttp=GetXmlHttpObject();\n if (xmlhttp==null)\n {\n alert (\"Browser does not support HTTP Request\");\n return;\n }\n value = int;\n name= char;\n\n\nPlease tell me how to do it?"
] | [
"javascript"
] |
[
"How to pip install a Fork Repo",
"I have recently forked repo and then made some changes but when I was trying to pip install that.\nI get this following error\nTried:\npip install https://github.com/RahulARanger/py-googletrans.git#egg=pytubex\n\nError:\nERROR: Cannot unpack file C:\\Users\\[Name]\\AppData\\Local\\Temp\\pip-unpack-uyk9f4ze\\pytubeX.git (downloaded from C:\\Users\\[Name]\\AppData\\Local\\Temp\\pip-install-826d06sl\\pytubex, content-type: text/html; charset=utf-8); cannot detect archive format\nERROR: Cannot determine archive format of C:\\Users\\[Name]\\AppData\\Local\\Temp\\pip-install-826d06sl\\pytubex\n\nTried:\npip install git+git//github.com/RahulARanger/py-googletrans.git@master\n\nError:\nERROR: Command errored out with exit status 1:\n command: 'c:\\users\\[name\\appdata\\local\\programs\\python\\python38\\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\\\Users\\\\[name]\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-fksh4wb0\\\\setup.py'"'"'; __file__='"'"'C:\\\\Users\\\\[name]\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-fksh4wb0\\\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\\r\\n'"'"', '"'"'\\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\\Users\\[name]\\AppData\\Local\\Temp\\pip-pip-egg-info-lolv29nn'\n cwd: C:\\Users\\[name]\\AppData\\Local\\Temp\\pip-req-build-fksh4wb0\\\n Complete output (5 lines):\n Traceback (most recent call last):\n File "<string>", line 1, in <module>\n File "C:\\Users\\[name]\\AppData\\Local\\Temp\\pip-req-build-fksh4wb0\\setup.py", line 10, in <module>\n README = (here / "README.md").read_text()\n TypeError: unsupported operand type(s) for /: 'str' and 'str'\n ----------------------------------------\nERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.\n\nFork Repo: https://github.com/RahulARanger/py-googletrans\nYes, I have uninstalled the main ones (pytubex)\nDo I need to make some changes in Fork or change my command?\nI have tried most of the prev suggestions in some questions before but it didn't work\nPlease help me with this issue."
] | [
"git",
"github",
"pip"
] |
[
"Google Drive API : ENOENT - but my file is just in the same directory",
"ENOENT - but my file is just in the same directory ...\nHi all I try to sent a file, birds.mp3, to my Google Drive using API. The file got to be reached by a function to be sent.\n\nDespite that the file I try to send is just in the same folder that the code concerned, my console return me :\n\n\n events.js:183\n \n throw er; // Unhandled 'error' event\n \n ^\n \n Error: ENOENT: no such file or directory, open './birds.mp3'\n\n\nHere my tree :\n\n-- folder\n |-- birds.mp3\n |-- quickstart.js\n\n\nHere my quickstart.js\n\nmodule.exports.insertDrive = function (req) {\n console.log(\"callback reached.\")\nvar url = req.body.url;\nvar folderId = 'id';\nvar fileMetadata = {\n 'name': req.body.word,\n parents: \"id\"\n};\nvar media = {\n mimeType: 'audio/*',\n body: fs.createReadStream(\"./birds.mp3\") // PATH FUNCTION HERE\n};\ndrive.files.create({\n resource: fileMetadata,\n media: media,\n fields: 'id'\n}, function (err, file) {\n if (err) {\n // Handle error\n console.error(err);\n } else {\n console.log('File Id: ', file.id);\n } \n})};\n\n\nI can't figure out why my file can't be reached. I have try several tricks like path.resolve and all, I have try to push my birds.mp3 in several folder if any, but that have failed.\n\nThanks."
] | [
"javascript",
"node.js",
"api",
"path",
"google-drive-api"
] |
[
"Why's my GET request becoming unidentifiable?",
"I want to eventually call functions from my php file onto my reactjs project so just to scratch the surface, I'm trying to to do a basic get request, but in the console, all I see is: \n\nHere's it is [object Response] \n\n\nWhich isn't what I want to happen. \n\nWhat am I doing wrong and how can I fix it? \n\nHere's my js code:\n\nimport React, { Component } from 'react';\n\nclass Home extends Component {\n\n componentWillMount() {\n fetch(\"http://localhost/myProject/phpCalls/index.php\", {\n method: 'GET'\n })\n .then(res => {\n console.log(\"Here's it is \" + res);\n });\n }\n\n render() {\n return (\n <h1>testing</h1>\n );\n }\n}\n\nexport default Home;\n\n\nHere's my php file:\n\nheader('Content-Type: application/json');\n\nfunction hey() {\n echo \"Will I see this?\";\n}\n\n$test = $_GET['do'];\n\nif($test === \"hey\") {\n hey();\n}"
] | [
"javascript",
"php",
"reactjs",
"debugging",
"get"
] |
[
"How to create DropDown which have dynamic Validation List",
"I have data table with columns 'Category' and 'Product'. Product names are not unique, Category names are not unique, but the combination Category-Product appears just once in table. This data table is NOT sorted in any way.\n\nCategory Product\n\n======== =======\n\nChairs Victorian\n\nChairs Beautiful\n\nChairs Edwardian\n\nChairs Gross\n\nTables Victorian\n\nTables Edwardian\n\nTables Huge\n\nTables Kool\n\nTables Lambda\n\nClosets Edwardian\n\nClosets Excellent\n\nClosets Major\n\nClosets Hello\n\nChairs Huge\n\nTables Picturesque\n\nClosets Picturesque\n\nChairs Incredible\n\nClosets Minor\n\nChairs Just\n\nChairs Kool\n\n\nI have already created temporary table with unique Category names, which will be used as validation range for the first dropdown list. This part works as it should.\n\nCategories\n\n==========\n\nChairs\n\nTables\n\nClosets\n\n\nNext to the first dropdown, I have another dropdown which should have dynamically created list of products of the category selected in previous dropdown.\n\nIf it is just for one pair of dropdowns (Category/Product), I can create satisfactory result using temporary columns.\n\nCategory: Chairs Product: Victorian\n\n Beautiful\n\n Edwardian\n\n Gross\n\n Huge\n\n . . .\n\n\nThe problem is that this dropdown pairs should be part of another table with columns: 'Category', 'Product', 'Amount'. So, when user chooses in first column Category dropdown value 'Chairs', in the next column dropdown should be available in list just Products from category 'Chairs'. In the next row when the user chooses category 'Tables', in the adjacent cell should be available just products from category 'Tables'.\n\nI am trying to make this using just formulas, array formulas, named functions (do not mix-up them with UDF functions) without VBA code.\n\nIs it possible to do it or I am wasting my time (2 days already)?\n\nExcel file with what I already did: here\n\nUPDATE (2019-09-30):\n\nFound this in a comment:\n'However, Excel doesn't allow you to use array formulas in data validation,' ... by Fernando J. Rivera Nov 4 '17 on Excel dynamic drop down List by filtered table\n\nSo, it means that it is NOT possible to do dynamic data validation."
] | [
"excel",
"excel-formula",
"excel-2010"
] |
[
"How to find the base part of a variable name that ends in I, J, or IJ",
"I want to cut off the end part of a vector of characters of variable length that all end in either I, J, or IJ, but haven't quite got it right yet:\n\nCurrent attempt, using a simple case.\n\nvars <- c(\"VARI\", \"VARJ\", \"VARIJ\")\nsapply(vars, function(v) {\n m <- regexec(\"^(.*)(?:I|J|IJ)$\", v)\n regmatches(v, m)[[1]][2]\n})\n\n\nHowever, it doesn't work for the IJ case:\n\n VARI VARJ VARIJ \n\"VAR\" \"VAR\" \"VARI\""
] | [
"regex",
"r"
] |
[
"android ListView onOverScroll never be called",
"can anyone tell me why I can not get onOverScrolled be called in my following code: \n\n public class KasOverScrollListenableListView extends ListView {\n\n public interface OverScrollListener{\n void onOverScroll(int scrollx, int scrollY,boolean clampedX, boolean clampedY );\n }\n private OverScrollListener mOverScrollListener= null;\n public KasOverScrollListenableListView(Context context, AttributeSet attrs,\n int defStyle) {\n super(context, attrs, defStyle);\n }\n\n public KasOverScrollListenableListView(Context context, AttributeSet attrs){\n this(context,attrs,0);\n }\n\n public KasOverScrollListenableListView(Context context){\n this(context,null,0);\n }\n\n protected void onOverScroll(int scrollX, int scrollY, boolean clampedX, boolean clampedY){\n Log.i(\"overScrolling\", \"overScrolling is \" + scrollY);\n // if the version of the system higher than 2.3 then do the following things.\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD){\n// super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);\n if(null != mOverScrollListener ){\n mOverScrollListener.onOverScroll(scrollX, scrollY, clampedX, clampedY);\n }\n }\n\n }\n\n public void setOnOverScrollListener(OverScrollListener listener){\n mOverScrollListener = listener;\n }\n}\n\n\nI can never get the log to be output which means this function never been called, while this listview is actually overscrolled.I will really be grateful to hear your idea."
] | [
"android",
"listview",
"overscroll"
] |
[
"VPC flow logs: how much vpc flow logs cost?",
"I have egress cost in my gcp project to debug the reason i enabled vpc flow logs for a day .But for just one day it gave me 850gb of logs and also costing arond 300plus USD which is as equal to egress .instead of reducing cost Debugging process increased my total cost ,what should i do with these logs and price ."
] | [
"google-cloud-platform"
] |
[
"How to drop duplicates in csv by pandas library in Python?",
"I've been looking around tried to get examples but can't get it work the way i want to.\n\nI want to dedupe by 'OrderID' and extract duplicates to seperate CSV.\nMain thing is I need to be able to change the column which I want to dedupe by, in this case its 'Order ID'. \n\nExample Data set:\n\n\nID Fruit Order ID Quantity Price\n1 apple 1111 11 £2.00\n2 banana 2222 22 £3.00\n3 orange 3333 33 £5.00\n4 mango 4444 44 £7.00\n5 Kiwi 3333 55 £5.00\n\n\n\nOutput:\n\n\nID Fruit Order ID Quantity Price\n5 Kiwi 3333 55 £5.00\n\n\n\nI've tried this:\n\nimport pandas as pd\n\ndf = pd.read_csv('C:/Users/shane/PycharmProjects/PythonTut/deduping/duplicate example.csv')\n\nnew_df = df[['ID','Fruit','Order ID','Quantity','Price']].drop_duplicates()\n\nnew_df.to_csv('C:/Users/shane/PycharmProjects/PythonTut/deduping/duplicate test.csv', index=False)\n\n\nIssue i have is it doesn't remove any duplicates."
] | [
"python",
"pandas"
] |
[
"Create New Objects in New Table During RealmJS Migration",
"Error on Realm Migration in Xcode com.facebook.JavaScript(11):EXC_BAD_ACCESS(code=1,address=0x20)\n\nRealm Schemas\n\nSchema v1:\n\n\nCar\n\n\nid: string (primary key)\nmake: string\nmodel: string\nyear: int\ncolor: string\nowner: string\n\n\n\nSchema v2:\n\n\nCar (remains unchanged)\nCarTitle (new RealmObject added in v2)\n\n\nid: string (primary key)\nmake: string\nyear: int\ncolor: string\nowner: string\nregistrationValid: type: string, optional: true\n\n\n\nRealm Migration function for v1 -> v2:\n\nexport function migration(oldRealm: Realm, newRealm: Realm) {\n const oldCars = oldRealm.objects(Car.schema.name) as Realm.Results<Car>;\n\n oldCars.forEach((car: any) => {\n const carTitle = {\n id: car.id,\n make: car.make,\n year: car.year,\n owner: car.owner,\n } as CarTitle;\n\n newRealm.create(CarTitle.schema.name, carTitle, true);\n });\n}\n\n\nThe error is thrown by the newRealm.create(). Is it not possible to create new objects in a new realm table from an old realm object during migration?"
] | [
"javascript",
"realm"
] |
[
"Seeking enlightenment - global variables in AppEngine (aeoid.get_current_user())",
"This may be a 'Python Web Programming 101' question, but I'm confused about some code in the aeoid project (http://github.com/Arachnid/aeoid). here's the code:\n\n_current_user = None\n\ndef get_current_user():\n \"\"\"Returns the currently logged in user, or None if no user is logged in.\"\"\"\n global _current_user\n\n if not _current_user and 'aeoid.user' in os.environ:\n _current_user = User(None, _from_model_key=os.environ['aeoid.user'])\n return _current_user\n\n\nBut my understanding was that global variables were, ehm, global! And so different requests from different users could (potentially) access and update the same value, hence the need for sessions, in order to store per-user, non-global variables. So, in the code above, what prevents one request from believing the current user is the user set by another request? Sorry if this is basic, it's just not how i thought things worked.\n\nThanks"
] | [
"python",
"google-app-engine",
"session",
"global-variables"
] |
[
"AutoreleasePoolPage3popEPv Crash log from TestFlight, what does it mean?",
"I received a crash log from TestFlight, after I've uploaded the dsym file, the crash log is as shown below.\n\nUnfortunately I am clueless what it means, and how I can find the cause of this crash. Am I missing something here?\n\nSIGSEGV\nlibobjc.A.dylib_ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv\n\nOccurrences1\nUsers1\n# Binary Image Name Address Symbol\n0 Moon Stones 0x0004d71e testflight_backtrace\n1 Moon Stones 0x0004cdb6 TFSignalHandler\n2 libsystem_c.dylib 0x393eed3a _sigtramp\n3 libobjc.A.dylib 0x38f77494 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv\n4 CoreFoundation 0x311c2830 _CFAutoreleasePoolPop\n5 Foundation 0x31ae8604 -[NSAutoreleasePool release]\n6 UIKit 0x3308e572 _UIApplicationHandleEvent\n7 GraphicsServices 0x34da65f6 _PurpleEventCallback\n8 GraphicsServices 0x34da6226 PurpleEventCallback\n9 CoreFoundation 0x312543e6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__\n10 CoreFoundation 0x3125438a __CFRunLoopDoSource1\n11 CoreFoundation 0x3125320e __CFRunLoopRun\n12 CoreFoundation 0x311c623c CFRunLoopRunSpecific\n13 CoreFoundation 0x311c60c8 CFRunLoopRunInMode\n14 GraphicsServices 0x34da533a GSEventRunModal\n15 UIKit 0x330e22b8 UIApplicationMain\n16 Moon Stones 0x0000e73a main in main.m on Line 16\n17 Moon Stones 0x0000951f start\n\n\nCrashed occurred at # 3 libobjc.A.dylib 0x38f77494 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv\n\nI would be probably adding TFLogs for logging, and adding checkpoints to get a clue for future crashes. \n\nAny help and insight on this crash log will be appreciated.\n\nEdit: Attached screenshot."
] | [
"ios",
"iphone-5",
"crash-reports",
"xcode4.6",
"testflight"
] |
[
"Uninstalling Windows Updates via CMD Batch File",
"I am trying to put together a batch script that will quietly remove a specific windows update. I have the KB #.\n\nI cant seem to find a seamless way to do this so far. Is there a way to uninstall via a GUID of sorts? If so, how do you find the GUIDs of each specific installed windows update?"
] | [
"windows",
"batch-file",
"cmd",
"updates",
"uninstallation"
] |
[
"Memoize over one parameter",
"I have a function which takes two inputs which I would like to memoize. The output of the function only depends on the value of the first input, the value of the second input has no functional effect on the outcome (but it may affect how long it takes to finish). Since I don't want the second parameter to affect the memoization I cannot use memoize. Is there an idiomatic way to do this or will I just have to implement the memoization myself?"
] | [
"clojure",
"memoization"
] |
[
"Alert if the checkbox is checked without a value and submitted",
"I want to do that when I click on the submit button, it should alerts me if the checkbox is checked without a value in my text box. And also after this is corrected, when I click on submit, I should get the values of the text box which are checked.\n\n<center>\n Would you like to proceed for checking?\n <input type=\"radio\" id=\"radio1\" name=\"radio\" value='Yes' />\n <label for=\"radio1\">Yes</label>\n <input type=\"radio\" id=\"radio2\" name=\"radio\" value='No'/>\n <label for=\"radio2\">No</label>\n <script src=\"https://code.jquery.com/jquery-1.10.2.js\"></script>\n <br><br>\n <div class=\"result1\"></div>\n <div class=\"result2\"></div>\n <div class=\"result3\"></div>\n <div class=\"result4\"></div>\n <script>\n $(function() { \n $(\"input[name='radio']\").on(\"change\", function() {\n if ($(\"input[name='radio']:checked\").val() == \"Yes\") {\n document.querySelector('.result1').innerHTML = 'Enter your requirements:';\n $('.result1').html('Enter your requirements:').fadeIn('fast');\n document.querySelector('.result2').innerHTML = '<input type=\"checkbox\" name=\"dn\" >DN length:<input type=\"text\" name=\"dnlength\" />';\n $('.result2').html('<input type=\"checkbox\" name=\"dn\"> DN length: <input type=\"text\" name=\"dnlength\" />').fadeIn('fast');\n document.querySelector('.result3').innerHTML = '<input type=\"checkbox\" name=\"dn\"> valid digits:<input type=\"text\" name=\"valid\" />';\n $('.result3').html('<input type=\"checkbox\" name=\"dn\"> valid digits: <input type=\"text\" name=\"valid\" />').fadeIn('fast');\n document.querySelector('.result4').innerHTML = '<button type=\"submit\" value=\"Submit\" onclick=\"checkboccheck()\">Submit</button>';\n $('.result4').html('<button type=\"submit\" value=\"Submit\">Submit</button>').fadeIn('fast');\n }\n if ($(\"input[name='radio']:checked\").val() == \"No\") {\n $('.result1').fadeOut('fast');\n $('.result2').fadeOut('fast');\n $('.result3').fadeOut('fast');\n $('.result4').fadeOut('fast');\n } \n });\n });\n </script>\n</center>"
] | [
"jquery"
] |
[
"How to resolve spring security core plug in?",
"I am having problem with my exercise in Spring Security. I already declare on my pom file:\n\n<dependency>\n <groupId>org.springframework.security</groupId>\n <artifactId>spring-security-core</artifactId>\n <version>4.2.3.RELEASE</version>\n</dependency>\n\n\nand on my maven dependency, the spring security core jar file is there, but upon importing class UserDetailsService my eclipse cannot found it. I did cleaning and updating my maven project but nothing happens.\n\nHope someone can advice."
] | [
"spring-security",
"maven-3"
] |
[
"Re-using partials and controllers in angular",
"I have two sections of a page that contain a form that are nearly identical. The only difference is some of the wording and the values of an object in the parent scope. How can I tell the view or the controller to use one scope variable instead of another?\n\nContrived Example:\n\nmyApp.controller('ParentController', function($scope) {\n $scope.container = {\n someA: { a: 1, b: 3 },\n someB: { a: 2, b: 4 }\n }\n});\n\nmyApp.controller('ChildController', function($scope) {\n // Some scope variable that gets the value of container.someA\n // or container.someB\n\n $scope.result = $scope.someValue.a + $scope.someValue.b;\n});\n\n\nI could then use $scope.result in two child views that use the same template.\n\n<div ng-controller=\"ParentController\">\n <!-- Include #1 -->\n <div ng-include=\"someTemplate.html\" ng-controller=\"ChildController\"></div>\n <!-- Include #2 -->\n <div ng-include=\"someTemplate.html\" ng-controller=\"ChildController\"></div>\n</div>\n\n\nHow can I tell include #1 to use the values of $scope.container.someA and include #2 to use the values of $scope.container.someB?"
] | [
"javascript",
"angularjs",
"angularjs-scope"
] |
[
"Correct way to serve binary data and partial content with Zend Framework 2",
"I want to allow the serving of binary files with some sort of access control. Since the control is rather complex, I cannot simply let Apache serve the files, I have to serve them via PHP, using my Zend Framework 2 app. The action goes like this:\n\npublic function sendAction() {\n $filename = /* database action */;\n $size = filesize($filename);\n $response = $this->getResponse();\n\n if($this->getRequest()->getHeaders()->has('Range')) {\n list($unit, $range) = explode('=', $this->getRequest()->getHeaders()->get('Range')->toString());\n $ranges = explode(',', $range);\n $ranges = explode('-', $ranges[0]);\n\n $start = (int)$ranges[0];\n $end = (int)(isset($ranges[1]) ? $ranges[1] : $size - 1);\n $length = $start - $end;\n\n $response->getHeaders()->addHeaders(array('Content-Type' => 'audio/mpeg', 'Accept-Ranges' => 'bytes', 'Content-Length' => $length - 1));\n $response->setStatusCode(206);\n\n $f = fopen($filename, 'r');\n if($start) fseek($f, $start);\n $out = '';\n while($length) {\n $read = ($length > 8192) ? 8192 : $length;\n $length -= $read;\n $out .= fread($fp,$read);\n }\n fclose($f);\n\n $response->setContent($out);\n } else {\n $response\n ->setContent(file_get_contents($filename))\n ->getHeaders()->addHeaders(array('Content-Type' => 'audio/mpeg', 'Accept-Ranges' => 'bytes'));\n }\n\n return $this->getResponse();\n}\n\n\nWell for one, I am sure this is very inefficient as the files are always loaded into the RAM entirely for this before being served.\n\nHowever, this doesn't seem to work. When I try to access the file, I get the correct audio/mpeg player in Chrome, but then the browser cancels the requests and stops. I can't play the audio at all.\n\nI could not find any hint on the web on how to implement a 206 response in Zend 2 the correct way, perhaps someone can help me here."
] | [
"php",
"http-headers",
"zend-framework2",
"download"
] |
[
"Proper Management Of A Singleton Data Store In IOS With Web Service",
"I'm currently using a singleton as a data store for my app. I essentially store a number of events that are pulled and parsed from a web service and then added as needed. Each time I make a request from the web service, I parse the results and see if the items already exist. If they do, I delete them and add the updated version provided by the web service. \n\nEverything appeared to be working properly until I fired up the Instruments panel to find out that my system is leaking the objects every time it loads them from the web service (from the second time on). The core method where things appear to be messing up is this one, which is located in my HollerStore singleton class:\n\n- (void)addHoller: (Holler *)h\n{\n //Take a holler, check to see if one like it already exists\n int i = 0;\n\n NSArray *theHollers = [NSArray arrayWithArray:allHollers];\n for( Holler *th in theHollers )\n {\n if( [[th hollerId]isEqualToString:[h hollerId]] )\n {\n NSLog(@\"Removing holler at index %i\", i);\n [allHollers removeObjectAtIndex:i];\n }\n i++;\n }\n [allHollers addObject:h];\n}\n\n\nQuick explanation: I decided to copy the allHollers NSMutableArray into theHollers because it's being updated asynchronously by NSURLConnection. If I update it directly, it results in a crash. As such, I switched to this model hoping to solve the problem, however the Instruments panel is telling me that my objects are leaking. All the counts are exactly the # of items I have in my data set. \n\nFrom what I can tell removeObjectAtIndex isn't effectively removing the items. Would love to get the thoughts of anybody else out there on three things:\n\n\nIs my analysis correct that something else must be retaining the individual hollers being added? \nShould I be using CoreData or SQLite for storing information pulled from the web service? \nDo you know how long data stored in a Singleton should be available for? Until the app is killed?\n\n\nUpdate\nI think I've found the source, however perhaps someone can provide some clarity on the proper way to do this. I've created a method called parseHoller which takes a dictionary object created through SBJSON and returns my own model (Holler). Here are the last couple lines:\n\nHoller *h = [[[Holler alloc] initFromApiResponse:hollerId \n creatorId:creatorId \n creatorName:creatorName \n creatorImageUrl:creatorImage \n comments:comments \n attendees:attendees \n wishes:wishes \n invitees:invites \n createdAt:createdAt \n text:text \n title:title \n when:when]autorelease];\n//(some other autorelease stuff is here to clean up the internal method)\nreturn h;\n\n\nI figured that since I'm returning an autoreleased object, this should be fine. Do you see anything wrong with this?"
] | [
"iphone",
"objective-c",
"ios",
"cocoa-touch"
] |
[
"Kohana Auth login with email not username",
"So as the title says i want to login with my email, not username, now my login works with username, but i can't find a way to change that, so i'm using this basic login code: \n\nAuth::instance()->login($post['email'],$post['password'], false\n\n\nEDIT After all it was my fault it seems that kohana let's me login using username and email, i had errors in my other script"
] | [
"kohana",
"kohana-auth"
] |
[
"hidden rows change to show on javascript on dropdown selection",
"I want to make all the results hidden all the time and to only show the one that corresponds to the option selected on the dropdown list. \nThe code that i have is working perfectly but as you can see this code shows all the results at first and i cant seem to get it to hide all the results first and then show only one.\n\n <script type=\"text/javascript\" src=\"/js/jquery.js\"></script>\n<script type=\"text/javascript\">\n (function($) {\n $(\"doucment\").ready(function() {\n\n $(\"#choice\").change(function() {\n $(\"td\").hide();\n $(\"td.\" + $(this).val()).show();\n });\n });\n\n })(jQuery);\n</script>\n</head>\n\n<body>\n <select id=\"choice\">\n <option value=\"d1\">A</option>\n <option value=\"d2\">B</option>\n <option value=\"d3\">C</option>\n <option value=\"d4\">D</option>\n </select>\n <table id=\"result\" border=\"1\">\n <tr>\n <td class=\"d1\">Column A</td>\n <td class=\"d2\">Column B</td>\n <td class=\"d3\">Column C</td>\n <td class=\"d4\">Column D</td>\n </tr>\n </table>"
] | [
"javascript",
"show",
"hidden",
"html-select"
] |
[
"codemirror show hints with angular",
"How to show hints and define dictionary with ui-codemirror?\n\n $scope.cmOption = {\n lineWrapping : true,\n lineNumbers: true,\n textWrapping: true,\n indentWithTabs: true,\n readOnly: false,\n mode: \"javascript\",\n matchBrackets: true,\n autoCloseBrackets: true,\n gutters: [\"CodeMirror-lint-markers\"],\n lint: true,\n showHint: true\n };\n\n\nI tried with ng-codemirror-dictionary-hint but it gives me an error\n\n\n instance.showHint is not a function"
] | [
"javascript",
"angularjs",
"codemirror",
"ui-codemirror"
] |
[
"has_many :through and FormBuilder.fields_for",
"I have a class Bar that has a user-defined list of config keys and values, defined like this:\n\nclass Bar < ActiveRecord::Base\n\n has_many :config_keys, :through => Foo\n has_many :config_values\n\nend\n\n\nSo the available config keys come from the Foo class and the values for those come from the Bar class.\n\nI'm creating a form for this Bar class, and I need to loop over each of the fields in config_keys using the name property as the label, but the textbox should be for the value of the config_values \n\nWhat I'm seeing is that if I do \n\n\n \n\nI thought that f.fields_for on a collection would do the looping for me.\n\nAm I approaching this the right way? Feels like I'm really fighting the framework."
] | [
"ruby-on-rails",
"has-many-through"
] |
[
"Filtering data based on data through multiple relationships",
"So I have this in my DB:\n\nCommodityCategories\n-------------------\nCommodityCategoryID (PK)\nName\n\nCommodities\n-------------------\nCommodityID (PK)\nCommodityCategoryID (FK)\nName\n\nVendorsCommodities\n-------------------\nVendorID (PK, FK)\nCommodityID (PK, FK)\n\nVendors\n-------------------\nVendorID\nName\n\n\nBasically, a Commodity has a Commodity Category, and a Vendor has multiple Commodities.\n\nI'd like to display the name of each Commodity Category, and underneath display the name of each Vendor that has a Commodity related to that Commodity Category. Here's what I have:\n\n@foreach (var commodityCategory in Model.CommodityCategories)\n{\n <h3><a href=\"#\">@commodityCategory.Name</a></h3>\n <div>\n @foreach (var vendor in Model.Vendors)\n {\n <span>@vendor.Name</span>\n }\n </div>\n}\n\n\nI need to filter Model.Vendors by the current Commodity Category that I'm looping through. I tried Model.Vendors.Where(v => v.Commodities.CommodityCategories.Contains(commodityCategory)), but CommodityCategories isn't a property of v.Commodities.\n\nIs there any way for me to do this?"
] | [
"c#",
"asp.net",
"asp.net-mvc",
"linq",
"entity-framework"
] |
[
"Does Python have a particular term for slicing a list element?",
"g = [\"01\", \"05\", \"95\", \"99\"]\nx = g[0][:1]\nprint x\n\n\nI was coding strings and slices, like above, and I was wondering if the double brackets had a particular Pythonic name (manly to differentiate the two sets of parenthesis)? Or is it just called a sliced element?"
] | [
"python",
"slice"
] |
[
"React does not recognize the 'activeKey' (and 'activeHref') prop on a DOM element",
"I've been continuously having this warning on my React web application and not sure how I can fix this. I'm pretty new to React and have tried googling my way through, but still haven't ended up in a solution.\n\nWarning: React does not recognize the `activeKey` prop on a DOM element. If \n you intentionally want it to appear in the DOM as a custom \n attribute, spell it as lowercase `activekey` instead. If you \n accidentally passed it from a parent component, remove it from the \n DOM element.\n in div (created by NavbarForm)\n in NavbarForm (created by Header)\n in ul (created by Nav)\n in Nav (created by Header)\n in div (created by Grid)\n in Grid (created by Navbar)\n in nav (created by Navbar)\n in Navbar (created by Uncontrolled(Navbar))\n in Uncontrolled(Navbar) (created by Header)\n in Header (created by App)\n in div (created by App)\n in App\n\n\nHere is the code for my Header\n\nimport * as React from 'react';\nimport { Button, FormControl, FormGroup, Nav, Navbar, NavItem} from 'react-bootstrap';\n\nconst Header = (props : any) => {\n return (\n <Navbar>\n <Navbar.Header>\n <Navbar.Brand>\n <NavItem href=\"/\">\n RedQuick\n </NavItem>\n </Navbar.Brand>\n </Navbar.Header>\n <Nav>\n <Navbar.Form>\n <form onSubmit={ props.getRedditPost }>\n <FormGroup>\n <FormControl \n type=\"text\" \n name=\"subreddit\" \n placeholder=\"Subreddit Name...\" \n />\n </FormGroup>\n <Button type=\"submit\">Search</Button>\n </form>\n </Navbar.Form> \n </Nav>\n </Navbar>\n );\n};\n\nexport default Header;\n\n\nLink to Github repo if its not the header's problem"
] | [
"reactjs",
"typescript",
"dom"
] |
[
"spring cache not retrieving the value from Map though it exist",
"I am trying to add data into cache at runtime and retrieve it. I am able to successfully add the data into HashMap but when I invoke findbyIndex method I am getting null value though the key exist in Map. Below is the code:\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.springframework.cache.annotation.CacheConfig;\nimport org.springframework.cache.annotation.CachePut;\nimport org.springframework.cache.annotation.Cacheable;\nimport org.springframework.stereotype.Component;\n\n@Component\n@CacheConfig(cacheNames = { \"cachetest\" })\npublic class CacheService {\n\n private static Map<String, String> store = new HashMap<String, String>();\n\n @CachePut\n public void putData(String dataid, String data) {\n System.out.println(\"Executing put data...\");\n store.put(dataid, data);\n }\n\n @Cacheable\n public String findByIndex(String dataid) {\n System.out.println(\":Executing findByIndex ...\");\n for (Map.Entry<String, String> entry : store.entrySet()) {\n System.out.println(entry.getKey() + \" : \" + entry.getValue());\n }\n return store.get(dataid);\n }\n\n}\n\n\nmy ehcache.xml for this cacheconfig is :\n\n<cache alias=\"cachetest\">\n <expiry>\n <ttl unit=\"seconds\">5</ttl>\n </expiry>\n <heap unit=\"entries\">1500</heap>\n <jsr107:mbeans enable-statistics=\"true\" />\n </cache>\n\n\nCache Configuration file:\n\nimport java.util.Arrays;\n\nimport org.springframework.cache.CacheManager;\nimport org.springframework.cache.annotation.EnableCaching;\nimport org.springframework.cache.concurrent.ConcurrentMapCache;\nimport org.springframework.cache.support.SimpleCacheManager;\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\n\n@Configuration\n@EnableCaching\npublic class CachingConfig {\n @Bean\n public CacheService customerDataService() {\n return new CacheService();\n }\n\n @Bean\n public CacheManager cacheManager() {\n SimpleCacheManager cacheManager = new SimpleCacheManager();\n cacheManager.setCaches(Arrays.asList(\n new ConcurrentMapCache(\"cachetest\")));\n return cacheManager;\n }\n}\n\n\nwhen a new value is added to store map using putData method the value is successfully getting added to HashMap, but if I try to fetch the value for that newly added data by calling findByIndex method, The method is returning null value though it exist. Any idea whats happening below?"
] | [
"spring",
"ehcache",
"spring-cache"
] |
[
"XCode Unit & UI Tests strategies/how to",
"I just started getting into writing unit tests via Xcode for an application I'm writing and so far it all seems pretty easy. However this is an unfortunately small amount of things to read about XCTest and related classes on the web so I'm left with a couple of questions.\n\n1) When testing massively complex structures such as a view controller, what do you test? My view controllers, for example, have outlets, view models, custom subview classes, and so on. So far I'm just testing the IBOutlets and that I can load the view controller from a storyboard instance.\n\n2) Should custom view classes be tested on their own? For some views this makes sense (subclasses of buttons, text fields, etc) because their view controller independent but what about with highly custom classes, say an OnboardingView that's a property on an OnboardingViewController instance.\n\n3) Finally, what are the practical use cases for XCTestSuite? My intuition would be if I wanted to group similar tests together, say ones for all my view controllers, and then run just that test suite via some automation tool like Jenkins."
] | [
"ios",
"xcode",
"unit-testing"
] |
[
"Jenkins build issue - npm ERR! Your cache folder contains root-owned files",
"I am trying to build a small node app on my Jenkins pipeline, which is running in a virtual machine. cross this error:\n + npm install\nnpm ERR! code EACCES\nnpm ERR! syscall mkdir\nnpm ERR! path /.npm\nnpm ERR! errno EACCES\nnpm ERR! \nnpm ERR! Your cache folder contains root-owned files, due to a bug in\nnpm ERR! previous versions of npm which has since been addressed.\nnpm ERR! \nnpm ERR! To permanently fix this problem, please run:\nnpm ERR! sudo chown -R 111:120 "/.npm"\n\nRunning sudo chown -R 111:120 "/.npm" doesn`t help since it says:\n\nchown: cannot access '/.npm': No such file or directory\n\nAnd, as per my understanding, runs in a local context, when the problem is actually from the container perspective. I`ve tried to add the command above on my Docker and Jenkinsfile as well, to no avail. Below is my public repo:\nNode app deploy on github"
] | [
"node.js",
"jenkins"
] |
[
"Vuetify v-radio label got broken after using label slot once",
"Context:\nI've decided to create a v-radio button with v-text-field as a label for it.\nI used the label slot like this:\n<v-radio\n v-for="option in question.options"\n :key="option"\n :label="option"\n :value="option"\n>\n <template #label>\n <v-text-field\n label="Test"\n />\n </template>\n</v-radio>\n\nProblem:\nThis is the output that I got when applying the previous code snippet:\n\nAdditional Info:\nI checked another normal radio button in the project\n(which is copied from Vuetify docs)\nThe code is as follows:\n<v-radio\n label="red darken-3"\n color="red darken-3"\n value="red darken-3"\n/>\n\nHere is the output for that code:\n\nQuestion:\nIs there a way to get a normal radio button with input text without having two radio button "circles"?\nVuetify version: ^2.4.5"
] | [
"vue.js",
"vuetify.js"
] |
[
"Native JavaScript - detect when a div is clicked away from / unfocused",
"I need to know when my div is clicked away from, in native javascript."
] | [
"javascript",
"html",
"css"
] |
[
"How to inject the path configuration into ServeStaticModule from another service?",
"The NestJS documentation says to server static files like this:\n\nimport { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { ServeStaticModule } from '@nestjs/serve-static';\nimport { join } from 'path';\n\n@Module({\n imports: [\n ServeStaticModule.forRoot({\n rootPath: join(__dirname, '..', 'client'),\n }),\n ],\n controllers: [AppController],\n providers: [AppService],\n})\nexport class AppModule {}\n\n\nBut as a DI and SOLID practitioner, I want to make the rootPath configurable. Lets say I have a ConfigModule or my own ConstantsModule. How do I inject rootPath in a way similar to this?\n\n@Module({\n imports: [\n ServeStaticModule.forRoot({\n rootPath: this.configService.get<string>('staticRootPath'),\n }),\n ],\n controllers: [AppController],\n providers: [AppService],\n})\nexport class AppModule {}"
] | [
"dependency-injection",
"nestjs",
"solid-principles",
"nestjs-config"
] |
[
"Validation error: There are unrecognized header names. Check documentation for allowed header names",
"I am getting the validation error during custom vocabulary creation in Amazon transcribe service\n\nI have created below text file to configure custom vocabulary. I am getting this validation error.\n\n\n Validation error: There are unrecognized header names. Check\n documentation for allowed header names\n\n\nPhraseTABSoundsLikeTABIPATABDisplayAs\nLos-AngelesTABTABTABLos Angeles\nF.B.ITABTABɛ f b i aɪTABFBI\nEtienneTABeh-tee-enTABTAB\n\n\nI followed Custom Vocabularies - Amazon Transcribe to prepare text file."
] | [
"amazon-web-services",
"amazon-translate"
] |
[
"My C++ program cannot open named pipe",
"I am trying to run C++ application that works perfectly on Mac OS under Ubuntu. The problem is due to failure in opening a named pipe. \n\nI used mkfifo as follows:\n\n pipe_name_ = std::string(\"/tmp/myfifo\");\n if (mkfifo(pipe_name_.c_str(), 0666) < 0) {\n error_print(\"Cannot create a named pipe\\n\");\n return -1;\n }\n\n if ((fd_ = open(pipe_name_.c_str(), O_RDONLY | O_CREAT, 0666)) < 0) {\n error_print(\"Cannot open file description named %s %s\\n\",\n pipe_name_.c_str(), strerror(errno));\n return -1;\n }\n\n\nHowever, this prints into screen the bellow message that is for open():\n\nCannot open file description named /tmp/myfifo Invalid argument\n\nMy permissions status is as bellow:\n\n$ls -la /tmp/myfifo\nprw-r----- 1 hamidb nonconf 0 Jun 20 13:35 /tmp/myfifo\n$umask\n0027\n\n\nI am wondering why it was working fine on Mac OS and not on Linux."
] | [
"c++",
"linux",
"pipe",
"named-pipes"
] |
[
"How to treat csv column as date-time",
"I have a CSV file where one of the columns is a string representation of a date in the form 'dd.mm.yy@hh:mm:ss'. I want excel to read this as a date format, so it can sort, filter, etc. How can I do that?"
] | [
"excel"
] |
[
"How to add a proper escape sequence character into string",
"I have defined variable 'a' with a value of a dictionary as a string.\nGot an error when trying to load that string as json.\n\n>>> a = '{\"key\":\"^~\\\\&\"}'\n>>> data = json.loads(a, object_pairs_hook=OrderedDict)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py\", line 352, in loads\n return cls(encoding=encoding, **kw).decode(s)\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py\", line 364, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py\", line 380, in raw_decode\n obj, end = self.scan_once(s, idx)\nValueError: Invalid \\escape: line 1 column 9 (char 8)\n>>> \n\n\nIs there a way to make this happen"
] | [
"python",
"json"
] |
[
"Why Static field can't be accessed through an instance",
"Why Static field can't be accessed through an instance.\nDart 2.4 Flutter 1.7 Android Studio 3.4\n\nWhen I was trying to port codes from JAVA to Flutter(Dart), I got the compile error\n\nI had defined the variable in MyMainBloc as follows\n\nstatic LoginStatus loginStatus = null;\n\n\nThen I create an instance:\n\nMyMainBloc myApp;\n\n\nI expect to use something like this: myApp.loginStatus, NOT MyMainBloc.loginStatus."
] | [
"flutter",
"dart"
] |
[
"Class Design - Properties or Parameters?",
"I am designing a class...\n\nthere are crucial methods that need an object passed to them or they need to be able to \"get\" an object.\n\nSo the question is, should you use getter/setters OR directly send the object as an argument to the method - in order for the method to work properly. Or should you set objects via the constructor if they are really crucial to the class operating correctly?"
] | [
"c#",
"class-design"
] |
[
"Pattern to map JPA Objects to DTO for Conversion to JSON",
"I have a somewhat philosophical question relating to mapping JPA Objects to JSON Strings. Of course there is no necessity for the source object to be a persistent object - it is just that that is my situation. \n\nI have a collection of objects that are managed by Eclipse Link. I need to turn some of these objects into JSON Strings, however the mapping is not one-to-one. I am convinced that the conversion should be loosely coupled so as to isolate the JSON objects from changes in the underlying entities. \n\nI am planning to have the JPA entity as such:\n\n@Entity\n@Table(name = \"AbnormalFlags\")\npublic class AbnormalFlag implements java.io.Serializable {\n private static final long serialVersionUID = 1L;\n\n @Id\n @GeneratedValue(strategy = GenerationType.AUTO)\n private Long id;\n\n @Column(name = \"Code\", unique = false, nullable = false)\n private String code;\n\n @Column(name = \"Description\", unique = false, nullable = false)\n private String description;\n\n// Getters and setters\n\n}\n\n\nand the equivalent object to be converted to JSON\n\npublic class AbnormalFlagDTO implements java.io.Serializable {\n\n private String code;\n private String description;\n private Boolean disabled;\n\n// Getters and setters\n\n}\n\n\nIs there an elegant pattern or methodology I can use to facilitate this process for several types of objects.\n\nThanks in anticipation"
] | [
"json",
"design-patterns",
"jpa",
"dto"
] |
[
"Select most recent from multiple columns and combine into a single field",
"I have a table where I'm trying to get the lastest date from either field b or field c per user. and then combine that into a single field. Using MS Access 2016\nExample.\n\n\n\n\nUSER\nFieldB\nFieldC\n\n\n\n\n1\n1/1/2020\n2/1/2020\n\n\n2\n1/1/2020\n-\n\n\n3\n-\n3/1/2020\n\n\n4\n-\n-\n\n\n\n\nAnd I need the data returned in like this.\n\n\n\n\nUSER\nFieldB\n\n\n\n\n1\n2/1/2020\n\n\n2\n1/1/2020\n\n\n3\n3/1/2020\n\n\n4\n-\n\n\n\n\nAny help is greatly appreciated. Thank you in advance.\nEDIT: Got it to work with the following query. I'm sure there is a more elegant solution.\nSELECT\nUSER, Max(FieldB) as FieldD\nFROM ( SELECT\n USER, FieldB\n FROM Table\n UNION\n SELECT\n USER, FieldC\n FROM Table) as T1\nGROUP BY USER"
] | [
"ms-access-2016"
] |
[
"Generating only a subset of posts in DocPad",
"I have seen folks using docpad for blogging, but didn't find a ready to use blogging framework. While Docpad compares to Jekyll, which are static site generators, I wanted something like Octopress which is purely a blogging framework. So I started building one gathering good parts from several repos.\n\nWhile everything works great, my main problem is, if I add a new post (creating a \".md\" file in \"src/documents/posts\" directory) and perform \"docpad run\", docpad parses every \".md\" file and converts all of them to \"html\". I have at least 400 blog posts and it takes a lot of time, just to add a new post. Is there a way in which I could generate just the newly added file instead of re-generating the entire set of files? Appreciate your inputs."
] | [
"docpad"
] |
[
"Doing a deep unrar of an archive using the unrar command in Linux",
"I use the following command to unrar all files in a rar-acrhive to a directory\n\nunrar x -ep -y archive.rar folder\n\n\nIt works great and it ignores the directory structure inside the archive which is just what I want.\n\nHow do I make it unrar all rar files inside the archive aswell if there are any?"
] | [
"linux",
"unrar"
] |
[
"MySQL How to get user's activities?",
"i have sql tables like this and i want to show activities of the User in the User page and i dont know how to Write query about this so my table is look like this :\n\nusers\n id\n name\n\nposts\n id\n title\n description\n\nposts_likes\n id\n post_id\n user_id\n time\n\nposts_comments\n id\n post_id\n user_id\n time\n\n\nnow i want to show users , thier activities in their page like : \nyou are commented on this post \nOR\nyou liked and commented on this post \n order by time so i write some query like this but it have a lots of problems...\n\nSELECT posts.id , posts.title , posts_comments.comment , posts_likes.time , posts_comments.time\nFROM posts \nJOIN posts_likes ON posts.id=posts_likes.post_id\nJOIN posts_comments ON posts.id=posts_comments.post_id\nWHERE posts_likes.user_id = 6 AND posts_comments.user_id =6\nORDER BY posts_likes.time, posts_comments.time DESC\n\n\nso when i use this query it brings me posts that user with id = 6 commented and liked and never show me the posts that user only commented or user only liked , so if any body know how i can fix this problem i really appreciate thanks alot guys ... sry for my english"
] | [
"mysql"
] |
[
"Access native KafkaConsumer in Camel RoutePolicy to change polling behaviour",
"I "monitor" the number of consecutive failures in my Camel processing pipeline with a Camel RoutePolicy.\nWhen a threshold of failures is reached, I want to pause the processing for a configured amount of time because it probably means that the data from another system is not yet ready and therefore every message fails.\nSince the source of my pipeline is a Kafka topic, I should not just stop the whole route because the broker would assume my consumer died and rebalance.\nThe best way to "pause" topic consumption seems to be to pause the [KafkaConsumer][3] (the native, not the one of Camel). Like this, the consumer continues to poll the broker, but it does not fetch any messages. Exactly what I need.\nBut can I access the native [KafkaConsumer][3] from the RoutePolicy context to call the pause and resume methods?\nThe spring-kafka listener containers expose these methods, it would be nice to use them from Camel too."
] | [
"java",
"apache-kafka",
"apache-camel"
] |
[
"Getting all values of a table column angular",
"I have a table which contains 4 columns and the number of rows will be dynamic. The table contains many values and hence the table is paginated on 20 pages. The first column is of checkbox input which the user may check or uncheck in order to select a row. On button click I need the values of all the checked checkboxes in the table on any page.\nRight now I am using the following code to populate the array with the values of selected checkboxes.\n$('#tableExmp tbody input[type="checkbox"]:checked').each(function () {\n var companyObj = {};\n companyObj['id'] = $(this).attr('id');\n companyObj['value'] = $(this).attr('value');\n\n selectedCompanies.push(companyObj);\n });\n\nUsing the above code, I only get the values from the current page. How can I get all values of checked checkboxes from all pages on which the table is paginated?"
] | [
"jquery"
] |
[
"How do I send a message to a window handle using AutoHotKey?",
"I'm trying to detect if ffdshow is currently running on the computer using AutoHotKey.\n\nSomeone has suggested that I can achieve this by sending a message to the to the ffdshow window handle. If it succeeds, then ffdshow is running.\n\nAccording to ffdshow, the window handle is 32786 and, according to the AutoHotKey documentation, I want to use PostMessage and then check ErrorLevel.\n\nHowever at that point, I'm struggling to understand the documentation. I've got the following:\n\nControlHwnd := 32786\nVarContainingID := 32786\nPostMessage, 0x00, , , ,ahk_id %ControlHwnd%, ahk_id %VarContainingID%\nMsgBox %ErrorLevel%\n\n\nbut that always reports a 1 indicating that it was unable to connect to the window handle - even though ffdshow is running.\n\nI've also tried changing PostMessage to the blocking SendMessage but that always reports FAIL.\n\nI'm clearly doing something wrong, but I'm not really sure what. Can anyone help?"
] | [
"autohotkey",
"window-handles"
] |
[
"MapR oozie sqoop error; Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]",
"I'm repeatedly getting this error when I submit a sqoop job using oozie on MapR. Details below. I even copied the mysql jar file to the share/lib/sqoop directory, with no result. Could you please help?\n\nCommand:\n\n/opt/mapr/oozie/oozie-4.0.1/bin/oozie job -oozie=http://OOZIE_URL:11000/oozie -config job.properties -run\n\n\nError\n\n2015-06-18 01:54:05,818 WARN SqoopActionExecutor:542 - SERVER[data-sci1] USER[mapr] GROUP[-] TOKEN[] APP[sqoop-orders-wf] JOB[0000024-150616000730465-oozie-mapr-W] ACTION[0000024-150616000730465-oozie-mapr-W@sqoop-orders-node] Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]\n\n\nMaprFS:\n\n/oozie/share/lib/sqoop/mysql-connector-java-5.1.25-bin.jar\n\n\njob.properties:\n\nnameNode=maprfs:/// jobTracker=YARN_RESOURCE_MANAGER:8032 queueName=default\n\noozie.use.system.libpath=true\n\noozie.wf.application.path=maprfs:/oozie/data/sqoop/orders\n\nmapreduce.framework.name=yarn\n\n\nworkflow.xml:\n\n<start to=\"sqoop-orders-node\"/>\n <action name=\"sqoop-orders-node\">\n <sqoop xmlns=\"uri:oozie:sqoop-action:0.2\">\n <job-tracker>${jobTracker}</job-tracker>\n <name-node>${nameNode}</name-node>\n <configuration>\n <property>\n <name>mapred.job.queue.name</name>\n <value>${queueName}</value>\n </property>\n </configuration>\n <arg>import</arg>\n <arg>--hbase-create-table</arg>\n <arg>--hbase-table</arg>\n <arg>orders</arg>\n <arg>--column-family</arg>\n <arg>d</arg>\n <arg>--username</arg>\n <arg>USERNAME</arg>\n <arg>--password</arg>\n <arg>PASSWORD</arg>\n <arg>--connect</arg>\n <arg>\"jdbc:mysql://HOST?zeroDateTimeBehavior=round\"</arg>\n <arg>--query</arg>\n <arg>--split-by</arg>\n <arg>o.OrderId</arg>\n <arg>--hbase-row-key</arg>\n <arg>rowkey</arg>\n <arg>-m</arg>\n <arg>8</arg>\n <arg>--verbose</arg>\n <arg>--query</arg>\n <arg>select o.OrderId as rowkey, o.OrderId as orderId from orders WHERE \\$CONDITIONS</arg>\n </sqoop>\n <ok to=\"end\"/>\n <error to=\"fail\"/>\n </action>\n <kill name=\"fail\">\n <message>Sqoop free form failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>\n </kill>\n <end name=\"end\"/>"
] | [
"sqoop",
"oozie",
"mapr"
] |
[
"Outcome of Function - Python",
"I'm creating a utility program whose functions will be used as part of another program.\n\nThis is my function (EDITED): \n\ndef push_up (grid):\n new_grid = up_down_swapper(grid)\n\n\n new_grid = zero_DR(new_grid) \n\n for i in range(4):\n for j in range(3): \n if new_grid[i][j] == new_grid[i][j+1]:\n new_grid[i][j+1] = (new_grid[i][j])+(new_grid[i][j])\n new_grid[i][j] = 0\n else: \n pass\n\nnew_grid = zero_DR(new_grid)\n\ngrid = up_down_swapper(new_grid)\n#print(grid) - shows the grid as the expected outcome. But outside of the function it doesn't change\n\n\nand here is how it's used:\n\npush.push_up (grid)\n\n\nAs you guys can see it isn't being assigned to a value like \n\nnew_grid = push.push_up (grid)\n\n\nI cannot change the main program ( this is an assignment and this is what I've been told to do.)\n\nMy problem is how do I get the function to change the value of the parameter? I'm not sure if I'm making sense but something like this:\n\ndef square(x):\n x = x*x\n\nvalue = 3 \nsquare(value) \nprint(value)\n\n\nThis will output 3, but I'm wanting 9. How would I go about doing this?\n\nHere is a pastebin of the main code:\nhttp://pastebin.com/NAxWL14h"
] | [
"python",
"arrays",
"list",
"function",
"python-3.x"
] |
[
"C++ How to write generic comparator function for int, double, string etc using templates",
"Hi I am trying to write a generic isLess compare function for int, double, null terminated character array etc. Below is my code for same, please help me understand how could we use this function for null terminated strings too.\n\n#include<iostream>\n\nusing namespace std;\n\ntemplate<typename T>\nbool isLess(T &x, T &y)\n{\n return x < y;\n}\n\nint main()\n{\n int a(10), b(20);\n double c(2.0), d(3.0);\n cout<<isLess<int>(a,b)<<endl;\n cout<<isLess<double>(c,d)<<endl;\n //For above types, generic comparator works fine\n\n //but if we have to compare character represented string, how can we do this in our comparator\n //assume charaters strings are compared the same way as strcmp.\n\n\n //char *e = \"str1\";\n //char *f = \"str2\";\n //cout<<isLess<char*>(e,f)<<endl;\n\n return 0;\n}"
] | [
"c++",
"templates",
"generics"
] |
[
"UITableView make 1 section for every day from NSMutableArray",
"Im stuck with this problem, I have a UITableView and i populate it with data from an NSMutableArray. The Array has the following structure:\n\n<array>\n<dict>\n <key>Date</key>\n <string>2011.18.09 04:17 PM</string>\n <key>Value</key>\n <string>58.00</string>\n</dict>\n<dict>\n <string>2011.15.09 04:21 PM</string>\n <key>Value</key>\n <string>0.00</string>\n</dict>\n</array>\n\n\nI would like to have a section for each day in the Array. I already figured out how to return the number of dates, and name the section headers, the only problem i am having is returning the number of rows per section and then defining the cells for each row.\n\nWorking code:\n\nNSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);\nNSString *documentsDirectory = [paths objectAtIndex:0];\nNSString *path = [documentsDirectory stringByAppendingPathComponent:@\"savedData.daf\"];\nNSMutableArray *d = [NSMutableArray arrayWithContentsOfFile:path];\nNSMutableArray *test = [d valueForKey:@\"Date\"];\nNSString *g = [[NSString alloc] init];\nNSString *s = [[NSString alloc] init];\nc = 0;\n for (g in test) {\n s = [g substringToIndex:[g length]-9];\n if (![s isEqualToString:sf]) {\n c = c+1;\n [dates addObject:s];\n }\n sf = [g substringToIndex:[g length]-9];\n }\nreturn c;\n\n\nthat code counts the different dates and creates an array with the section names. Could anybody help me with defining the number of rows (by counting the number of objects for each day) and by giving the rows the right value in the ´cellForRowAtIndexPath´ method."
] | [
"objective-c",
"ios",
"cocoa-touch",
"uitableview"
] |
[
"How to open the .c file which contains the implementation for any system call in Linux?",
"My motive is to open the definition i.e the (.c) file of the shm.h header, but after following tons of advices and experiencing a lot, I still couldn't not get the exact location of it in Linux. When I open the header files, it says something like the definition of it is defined in XP4.2 but I couldn't figure it out."
] | [
"linux",
"system-calls",
"runtimemodification"
] |
[
"Stripchart in ggplot2",
"Any idea how to draw stripchart in ggplot2? The example in base R is pasted below.\n\nstripchart(iris$Sepal.Length, col = \"red\", method=\"stack\")"
] | [
"r",
"ggplot2"
] |
[
"UITableView Reload data after dismissing a ViewController",
"I have two viewcontrllers. In one there is a tableview with a button at each cell. Onclick on this button another view controller is shown. After performing some functions in that viewcontroller i am dismissing it by calling [self dismissViewContrller animated:YES completion:nil]; Now after it gets dismissed i want to reload the data in tableview of the 1st viewcontroller. Any ideas on how to do it?\nI can post the code if requested.\n\nThank You."
] | [
"objective-c",
"uitableview",
"uiviewcontroller"
] |
[
"javascript : text box with default value",
"I have text boxes with default values, I am not able to enter values into them when i am trying to enter, I have to first delete the existing value using delete key then only i can enter.\n\nI want to enter values and on tab change it should change for the other box as well, currently it is changing focus but I cannot enter values into them.\n\n<input type=\"text\" name=\"namebox\" id=\"{concat('textboxvalue', position())}\" value=\"{@proj}\" style=\"font-size:10px;padding:0px;height:15px;width:90px;text-align:right;\"/>\n\n\n@proj: values coming from database\n\nThanks,\nAni"
] | [
"javascript",
"jquery"
] |
[
"Image Resizer for ASP.NET",
"Anyone knows of any good Image resize API for ASP.net?"
] | [
"asp.net",
"image-processing",
"resize"
] |
[
"Prioritising an NSButton over window resizing",
"I have an NSButton in the bottom right corner of an NSWindow. The latter is resizeable.\n\nIf I try to click my NSButton, the resizing cursor\n shows as long as my cursor is close to the corner. It's a little inconvenient, at this point I'm wondering, is there any way to prioritise the NSButton hover over the resizing?"
] | [
"objective-c",
"cocoa",
"resize",
"nswindow",
"nsbutton"
] |
[
"Auxiliary space complexity of this solution",
"This is a tail-recursive solution for reversing a singly linked list. What is the auxiliary space occupied by this solution?\nvoid reverseUtil(Node* curr, Node* prev, Node** head)\n{\n if (curr->next==NULL) {\n *head = curr;\n curr->next = prev;\n return;\n }\n Node* next = curr->next;\n curr->next = prev;\n reverseUtil(next, curr, head);\n}\n\nvoid reverse(Node** head)\n{\n if (head==NULL)\n return;\n reverseUtil(*head, NULL, head);\n}"
] | [
"linked-list",
"tail-recursion",
"space-complexity"
] |
[
"A SELECT statement with MAX and WITH clause",
"Table has schema of TIMESTAMP, PATIENTID, ECGVALUE and sample table is given below:\n\n01.34 ANON 12\n02.34 ANON 12\n03.34 ANON 12\n04.34 ANON 12\n05.34 ANON 12\n06.34 ANON 12\n07.34 ANON 12\n08.34 ANON 12\n10.34 ANON 12\n11.34 ANON 12\n12.34 ANON 12\n\n\nNow, I want to select rows which are 'n' less or equal than maximum time stamp. From above table we can see that for PATIENTID = 'ANON' maximum TIMESTAMP is 12.34, now, I want such an SQL query that shd be able to select all rows that are 'n' less than 12.34 where n can be any number. SO far, I have written this, but it does't work.\n\nWITH\nrownums(TIMESTAMP, ECGVALUE, RN) AS (\nSELECT TIMESTAMP, ECGVALUE ROW_NUMBER() OVER() AS RN\nFROM EKLUND.DEV_RAWECG WERE PATIENID = 'ANON'\n),\nmaxtime(MAXTM) AS (\nSELECT MAX(TIMESTAMP) AS MAXTM FROM rownums\n)\nSELECT TIMESTAMP, ECGVALUE, RN FROM rownums\nWHERE TIMESTAMP >= maxtime.MAXTM - 2;"
] | [
"sql",
"database",
"db2"
] |
[
"Lot of connections are in time wait and closed stage",
"I am using gorilla/mux framework for a rest api which inserts data into cassandra. \nWhen I run performance test on the api with jmeter and 2500 users , i get error of socket exception after 1500 active users . \nWhen i checked the connection status, lots of connections are in time wait/closed stage while number of established connections are very low .\n\n\n\nBut when i set keepalive enabled in jmeter , there are no connections in timewait /closed stage and I get no errors\n\nKeeping keep alive in jmeter is not my real scenario . \nHow can i set keep alive through framework itself?"
] | [
"go",
"jmeter",
"socketexception",
"gorilla"
] |
[
"System.ArgumentOutOfRangeException: Not a valid Win32 FileTime",
"I am trying to implement ADFS authentication in my ASP.net Web Application. I have configured my web application to use the adfs authentication and also set up the relying party trust in adfs. When I browse my web application, browser is redirected to the adfs login page. After the submitting the login details, it shows the error page from adfs. I don't have much knowledge about ADFS.\nError logged by adfs is below:\n\n Exception details: \nMicrosoft.IdentityServer.RequestFailedException: MSIS7012: An error occurred while processing the request. Contact your administrator for details. ---> System.ArgumentOutOfRangeException: Not a valid Win32 FileTime.\nParameter name: fileTime\n at System.DateTime.FromFileTimeUtc(Int64 fileTime)\n at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetPasswordExpiryDetails(SafeLsaReturnBufferHandle profileHandle, DateTime& nextPasswordChange, DateTime& lastPasswordChange)\n at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetLsaLogonUserInfo(SafeHGlobalHandle pLogonInfo, Int32 logonInfoSize, DateTime& nextPasswordChange, DateTime& lastPasswordChange, String authenticationType, String issuerName)\n at Microsoft.IdentityServer.Service.Tokens.LsaLogonUserHelper.GetLsaLogonUser(UserNameSecurityToken token, DateTime& nextPasswordChange, DateTime& lastPasswordChange, String issuerName)\n at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateTokenInternal(SecurityToken token)\n at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateToken(SecurityToken token)\n at Microsoft.IdentityServer.Web.WSTrust.SecurityTokenServiceManager.GetEffectivePrincipal(SecurityTokenElement securityTokenElement, SecurityTokenHandlerCollection securityTokenHandlerCollection)\n at Microsoft.IdentityServer.Web.WSTrust.SecurityTokenServiceManager.Issue(RequestSecurityToken request, IList`1& identityClaimSet)\n at Microsoft.IdentityServer.Web.Protocols.PassiveProtocolHandler.SubmitRequest(MSISRequestSecurityToken request, IList`1& identityClaimCollection)\n at Microsoft.IdentityServer.Web.Protocols.PassiveProtocolHandler.RequestBearerToken(MSISRequestSecurityToken signInRequest, Uri& replyTo, IList`1& identityClaimCollection)\n at Microsoft.IdentityServer.Web.Protocols.PassiveProtocolHandler.RequestSingleSingOnToken(ProtocolContext context, SecurityToken securityToken, SecurityToken deviceSecurityToken)\n at Microsoft.IdentityServer.Web.Protocols.WSFederation.WSFederationProtocolHandler.BuildSsoSecurityToken(WSFederationSignInContext context, SecurityToken securityToken, SecurityToken deviceSecurityToken, SecurityToken& ssoSecurityToken)\n at Microsoft.IdentityServer.Web.Protocols.WSFederation.WSFederationProtocolHandler.BuildSignInResponseCoreWithSecurityToken(WSFederationSignInContext context, SecurityToken securityToken, SecurityToken deviceSecurityToken)\n at Microsoft.IdentityServer.Web.Protocols.WSFederation.WSFederationProtocolHandler.BuildSignInResponse(WSFederationSignInContext federationPassiveContext, SecurityToken securityToken, SecurityToken deviceSecurityToken)\n --- End of inner exception stack trace ---\n at Microsoft.IdentityServer.Web.Protocols.WSFederation.WSFederationProtocolHandler.BuildSignInResponse(WSFederationSignInContext federationPassiveContext, SecurityToken securityToken, SecurityToken deviceSecurityToken)\n at Microsoft.IdentityServer.Web.Protocols.WSFederation.WSFederationProtocolHandler.Process(ProtocolContext context)\n at Microsoft.IdentityServer.Web.PassiveProtocolListener.ProcessProtocolRequest(ProtocolContext protocolContext, PassiveProtocolHandler protocolHandler)\n at Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext context)\n\n\nPlease help."
] | [
"adfs"
] |
[
"How to give docker container write/chmod permissions on mapped volume?",
"I have a synology NAS which has docker support and wanted to run some docker containers (I'm pretty new to Docker) on it. For example pocketmine-pm (but I believe I have the write issue also with other containers).\n\nI created a volume on the host and mapped this in the container settings. (And in the synology docker settings for the volume mapping I did not click on \"read only\").\n\nAccording to the Dockerfile a new user 'pocketmine' is created inside the container and this user is used to start the server. The user seems to have the user ID 1000 (first UID for new linux users). The container also uses an Entrypoint.sh script to start the server.\n\nInitially the container was not able to write files to the mapped directory. I had to SSH into the host 'chown' the directory for the UID 1000:\n\nsudo chown 1000:1000 /volXy/docker/pocketminemp -R\n\n\nAfter that the archive could be downloaded and extracted.\n\nUnfortunately I was not able to connect to the server from my iOS device. The server is listed as 'online' but the connection fails without any specific message. I then checked the logs of the container and saw the following entries (not sure if this really prevents the connection but I will give it a try):\n\n[*] Everything done! Run ./start.sh to start PocketMine-MP\nchown: changing ownership of '/pocketmine/entrypoint.sh': Operation not permitted\nchown: changing ownership of '/pocketmine/server.properties.original': Operation not permitted\nLoading pocketmine.yml...\n\n\nApparently the container cannot chown a file it was previously able to download.\n\nDoes anybody know what can be done to fix this? Do I need to chmod the mapped volume and why did I need to chown the directory to UID 1000 (a user that doesn't really exist on the host) - isn't there a more elegant way to fix the permissions?"
] | [
"docker",
"permissions",
"chmod",
"chown",
"pocketmine"
] |
[
"php log in form does not respond",
"I'm trying what should be a pretty easy loginn form to a localhost database, but when I push log in it doesn't do anything. Basically I just get as input a username and password and try to get the data (I know the url looks weird as uid=password but it is as it has to be).\nThen I compare what the database should return (name and uid) and compare those fields. Any hint would be of great help!\n <?php\n $log = file_get_contents("http://localhost:8080/users?uid=$password");\n $data = json_decode($log);\n $username= $_POST['username'];\n $password=$_POST['password'];\n \n if($log.empty) {\n header("Location: inici.html");\n exit;\n }\n \n if(($username == $data->Nombre) && ($password == $data->UID)){\n header("Location: inici.html");\n exit;\n }\n else\n {\n header("Location: login.html");\n exit;\n }\n ?>"
] | [
"php",
"mysql"
] |
[
"How to merge first index of an array with first index of other array",
"I want to combine two arrays, but I want to merge 1st index with 1st and 2nd with 2nd and so on.\n\n$latlong = office::select('latitude', 'longitude')->get();\nforeach ($latlong as $l)\n{\n $lati = explode(',', $l->latitude);\n $longi = explode(',', $l->longitude);\n\n $result = array_merge($lati, $longi);\n dd($result);\n}\n\n\nOutput:\n\narray:8 [▼\n 0 => \"31.4824454\"\n 1 => \"31.4824454\"\n 2 => \"31.48306351\"\n 3 => \"\"\n 4 => \"74.3270004\"\n 5 => \"74.31525707\"\n 6 => \"74.31045055\"\n 7 => \"\"\n]"
] | [
"php",
"laravel"
] |
[
"Angularjs websocket service memory leak",
"In my project I have an angular factory which will take care of the websocket connection with a c++ app.\n\nStructure of the websocket factory:\n\n.factory('SocketFactory', function ($rootScope) {\n var factory = {};\n\n factory.connect = function () {\n if(factory.ws) { return; }\n\n var ws = new WebSocket('ws://...');\n\n ws.onopen = function () {\n console.log('Connection to the App established');\n };\n\n ws.onerror = function () {\n console.log('Failed to established the connection to the App');\n };\n\n ws.onclose = function () {\n console.log('Connection to the App closed');\n };\n\n ws.onmessage = function (message) {\n //do stuff here\n };\n factory.ws = ws;\n };\n\n factory.send = function (msg) {\n if(!factory.ws){ return; }\n if(factory.ws.readyState === 1) {\n factory.ws.send(JSON.stringify(msg));\n }\n };\n\n return factory;\n});\n\n\nThe c++ app will be sending images via websockets and they will be shown in a canvas that will be updated everytime a new image is received.\n\nEverything works fine, however as soon as I start sending images to the browser, I noticed in ubuntu's system resource monitor that the memory used by chrome process keeps increasing +/-5mb each time ws.onMessage is fired (approximately).\n\nI commented the code inside ws.onMessage leaving just the event detection and nothing else and the memory used still increases, if I comment the whole ws.onMessage event the memory used stays inside normal limits.\n\nDo you have any suggestions to solve this problem? Is this happening because I should be using $destroy to prevent this kind of loop?"
] | [
"javascript",
"angularjs",
"memory-leaks"
] |
[
"Implementing a 2D Map",
"I posted a Q. earlier about arrays and the replies lead me to change my game design. I'm building a 2D game map from tiles (Cells). I need to add a pen line to some cells, representing a wall you cannot pass through. This pen line is represented by Cell.TopWall, Cell.BottomWall etc etc of type boolean as shown in my code. This is my whole app so far. It draws the grid without the pen lines for walls. Take note of commented out code where i have tried different things like stating where the walls go with an array of 0's (no wall) and 1's (walls). My question is, can i get a hint on how to implement the walls where i would like? I hope i have shared enough information about my app. Thanks\n\nCell.cs\n\n using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\n\nnamespace Map\n{\n public class Cell : PictureBox\n {\n bool LeftWall; \n bool TopWall; \n bool RightWall;\n bool BottomWall;\n }\n}\n\n\nForm1.cs\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows.Forms;\n\nnamespace Map\n{\n public partial class Form1 : Form\n {\n public Form1()\n {\n InitializeComponent();\n }\n /// <summary>\n /// Array of tiles\n /// </summary>\n //PictureBox[,] Boxes = new PictureBox[4,4];\n Cell[,] Map = new Cell[4,4];\n\n /*int [][] Boxes = new int[][] {\n new int[] {0,0}, new int[] {1,0,0,1},\n new int[] {1,0}, new int[] {1,0,1,0},\n new int[] {0,1}, new int[] {0,0,0,1}, \n new int[] {1,1}, new int[] {1,1,1,0}, \n new int[] {2,0}, new int[] {1,1,0,0},\n new int[] {2,1}, new int[] {0,0,0,1}, \n new int[] {3,1}, new int[] {1,0,1,0}, \n new int[] {0,2}, new int[] {0,0,1,1}, \n new int[] {1,2}, new int[] {1,0,1,0}, \n new int[] {2,2}, new int[] {0,1,1,0}};*/\n\n #region Runtime load\n /// <summary>\n /// Build the map when window is loaded\n /// </summary>\n /// <param name=\"sender\"></param>\n /// <param name=\"e\"></param>\n private void Form1_Load(object sender, EventArgs e)\n {\n BuildMap();\n }\n #endregion\n\n #region Build grid\n /// <summary>\n /// Draw every tile on the map\n /// </summary>\n public void BuildMap()\n {\n for (int row = 0; row < 3; row++)\n {\n for (int column = 0; column < 3; column++)\n {\n DrawBox(row, column);\n }\n }\n //draw the exit box\n DrawBox(1, 3);\n }\n #endregion\n\n #region Draw\n /// <summary>\n /// Draw one tile\n /// </summary>\n /// <param name=\"row\"></param>\n /// <param name=\"column\"></param>\n public void DrawBox(int row, int column)\n {\n Map[row, column] = new Cell();\n Map[row, column].Height = 100;\n Map[row, column].Width = 100;\n Map[row, column].BorderStyle = BorderStyle.FixedSingle;\n Map[row, column].BackColor = Color.BurlyWood;\n Map[row, column].Location = new Point((Map[row, column].Width * column), (Map[row, column].Height * row));\n this.Controls.Add(Map[row, column]);\n\n System.Drawing.Pen myPen;\n myPen = new System.Drawing.Pen(System.Drawing.Color.Red);\n System.Drawing.Graphics formGraphics = this.CreateGraphics();\n\n\n //formGraphics.DrawLine(myPen, 0, 0, 200, 200);\n //myPen.Dispose();\n //formGraphics.Dispose();\n }\n #endregion\n }\n\n\n}"
] | [
"c#",
"map"
] |
[
"Heroku not recognizing Procfile",
"so i'm making a discord bot in python and want to deploy it to Heroku to have the bot running 24/7. but Heroku isn't detecting my Procfile(and yes, that is not a .txt file) i've search on google and viewed questions like This and This but still it's not working. here's the Procfile code: worker: python bot.py can anybody help me with this? TIA!"
] | [
"python",
"heroku",
"discord.py"
] |
[
"Passport Reddit not working in production",
"I'm developing an app with Login with Reddit Oauth using Passport.js and the passport-reddit strategy. It works fine during local development however when I push the code to Heroku I get internal server error when I authorise my app with my Reddit account.\nWhen I enter the command heroku logs --tail in the terminal it gives the following message:\n\n2020-10-22T06:33:44.482074+00:00 app[web.1]: TokenError\n2020-10-22T06:33:44.482092+00:00 app[web.1]: at Strategy.OAuth2Strategy.parseErrorResponse (/app/node_modules/passport-oauth2/lib/strategy.js:358:12)\n2020-10-22T06:33:44.482093+00:00 app[web.1]: at Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:405:16)\n\ncan someone please help with this issue?"
] | [
"node.js",
"heroku",
"passport.js",
"reddit"
] |
[
"How to bind RadioButtons to an enum?",
"I've got an enum like this:\n\npublic enum MyLovelyEnum\n{\n FirstSelection,\n TheOtherSelection,\n YetAnotherOne\n};\n\n\nI got a property in my DataContext:\n\npublic MyLovelyEnum VeryLovelyEnum { get; set; }\n\n\nAnd I got three RadioButtons in my WPF client.\n\n<RadioButton Margin=\"3\">First Selection</RadioButton>\n<RadioButton Margin=\"3\">The Other Selection</RadioButton>\n<RadioButton Margin=\"3\">Yet Another one</RadioButton>\n\n\nNow how do I bind the RadioButtons to the property for a proper two-way binding?"
] | [
"wpf",
"data-binding",
"enums",
"radio-button"
] |
[
"How to make a single function return Array of provided Array and value?",
"I am working on a project where I need to push elements into Array. I made a function as follow to push value inside array:\n public float[] insertFloatIntoArray(float[] arr, float val) {\n float newarr[] = new float[arr.length + 1];\n for (int i = 0; i < arr.length; i++) {\n newarr[i] = arr[i];\n }\n newarr[arr.length] = val;\n return newarr;\n }\n\nBut is there any way to make it generic so that if I provide an Array of any data type with value of same datatype and return new array of same datatype. doing so can make me avoid replica of code and function for various data types."
] | [
"java",
"arrays"
] |
[
"Cassandra NoSQL - optimal data structure for domains and pages",
"I am starting with noSQL, watched great tutorials and explanations like this https://www.youtube.com/watch?v=tg6eIht-00M. However, I am still thinking in relational way and that is why I am asking for your help.\n\nI have the following simple relational model that stores domains and their pages and is able to keep history of page title and description updates.\n\nCREATE TABLE domain (\n id bigint(20) NOT NULL AUTO_INCREMENT,\n name TEXT,\n suffix TEXT,\n PRIMARY KEY (id)\n) ENGINE=InnoDB;\n\nCREATE TABLE page (\n id bigint(20) NOT NULL AUTO_INCREMENT,\n domainid bigint(20),\n url TEXT,\n PRIMARY KEY (id),\n FOREIGN KEY (domainid) REFERENCES domain(id)\n) ENGINE=InnoDB;\n\nCREATE TABLE page_update (\n id bigint(20) NOT NULL AUTO_INCREMENT,\n pageid bigint(20),\n updated TIMESTAMP,\n title TEXT,\n descr TEXT,\n PRIMARY KEY (id),\n FOREIGN KEY (pageid) REFERENCES page(id)\n) ENGINE=InnoDB;\n\n\nI want to transfer this model into CQL:\n\nI should create denormalized table page and distribute it over partitions according to domain suffix (.com, .net, .de,...) and name. And set clustering index to update time.\n\nCREATE TABLE page (\n domain_name text,\n domain_suffix text,\n page_url text,\n page_title text,\n page_descr text,\n page_updated timestamp, \n PRIMARY KEY ((domain_suffix, domain_name), page_updated)\n);\n\n\nNevertheless, I am not sure if this is optimal, because \n\n\nI have to keep domain name, suffix and page url for each update, so there will be many duplicities. \nEach update will produce the whole row of data instead of its portion\nI want address domains or pages from other tables. For instance, I have another table domain_technlogy which assigns web technologies to domains\n\n\nHow could the optimal structure look like?"
] | [
"data-structures",
"cassandra",
"cql",
"database",
"nosql"
] |
[
"How to select the inverse of the selection",
"I am successful in selecting the first <li> of the <ul>.\nI want to select the remaining of the <li> except the current selected <li> . i.e., (inverse).\nHow can I select it?\nEdited as per request\nvar newEle = $(str); //str contains a <li> i.e., <li>Some content</li>\n$(newEle).hide();"
] | [
"javascript",
"jquery",
"jquery-selectors"
] |
[
"jQuery Mobile page not showing up on mobile devices",
"I've got some problem, and I'm not sure that what it is from maybe jQuery Mobile or jPlayer.\n\nI tried to open this page: http://music.x7dtv.com/m/radio/cool93\n\nIt works normally on desktop (Chrome) but when I tried it on mobile (iOS and Android); It shows the blank page. The other pages (http://music.x7dtv.com/m/radio) work fine except the page I included jPlayer.\n\nThe jPlayer Core seems fine here's my code:\n\n$(document).ready(function() {\n $(\"#jquery_jplayer_1\").jPlayer({\n swfPath: \"http://www.jplayer.org/latest/js/Jplayer.swf\",\n ready: function() {\n $(this).jPlayer(\"setMedia\", {\n mp3: \"http://ip:8000/;stream/1\"\n }).jPlayer(\"play\");\n },\n supplied:\"mp3\"\n });\n});\n\n\nEDIT: The response code is 200."
] | [
"php",
"javascript",
"jquery",
"jquery-mobile",
"jplayer"
] |
[
"Unable to create stripe token",
"I am trying to create token of Card but I don't know how to do it.\nlet say I have Data like this in my state\n\nthis.state = {\npaymentInfo : {\ncardNumber : '4242424242424242',\nexpiry_month : 12,\nexpiry_year : 22,\ncardCvc : 123\n} \n}\n\ncreateToken = () => {\n const {stripe} = this.props;\n const element = stripe.elements();\n\n//From here I don't know how to use data in my State to generate a token \n}\n\n\nYour help would be appreciated."
] | [
"stripe-payments",
"payment-gateway"
] |
[
"Matlab: Unable to store information into array",
"Im trying to store values from radialspeed (a function from the phased array toolbox) into an array, but im getting errors: \n\nConversion to cell from double is not possible.\n\nError in modelCar (line 40)\nCell(1,T)= Rspeed;\n\n\n^^Error Message\n\nCell = cell(1,12)\n\nfor T = 1:11\n\n[POS,v] = step(H,T);\nRspeed = radialspeed(POS,v,[25; 25; 70],[0; 0; 0]);\ntypecast(Rspeed,'uint16');\nCell(1,T)= Rspeed;\n%%Rspeed = Vel.Radspeed(:,T);\n\n\ndisp(Rspeed);\n\n\nend\n\n\n^^^Excerpt of the code im using.\n\nAnother question any tips to plot a graph continuously while in the loop, the draw now function doesn't seem to work\n\nThank you."
] | [
"arrays",
"matlab",
"loops",
"graph"
] |
[
"Trying to create a proc but getting error",
"I am trying to create a procedure which will return concatenated value but getting error.\n\nI have created a procedure name \"GetMultiVal\" and inside that created a cursor 'stage_val'for fetching value .\n\nCREATE OR REPLACE PROCEDURE GetMultiVal\n(v_var_value out varchar2,v_hr_stk_out out Sys_Refcursor)\nis\nvar_value varchar2(200);\nx varchar2 (200);\ncursor age_val is\n SELECT AGE_CD,\n decode(AGE_CD,'07','CLNE(RW','05','CS ','4A',NULL,AGE_DESC) AGE_DESC ,\n AGE_SEQ\n FROM DBPROD.PROD_AGE_MST\n WHERE AGE_SEQ < 15\n AND AGE_CD NOT IN ('6A','05')\n ORDER BY 3;\nBEGIN\nOPEN v_hr_stk_out For\n FOR i IN age_val LOOP\n SELECT To_Char(Round(NVL(SUM(NVL(ROD_WT, 0)), 0), 0))\n INTO X\n FROM DBPROD.Prod_age_fgs_cur\n WHERE WF_DATE BETWEEN sysdate AND sysdate+1\n AND WF_AGE_CD=i.AGE_CD;\n var_value :=var_value || X||'~';\n END LOOP;\n select var_value as v_var_value from dual;\nend;\nend;\n\n\nExpected: should get concatenated value in v_var_value variable.\n\nActual: getting error Compilation errors for PROCEDURE DBPROD.GETMULTIVAL\n\n\n Error: PLS-00103: Encountered the symbol \"FOR\" when expecting one of the following:"
] | [
"oracle",
"plsql"
] |
[
"Initialize subclasses from json",
"I am looking for a good way of persisting arbitrary subclasses.\nI am writing objects asDictionary to json upon save, and init(json) them back upon load. The structure is Groups that have Units of different kind. The Group only knows its units as something implementing UnitProtocol.\n\nThe subclasses UA etc of Unit has the exact same data as a Unit. So data wise, the asDictionary and init(json) fits well in Unit. The subclasses only differ in logic. So when restoring them from file, I believe it has to be the exact subclass that is initialized.\n(Bad) Solutions I thought of\n\nLetting every group know that it can have Units of different subclasses by not holding them as [UnitProtocol] only, but also as [UA], [UB], etc, that can saved separately, restored by their respective sub inits, and be merged into a [UnitProtocol] upon init.\nStore subunits with their classname and create a Unit.Init(json) that somehow is able to pass down the initialization depending on subtype.\n?? Still thinking, but I believe there has to be something I can learn here to do this in a maintainable way without breaking the single responsibility policy."
] | [
"json",
"swift",
"inheritance",
"swift-protocols"
] |
[
"Auth0 callback not working",
"I have downloaded the seed project from Auth0 site for my ASP .NET MVC application using OWIN. However, when trying to log in using the google login in the widget the callback to /signin-auth0 throws an 404 exception. My understanding was that the callback to /signin-auth0 was supposed to be handled by the Auth0Account controller, but not of the code in the controller is being called during the login process. Anyone have any ideas?"
] | [
"asp.net-mvc-4",
"owin",
"auth0"
] |
[
"How can i use a nested loops to help identify if i have 2 different matching pairs of dices",
"So I just had a lesson on loops and nested loops. My professor said that nested loops can help us do tasks such as knowing if we rolled 2 different matching pairs with 4 dices (4242) I'm a bit confused on how that would work. \n\nSo I started to work it out and this is what I was able to create.\n\npublic boolean 4matchDice(String dice){\n\n for (int i = 0; i < 4; i++) {\n\n for (int j = 0; j < 4; j++) {\n\n }\n }\n\n\nI used boolean as the return as it will tell us whether or not we have 2 different matching pairs.\n\nThing is, what do I put in the the loops? That's what's confusing me the most."
] | [
"java",
"nested-loops"
] |
[
"PostgreSQL case multiple columns gives error column does not exist",
"Is it possible to run a case statement with two different columns in postgresql?\n\nI'd like to map integers to specific values using a CASE statement. I'm able to do this with ds.ordinal but when I add dcs.status I receive the following error: column \"follow_up\" does not exist.\n\nIs it possible to use multiple case statements on different columns in one SELECT statement?\n\nHow can I get case when dcs.status = 0 then \"follow_up\" end as \"follow_up\" to not return an error?\n\nSELECT DISTINCT ON (pd.id)\n case when ds.ordinal = 1 then s.name end as \"primary_specialty\",\n case when ds.ordinal = 2 then s.name end as \"secondary_specialty\",\n case when dcs.status = 0 then \"follow_up\" end as \"follow_up\"\n\n FROM potential_doctors AS pd\n INNER JOIN patient_profile_potential_doctors as pppd on pd.id = pppd.potential_doctor_id\n INNER JOIN doctor_taxonomies AS dt on pd.id = dt.potential_doctor_id\n INNER JOIN taxonomies AS t on dt.taxonomy_id = t.id\n INNER JOIN doctor_profiles AS dp on pd.npi = dp.npi\n INNER JOIN doctor_specialties AS ds on dp.id = ds.doctor_profile_id\n INNER JOIN specialties AS s on ds.specialty_id = s.id\n INNER JOIN doctor_creation_notes as dcs on dcs.doctor_profile_id = dp.id\n\n WHERE dp.approved IS FALSE"
] | [
"sql",
"postgresql"
] |
[
"Checkbox in UITableView Cell",
"I've written an app which list the title, a thumbnail and the second-hand price of some books. It's all done using a UITableView and the data is taken from a .plist file.\n\nWhat I want to add is a checkbox to each cell which can be toggled if the user has the book or not and then store that checkbox state for the next time they use the app. Is it possible to store a value back to the .plist file or is there another way to do it?\n\nHere's the code I have so far for the cell:\n\n@implementation ffbooksCell\n\n@synthesize ffbooksLabel = _ffbooksLabel;\n@synthesize priceLabel = _priceLabel;\n@synthesize thumbnailImageView = _thumbnailImageView;\n\n\n- (void) viewDidLoad {\n NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];\n\n NSString* path = [documentsDirectory stringByAppendingPathComponent:@\"ffbooks.plist\"];\n NSMutableArray* checkboxSelected = nil;\n // Attempt to load saved data from the documents directory\n if ([[NSFileManager defaultManager] fileExistsAtPath:path]){\n checkboxSelected = [NSMutableArray arrayWithContentsOfFile:path];\n }else{\n // No saved data in documents directory so we need to load the data from the bundle\n NSString* bundlePath = [[NSBundle mainBundle] pathForResource:@\"ffbooks\" ofType:@\"plist\"];\n checkboxSelected = [NSMutableArray arrayWithContentsOfFile:bundlePath];\n }\n\n //...\n // Toggle check box for book 0\n if ([checkboxSelected[0][@\"checkbox\"] boolValue]){\n checkboxSelected[0][@\"checkbox\"] = @NO;\n }else{\n checkboxSelected[0][@\"checkbox\"] = @YES;\n }\n // Note: @\"checkbox\" does not need to be in the original plist\n //...\n\n [checkboxSelected writeToFile:path atomically:YES];\n\n if (checkboxSelected == 0){\n [checkboxButton setSelected:NO];\n } else {\n [checkboxButton setSelected:YES];\n }\n\n}\n\n- (IBAction)checkboxButton:(id)sender{\n\n if (checkboxSelected == 0){\n [checkboxButton setSelected:YES];\n checkboxSelected = 1;\n } else {\n [checkboxButton setSelected:NO];\n checkboxSelected = 0;\n }\n\n}\n\n\n- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier\n{\n self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];\n if (self) {\n // Initialization code\n }\n return self;\n}\n\n- (void)setSelected:(BOOL)selected animated:(BOOL)animated\n{\n [super setSelected:selected animated:animated];\n\n // Configure the view for the selected state\n}\n\n\n@end"
] | [
"ios",
"uitableview",
"plist"
] |
[
"Database schema for getting started with a Content Management System",
"Hi \nI'm starting development of a small content management system but struggling to figure out how to get started. Does any one know where I can get a database schema or how such a system is developed.\n\nThere are loads of CMS systems but none allow you to embed them in an application and that is why I need to develop this.\n\nany ideas will be very much welcomed\n\nA java based system will be preffered.\n\nThanks"
] | [
"java",
"content-management-system",
"content-management"
] |
[
"How do I enable a disabled textfield in a cell after typing in another one?",
"I have a table view controller with three cells, each with a textfield where a user defines:\n-Country\n-State (disabled)\n-City (disabled)\n\nHow do I enable \"State\" textfield after the user types in \"Country\"?\n\nThe main problem is that I'm using a model called \"Field\", which has a property called \"depends\", which shows the id of the other Field that must not be empty.\n\nMy custom table view cell has a property \"Field\".\n\nIf I use \"textfieldDidBeginEditing()\" I can only access the textfield inside the cell, not the \"Field\" property.\n\nAll my cells are created dynamically.\n\nThe project is in Objective-C."
] | [
"ios",
"objective-c",
"uitableview",
"custom-cell"
] |
[
"How to make a checkbox selected default?",
"<span ng-repeat=\"location in model.locations \">\n <input type=\"checkbox\" ng-disabled=\"isDisabled\" ng-model=\"locations.isChecked\" ng-true-value=\"CHECKED\" ng-false-value=\"UNCHECKED\" ng-change=\"filterGrid(location)\">\n <label>{{ location }}</label>\n</span>\n\n\ndata i in list format\n\n0: \"One\"\n1: \"Two\"\n2: \"Three\"\n3: \"USA\"\n4: \"India\"\n5: \"Japan\"\n6: \"China\"\n\n\n\n $scope.model.locations = data.location;\n for(var i=0;i<$scope.model.locations.length;i++){\n if($scope.model.locations[i] == 'USA'){\n $scope.model.locations[i].isChecked =\"CHECKED\"\n }\n }\n\n\nBut I am not able to make USA checked default, may be because of this is in string format.\n\nPlease suggest"
] | [
"javascript",
"jquery",
"angularjs"
] |
[
"How to enter Greek characters in Emacs",
"This page indicates that Greek letters can be inserted into Emacs by using M-i. However, Emacs 23.2.1 in a Debian Squeeze variant inserts the \"tab\" character when M-i is pressed. How can I insert Greek letters such α and β in Emacs?"
] | [
"emacs"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.