texts
sequence | tags
sequence |
---|---|
[
"Deleting style elements from a style in Delphi Firemonkey",
"For the life of me, i can't seem to figure out how to delete primitive or control elements from a style with in the style designer of Delphi. What am I missing? I have tried right clicking everything i could find and no option surfaces. I tried looking for a panel that isn't enabled. Can't seem to find one. As of now, I have to edit the actual text and reload it, in order to delete a style element.\n\nDelphi XE6\n\n\n\nDelphi 10.1 Berlin\n\n\n\nEDIT UPDATE:\nHow do I get this window to appear in either IDE?\n\n\n\nEDIT UPDATE:\nLooks like there is a very small button on top left of structure pane that does the trick. I will leave question open for someone to answer with any other way. If no one can, Ill post the answer and accept it."
] | [
"delphi",
"firemonkey"
] |
[
"Join Criteria into another Criteria on two properties",
"Is there a way to join Criteria query into an existing one?\n\nThe actual query is a way more complicated and below is illustrating the simplified version of the problem.\n\nCriteria c1 = session.createCriteria(A.class);\nc1.setProjection(Projections.projectionList()\n .add(Projections.groupProperty(\"x\"))\n .add(Projections.groupProperty(\"y\"))\n .add(Projections.sum(\"amount\"))\n);\n\nCriteria c2 = session.createCritera(A.class);\n//\n// join on c2.x = c1.x AND c2.y = c1.y\n//\n\n\nCan this be achieved?"
] | [
"java",
"hibernate",
"criteria"
] |
[
"reading gpio pins of raspberry pi",
"I am using 8 channel relay, with raspberry pi 3 and programming in python. i want to read or sense the pins if they or low every 5 seconds and to print the output in .txt or .csv file. for single pin I have attached the code and it working fine but how i can expand to all 8 channels (relays). please help me\npython code:\n\nimport time \nfrom time import sleep # Allows us to call the sleep function to slow down \n our loop\nimport RPi.GPIO as GPIO # Allows us to call our GPIO pins and names it just \nGPIO\n\nGPIO.setmode(GPIO.BCM) # Set's GPIO pins to BCM GPIO numbering\nINPUT_PIN = 26 # Write GPIO pin number.\nGPIO.setup(INPUT_PIN, GPIO.IN) # Set our input pin to be an input\n# Start a loop that never ends\nwhile True:\n if (GPIO.input(INPUT_PIN) == True):\n # load is turned off.\n print (time.strftime (\"%Y/%m/%d , %H:%M:%S\"),\"0\")\n else:\n #now 20 watt load is turned ON!.\n print(time.strftime (\"%Y/%m/%d , %H:%M:%S\"),\"20\")\n sleep(10); # Sleep for 10 seconds.\n\n\nand i want to save all the data in a .csv or .txt file with time stamp at the start and other 8 columns for pins status that are connected with relay.\nmy output should look like\n06/01/2018,18:54:00,1,0,1,1,1,0,0,0\n06/01/2018,18:54:05,1,0,1,1,1,0,0,0\n06/01/2018,18:54:10,1,0,1,1,1,0,0,0\n06/01/2018,18:54:15,1,0,1,1,1,0,0,0\n06/01/2018,18:54:20,0,0,0,0,0,0,0,0"
] | [
"python",
"csv"
] |
[
"Google Apps Script JSON.parse replaces all \":\" (colon) in a URLFetchAPP with =\" (equals sign)",
"JSON.parse of a URLFetchApp on Google App Scripts changes all colons in a string to an equals sign. It's doing the exact opposite of what I thought JSON.parse is supposed to do. I tried parsing the same string in different places and even made a node.js fetch and output all works. Seems to be a problem with Google AppScript\nExample:\nCODE\nvar res = UrlFetchApp.fetch(url, options)\nvar text = res.getContentText()\nvar json = JSON.parse(text)\nLogger.log(text)\nLogger.log(json)\n\nLOG:\n{"status":{"timestamp":"2021-03-24T16:01:13.657Z","error_code":0,"error_message":null,"elapsed":20,"credit_count":1,"notice":null},"data":[{"id":1,"symbol":"BTC","name":"Bitcoin","amount":1,"last_updated":"2021-03-24T16:00:03.000Z","quote":{"GBP":{"price":41091.43869808855,"last_updated":"2021-03-24T16:00:21.000Z"}}}]}\n\n{status={elapsed=20.0, timestamp=2021-03-24T16:01:13.657Z, error_message=null, notice=null, credit_count=1.0, error_code=0.0}, data=[{amount=1.0, symbol=BTC, last_updated=2021-03-24T16:00:03.000Z, id=1.0, name=Bitcoin, quote={GBP={price=41091.43869808855, last_updated=2021-03-24T16:00:21.000Z}}}]}"
] | [
"javascript",
"json",
"google-apps-script",
"ide"
] |
[
"Using modular arithmetics for interval",
"Let's say we have range [-2, -1, 0, 1, 2, 3] which can be described as MIN_VALUE=-2 and MAX_VALUE=3\nWe want to implement function called infiniteCarousel() which will accept any number and used modulo operator (or somthing else) in order to calculate corresponding number in specified range.\n\nfunction infiniteCarousel(value, minValue, maxValue)\n{\n // todo\n // use modulus operator to calculate correct number\n // return calculated number \n}\n\n\n// range = [-2, -1, 0, 1, 2, 3]\nconst MIN_VALUE = -2;\nconst MAX_VALUE = 3;\n\nvar array = [];\n\n// let's calculate number from -10 to 10\nfor (var i = -10; i<10; i++)\n{\n array.push( infiniteCarousel(i, MIN_VALUE, MAX_VALUE) );\n}\n\n// should print [2, 3, -2, -1, 0, 1, 2, 3, -2, -1, 0, 1, 2, 3, -2, -1, 0, 1, 2, 3, -2]\nconsole.log(array); \n\n\nDo you know any efficient way to implement this?\nAlso, does anybody know what is the correct name for this problem? I am having troubles searching web because I don't know how to properly describe this problem."
] | [
"javascript",
"carousel",
"modulo",
"infinite"
] |
[
"Multi value wildcard search in ibatis",
"I have a search field which can take values separated by blank spaces for multi value search. But now I want to make it multi value search using wildcards. For example if I add 'away%' and 'ds%' separated by blank space in the search field it should search for both wild card values in a given column. The query should be as :\n\nSELECT * FROM [table]\nWHERE [column] LIKE ('away%') OR\n[column] LIKE ('ds%');\n\n\nHow can i achieve this repetitive column reference based on number of search values ? P.S: search value can be of any number."
] | [
"oracle",
"mybatis",
"ibatis"
] |
[
"Searching a string for a variable substring in a certain format",
"Imagine I'm trying to find a substring formatted as "X.X.X", in which the Xs can be any integer or character, in a string. I know that in Python I can use string.find("whatever") to find some substring within a string, but in this case, I'm looking to find anything that is in that format.\nFor example:\nSay I have the string "Hello, my name is John and my Hotel room is 1.5.3, Paul's room is 1.5.4"\nHow do I go about finding "1.5.3" and "1.5.4" in this case?"
] | [
"python",
"python-3.x",
"string",
"find",
"string-formatting"
] |
[
"How does MySQL handle WHERE tests?",
"As I was coding a php page building a MySQL request according to GET parameters, I was wondering if MySQL does any kind of reorganization of WHERE tests in a request, or if it just takes them as they come.\n\nFor example, if I execute this request:\n\nSELECT * FROM `table` t WHERE (SELECT `some_value` FROM `another_table` u WHERE `t.id` = `u.id` LIMIT 1) = 10 AND `a_boolean` = 1;\n\n\nObviously the second test is faster and executing it first would filter a lot of entries, so there would be less subrequests to do for the other test.\nSo, does MySQL reorganize the tests according to which one is faster/would filter the most entries, or does it just execute them in the given order?"
] | [
"sql",
"mysql",
"where-clause"
] |
[
"What are the pygame key names for number keys on an azerty keyboard?",
"What are the pygame key names for number keys on an azerty layout?\nI need to know this to be able to properly detect key presses on an azerty layout which I don't have.\nI have tried switching my mac keyboard layout to French - PC and the key namesshow up as:\n1234567890)= when I would expect:\n&é”’(-è_çà)=\nIn the pygame code base I do not see the french key codes.\nCan someone with a France AZERY keyboard test this?\nYou can test it by running python samples/pressed_keys_pygame.py azerty_laptop from this branch and pressing all the number keys in order and looking at the terminal input.\nI get this info from pygame when using the French - PC layout:\n{'unicode': '', 'key': 49, 'mod': 0, 'scancode': 30, 'window': None} key_name = 1\n{'key': 49, 'mod': 0, 'scancode': 30, 'window': None} key_name = 1\n{'unicode': '', 'key': 50, 'mod': 0, 'scancode': 31, 'window': None} key_name = 2\n{'key': 50, 'mod': 0, 'scancode': 31, 'window': None} key_name = 2\n{'unicode': '', 'key': 51, 'mod': 0, 'scancode': 32, 'window': None} key_name = 3\n{'key': 51, 'mod': 0, 'scancode': 32, 'window': None} key_name = 3\n{'unicode': '', 'key': 52, 'mod': 0, 'scancode': 33, 'window': None} key_name = 4\n{'key': 52, 'mod': 0, 'scancode': 33, 'window': None} key_name = 4\n{'unicode': '', 'key': 53, 'mod': 0, 'scancode': 34, 'window': None} key_name = 5\n{'key': 53, 'mod': 0, 'scancode': 34, 'window': None} key_name = 5\n{'unicode': '', 'key': 54, 'mod': 0, 'scancode': 35, 'window': None} key_name = 6\n{'key': 54, 'mod': 0, 'scancode': 35, 'window': None} key_name = 6\n{'unicode': '', 'key': 55, 'mod': 0, 'scancode': 36, 'window': None} key_name = 7\n{'key': 55, 'mod': 0, 'scancode': 36, 'window': None} key_name = 7\n{'unicode': '', 'key': 56, 'mod': 0, 'scancode': 37, 'window': None} key_name = 8\n{'key': 56, 'mod': 0, 'scancode': 37, 'window': None} key_name = 8\n{'unicode': '', 'key': 57, 'mod': 0, 'scancode': 38, 'window': None} key_name = 9\n{'key': 57, 'mod': 0, 'scancode': 38, 'window': None} key_name = 9\n{'unicode': '', 'key': 48, 'mod': 0, 'scancode': 39, 'window': None} key_name = 0\n{'key': 48, 'mod': 0, 'scancode': 39, 'window': None} key_name = 0\n{'unicode': '', 'key': 41, 'mod': 0, 'scancode': 45, 'window': None} key_name = )\n{'key': 41, 'mod': 0, 'scancode': 45, 'window': None} key_name = )\n{'unicode': '', 'key': 61, 'mod': 0, 'scancode': 46, 'window': None} key_name = =\n{'key': 61, 'mod': 0, 'scancode': 46, 'window': None} key_name = =\n\nIs pygame or my french keyboard layout not using the right scancodes? That's what it looks like because these pc scancodes are different. Do key codes differ across platforms? My environment is MacOS 10.14.6 and when I type with the French - PC layout in other apps or in a tkinter terminal, the expected &é”’(-è_çà)= text is printed.\nPer the above results it looks like pygame key values are the same as keysym_num values for tkinter. Also when using tkinter and logging key events; I am seeing different values for the pygame even.key/tkinter event.keysym_num values so it looks like pygame is handling these keys differently than I would expect. Tkinter looks like it is handling them correctly. These results are per my testing on a qwerty keyboard using a French - PC layout."
] | [
"python",
"pygame",
"keyboard",
"keyboard-layout",
"azerty-keyboard"
] |
[
"How do I exclude a directory using regular expressions?",
"I asked a question a little while ago about using regular expressions to extract a match from a URL in a particular directory.\n\neg: www.domain.com/shop/widgets/match/\n\nThe solution given was ^/shop.*/([^/]+)/?$\n\nThis would return \"match\"\n\nHowever, my file structure has changed and I now need an expression that instead returns \"match\" in any directory excluding \"pages\" and \"system\"\n\nBasically I need an expression that will return \"match\" for the following:\n\nwww.domain.com/shop/widgets/match/\nwww.domain.com/match/\n\n\nBut not:\n\nwww.domain.com/pages/widgets/match/\nwww.domain.com/pages/\n\nwww.domain.com/system/widgets/match/\nwww.domain.com/system/\n\n\nI've been struggling for days without any luck.\n\nThanks"
] | [
"regex"
] |
[
"Resize Chart ListObject Automatically on PowerPoint with VBA",
"I want to resize a chart table in PowerPoint via VBA. I've read the following solution multiple times (Resize Listobject Table dynamically with VBA) and it does seem precisely what I need, but for some reason (maybe because I'm running the macro from PowerPoint) it gives me the following error: Automation error (Error 440).\nI plan to use the Resize method because I'm updating a PPT chart data table from another Excel file without using the .Activate method (I opted to not use the .Activate because it opened many charts workbooks after the Macro finished execution, even with multiple Waits and Excel.Application.Quit and .Close).\nIt works great, the charts workbooks do not flash on the screen and the values are copied fast, BUT... the table size is not correct. It only includes the 1st line of the ppt chart data table, and thus my chart is rendered incomplete.\n Dim Line As Range Dim financialPartner As String, financialProject As String\n\n financialPartner = excl.Workbooks("HNK-Status-CDAU.xlsx").Sheets("Financial").Cells(int_lin, 2)\n financialProject = excl.Workbooks("HNK-Status-CDAU.xlsx").Sheets("Financial").Cells(int_lin, 3)\n \n Dim found As Boolean\n found = False\n \n Dim lastRow As Long\n Dim financialChart As Chart\n Dim financialChartData As Range\n Dim financialChartTable As ListObject\n Dim financialChartTablews As Worksheet\n \n lastRow = ActiveWindow.Selection.SlideRange.Shapes("RevenuesVolume").Chart.chartData.Workbook.Sheets(1).Range("A1048576").End(xlUp).Row\n Set financialChart = ActiveWindow.Selection.SlideRange.Shapes("RevenuesVolume").Chart\n \n Set financialChartTablews = ActiveWindow.Selection.SlideRange.Shapes("RevenuesVolume").Chart.chartData.Workbook.Worksheets(1)\n Set financialChartTable = financialChartTablews.ListObjects("Tabela1")\n \n For Each Line In chartDataTable.DataBodyRange.Rows\n Dim lineNumber As Long\n lineNumber = Line.Row\n \n If ((Line.Columns(1) <> financialPartner) Or (Line.Columns(2) <> financialProject)) And found Then\n Exit For\n End If\n \n If (Line.Columns(1) = financialPartner) And (Line.Columns(2) = financialProject) Then\n found = True\n With financialChart.chartData\n Set financialChartData = .Workbook.Worksheets(1).ListObjects(1).Range\n financialChartData.Range("A" & lastRow).Value = chartDataWs.Cells(lineNumber, 4)\n financialChartData.Range("B" & lastRow).Value = chartDataWs.Cells(lineNumber, 5)\n financialChartData.Range("C" & lastRow).Value = chartDataWs.Cells(lineNumber, 6)\n lastRow = lastRow + 1\n financialChartTable.Resize Range("A1:C" & lastRow)\n .Workbook.Close\n End With\n End If\n Next\nNext"
] | [
"excel",
"vba",
"powerpoint",
"excel-charts"
] |
[
"How to redirect one of several inputs?",
"In Linux/Unix command line, when using a command with multiple inputs, how can I redirect one of them?\n\nFor example, say I'm using cat to concatenate multiple files, but I only want the last few lines of one file, so my inputs are testinput1, testinput2, and tail -n 4 testinput3.\n\nHow can I do this in one line without any temporary files?\n\nI tried tail -n 4 testinput3 | cat testinput1 testinput2, but this seems to just take in input 1 and 2.\n\nSorry for the bad title, I wasn't sure how to phrase it exactly."
] | [
"linux",
"bash",
"unix"
] |
[
"dropdownlist items find by partial value",
"To find an item (and select it) in a dropdownlist using a value we simply do\n\ndropdownlist1.Items.FindByValue(\"myValue\").Selected = true;\n\n\nHow can I find an item using partial value? Say I have 3 elements and they have values \"myValue one\", \"myvalue two\", \"myValue three\" respectively. I want to do something like \n\ndropdownlist1.Items.FindByValue(\"three\").Selected = true;\n\n\nand have it select the last item."
] | [
"c#",
"drop-down-menu"
] |
[
"Drupal Views Teaser/body Toggle",
"I have a view in Drupal 6 (views 2) and it outputs a page using the table format. I have several fields showing in the table, one being the node:body. I would like to have only the teaser shown but a + symbol or other clickable element to switch that to the node body. I don't want to have to reload the view or switch over as sometimes the view will have 400 rows.\n\nThe possible solutions I have been considering would be to use Views Accordian, but that does not keep the functionaly of the table to sort by the other fields.\n\nThe other option is some form of javascript or ajax update of the view to swap between the two fields, or exclude one from the display and reveal the other.\n\nThe other option would be some css based javascipt to limit the height of the body with a link that can then expand it to full height.\n\nI hope someone can help."
] | [
"ajax",
"dynamic",
"drupal-6",
"drupal-views"
] |
[
"onSubmit function for multiple typeform on one page",
"I am embedding 2 typeform on my webpage.\nWhen I submit 1st typefrom onSubmit function get executed, but onSubmit function of 2nd typeform get called automatically even I submitted the 1st typeform.\n\n<div id=\"my-embedded-typeform1\" style=\"width: 100%; height: 300px;\"></div>\n<div id=\"my-embedded-typeform2\" style=\"width: 100%; height: 300px;\"></div>\n\n<script src=\"https://embed.typeform.com/embed.js\" type=\"text/javascript\"</script>\n window.addEventListener(\"DOMContentLoaded\", function() {\n var el = document.getElementById(\"my-embedded-typeform1\");\n var el2 = document.getElementById(\"my-embedded-typeform2\");\n window.typeformEmbed.makeWidget(el1, \"https://admin.typeform.com/to/cVa5IG\", {\n hideFooter: true,\n onSubmit: () => { alert('Typeform 1 submitted') }\n });\nwindow.typeformEmbed.makeWidget(el2, \"https://admin.typeform.com/to/cVa5IG\", {\n hideFooter: true,\n onSubmit: () => { alert('Typeform 2 submitted') }\n });\n });"
] | [
"reactjs",
"typeform"
] |
[
"Package Inconsistencies and Permission Denied Error For All Of My Installs",
"Lately, every time I try to install a package using conda I am getting message saying The following packages are causing the inconsistency and then this error:\n\nERROR conda.core.link:_execute(696): An error occurred while installing package 'defaults::numpy-base-1.16.4-py37ha711998_0'.\n\n[Errno 13] Permission denied: '/Users/<myusername>/anaconda3/envs/dsi/lib/python3.7/site-packages/numpy/LICENSE.txt'\n\n\nI tried searching around and I cannot find a good answer to my problem.\n\nThank you in advance for all of your help."
] | [
"python",
"macos",
"installation",
"conda"
] |
[
"Consolidating Duplicate Rows into 1 Row with Multiple Columns",
"I was wondering how I can take a data set that looks like this:\n\nTable 1:\n\nRecordID Code\nA 351\nA 352\nA 353\nA 354\n\n\nto look like this:\n\nTable 2:\n\nyou can already assume I created a second table with the column headers I created below\n\nRecordID 351 352 353 354 355 356\n A Y Y Y Y N N\n\n\nThank you in advance for your help."
] | [
"sql",
"merge",
"sql-server-2012",
"duplicates"
] |
[
"Loading Image onto Tomcat Server in Android for phoneGap",
"I'm new to phoneGap. What i want is to upload and then download an image onto a Tomcat server. I found several examples to upload and download pictures but they were all for PHP server. If someone can tell me how to do it for Tomcat Server.From my emulator i upload the image but on the server i don't see anything.If anyone could guide me how to do the same.Thanks."
] | [
"cordova",
"android-emulator",
"phonegap-plugins"
] |
[
"IdentityServer4 how to set server cookie expiration",
"So far I've seen how to set expiration for the client webapp's cookie (thank you v0id): IdentityServer4 cookie expiration\n\nThere are actually two cookies used by IdentityServer4 - the client cookie and server cookie (\"idsrv\").\n\nIf I set the client cookie expiration as given here:\nIdentityServer4 cookie expiration\nthen when I close the browser and go back to a client webapp page where I need to be authorized, I get access denied because the browser session no longer has the server cookie.\n\nSo I need a way to set the \"idsrv\" cookie expiration to be the same as the client.\n\nCurrently, the best way I see to set the server cookie (it is being ignored or dropped somehow) is the following code block in the IdentityServer4 host Startup.cs / ConfigureServices() method:\n\nservices.AddIdentityServer(options =>\n {\n options.Authentication.CookieLifetime = new TimeSpan(365, 0, 0, 0);\n options.Authentication.CookieSlidingExpiration = true;\n })\n\n\nThat should set the cookie's expiration to one year later. However, in Chrome developer tools under the Application tab, cookies, I see that it still has an expired expiration default date in 1969.\n\nI downloaded the IdentityServer4 project source, removed the nuget package, and added the source project to my solution so I could debug through it. \n\nI see that it gets the expiration I gave it in the ConfigureInternalCookieOptions.cs / Configure() method. It's matching the DefaultCookieAuthenticationScheme inside as well / applying the properties. I haven't found anything specific to IdentityServer that would ignore the expiration date I've set, but it still has the 1969 expiration.\n\nEdit: I've attempted to set the cookie persistent in the IdentityServer host's AccountController as follows (interestingly enough, Microsoft has a good article around using authenticationproperties without using AspNet Identity here: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie?tabs=aspnetcore2x - it is sending information in a cookie, \"scheme\" is just the cookie name):\nIn the ExternalLoginCallback():\n\nif (id_token != null)\n {\n props = new AuthenticationProperties();\n props.ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration);\n props.IsPersistent = true;\n props.StoreTokens(new[] { new AuthenticationToken { Name = \"id_token\", Value = id_token } });\n }\n\n\nNone of the server side cookies have their expiration set (the AccountOptions RememberMeLoginDuration is also set to 365 days). Both \"idsrv\" and \"idsrv.session\" still have a 1969 expiration."
] | [
"cookies",
"identityserver4"
] |
[
"Regarding object = new when another reference type points to it",
"I am vary curious regarding a specific case in c#:\nIn this code, pointToSourceArr points to source arr, but if I change sourceArr by a setting it to a new array or setting it to null, pointToSourceArr remains with it's two objects :\n{ \"Itamar\", \"sasha\" }. Why is that?\n\nstring[] sourceArr = new string[] { \"Itamar\", \"sasha\" };\nstring[] pointToSourceArr = sourceArr;\nsourceArr = new string[]() // OR NULL;"
] | [
"c#",
"object",
"reference-type"
] |
[
"How can I find out in authorization filter which authentication scheme was used?",
"In authorization filter I can set result to either Forbidden or Challenge. Constructors of both have an overload accepting authentication scheme name.\nBut how do I get the name of auth scheme used of the request?"
] | [
"asp.net-core"
] |
[
"Separating single grouped WHILE loop results",
"I asked a question yesterday which was solved and I can now output WHILE loops which 2 results on a line, rather than 1 on a line. This is the code I've got at the moment:\n\nif(mysql_num_rows($result2) > 0) {\n $count=0;\n $day = 1;\n while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) {\n echo \"<b>\";\n if ($day=='1') { echo \"Sunday - \";}\n else if ($day=='3') { echo \"Monday - \"; }\n else if ($day=='5') { echo \"Tuesday - \"; }\n else if ($day=='7') { echo \"Wednesday - \"; }\n else if ($day=='9') { echo \"Thursday - \"; }\n else if ($day=='11') { echo \"Friday - \"; }\n else if ($day=='13') { echo \"Saturday - \"; }\n else { echo \"\";}\n\n if (($row[\"open\"] == 0) && ($row[\"close\"] == 0)) \n {\n echo \"closed\"\n } \n else\n {\n echo \"</b>\" . $row[\"open\"] . \"-\" . $row[\"close\"] . \" &nbsp;&nbsp;&nbsp;&nbsp; \";\n if ($count % 2 !=0 ){ echo \"<br/><br/>\";}\n }\n $count++;\n $day++;\n }\n} else {\n echo \"Error\";\n}\n\n\nWith this code, when the branch is closed, then it returns the word 'closed' twice, where I need it to appear only once. Is this possible?"
] | [
"php",
"loops",
"count",
"if-statement",
"while-loop"
] |
[
"Generate a sequence number (1,1,1,2,2,2,3,3,3) within groups of different length",
"I have a data frame with a column \"Tag\", here with four different levels. I need help to create the \"Seq\" column, a sequence generated from the \"Tag\" Column: \n\ndf <- data.frame(Tag = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4),\n Seq = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3 )\n\n\nEach \"Tag\" should be divided into 3 sub-groups defined by \"Seq\". We need to generate runs of 1, 2, and 3, with a total length of that of each \"Tag\". Thus, the length of each run of 1, 2, and 3 respectively depends on length of each \"Tag\".\n\nNote that the length each \"Tag\" differs. For example, Tag 1 is of length 31, and has a \"Seq\" 10 times 1, 10 times 2, and 11 times 3."
] | [
"r",
"sequence",
"seq"
] |
[
"Unable to segue tableview",
"I am trying to create a Tableview app and here is my code, I am unable to segue due to an error saying cvc.college = colleges[indexPath.row] saying cannot assign value of type 'string' to 'College!'\nWhat do i do?\n\nimport UIKit\n\nclass ViewController: UIViewController, UITableViewDelegate ,UITableViewDataSource {\n\n @IBOutlet weak var myTableView: UITableView!\n\n\n\n\n var colleges = [\"Harper\",\"UofI\",\"Florida State University\"]\n\n\n\n\n\n\n\n override func viewDidLoad() {\n super.viewDidLoad()\n myTableView.delegate = self\n myTableView.dataSource = self\n\n var college1 = College(name: \"Harper\", state: \"IL\", population: \"25,000+\")\n var college2 = College(name: \"UofI\", state: \"IL\", population: \"44,000+\")\n var college3 = College(name: \"Florida State University\", state: \"Fl\", population:\"40,000+\")\n var colleges = [college1 , college2, college3]\n\n\n\n }\n func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n return colleges.count\n }\n\n\n\n func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n let myCell = myTableView.dequeueReusableCell(withIdentifier: \"myCell\", for: indexPath)\n myCell.textLabel!.text = colleges[indexPath.row]\n return myCell\n }\n\n func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath){\n if editingStyle == .delete {\n colleges.remove(at: indexPath.row)\n tableView.reloadData()\n let college = colleges[indexPath.row]\n\n }\n\n }\n\n\n\n func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {\n let college = colleges[sourceIndexPath.row ]\n colleges.remove(at: sourceIndexPath.row)\n colleges.insert(college, at: destinationIndexPath.row)\n\n\n }\n\n override func prepare(for segue: UIStoryboardSegue, sender: Any?) {\n var cvc = segue.destination as! CollegeViewController\n if let cell = sender as? UITableViewCell,\n let indexPath = self.myTableView.indexPath(for: cell) {\n\n cvc.college = colleges[indexPath.row]\n\n }\n\n}\n\n\nheres my code for CollegeViewController\n\n class CollegeViewController: UIViewController {\nvar college : College!\n@IBAction func onTappedSave(_ sender: UIButton) {\n college.name = collegeText.text!\n college.state = stateText.text!\n college.population = populationText.text!\n\n\n}\n@IBOutlet weak var collegeText: UITextField!\n@IBOutlet weak var populationText: UITextField!\n@IBOutlet weak var stateText: UITextField!\n\n\noverride func viewDidLoad() {\n super.viewDidLoad()\n collegeText.text = college.name\n stateText.text = college.state\n populationText.text = String(college.population)\n\n\n}\n\n}"
] | [
"swift",
"xcode",
"uitableview",
"swift3",
"nsindexpath"
] |
[
"Java concurrency : Do I have to synchronise a method that only retrieve state and does not modify it?",
"I'm learning java concurrency and used a Bank Account that is shared among multiple people example to try to practice principles of concurrency. \n\nThis is my Account class.\n\npublic class Account(){\n private int balance = 0;\n\n public int getBalance(){ return balance} \n public synchronized void deposit(int val){//..} \n void synchronized void withdrawal(int val){//..}\n}\n\n\ndeposit and withdrawal methods are synchronized because they directly modify the state of the Account object, so to avoid data corruption if multiple users try to change it at the same time.\n\nOn the other hand, getBalance() does not change the state of the Account object. But I was thinking that if getBalance() is called while a deposit or withdrawal is happening, it will return an outdated value. What is the standard practice, to synchronize or not to synchronize getBalance()?"
] | [
"java",
"concurrency",
"synchronization"
] |
[
"Make new column which is incremented by it's order",
"I need to make new column for my table Products -> called Order (new column). And using rails migration I need to add new column and instantly set it's order number, but it's need to be done by product_id.\n\nWhat I mean I need something like:\n\nproduct_id | order\n\n1 ------------> 1\n\n1 ------------> 2\n\n1 ------------> 3\n\n2 ------------> 1\n\n2 ------------> 2\n\n\nIs there a way of doing it?\n\nEDIT :\nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''order' = t1.'order'' at line 15: \n\nupdate product_submissions t\n join (\n select\n id,\n product_id,\n 'order' from (\n select id,\n product_id,\n @rn:= if(@prev = product_id,@rn:=@rn+1,1) as 'order',\n @prev:=product_id\n from product_submissions,\n (select @rn:=0,@prev:=0)r\n order by product_id,id\n )x\n )t1 on t1.id=t.id set t.'order' = t1.'order'"
] | [
"mysql",
"sql",
"ruby-on-rails",
"migration",
"rails-migrations"
] |
[
"Background image won't show via URL (HTML & CSS)",
"So I had been watching tutorials on how to code with html, and I succeeded at first with the whole background-image: url('somePicture.jpg');\nbut my issue now is that it doesn't show up at all. I've been learning all week last week but over the weekend I took a break and now I come back to my office and I ruined everything.\nHere's what I have now:\n\r\n\r\nbody{\n font-family: 'Syne', serif;\n}\n#help{\n color: purple;\n}\n.what{\n font-weight: bold;\n}\nsection{\n border: solid 5px purple;\n padding: 20px 5px 10px 5px;\n margin: 0px auto 0px auto;\n width: 500px;\n}\nmain{\n background-image: rgb(59, 59, 187) url(\"https://photographylife.com/wp-content/uploads/2017/05/img013-1200-copy.jpg\") center/contain no-repeat;\n}\r\n<!DOCTYPE html>\n<html>\n <head>\n <link href=\"https://fonts.googleapis.com/css2?family=Syne&display=swap\" rel=\"stylesheet\">\n <link rel=\"stylesheet\" href=\"Christ.css\">\n<title>\n Wow\n</title>\n </head>\n <body>\n <main>\n <section>\n <h1 id=\"help\">Oh.</h1>\n <p class=\"what\">Hello, I exist. This is text. Welcome.</p>\n </section>\n </main>\n </body>\n</html>"
] | [
"html",
"css",
"image",
"url",
"background"
] |
[
"Why is only the first element appearing from html string through XMLHttp request?",
"I am trying to dynamically load mp3 files to a webpage via XMLHttp request. It is in a string, and there should be two divs with audio files appearing. However, only the first one is appearing. Could someone please help me determine why this is happening? I want to be able to load more files to the source page and have them appear dynamically on this webpage. \n\nHere is my code:\n\n<!DOCTYPE html>\n<HTML lang=\"en-US\">\n<HEAD>\n<TITLE>load files</TITLE> \n\n<Style>\n body{\n background-color: blue;\n }\n\n .container{\n border:5px solid white;\n margin:10%;\n width:600px;\n height:600px;\n\n }\n\n .floating {\n display: inline-block;\n width: 150px;\n height: 75px;\n margin: 10px;\n border: 3px solid #73AD21; \n }\n\n</Style>\n<SCRIPT>\n function get_list_of_files_from_html( html_string ){\n var el = document.createElement( 'html' );\n el.innerHTML = html_string;\n\n var list_of_files = el.getElementsByTagName( 'a' ); \n\n var return_string = '<div class=\"floating\">';\n\n for(var i=5; i < list_of_files.length ; i++){\n var current_string = list_of_files[i];\n var new_string = current_string.toString()\n .replace('http://www.website.com/~user/final/','');\n return_string += \n '<audio controls><source src =\"' + new_string + \n '\" type=audio/mpeg></audio>';\n return_string += '</div>';\n\n return return_string;\n }\n }\n\n function loadDoc(){\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n document.getElementById(\"container\").innerHTML =\n get_list_of_files_from_html( this.responseText);\n }\n };\n xhttp.open(\"GET\", \n \"http://www.website.com/~user/final/audiofiles/\", true);\n xhttp.send();\n }\n\n</SCRIPT>\n</HEAD>\n<BODY>\n <body onload=\"loadDoc()\">\n <div id=\"container\" class=\"container\"></div>\n</body>\n</BODY>\n</HTML>"
] | [
"javascript"
] |
[
"is it possible to have 2 data sets on single line chart in chart.js?",
"Preview:\nI am using chart.js in Angular 7 application. I want to know, is it possible to have 2 data sets on single line chart.\n\nDetail:\nOn my X-axis I have time related data and Y-axis contains numbers. Based on API response, (which returns time stamp and number) I can generate a line chart. But I want to have 2nd datasets on same line. 2nd data set related API response, gives me time stamp, so I want to use that time stamp to project point (maybe of different color) to show on single line.\n\nthis.chart = new Chart(ctx, {\n type: 'line',\n data: this.getChartAxisData(),\n options: this.getChartOptions()\n });\n\ngetChartAxisData() {\n const first: any[] = this.listOne.map((data) => (new Date(data.date)));\n const firstArray: any[] = this.listOne.map((data) => data.number);\n const second: any[] = this.listTwo.map((data) => (new Date(data.date)));\n\n return {\n labels: first,\n datasets: [\n {\n data: firstArray\n }\n ]\n };\n }\n\ngetChartOptions() {\n\n return {\n scales: {\n xAxes: [{\n type: 'time',\n time: {\n max: this.endDate,\n min: this.startDate,\n displayFormats: {\n 'millisecond': 'hh:mm A',\n 'second': 'hh:mm A',\n 'minute': 'hh:mm A',\n 'hour': 'hh:mm A',\n 'day': 'DD-MMM',\n 'week': 'DD-MMM',\n 'month': 'DD-MMM'\n }\n }\n }],\n yAxes: [{\n ticks: {\n min: 0,\n max: 800\n }\n }]\n }\n };\n }"
] | [
"javascript",
"angular",
"typescript",
"chart.js2"
] |
[
"Loading a 32 bit integer image with opencv",
"I have 32 bit grayscale image data saved in tif files. It stems from background corrected CCD data so the values can also be negative.\n\nWorking in Python, scipy.misc.imread can load the file with no problems. With opencv however, I didn't manage to get the correct data, it loads all values as NaN, no matter what options I pass imread.\n\nMy main code is in C++, so I cannot use SciPy and have so far been happy with OpenCV but here it fails me.\n\nAny suggestions?"
] | [
"python",
"c++",
"opencv",
"scipy"
] |
[
"elasticsearch nested query, i think",
"I come from a related database background and something like this would be so simple there, but I can't figure this out. I've been trying to learn Elasticsearch for a week or so and I'm trying to figure out what I think is a nested query. Here's some sample data:\n\nPUT /myindex/pets/_mapping\n{\n \"pets\": {\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"pet\": {\n \"type\": \"nested\", \n \"properties\": {\n \"name\": {\"type\": \"string\"}\n }\n }\n }\n }\n}\n\nPOST /myindex/pets/\n{\"pet\": {\"name\": \"rosco\"}, \"name\": \"sam smith\"}\n\nPOST /myindex/pets/\n{\"pet\": {\"name\": \"patches\"}, \"name\": \"sam smith\"}\n\nPOST /myindex/pets\n{\"pet\": {\"name\": \"rosco\"}, \"name\": \"jack mitchell\"}\n\n\nWhat would the query look like that only returns documents matching:\n\n\nowner name is \"sam smith\"\npet name is \"rosco\"\n\n\nI've tried a mixmatch of bool, match, nested, filtered/filter type queries, but I just keep getting errors. Stuff like this stands out in the errors: \n\nnested: ElasticsearchParseException[Expected field name but got START_OBJECT \\\"nested\\\"];\n\n\nHere was the query:\n\nGET /myindex/pets/_search\n{\n \"query\": {\n \"match\": {\n \"name\": \"sam smith\"\n },\n \"nested\": {\n \"path\": \"pet\",\n \"query\": {\n \"match\": {\n \"pet.name\": \"rosco\"\n }\n }\n }\n }\n}\n\n\nI'm beginning to think that I just can't target something this specific due to the relevant nature of Elasticsearch.\n\nAny ideas?"
] | [
"elasticsearch",
"filter",
"mapping",
"nested-queries"
] |
[
"How to set up a WM_KEYDOWN message interceptor in console application?",
"I'm working on a console game engine, and for it I'd like to make some control interface.\n\nFor it I chose approach of making a hidden window, which reads keys being pressed, then pushes them into a queue (this thing i'll implement separately) and then the engine itself just reads those keys via reading the queue and doing things described on each button pressed (control table). Here is what I mean:\n\nbool _CreateMessageWnd(HWND* MWND)\n{\n WNDCLASSEX wx = {0};\n wx.cbSize = sizeof(WNDCLASSEX);\n wx.lpfnWndProc = HandleMessageSetup; // function which will handle messages\n wx.hInstance = GetModuleHandle(NULL);\n wx.lpszClassName = L\"Dummy\";\n if (RegisterClassEx(&wx)) {\n *MWND = CreateWindowExW(0, L\"Dummy\", L\"dummy_name\", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);\n return true;\n }\n return false;\n}\n\n\nThis function creates a message window and sets HandleMessageSetup() as a proc func.\n\nIn a game loop (replicate with while(1)) I call for \n\nvoid _DispMessage()\n{\n MSG msg;\n if(GetMessageW(&msg, 0, 0, 0) > 0) \n {\n TranslateMessage(&msg);\n DispatchMessage(&msg);\n }\n}\n\n\nand the message interceptor procedure looks like this:\n\nLRESULT CALLBACK HandleMessageSetup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\n {\n printf(\"Got a message! %u\\n\", uMsg);\n return DefWindowProc(hWnd, uMsg, wParam, lParam);\n }\n\n\nbut all the messages it receives are 36, 129, 131, 1, which are creation messages of window itself, but no messages from console are present, any key I press, WM_KEYDOWN message does not appear.\n\nfrom this question I learned about ChangeWindowMessageFilterEx() but neither \nChangeWindowMessageFilterEx(MWND, WM_KEYDOWN,1,NULL); nor ChangeWindowMessageFilterEx(GetConsoleWindow(), WM_KEYDOWN,1,NULL); is working and still no messages received. How to overcome this trouble?"
] | [
"c",
"winapi",
"console",
"window-messages"
] |
[
"Plot Data from CSV and group values in colum",
"I am pretty new in python and try to understand how to do the following:\n\nI am trying to plot data from a csv file where I have values for A values for B and values for C. How can I group it and plot it based on the Valuegroup and as values using the colum values? \n\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ncsv_loader = pd.read_csv('C:/Test.csv', encoding='cp1252', sep=';', index_col=0).dropna()\n#csv_loader.plot()\n\nprint(csv_loader)\n\nfig, ax = plt.subplots()\ncsv_loader.groupby('Valuegroup').plot(x='Date', y='Value', ax=ax, legend=False, kind='line')\n\n\nThe data looks like the following:\n\nCalcgroup;Valuegroup;id;Date;Value\nGroup1;A;1;20080103;0.1\nGroup1;A;1;20080104;0.3\nGroup1;A;1;20080107;0.5\nGroup1;A;1;20080108;0.9\nGroup1;B;1;20080103;0.5\nGroup1;B;1;20080104;1.3\nGroup1;B;1;20080107;2.0\nGroup1;B;1;20080108;0.15\nGroup1;C;1;20080103;1.9\nGroup1;C;1;20080104;2.1\nGroup1;C;1;20080107;2.9\nGroup1;C;1;20080108;0.45"
] | [
"python",
"pandas",
"csv",
"dataframe"
] |
[
"Should you bundle and minify - jQuery and other third party libraries?",
"Using ASP.NET's bundling and minification technique, I'm sort evaluating pros and cons of bundling standard libraries.\n\n\nOne of the critical point against bundling is that we won't be able to point to CDNs of these common libraries.\nAlso if something changes in our application's JavaScript, we would also force the client to download all the bundled 3rd party libraries.\n\n\nIs there any way I could avoid these issues?"
] | [
"asp.net-mvc-4",
"bundling-and-minification"
] |
[
"Populating a Modal contact form on click with javascript",
"I have a modal form which loads upon clicking an anchor tag with a specific class.\n\nWhat I am trying to achieve is to apply a value to a certain text field within the mdoal form when the anchor tag is clicked.\n\nI have this function working to a point with the following, when the anchor tag is clicked the input field with the id=\"contact-catalogue\" is populated with the value set within anchor tag:\n\n<input type=\"text\" id=\"contact-catalogue\" />\n\n<a class=\"button-left contact\" href=\"#\" onclick=\"document.getElementById('contact-catalogue').value='link2';\">Request</a></div>\n\n\nMy problem is that the modal form loads when the anchor tag is clicked and the value set within the anchor tag does not populate the required text field.\n\nMy guess is that because the form loads after anchor tag is clicked there is no ID being picked up and that is why the value is not being passed.\n\nAny help would be greatly appreciated...."
] | [
"forms",
"modal-dialog",
"contact"
] |
[
"ajaxSetup beforeSend only being called the first time button is clicked",
"I am using ASP.Net MVC and jQuery 1.8.2\n\nI have a form with a button that calls this javascript when it is clicked:\n\n$(function () {\n $('#SearchButton').click(function () {\n var data = $('#FilterDefinition :input').serialize() + \"&PageNumber=1\";\n $.post('@Url.Action(\"Search\")', data, LoadContentCallback);\n $(\"#SearchResults\").show();\n });\n});\n\n\nThis calls an MVC Controller Action which returns a PartialViewResult\n\nOn the Layout page I have the following JavaScript code:\n\n//Add a custom header to all AJAX Requests\n $(document).ready(function () { \n $.ajaxSetup({\n beforeSend: function(xhr) {\n debugger;\n if ($('[name=__RequestVerificationToken]').length) {\n var token = $('[name=__RequestVerificationToken]').val();\n xhr.setRequestHeader('__RequestVerificationToken', token);\n }\n }\n });\n });\n\n\nWhen the button is clicked for the first time, the beforeSend function is called correctly. However, if the button is clicked more than once (for example they change the search criteria and search again) then the beforeSend function never gets called again and the validate anti-forgery fails.\n\nI tried using the ajaxSend event instead and I got the same results.\n\nAny help is solving this problem would be greatly appreciated.\n\nThanks!"
] | [
"javascript",
"jquery",
"asp.net",
"ajax",
"asp.net-mvc"
] |
[
"how to bind more than one dropdownlist without refreshing?",
"protected void Page_Load(object sender, EventArgs e)\n{\n\n\n\n bindbranches();\n bindbranches1();\n\n}\npublic void bindbranches()\n{\n DataTable dtbranch = new DataTable();\n dtbranch = objsupplyBAL.getbrnch();\n\n ddlbranch.DataSource = dtbranch;\n ddlbranch.DataBind();\n ddlbranch.Items.Add(new ListItem(\"--select--\", \"0\"));\n ddlbranch.SelectedIndex = ddlbranch.Items.Count - 1;\n\n}\npublic void bindbranches1()\n{\n DataTable dt = new DataTable();\n dt = objsupplyBAL.getbrnch();\n\n ddlbranch1.DataSource = dt;\n ddlbranch1.DataBind();\n ddlbranch1.Items.Add(new ListItem(\"--select--\", \"0\"));\n ddlbranch1.SelectedIndex = ddlbranch1.Items.Count - 1;\n\n}\n\n\nMy dropdownlist's are not binding without refreshing.If i select one dropdownlist another one is refreshing. What i have to add extra to my code. Can any one tell..."
] | [
"c#",
"asp.net"
] |
[
"TF2.2: Loading a Saved Model from tensorflow_hub failed with `AttributeError: '_UserObject' object has no attribute 'summary'`",
"System info:\nPython: 3.6.9\nTensorflow: 2.2.0 CPU package from pip\n\nThe issue:\n\nI got https://tfhub.dev/google/imagenet/resnet_v2_50/classification/4?tf-hub-format=compressed from tf-hub and then uncompressed in a new directory.\n\nwget https://storage.googleapis.com/tfhub-modules/google/imagenet/resnet_v2_50/feature_vector/4.tar.gz\nmkdir test_pb\nmv 4.tar.gz test_pb\ncd test_pb\ntar -xvf 4.tar.gz\nrm 4.tar.gz\ncd ..\n./test.py\n\n\nhttps://storage.googleapis.com/tfhub-modules/google/imagenet/resnet_v2_50/feature_vector/4.tar.gz is the feature vector pre-trained model from https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/4 in tf-hub.\n\ntest.py is the Python script, and this following is the standalone code:\n\n#!/usr/bin/env python3\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nimport tensorflow as tf\n\nprint(tf.__version__)\n\nresnet50v2_save_path = os.path.join('.', \"./test_pb/\")\n\nloaded1 = tf.keras.models.load_model(resnet50v2_save_path)\nprint(\"Load done\")\n\nprint(\"Signatures: \", loaded1.signatures)\n\nprint(\"Type: \", type(loaded1))\n\nprint(loaded1.summary())\n\n\nthat give this output:\n\n2.2.0\n2020-06-12 20:29:07.677555: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 1995455000 Hz\n2020-06-12 20:29:07.678219: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x59eb130 initialized for platform Host (this does not guarantee that XLA will be used). Devices:\n2020-06-12 20:29:07.678241: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version\nLoad done\nSignatures: _SignatureMap({})\nType: <class 'tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject'>\nTraceback (most recent call last):\n File \"./test.py\", line 18, in <module>\n print(loaded1.summary())\nAttributeError: '_UserObject' object has no attribute 'summary'\n\n\nthat is the mentioned error.\n\nWhy?\n\nThx"
] | [
"python",
"python-3.x",
"tensorflow",
"tensorflow2.0",
"tensorflow-datasets"
] |
[
"Running a Javascript Sort Through Apple Automator",
"I am trying to use the following code in Apple Automator\n\nvar lnRange = getSelectedLineRange();\nvar ln = getTextInRange(lnRange[0],lnRange[1]);\n\nvar lines = ln.split('\\n').sort(function(a, b)\n{\n var parsedA = a.replace(/\\*\\s(<s>)?(The )?/, \"* \");\n var parsedB = b.replace(/\\*\\s(<s>)?(The )?/, \"* \");\n\n return parsedA.localeCompare(parsedB);\n});\nsetTextInRange(lnRange[0],lnRange[1],lines.join('\\n'));\n\n\nI know the code is sound and achieves the results I need it to (Running it in Drafts on the iPhone produces exactly the results I require, namely sorting a markdown list while ignoring the use of <s> and/or \"The \"at the start of a line. The * needs to stay in so the list holds up).\n\nTransferring it from the iPhone into Automator is where things fall apart, as Automator can't find the variable getSelectedLineRange. I'm guessing this is a conflict between how Automator handles the text input and how the script wants to take and process it, but I'm at an impasse as to how to resolve it.\n\nFor the sake of example (in the event of my entire approach being wrong) I'd like this list, in any text field I can throw at it\n\n* Armadillo\n* The aardvark\n* <s>Rhino</s>\n* <s>The Zebra</s>\n* The Giraffe\n* Hedgehog\n\n\nwhen selected, to go through the script, running as a service, and come out like this\n\n* The aardvark\n* Armadillo\n* The Giraffe\n* Hedgehog\n* <s>Rhino</s>\n* <s>The Zebra</s>\n\n\nI'm certainly not married to a javascript solution, but it's the starting point I have."
] | [
"javascript",
"sorting",
"automator"
] |
[
"How do i update boolean field on Django model?",
"I have implemented a view that is supposed to update two boolean fields on a Django model i.e is_published and submitted. However , currently, the view is only able to update the first boolean field(is_published) and leaves out the second one(submitted). What am i doing wrong and how can I implement a solution that updates both fields at the same time?\n\nHere is my code\n\nModel\n\nclass Course(models.Model):\n\n is_published = models.BooleanField(default=False)\n\n submitted = models.BooleanField(default=False)\n\n\nView\n\nclass UpdateVideoAPIPublishView(generics.UpdateAPIView):\n \"\"\" Update course \"\"\"\n\n permission_classes = (IsAuthenticated,)\n renderer_classes = (CourseJSONRenderer,)\n serializer_class = CourseSerializer\n\n def update(self, request, *args, **kwargs):\n course = get_object_or_404(\n Course, slug=self.kwargs['slug'])\n\n if not course.is_published:\n course.is_published = True\n course.submitted = False\n course.save()\n return Response(\n {\"message\": \"Course updated succesfully\"}, status=status.HTTP_201_CREATED)\n raise serializers.ValidationError(\n 'Course already published'\n )"
] | [
"python",
"django"
] |
[
"AuthLogic gem - how to destroy all sessions?",
"I am using the AuthLogic gem in my ruby app (not rails).\nthis gem can manage multiple sessions for same user, but, if i want to block a user\nfrom my app, i want to invalidate all his sessions from backend.\ncurrently i can destroy the session only when its active\n\n user_session = UserSession.find\n if user_session\n user_session.destroy\n return {status: 200, message: 'Success'}\n else\n return {status: 400, message: 'No session to destroy'}\n end\n\n\n, but how can i get all user sessions by user id and destroy them?"
] | [
"ruby",
"authlogic"
] |
[
"org.hibernate.HibernateException in a basic program of Hibernate",
"i am using MySQL workbench 5.2 CE database with a basic hibernate program\nat run time it give me error: \n\nCaused by: org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver\n\n\nthis code in hibernate.cfg.xml: \n\n<hibernate-configuration>\n <session-factory>\n <property name=\"dialect\">org.hibernate.dialect.MySQLDialect</property>\n <property name=\"connection.url\">jdbc:mysql://192.168.8.212/da?autoReconnect=true&amp;useOldUTF8Behavior=true&amp;useUnicode=true&amp;characterEncoding=UTF-8\" /></property>\n <property name=\"connection.username\">root</property>\n <property name=\"connection.password\">password</property>\n <property name=\"connection.driver_class\">com.mysql.jdbc.Driver</property>\n <property name=\"myeclipse.connection.profile\">MyEclipse Derby</property>\n </session-factory>\n</hibernate-configuration>"
] | [
"java",
"mysql",
"hibernate",
"orm"
] |
[
"populate dropdownlist from jsonresult using .each",
"I have a dropdown list that I need to dynamically populate based on the selection of another. It all works up to the point that I have to render the new data in the dropdown list after clearing the list first. The list clears, but then fails to populate the new data being returned from the controller. I am attempting to use .each for this.\n\nHere's the controller method in question: \n\n[AcceptVerbs(HttpVerbs.Get)]\npublic JsonResult UpdateDocumentSubType(string DocumentType)\n{\n List<SelectListItem> DocumentSubTypeList = new List<SelectListItem>();\n PropertyModel model = new PropertyModel();\n int DocTypeID = 0;\n //get DocTypeID\n DocTypeID = model.GetDocTypeID(DocumentType);\n //gets new document subtype list\n DocumentSubTypeList = model.GetDocumentSubTypes(DocTypeID);\n //return document subtype list\n return Json(DocumentSubTypeList, JsonRequestBehavior.AllowGet);\n}\n\n\nAs you can see, I'm returning a serialized json result of List.\n\nOn the view, I have the following:\n\n$.ajax({\n url: '@Url.Action(\"UpdateDocumentSubType\",\"Document\")',\n type: 'GET',\n dataType: \"json\",\n data: { DocumentType: SelectedDocTypeText },\n async: true,\n success: function (data) {\n var select = $(\"#Docs_DocumentSubTypeID\");\n select.empty();\n $.each(data, function (index, item) {\n select.append($('<option></option>').val(item).html(index));\n });\n }\n});\n\n\nThis is where it all falls apart. The code hits select.empty(): and executes it successfully, but then as the \"text\" value of the SelectListItem, it instead provides the index element of the array of objects. Essentially, the tags render something like this:\n\n<option value=\"[object Object]\">1</option>\n<option value=\"[object Object]\">2</option>\n<option value=\"[object Object]\">3</option>\n<option value=\"[object Object]\">4</option>\n\n\nI have verified that the data IS being passed. When I take the .each and put it in its own function, call that function, and add \"debugger;\" to it, I can see the data in the resulting \"data\" as four elements of [object, object].\n\nAs you may have guessed, JQuery isn't my strong suit, so any assistance would be appreciated. :)"
] | [
"javascript",
"jquery",
"json",
"asp.net-mvc"
] |
[
"Plone 4.3.3 - Schema-Driven types - plone.directives.form not importing",
"I am following the Plone guide for Schema-Driven Types: http://docs.plone.org/external/plone.app.dexterity/docs/prerequisite.html\n\nRunning: \n\n\nMac OSX 10.8.5 Mountain Lion\nPlone 4.3.3 http://plone.org/products/plone/releases/4.3.3\n\n\nWhen I get to the second page on Testing the Type, I get an error. \n\nI have the ZCML error below. I have already made sure to do what it says. I did another clean install and received the same error. Here is what it says in the guide. \n\n\n\nIf Zope doesn’t start up:\n\nLook for error messages on the console, and make sure you start in the foreground with ./bin/instance fg. You could have a syntax error or a ZCML error.\nIf you have a failed import for plone.directives.form, make sure that you specified the [grok] extra for plone.app.dexterity in your setup.py install_requires.\n\n\n\nError Message:\n\nZopeXMLConfigurationError: File \"/Users/Josh/Documents/Plone4/buildout-cache/eggs/Products.CMFPlone-4.3.3-py2.7.egg/Products/CMFPlone/configure.zcml\", line 98.4-102.10\n\nZopeXMLConfigurationError: File \"/Users/Josh/Documents/Plone4/zinstance/src/example.conference/example/conference/configure.zcml\", line 18.2-18.27\n\nNameError: name 'form' is not defined\n\n\nHere is the full log of the error message http://pastie.org/9200196"
] | [
"python",
"macos",
"plone",
"plone-4.x",
"zcml"
] |
[
"For Loop for next page button keeps displaying repeatedly",
"for (i = 0; i < 5; i++) {\n var timeStampConvert = JSON.stringify(fromAddressList[i].timeStamp).replace(/\\"/g, "");\n timeStampConvert = new Date(timeStampConvert * 1000);\n console.log(timeStampConvert);\n\n var amountSent = JSON.stringify(fromAddressList[i].value).replace(/\\"/g, "");\n amountSent = addDec(amountSent, 1000000000);\n\n $("#test-from-address").append("<table id='hash-display-2' style='margin-top: 50px;'><tr><th>Hash</th><td>"+fromAddressList[i].hash+"</td></tr><tr><th>Confirmations</th><td>"+fromAddressList[i].confirmations+"</td></tr><tr><th>Time</th><td>"+timeStampConvert+"</td></tr><tr><th>Sender</th><td>"+fromAddressList[i].from+"</td></tr><tr><th>Recipient</th><td>"+fromAddressList[i].to+"</td></tr><tr><th>Amount</th><td>"+amountSent+ " "+fromAddressList[i].tokenSymbol+"</td></tr><tr><th>Block</th><td>"+fromAddressList[i].blockNumber+"</td></tr></table>")\n console.log(fromAddressList[i]);\n \n if (i == 4) {\n $("#test-from-address").append("<input type='button' class='from_next' name='submit' value='Next' id='from_next'>");\n\n fromNextLoop = 5;\n\n document.getElementById('from_next').onclick = function () {\n $("#test-from-address").html("");\n for (i = fromNextLoop; i < fromNextLoop + 5; i++) {\n var timeStampConvert = JSON.stringify(fromAddressList[i].timeStamp).replace(/\\"/g, "");\n timeStampConvert = new Date(timeStampConvert * 1000);\n console.log(timeStampConvert);\n\n var amountSent = JSON.stringify(fromAddressList[i].value).replace(/\\"/g, "");\n amountSent = addDec(amountSent, 1000000000);\n\n $("#test-from-address").append("<table id='hash-display-2' style='margin-top: 50px;'><tr><th>Hash</th><td>"+fromAddressList[i].hash+"</td></tr><tr><th>Confirmations</th><td>"+fromAddressList[i].confirmations+"</td></tr><tr><th>Time</th><td>"+timeStampConvert+"</td></tr><tr><th>Sender</th><td>"+fromAddressList[i].from+"</td></tr><tr><th>Recipient</th><td>"+fromAddressList[i].to+"</td></tr><tr><th>Amount</th><td>"+amountSent+ " "+fromAddressList[i].tokenSymbol+"</td></tr><tr><th>Block</th><td>"+fromAddressList[i].blockNumber+"</td></tr></table>")\n\n if (i == fromNextLoop + 5 - 1) {\n fromNextLoop = fromNextLoop + 5;\n console.log(fromNextLoop);\n $("#test-from-address").append("<input type='button' class='from_next' name='submit' value='Next' id='from_next'>");\n }\n }\n \n }\n }\n}\n\nFor some reason, once the user clicks next in the last for loop, it displays everything rather than just one set of 5 at a time, images attached for a better idea:\n\nAs after the first block with a next button, it displays another and another until the whole array is complete, when I'd just like to have one a time, I'm not sure where my error is or how I should fix it, I tried to use a break in the inner for loop which fixed it but then if I clicked the button again, it would not work and not display any more."
] | [
"javascript",
"arrays",
"json",
"for-loop"
] |
[
"playframework: persist java8 java.time type LocalDate with hibernate in Play",
"I'm having trouble getting any kind of conversion or compatibility working for the new java.time.* types. Or at least, LocalDate. \n\nI see the exception:\n\nplay.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[IllegalStateException: Error(s) binding form: {\"dateOfBirth\":[\"Invalid value\"]}]]\n at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:265) ~[play_2.11-2.4.4.jar:2.4.4]\n\nCaused by: java.lang.IllegalStateException: Error(s) binding form: {\"dateOfBirth\":[\"Invalid value\"]}\n at play.data.Form.get(Form.java:592) ~[play-java_2.11-2.4.4.jar:2.4.4]\n at controllers.Application.addPatient(Application.java:49) ~[classes/:na]\n\n\nThere are several methods I've found, that should in principle work, with JPA hibernate, however, if this is a problem (again) of Play or what? I am not sure. \n\nFirst method:\n\nProvide your own custom converter:\n\n@Converter(autoApply = true)\npublic class LocalDateAttributeConverter implements AttributeConverter<LocalDate, Date> \n{\n @Override\n public Date convertToDatabaseColumn(LocalDate locDate) {\n return (locDate == null ? null : Date.valueOf(locDate));\n }\n\n @Override\n public LocalDate convertToEntityAttribute(Date sqlDate) {\n return (sqlDate == null ? null : sqlDate.toLocalDate());\n }\n}\n\n\nThen on the field one needs to use this:\n\n@Convert(converter = LocalDateAttributeConverter.class)\npublic LocalDate dateOfBirth;\n\n\nhttp://www.thoughts-on-java.org/persist-localdate-localdatetime-jpa/\n\nOf course, as I understand it, in principle, I should not need the @Convert annotation since the converter itself is annotated with the @Converter(autoApply = true) annotation. But as I can find no documentation about using successfully Converters with Play (nor any hits on google) I have tried with and without, WITHOUT any success. \n\nNext method:\n\nWell, actually, so far as I read, the newer java8 types should be now supported since hibernate 5 something.... and i've got 5.0.5 in use, and included the necessary library in my class path:\n\n\"org.hibernate\" % \"hibernate-java8\" % \"5.0.5.Final\", \n\n\nhttps://hibernate.atlassian.net/browse/HHH-8844\n\nThat didn't help at all. Same stacktrace.\n\nFor good measure, I added the hibernate specific annotation\n\n@Type(type=\"java.time.LocalDate\")\n\n\nto my field. \n\nThat would have been ugly. But i'd have put up with it, if it had've helped. It didn't. Same exception. Using that WITH the converter caused other errors. Which is interesting. \n\nI am using Play 2.4, with Hibernate 5.0.5.\nHas anyone managed to achieve this?"
] | [
"java",
"hibernate",
"jpa",
"playframework",
"java-8"
] |
[
"how to get the content size of a view",
"i am just beginner of iphone programming . i want to get size(full size) of content for scrollview can any one please provide me solution .\n Thanks and regards"
] | [
"objective-c"
] |
[
"How to use aliases in WHERE clause?",
"Simple question: How to use aliases after SELECT statement? Let's say i have query like this: \n\nSELECT salary/12 AS sal \nFROM sdatabase\nWHERE sal > 1000\n\n\nOf course it won't work because database will throw me an error. I know I can just replace sal with salary/12 like this: \n\nWHERE salary/12 > 1000\n\n\nbut I think it is less readable. So is there anything I can do with it or this is just the way it's done?"
] | [
"sql",
"alias"
] |
[
"Ignore a request error from an observable",
"I have an Angular application that uses GraphQL as API structure. When an error is thrown on the backend, the request has a 500 status on it, but still returns a standard JSON (ableit with an "errors" array). However, this 500 status triggers an error in the observable when I only subscribe to it. I want to ignore the error that is thrown and instead just check for the error array on the response. My first approach:\nlogin(email: string, password: string) {\n this.loginGQL.watch({email, password}).valueChanges.subscribe(result => {\n \n if(!result.errors || result.errors.length === 0) {\n this.authData.next(result.data.login);\n } else {\n this.error.next(result.errors[0].message);\n }\n });\n }\n\nI have tried this approach to try to solve the problem:\nlogin(email: string, password: string) {\n this.loginGQL.fetch({email, password}).pipe(map(result => \n result.data\n ), catchError(\n err => {\n console.log(err);\n return err.message;\n }\n )).subscribe(\n (finalResult: string | AuthData) => {\n if(typeof finalResult !== "string") {\n this.authData.next(finalResult);\n } else {\n console.log(finalResult);\n this.error.next(finalResult);\n }\n }\n );\n }\n\nThis however not only throws away the response, but the error message also somehow gets split up into single letters. Not the best experience.\nWhat would be the best approach do to this? Thanks in advance."
] | [
"angular",
"rxjs"
] |
[
"Get proper language format in android",
"I have a multi language app which calls to api to get information depending of language code. For now I recognizning which Language is set by called Locale.getDefault().getLanguage(); and it gives me 2 characters language format ( for example en,de,fr) . I want to change it to en-US, en-GB and so on. Also i found incompatibilities - The Ukrainian language should be describe like uk but it is ua. I tried Locale.getDefault().toString(); and Locale.getDefault().getLanguage()+\"_\"+ Locale.getDefault().getCountry(); but it still gives me en and en_ results"
] | [
"android",
"locale",
"multiple-languages"
] |
[
"Performing a fuzzy contains check",
"I would like to check if a keyword string is contained within a text string. This must be a fuzzy contains. \n\nMy first attempt was to use the library fuzzywuzzy. This seemed to have unexpected behavior producing high match values when the strings differed quite a lot when using the partial ratio. \n\nI've tried using levenshtein's distance which works for comparing one string to another but not for finding if a string contains a keyword.\nOne idea I tried was to split the text into individual words and then loop through them all calculating the distance to see if there is a match. The problem is that the keyword may have white space in it which means it wouldn't find any matches using this method. \n\nI've now tried using a Bitap algorithm to find if the keyword is in the text but this come back as true when the keyword and text are very different. The algorithm can be found here. \n\nfinal String keyword = \"br0wn foxes very nice and hfhjdfgdfgdfgfvffdbdffgjfjfhjgjfdghfghghfg\".toLowerCase();\nfinal String text = \"The Quick Brown Fox Jumps Over the Lazy Dog\".toLowerCase();\n\nfinal Bitap bitap = new Bitap(keyword, alphabet); \nbitap.within(text, 20); // Returns true\n\n\nI've looked into using Lucene. The problem with this is that a lot of it is based around creating indexes from all the data and then performing the search. In my case this can't be done as it needs to be a method that takes a keyword and text separately. If there are any resources to do with performing a fuzzy contains without indexing using Lucene it would be very useful. \n\nWhat is the best approach for this?"
] | [
"java",
"lucene",
"levenshtein-distance",
"keyword-search",
"fuzzywuzzy"
] |
[
"How to mock Azure Queue storage for unit test?",
"I want to mock QueueMessage for unit test,but I can not find any lib to mock\n public async Task<QueueMessage[]> ReceiveMessagesAsync(QueueClient queue)\n {\n \n QueueProperties properties = queue.GetProperties();\n\n // Retrieve the cached approximate message count.\n int cachedMessagesCount = properties.ApproximateMessagesCount;\n QueueMessage[] queueMessages =new QueueMessage[cachedMessagesCount];\n\n int num = cachedMessagesCount / 32;\n\n for (int i = 0; i < num + 1; i++)\n {\n var messages = await queue.ReceiveMessagesAsync(maxMessages: 32);\n messages.Value.CopyTo(queueMessages,i*32);\n }\n return queueMessages;\n }"
] | [
"c#",
"azure",
"azure-storage",
"xunit"
] |
[
"KeyError : The tensor variable , Refer to the tensor which does not exists",
"Using LSTMCell i trained a model to do text generation . I started the tensorflow session and save all the tensorflow varibles using tf.global_variables_initializer() . \n\nimport tensorflow as tf\nsess = tf.Session()\n//code blocks\nrun_init_op = tf.global_variables_intializer()\nsess.run(run_init_op)\nsaver = tf.train.Saver()\n#varible that makes prediction\nprediction = tf.nn.softmax(tf.matmul(last,weight)+bias)\n#feed the inputdata into model and trained\n#saved the model\n#save the tensorflow model\nsave_path= saver.save(sess,'/tmp/text_generate_trained_model.ckpt')\nprint(\"Model saved in the path : {}\".format(save_path))\n\n\nThe model get trained and saved all its session . Link to review the whole code lstm_rnn.py\n\nNow i loaded the stored model and tried to do text generation for the document . So,i restored the model with following code\n\ntf.reset_default_graph()\nimported_data = tf.train.import_meta_graph('text_generate_trained_model.ckpt.meta')\nwith tf.Session() as sess:\n imported_meta.restore(sess,tf.train.latest_checkpoint('./'))\n\n #accessing the default graph which we restored\n graph = tf.get_default_graph()\n\n #op that we can be processed to get the output\n #last is the tensor that is the prediction of the network\n y_pred = graph.get_tensor_by_name(\"prediction:0\")\n #generate characters\n for i in range(500):\n x = np.reshape(pattern,(1,len(pattern),1))\n x = x / float(n_vocab)\n prediction = sess.run(y_pred,feed_dict=x)\n index = np.argmax(prediction)\n result = int_to_char[index]\n seq_in = [int_to_char[value] for value in pattern]\n sys.stdout.write(result)\n patter.append(index)\n pattern = pattern[1:len(pattern)]\n\n print(\"\\n Done...!\")\nsess.close()\n\n\nI came to know that the prediction variable does not exist in the graph.\n\n\n KeyError: \"The name 'prediction:0' refers to a Tensor which does not\n exist. The operation, 'prediction', does not exist in the graph.\"\n\n\nFull code is available here text_generation.py\n\nThough i saved all tensorflow varibles , the prediction tensor is not saved in the tensorflow computation graph . whats wrong in my lstm_rnn.py file . \n\nThanks!"
] | [
"python",
"tensorflow",
"lstm"
] |
[
"Uncaught Error: A state mutation was detected between dispatches",
"I am making a React + Redux application, and I'm getting this when clicking on a link\n\nUncaught Error: A state mutation was detected between dispatches, in the path `library.items.5.track.duration`. This may cause incorrect behavior. (http://redux.js.org/docs/Troubleshooting.html#never-mutate-reducer-arguments)\n at invariant (browser.js:40)\n at index.js:50\n at index.js:208\n at index.js:21\n at Object.select (bindActionCreators.js:7)\n at ListItem.handleTrackNameClick (ListItem.js:12)\n at Object.ReactErrorUtils.invokeGuardedCallback (ReactErrorUtils.js:70)\n at executeDispatch (EventPluginUtils.js:89)\n at Object.executeDispatchesInOrder (EventPluginUtils.js:112)\n at executeDispatchesAndRelease (EventPluginHub.js:44)\n\n\nNow I get what this means, it means I have somewhere some code that is changing my state. My reducer isn't even called, the only things that get called on click are:\n\nhandleTrackNameClick() {\n this.props.select([\n deepAssign({}, this.props.track)\n ]);\n }\n\n\nand select function corresponds to:\n\nfunction playTracks(tracks) {\n console.log('playing');\n return {\n type: PLAY_TRACKS,\n tracks: deepAssign({}, tracks)\n };\n}\n\n\nand then (just after displaying playing) I immediately get the error, the reducer is never called. It's weird because I don't mutate my state anywhere in my code. I don't really know what to post else, so tell me if you need more. Here is the full source \n\nEDIT: the playTrack function receives an argument like this:\n\n[\n {\n \"id\":\"8hAt8fvQomHt9ztV\",\n \"name\":\"Bounce\",\n \"duration\":114226,\n \"artist\":{\n \"id\":\"1MUjmFoDBQOk2vbO\",\n \"name\":\"System of a Down\"\n },\n \"album\":{\n \"id\":\"8B7MePC7rhglf7px\",\n \"name\":\"Toxicity\"\n }\n }\n]\n\n\nand here is a sample state just before call:\n\n{\n \"routing\":{\n \"locationBeforeTransitions\":{\n \"pathname\":\"/app/library\",\n \"search\":\"\",\n \"hash\":\"\",\n \"state\":null,\n \"action\":\"POP\",\n \"key\":\"oabgr1\",\n \"query\":{\n\n },\n \"$searchBase\":{\n \"search\":\"\",\n \"searchBase\":\"\"\n }\n }\n },\n \"toolbar\":{\n \"playing\":false,\n \"currentTime\":0,\n \"viewType\":\"redux-app/view-types/THUMBNAILS\",\n \"searchString\":\"\",\n \"volume\":1\n },\n \"library\":{\n \"items\":[\n {\n \"id\":\"mwgwHdOVamAz8wq0\",\n \"track\":{\n \"id\":\"mwgwHdOVamAz8wq0\",\n \"name\":\"A Hopeful Transmission\",\n \"duration\":33000,\n \"artist\":{\n \"id\":\"tL1YNNTaOLvYmHot\",\n \"name\":\"Coldplay\"\n },\n \"album\":{\n \"id\":\"3xYmTho9gpG5g4bs\",\n \"name\":\"Mylo Xyloto\"\n }\n }\n },\n {\n \"id\":\"NVcZ9spiBPSebv57\",\n \"track\":{\n \"id\":\"NVcZ9spiBPSebv57\",\n \"name\":\"X\",\n \"duration\":118160,\n \"artist\":{\n \"id\":\"1MUjmFoDBQOk2vbO\",\n \"name\":\"System of a Down\"\n },\n \"album\":{\n \"id\":\"8B7MePC7rhglf7px\",\n \"name\":\"Toxicity\"\n }\n }\n },...\n ],\n \"loading\":false,\n \"viewType\":\"LIST\",\n \"viewScope\":\"TRACKS\"\n },\n \"sidebar\":{\n \"libraries\":[\n {\n \"_id\":\"GaejiodsIlFRteGW\",\n \"name\":\"Test\",\n \"path\":\"/home/vinz243/.cassette/downloads\"\n }\n ]\n },\n \"store\":{\n \"query\":\"\",\n \"results\":{\n \"albums\":[\n\n ],\n \"tracks\":[\n\n ]\n },\n \"releases\":[\n\n ]\n }\n}"
] | [
"javascript",
"reactjs",
"redux",
"react-router-redux"
] |
[
"How to integrate Error Boundary in Components routed using react-router",
"I have a page which uses different components which is loaded using react router.\nIs it possible to integrate error boundary in each component as shown in the below code when I use the react router to route to different pages?\n\nMy target is to show errors particularly for individual components so that other components should work in case there is an error in one component.\n\nPlease see my code below:\n\nindex.js\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport App from './App';\nimport registerServiceWorker from './registerServiceWorker';\n\nReactDOM.render(<App />, document.getElementById('root'));\n\nregisterServiceWorker();\n\n\nApp.js\n\nimport React, { Component } from 'react';\nimport {BrowserRouter as Router, Route, Link } from 'react-router-dom';\n//import ErrorBoundary from \"./errorboundary\";\nimport MyComponent1 from './component1';\nimport MyComponent2 from './component2';\n\nclass App extends Component {\nrender() {\nreturn (\n<Router>\n<div style={{ backgroundColor: 'green' }}>\n<div style={{ backgroundColor: '#f0f0ae', height: '30px' }}>\n<Link to='/'>Link 1</Link> &#160;&#160;\n<Link to='/comp1'>Link 2</Link> &#160;&#160;\n<Link to='/comp2'>Link 3</Link> &#160;&#160;\n</div>\n\n<div style={{ backgroundColor: '#ffc993', height: '150px' }}>\n<Route path='/' exact render={() => <MyComponent1 title=\"Component 1\" />} />\n<Route path='/comp1' render={() => <MyComponent1 title=\"Component 1 Again\" />} />\n<Route path='/comp2' render={() => <MyComponent2 title=\"Component 2\" />} />\n</div>\n</div>\n</Router>\n);\n}\n}\n\nexport default App;\n\n\nThis is one of the component in which I want to use Error Boundary.\n\ncomponent1.js\n\nimport React, { Component } from 'react';\nimport ErrorBoundary from \"./errorboundary\";\n\nclass MyComponent1 extends Component {\nstate = {\nboom: false,\n};\n\nthrowError = () => this.setState({ boom: true });\n\nrender() {\nconst { title } = this.props;\n\nif(this.state.boom) {\nthrow new Error(`${title} throw an error!`);\n}\n\nreturn (\n<ErrorBoundary>\n<input type='button' onClick={this.throwError} value={title} />\n</ErrorBoundary>\n)\n}\n}\n\nexport default MyComponent1;\n\n\nThis is another component in which I want to use the Error Boundary.\n\ncomponent2.js\n\nimport React, { Component } from 'react';\nimport ErrorBoundary from \"./errorboundary\";\n\nclass MyComponent2 extends Component {\nstate = {\nboom: false,\n};\n\nthrowError = () => this.setState({ boom: true });\n\nrender() {\nconst { title } = this.props;\n\nif(this.state.boom) {\nthrow new Error(`${title} throw an error!`);\n}\n\nreturn (\n<ErrorBoundary>\n<input type='button' onClick={this.throwError} value={title} />\n</ErrorBoundary>\n)\n}\n}\n\nexport default MyComponent2;\n\n\nThis is my customized error message using error boundary when there is an error in each component.\n\nerrorboundary.js\n\nimport React, { Component } from 'react';\n\nclass ErrorBoundary extends Component {\nconstructor(props) {\nsuper(props);\nthis.state = { error: null, errorInfo: null };\n\nif(this.props.showError === false)\n{\nthis.state.error = null;\nthis.state.errorInfo = null;\n}\n}\n\ncomponentDidCatch = (error, info) => {\nconsole.log(\"error did catch\");\nthis.setState({error: error, errorInfo: info }); \n}\n\nrender() {\nif(this.state.errorInfo) {\nreturn (\n<div style={{ backgroundColor: '#ffcc99', color: 'white', width: '500px', height: '60px' }}>\nAn Error Occurred !\n</div>\n);\n}\nelse {\nreturn this.props.children;\n}\n}\n}\n\nexport default ErrorBoundary;\n\n\nCan anyone please help me? I am a newbie in React JS."
] | [
"reactjs",
"react-router"
] |
[
"how to remove object if all values are empty in javascript?",
"I have multiple objects in array. It has values array with value property in object. when all value properties are empty. I want to remove whole object.\n\nI tried it but i am not able to produce output.\nPlease help me.\n\n\r\n\r\nvar data = [\r\n {\r\n \"field\": \"surname\",\r\n \"values\": [\r\n {\r\n \"id\": \"drivingLicenseFront\",\r\n \"value\": \"\",\r\n \"isAvailable\": true\r\n },\r\n {\r\n \"id\": \"passport\",\r\n \"value\": \"\",\r\n \"isAvailable\": true\r\n }\r\n ],\r\n \"status\": \"passed\"\r\n },\r\n {\r\n \"field\": \"given names\",\r\n \"values\": [\r\n {\r\n \"id\": \"drivingLicenseFront\",\r\n \"value\": \"\",\r\n \"isAvailable\": true\r\n },\r\n {\r\n \"id\": \"passport\",\r\n \"value\": \"\",\r\n \"isAvailable\": true\r\n }\r\n ],\r\n \"status\": \"passed\"\r\n },\r\n {\r\n \"field\": \"date of birth\",\r\n \"values\": [\r\n {\r\n \"id\": \"drivingLicenseFront\",\r\n \"value\": \"25.07.1974\",\r\n \"isAvailable\": true\r\n },\r\n {\r\n \"id\": \"passport\",\r\n \"value\": \"05 JUN /JOIN 57\",\r\n \"isAvailable\": true\r\n }\r\n ],\r\n \"status\": \"passed\"\r\n }\r\n];\r\n\r\n for (let x = data.length-1; x >= 0; x--) {\r\n let count = 1;\r\n var dataValueLength = data[x].values.length;\r\n for (let y = 0; y < data[x].values.length; y++) {\r\n if (data[x].values[y].value === \"\") {\r\n count++;\r\n }\r\n }\r\n if (dataValueLength == count) {\r\n data.splice(x, 1)\r\n }\r\n }\r\n \r\n console.log(JSON.stringify(data));\r\n\r\n\r\n\n\nIn above scenario, output should be only one object that is \"date of birth\"."
] | [
"javascript",
"arrays"
] |
[
"Adding UI elements to a PFQueryTableViewController/UITableViewController?",
"I was curious as to if I was able to override the appeareance of how a PFQueryTableViewController looks (not the cells or table itself). For example right now I am adding my search bar programatically to the header of my tableView. The issue I'm having with that is when the user scrolls the tableView the header goes up with it, and I want it to stick. I know I can easily probably accomplish this by making a UIViewController with a UITableView, but was wondering if there is any way to add this above the tableview in a PFQueryTableViewController (subclass of UITableViewController I believe if I'm not total noob?), or get the header to stick?\n\nHere is how I currently have my searchBar adding to my PFQueryTableViewController in my viewDidLoad:\n\n UITableViewController *searchResultsController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];\n searchResultsController.tableView.dataSource = self;\n searchResultsController.tableView.delegate = self;\n\n self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];\n [[UISearchBar appearance]setBackgroundColor:[UIColor clearColor]];\n self.searchController.searchResultsUpdater = self;\n self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44.0);\n self.tableView.tableHeaderView = self.searchController.searchBar;\n self.definesPresentationContext = YES;\n\n [self.searchController.searchBar setPlaceholder:@\"What are you looking for?\"];"
] | [
"ios",
"objective-c",
"iphone",
"uitableview"
] |
[
"Token pattern in CountVectorizer, scikit-learn",
"So I have list of keywords as follows,\n\n[u\"ALZHEIMER'S DISEASE, OLFACTORY, AGING\", \n u\"EEG, COGNITIVE CONTROL, FATIGUE\", \n u\"AGING, OBESITY, GENDER\", \n u\"AGING, COGNITIVE CONTROL, BRAIN IMAGING\"]\n\n\nThen I want to use CountVectorizer to tokenize so that my model has following dictionary:\n\n[{'ALZHEIMER\\'S DISEASE': 0, 'OLFACTORY': 1, 'AGING': 2, 'BRAIN IMAGING': 3, ...}]\n\n\nBasically, I want to treat comma as my tokenize pattern (except the last one). However, feel free to concat , at the end of each list. Here is a code snippet that I have right now:\n\nfrom sklearn.feature_extraction.text import CountVectorizer\nls = [u\"ALZHEIMER'S DISEASE, OLFACTORY, AGING\", \n u\"EEG, COGNITIVE CONTROL, FATIGUE\", \n u\"AGING, OBESITY, GENDER\", \n u\"AGING, COGNITIVE CONTROL, BRAIN IMAGING\"]\ntfidf_model = CountVectorizer(min_df=1, max_df=1, token_pattern=r'(\\w{1,}),')\ntfidf_model.fit_transform(ls)\nprint tfidf_model.vocabulary_.keys()\n>>> [u'obesity', u'eeg', u'olfactory', u'disease']\n\n\nFeel free to comments if you want more information."
] | [
"python",
"regex",
"scikit-learn"
] |
[
"Best way to parse a query string with AngularJS without using html5mode",
"What's the best way to parse a query string in Angular without using html5mode? (Not using html5mode because we need to support older browsers)\n\nI get the same undefined results whether or not I use a hash:\n\nhttp://localhost/test?param1=abc&param2=def\nhttp://localhost/test#/param1=abc&param2=def\n\n\n$routeParams and $location.search() both return undefined:\n\nvar app = angular.module('plunker', [\"ngRoute\"]);\n\napp.controller('MainCtrl', [\"$scope\", \"$routeParams\", \"$location\",\n function($scope, $routeParams, $location) {\n\n console.log($routeParams, $routeParams.abc); //undefined, undefined\n console.log($location.search(), $location.search().abc); //undefined, undefined\n\n}]);\n\n\nI can parse the window.location.search myself, but I'm hoping there is a better way to do it in Angular.\n\nPlnkr: http://plnkr.co/edit/alBGFAkfqncVyK7iv8Ia?p=preview\n\nI've read this post and haven't found a solution. I must be missing something. Thanks for the help."
] | [
"javascript",
"angularjs"
] |
[
"Can multiple users be logged in to the same email account in c#?",
"I am developing an application where in the case of an exception an email is sent to my email account automatically - the point is that I will be using my email account and each user will automatically login using my credentials - so will this cause a problem asuming I dispose the object after each sending?"
] | [
"c#",
".net",
"email",
"exception-handling"
] |
[
"Using RSLs with Adobe AIR",
"Does anyone know how exactly RSLs work with AIR? I have a terminal server that runs several instances of a very large AIR application, which unfortunately has 100M RAM on startup and 200 after a bit of use. This is obviously not really workable, and I'm thinking that RSLs may be a solution if they're cached on the machine. However I haven't been able to find much of anything on this, and I'd really like to know if anyone has.\n\nOn a second note, what are some good ways to reduce the initial memory size of an AIR applicaiton?"
] | [
"apache-flex",
"memory",
"actionscript",
"memory-management",
"air"
] |
[
"runOnUiThread() acts on a closed activity when called from ThreadExecutor",
"I am having an issue with runOnUiThread() acting on a closed activity. Here is the logic:\nIn activity one, I navigate to activity two.\nIn activity two I am doing some background fetching and once it is done, I navigate to activity three.\nThe issue is that if I close activity two while data is still being fetched, my thread keeps running and since runOnUiThread() gets called in my code, activity one gets acted on and it navigates me to activity three. I don't want that to happen. I want the thread to stop or at least for the things in runOnUiThread() to not touch any other activity besides the one that the thread was created in.\nNote: In my example it is launching an activity but other code could be in there related to the UI that gets triggered in the same way.\nHere is what my code looks like:\nExecutorService executorService = Executors.newSingleThreadExecutor();\n\nexecutorService.execute(new Runnable() {\n public void run() {\n // Do fetching of data\n\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n // Navigate to activity three\n }\n });\n }\n});\n\nI tried shutting down the executor service when the activity is closed, and while I can verify that onDestroy() gets called with a console.log statement, it appears neither shutdown() or shutdownNow() work:\n@Override\nprotected void onDestroy() {\n super.onDestroy();\n\n if (executorService != null) {\n executorService.shutdown(); // Does not work to stop thread from executing\n executorService.shutdownNow(); // Does not work to stop thread from executing\n }\n\n}\n\nEdit: How do I add an interruptor to this to be able to interrupt the thread?"
] | [
"java",
"android",
"runnable"
] |
[
"Having some trouble with Tkinter Treeview and SQLite when trying to search for a name in a database",
"I have successfully been able to click a search button on my tkinter GUI and have the results display in my treeview however if I want to search straight again I get an error because when trying to write for the second time it's writing to the same row as the first search query. How would I either clear the treeview or make sure that my program writes to the next row in my treeview?\n\nsrchEntry = str(searchEntry.get())\nconn = sqlite3.connect('test.db')\nc = conn.cursor()\nc.execute(\"SELECT memberID, fullName, username FROM Test WHERE fullName ='\"+srchEntry+\"'\")\nconn.commit()\ndata = c.fetchall()\ntreeview.insert(\"\", 0, 1, values=(str(data[0][0]), str(data[0][1]), str(data[0][2])))\n\n\nSo 'data' will return ('memberID', 'fullname', 'username') and I am inserting those values into my treeview"
] | [
"python",
"sqlite",
"tkinter",
"treeview",
"tkinter-entry"
] |
[
"Looking for a complete tutorial about ChronoConnectivity",
"I am trying to work with ChronoConnectivity and I have read all the tutorials available about it.\nStill, I have'nt found any tutorial that talks about the \"Custom Display Type\" or the \"hasMany\" relationship between models. Would someone please help me find a complete tutorial about ChronoConnectivity?\nThanks a lot."
] | [
"joomla"
] |
[
"iPad Splash Screen setting warning in App Target",
"These are the splash screen of my iPad application.\n\n\nDefault-Portrait.png (768 × 1024)\[email protected] (1536 × 2048)\nDefault-Landscape.png (1024 × 768)\[email protected] (1024 × 768)\n\n\nThe problem:\nI upload all these screen in my application. Then set\nDefault-Landscape@2x, Default-Landscape & Default-Portrait in App Target as iPad Splash screen.\n\nNow when I try to set Default-Portrait@2x, I find \"No image Specified\" message in \"Portrait Non-Retina\" section.\nLike this:\n\n\n\nAnd then when try to set Default-Portrait again, I find \"No image with correct dimensions found\" message in \"Portrait Retina\" section. \nLike this:\n\n\n\nAnd this thing happen no matter how many times I re change them one after one. What is the reason of it? If any one have any clue please share that with me. I check my \"image name\" and \"size\", no problem in there. I set these splash in a Cross platform \"Cordova\" project.\nThanks in advanced. Have a nice day.\n\nAddition:\n\nI also try it with these names, but no luck.\n\n\nDefault-Portrait~iPad.png (768 × 1024)\[email protected] (1536 × 2048)\nDefault-Landscape~iPad.png (1024 × 768)\[email protected] (1024 × 768)\nList item"
] | [
"ios",
"ipad",
"splash-screen"
] |
[
"NuxtServerError: Cannot find module 'undefined'",
"I'm trying to dynamically upload images into a vuetify carousel component from a folder I've added to the project path called 'Main'.\n\n\n\nMy component looks like:\n\n<template>\n <v-carousel>\n <v-carousel-item v-for=\"(item,i) in items\" :key=\"i\" :src=\"item.src\"></v-carousel-item>\n </v-carousel>\n</template>\n\n\n<script>\nfunction getImagePaths() {\n // var images = require.context('../../main/img/', false, /\\.png$/)\n var images = require.context(\"../../main/\", false, /\\.png$/);\n // var images = require.context('/main/', false, /\\.png$/)\n console.log(\"images\", images);\n return images;\n}\n\nexport default {\n methods: {\n imgUrl: getImagePaths()\n }\n}; \n\n\nI'm getting the:\n\nNuxtServerError: Cannot find module 'undefined' \n\n\n(screenshot above) How can I fix this?\n\nEDIT: if I change the Script tag to:\n\n <script>\n// function getImagePaths() {\n// // Load locally as a function.\n// const fs = require(\"fs-extra\");\n\n// var requireContext = require(\"require-context\");\n// // var images = require.context('../../main/img/', false, /\\.png$/)\n// var images = require.context(\"../../main/\", false, /\\.png$/);\n// // var images = require.context('/main/', false, /\\.png$/)\n// console.log(\"images\", images);\n// return images;\n// }\n\n// export default {\n// methods: {\n// imgUrl: getImagePaths()\n// }\n// };\nexport default {\n data () {\n return {\n items: [\n {\n src: 'https://cdn.vuetifyjs.com/images/carousel/squirrel.jpg'\n },\n {\n src: 'https://cdn.vuetifyjs.com/images/carousel/sky.jpg'\n },\n {\n src: 'https://cdn.vuetifyjs.com/images/carousel/bird.jpg'\n },\n {\n src: 'https://cdn.vuetifyjs.com/images/carousel/planet.jpg'\n }\n ]\n }\n }\n}\n</script>\n\n\nIt works as expected."
] | [
"javascript",
"vue.js",
"nuxt.js"
] |
[
"silverlight textbox scrollbarvisibility",
"I have a text box with verticalscrollbarvisibility set to auto. I would like to do a test to find out if the scrollbar is actually visible during runtime. I have tried the statement:\n\nif (textbox1.VerticalScrollBarVisibility == ScrollBarVisibility.Visible)\n\nbut it does not work. Any ideas?"
] | [
"silverlight",
"silverlight-3.0"
] |
[
"iOS 12 Model rendering issue",
"Having an iOS 12 model rending issue.\n\nMy app loads OBJ models with associated MTLs and textures.\n\nOn iOS 11 we were able to load up the models and they looked good:\n\n\n\nOn iOS 12, they look completely different:\n\n\n\nWe are able to make some changes after the model loads initially to make it look good, but it takes time for the iPhone to load the better looking version.\n\nHas anyone heard about/experienced this issue and know what has changed in iOS 12 (and potentially MacOS Mojave) that is causing it?\n\nThere might be two issues: 1- texture issue (as seen in chair on left) and 2- Material/MTL issue as seen in the ‘delivery drone’ on the right\n\nI don't have any code at this moment as I am not one of the developers on the project - I have been tasked with reaching out here. If you have any questions regarding the specific code I could definitely try to get some to show here. It seems to me like this might not be a code issue or bug, but rather some settings that have to changed due to changes made in iOS 12, but I can't find documentation for something that matches this."
] | [
"ios",
"scenekit",
"arkit"
] |
[
"How to convert string to array of data and send in ajax post request",
"I have \n\nvar data = decodeURIComponent($(this).attr(\"name\"));\n\n\noutput of var data is \n\nldef_index[]=5&lquality[]=0&id[]=&rdef_index[]=315&rquality[]=0&rdef_index[]=7115&rquality[]=0&rdef_index[]=50&rquality[]=0&rdef_index[]=55&rquality[]=0&rdef_index[]=5086&rquality[]=0&rdef_index[]=711&rquality[]=0&rdef_index[]=3229&rquality[]=0&rdef_index[]=7555&rquality[]=0&tslt=c9942&notes=test\n\n\nHow can i convert this variable to send it as data in jquery ajax request ?\n\n $.ajax({\n type : \"POST\",\n url : 'https://example.com/ajax/test.php',\n data: { ldef_index[]: 5,\n lquality[]: 0,\n id[]= ,\n rdef_index[]: 315,\n rquality[]: 0,\n rdef_index[]: 7115,\n rquality[]: 0,\n rdef_index[]: 50,\n rquality[]: 0,\n rdef_index[]: 55,\n rquality[]: 0,\n rdef_index[]: 5086,\n rquality[]: 0,\n rdef_index[]: 711,\n rquality[]: 0,\n rdef_index[]: 3229,\n rquality[]: 0,\n rdef_index[]: 7555,\n rquality[]: 0,\n tslt: c9942,\n notes: test },\n });"
] | [
"jquery",
"ajax"
] |
[
"How to remove click tracking in Adobe Analytics",
"Is it possible to remove default click tracking in Adobe Analytics? We want all our tracking by having full control of what is being sent to the Adobe Servers by using the s.tl() function manually.\n\nI have tried setting window.s.stackInlineStats to false as described in the documentation, but it still keeps tracking any link clicks.\n\nIs there any way of disabling default click tracking?"
] | [
"javascript",
"adobe",
"tracking",
"adobe-analytics"
] |
[
"(How) can I add a second domain to a website to improve SEO?",
"So I'm making a website for a restaurant in a village in France. The restaurant is called Le Cantou, so I've registered www.lecantou.net. I want to make sure it is easy to find with Google. Now people obviously are not going to type in the name of the restaurant in Google, they will write \"restaurant a saint cirq lapopie\", because that's the name of the village. So I've also registered http://restaurant-a-saint-cirq-lapopie.com in the hopes that that will make it clear to the visitor that this is the restaurant they want.\n\nNow my question is, I have one website with two domains: is there a way to handle the two domains so I get maximum SEO? I think duplicating the website is a bad idea. But setting a redirect from the long domain name to the original domain name also doesn't work, because then the long domain name will never show up in Google results, isn't that right?\n\nWhat do you guys recommend?"
] | [
".htaccess",
"redirect",
"dns",
"web",
"seo"
] |
[
"Gulp wait until other function is done",
"I'm using gulp to build html/css/ts with browser-sync for livereload. The problem is when first builds, building html is much faster than ts build so when browser-sync runs, it fails to load compiled JavaScript.\n\nThis is my gulpfile.js:\n\nconst gulp = require('gulp');\nconst gutil = require('gulp-util');\nconst merge = require('merge-stream');\nconst watchify = require('watchify');\nconst tsify = require('tsify');\nconst source = require('vinyl-source-stream');\n\nconst browserSync = require('browser-sync').create();\n\n\nfunction swallowError (error) {\n console.log(error.toString());\n this.emit('end');\n}\n\nfunction buildHtml() {\n return gulp.src('./src/html/index.html')\n .pipe(gulp.dest('./build'));\n}\n\nfunction buildCss() {\n return gulp.src('./src/css/app.css')\n .pipe(gulp.dest('./build'))\n .pipe(browserSync.stream());\n}\n\nfunction buildScript() {\n let opts = Object.assign({}, watchify.args, { debug: true });\n let b = watchify(opts)\n .add('./src/ts/index.tsx')\n .on('update', bundle)\n .on('log', gutil.log)\n .plugin(tsify, {\n jsx: 'react'\n });\n\n function bundle() {\n return b.bundle()\n .on('error', swallowError)\n .pipe(source('index.js'))\n .pipe(gulp.dest('./build'));\n }\n\n return bundle();\n}\n\ngulp.task('default', () => {\n browserSync.init({\n server: './build'\n });\n\n\n gulp.watch('./src/html/**.html', buildHtml);\n gulp.watch('./src/css/**.css', buildCss);\n\n gulp.watch('./build/index.html').on('change', browserSync.reload);\n gulp.watch('./build/index.js').on('change', browserSync.reload);\n\n return merge([\n buildHtml(),\n buildScript(),\n buildCss()\n ]);\n});\n\n\nYou can see the functions for build each resources, buildHtml, buildScript, buildCss. They are working great, but I don't know how to execute buildScript after buildHtml with merge-stream in this case.\n\nYou can see the 4 watch codes, which for livereload of course, watching build/index.js not working on first builds. I mean on first build, first build directory will created and html will be there also, but not index.js created yet. And this moment, browser-sync will activate, run this application but script wasn't there, so it failed. After compiled script, browser-sync not reload, looks like generated new file isn't trigger onchange event at all.\n\nThis will resolve for refresh website with F5, or just restart the gulp, but I want to fix this problem. Any advice will very appreciate it!!"
] | [
"gulp"
] |
[
"How to load sprite sheet with 5 rows and 5 columns top view in android?",
"I have a sprite sheet of 612x864 dimension with 5 rows and 5 columns .My problem is how can I load it and animate it? I want to move the cat sprite in y-axis only .I've already try but my code is not working properly. Here is my code.\n\nIn GameView.java\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.view.SurfaceHolder;\nimport android.view.SurfaceView;\n\npublic class GameView extends SurfaceView {\nprivate Bitmap bmp;\nprivate SurfaceHolder holder;\nprivate GameLoopThread gameLoopThread;\nprivate Sprite sprite;\n\npublic GameView(Context context) {\n super(context);\n gameLoopThread = new GameLoopThread(this);\n holder = getHolder();\n holder.addCallback(new SurfaceHolder.Callback() {\n\n @Override\n public void surfaceDestroyed(SurfaceHolder holder) {\n boolean retry = true;\n gameLoopThread.setRunning(false);\n while (retry) {\n try {\n gameLoopThread.join();\n retry = false;\n } catch (InterruptedException e) {\n }\n }\n }\n\n @Override\n public void surfaceCreated(SurfaceHolder holder) {\n gameLoopThread.setRunning(true);\n gameLoopThread.start();\n }\n\n @Override\n public void surfaceChanged(SurfaceHolder holder, int format,\n int width, int height) {\n }\n });\n bmp = BitmapFactory.decodeResource(getResources(), R.drawable.catsprite);\n sprite = new Sprite(this,bmp);\n}\n\n@Override\nprotected void onDraw(Canvas canvas) {\n canvas.drawColor(Color.BLACK);\n sprite.onDraw(canvas);\n}\n}\n\n\nGameLoopThread.java\n\nimport android.graphics.Canvas;\n\npublic class GameLoopThread extends Thread {\nstatic final long FPS = 10;\nprivate GameView view;\nprivate boolean running = false;\n\npublic GameLoopThread(GameView view) {\n this.view = view;\n}\n\npublic void setRunning(boolean run) {\n running = run;\n}\n\n@Override\npublic void run() {\n long ticksPS = 1000 / FPS;\n long startTime;\n long sleepTime;\n while (running) {\n Canvas c = null;\n startTime = System.currentTimeMillis();\n try {\n c = view.getHolder().lockCanvas();\n synchronized (view.getHolder()) {\n view.onDraw(c);\n }\n } finally {\n if (c != null) {\n view.getHolder().unlockCanvasAndPost(c);\n }\n }\n sleepTime = ticksPS-(System.currentTimeMillis() - startTime);\n try {\n if (sleepTime > 0)\n sleep(sleepTime);\n else\n sleep(10);\n } catch (Exception e) {}\n }\n}\n}\n\n\nSprite.java\n\nimport android.graphics.Bitmap;\nimport android.graphics.Canvas;\nimport android.graphics.Rect;\n\npublic class Sprite {\nprivate static final int BMP_ROWS = 5;\nprivate static final int BMP_COLUMNS = 5;\nprivate int x = 0;\nprivate int y = 0;\nprivate int ySpeed = 3;\nprivate GameView gameView;\nprivate Bitmap bmp;\nprivate int currentFrame = 1;\nprivate int width;\nprivate int height;\n\npublic Sprite(GameView gameView, Bitmap bmp) {\n this.gameView = gameView;\n this.bmp = bmp;\n this.width = bmp.getWidth() / BMP_COLUMNS;\n this.height = bmp.getHeight() / BMP_ROWS;\n}\n\nprivate void update() {\n if (y > gameView.getWidth() - width - y) {\n ySpeed = -5;\n }\n if (y + y < 0) {\n ySpeed = 5;\n }\n y = y + ySpeed;\n currentFrame = ++currentFrame % BMP_COLUMNS;\n}\n\npublic void onDraw(Canvas canvas) {\n update();\n int srcX = currentFrame * width;\n int srcY = 1 * height;\n Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);\n Rect dst = new Rect(x, y, x + width, y + height);\n canvas.drawBitmap(bmp, src, dst, null);\n}\n}"
] | [
"java",
"android",
"animation",
"sprite"
] |
[
"Multiple databases in Laravel PHP",
"We are building a multi-tenant application. Through the admin interface, we will add new tenant as and when required. This application needs to work with 1+n database. \n\n1 Main DB with about 5 tables. \nn DBs for each tenant that we create. The tenant specific database may reside on the separate db server altogether. \n\nQuestion: \n\n\nWhat is the best way to achieve this ?\nWhere do we store the the db connection information for each tenant ?\nSometime, we may have to fire join queries on tables in tenant and main db.\nHow would this work?\n\n\nThanks in advance for reading and any possible solution please."
] | [
"php",
"laravel",
"multi-database"
] |
[
"Convert string to number with zero decimal and not to be a string",
"I'm working with eBay API and for some stupid reason prices have to be in double format even if zero.\n\nFor example:\nI have a price of value 100\nI need to send it to eBay as 100.00 but it must NOT be a string.\n\nNo matter what I've tried I get float(100) and not 100.00\n\nI've tried (double), (int), doubleval() without any success.\n\nnumber_format is out of the question because output is a string.\n\nI've spend way too much time trying to get this right.\n\nPlease help.\n\nLE:\nValue passed to eBay: [value] => 120\nReturned error: You have entered invalid start price or Buy It Now price.\n\nI'm using ebay-sdk-php and the type I'm supposed to pass is documented here\n\neBay required type to be passed"
] | [
"php"
] |
[
"Create List from comma seperated String making braced strings as one object",
"I am using \n\nList<String> items = Arrays.asList(stringValue.split(\"\\\\s*,\\\\s*\"));\n\n\nfor converting comma separated string into list. \nBut this is not working for one of the case.\nI have input String as \n\njohn, M, 1001, 400000, 26, [101,\n301, 201]\n\n\nWhat I need is the last braced String [101, 301, 201] should be read as a single string.\nAbove code separate out these into separate String.\nPlease let me know how can we achieve this.\n\nThanks"
] | [
"java",
"regex",
"string",
"list"
] |
[
"How can I get all the weekdays(Tuesday, Thursday, Friday, Saturday) within the year",
"I'm using Moment.js. Here is my code: \n\n `const duration = moment.duration(7, 'days');\n const maximumDate = moment().endOf('year');\n const availableDays = [0, 1, 3];\n const days = [0, 1, 2, 3, 4, 5, 6];\n\n const unavailableDays = availableDays.map((el, i) => {\n return el; \n }); //will return [0,1,2];\n\n let initialClosedDays = days.filter(day => {\n return !indexes.includes(day);\n }); //will return [2,4,5,6];\n\n initialClosedDays &&\n initialClosedDays.map(day =>\n getDayOfYear.push(\n moment(day, 'e')\n .dayOfYear()\n .add(duration.clone())\n .max(maximumDate),\n ),\n );`\n\n\nHowever, I'm getting .add() is not a function. I know that nesting functions like these won't work but I tried adding the function one by one and still not working. Please help!"
] | [
"javascript",
"date",
"weekday"
] |
[
"jQuery UI is disabeling links in SVG image ( xlink:href )",
"I have an embedded SVG image which contains some links to external URLs. When adding jQuery UI to the document, the links of the SVG won't work anymore. I set up a fiddle to demonstrate the behavoir. When removing jQuery UI from the \"External Resources\" the links will work.\n\nThe SVG links are made like this:\n\n<a xlink:href=\"/hamburg-nord\" xlink:title=\"SomeName\">\n<path id=\"nord\" d=\".....a lot of image-data-coordinates..........\"/>\n</a>\n\n\nI suspect, it is a bug in jQuery UI. But what can i do to make the links work? Is there a workaround?"
] | [
"javascript",
"jquery",
"jquery-ui",
"jquery-plugins",
"svg"
] |
[
"Getting mean for n-largest values in each group",
"Let's say I have a data frame named df as below in Pandas : \n\n id x y\n 1 10 A\n 2 12 B\n 3 10 B\n 4 4 C\n 5 9 A\n 6 15 A\n 7 6 B\n\n\nNow I would like to group data by column y and get mean of 2 largest values (x) of each group, which would look something like that\n\ny \nA (10+15)/2 = 12.5\nB (12 + 10)/2 = 11\nC 4\n\n\nIf I try with df.groupby('y')['x'].nlargest(2), I get\n\ny id \nA 1 10\n 6 15\nB 2 12\n 3 10\nC 4 4\n\n\nwhich is of type pandas.core.series.Series. So when I do df.groupby('y')[x].nlargest(2).mean() I get mean of all numbers instead of 3 means, one for each group. At the end I would like to plot the results where groups would be on the x axis and means on y axis, so I'm guessing I should get rid of column 'id' as well? \nAnyone knows how to solve this one? Thank you for help!"
] | [
"python",
"pandas",
"pandas-groupby"
] |
[
"JavaScript: Strings are equal but comparing returns false",
"I'm currently developing theme for Textual IRC and I want to compare the \"Topic is ...\" messages to the topic displayed in the channels topic bar, to delete them if the are the same.\n\nThe topic that causes problems has both Umlaute and a URI in it and looks like the following:\n\n++ Frische Austern ++ Nächste Sitzung: https:/some/uri/that/can/contain/umlaute\" ++\n\nWhen I print both the old topic and the new topic, they look exactly the same, down to the trailing and leading whitespaces (I used trim() to eliminate them).\n\nThe comparison is done with \n\nif(oldTopic === newTopic){\n // do stuff\n}\n\n\nWhat I've tried so far\n\nTypecheck\n\nI used typeof to make sure both them are of the type string and not Object\n\nUmlaut elimination\n\nI used replace(/ä/g, 'ae') to eliminate the Umlaute\n\nURL Elimination\n\nI used replace(/\\//g, '_') to get rid of the forward slashes\nI used escape() to escape non unicode characters\n\nUnfortunately none of it worked. Again if I use console.log to show the two strings, they are exactly the same. I was expecting some Unicode stuff, that you can represent ä in different ways, but replacing it didn't work either.\n\nI've tried but I reached my limit of my JavaScript knowledge. I have really no idea why it's not working. The code has worked on some other topics, that did neither involve any Umlaute nor an URL.\n\nIf any of you happens to know an answer I'd be very thankful.\n\nKind regards and thanks in advance!"
] | [
"javascript",
"string",
"string-comparison",
"non-ascii-characters"
] |
[
"XML character entity reference",
"I'm parsing some data from an XML document then write it back to another XML document. I face a problem where the data in the original one is written in CDATA section.\n\nThis is an example of the input :\n\n<actions><![CDATA[<div>\ncheck that&#39;s is sent </div>\n\n\nI simply replaced div , p etc. with substring function, but my output was \n\n<logical>check that &amp;#39; is sent </logical>\n\n\nI want the content of the output to appear to be the same as the input:\n\n<logical>check that's is sent </logical>\n\n\nI tried using substring as well, like this:\n\nstring= string.replaceAll(\"&#\\\\d+;\", \" 39\");\n\n\nbut the problem now is that this number is variable so I need to replace the current regex with the number inside the &#numl;\n\nAlso the string may include many numbers so I couldn't just search for a number inside it , something like this: \n\ncheck that&#39;s is sent and&#42;s is received"
] | [
"java",
"xml"
] |
[
"django - modelforms and react - DRY",
"I'm adding React to my django web app and I'm not sure how to proceed with forms. \n\nIn pure django, you can just render a form with {{my_form.as_p}} and this will create inputs for all the fields with the correct input type. If you use ModelForm, you don't even need to create a definition for the fields because it will just take it from the django model definition, keeping the DRY principle very nicely.\n\nWith React I understand that it's best to give the data as json and let React take care of rendering and not use django template rendering. But with forms, this means that I have to write all the form fields by hand. Not only this is much more effort, but also it is breaking the DRY principle because I have to have two definitions of the same thing in two separate places that I need to keep in sync.\n\nIs there any library/best practice for this? Is there any way to create a json with the form definition as well as the data, and some way to render this in react without having to manually write all the fields?"
] | [
"django",
"reactjs",
"django-forms"
] |
[
"statement select with value in label",
"I make a statement in below but its showing the statement instead of value \n\n Dim amt As String = Nothing\n amt = \"select amount from [xx].[dbo].[xx] where referance_number=\" & Page.Request.QueryString(\"trackidx\") & \"\"\n Dim objs As New DATAAccess\n objs.insert_dataset_Access_accdb_test(amt)\n\n vpc_Amount.Text = amt"
] | [
"asp.net",
"vb.net"
] |
[
"Azure Batch Job Scheduling: Task doesn't run recurrently",
"My objective is to schedule an Azure Batch Task to run every 5 minutes from the moment it has been added, and I use the Python SDK to create/manage my Azure resources. I tried creating a Job-Schedule and it automatically created a new Job under the specified Pool. \n\n job_spec = batch.models.JobSpecification(\n pool_info=batch.models.PoolInformation(pool_id=pool_id)\n )\n schedule = batch.models.Schedule(\n start_window=datetime.timedelta(hours=1),\n recurrence_interval=datetime.timedelta(minutes=5)\n )\n setup = batch.models.JobScheduleAddParameter(\n 'python_test_schedule',\n schedule,\n job_spec\n )\n batch_client.job_schedule.add(setup)\n\n\nWhat I did is then add a task to this new Job. But the task seems to run only once as soon as it is added (like a normal task). Is there something more that I need to do to make the task run recurrently? There doesn't seem to be much documentation and examples of JobSchedule either.\n\nThank you! Any help is appreciated."
] | [
"python",
"azure",
"job-scheduling",
"azure-batch"
] |
[
"Processing JS svg load - Google Appengine",
"i have a problem. I want to use my Processing code on the Google appengine cloud. I load the svg file asynchronously visa @psj preload tag and i have the map1.svg in the same directory as the .pde file, so I just want to display a PShape but it doesn't show up. I have the following processing code:\n\nEDITED SEE BELOW ! \n\nI have all the files (.pde, processing lib, geoloc.js) and the map1.svg in the same folder ../static/processing/ .\n\nHas anybody managed to get a processing file on the app engine, where the script uses loadImage() or loadShape() ? By the way the geoloc.js library is working and the processing code also works if I don't use the loadShape function, so i suspect that the path to map1.svg isn't correct ?\n\nEDIT !!!!!!!!!\n\nOk so now i have stripped the files as much as possible and the map is still not shown on the appengine, the .html works if i open it in my desktop, so I still supspect that it has something to do with the loading of the map1.svg file in the processing code. I must point out that the processing .pde source is found it's just the map that is not shown !\n\nHere is my crunched processing code:\n\nEDITED AGAIN ! IT'S WORKING NOW...THE PATH SHOULD BE MORE SPECIFIC - relative !\n\n/* @pjs preload=\"../static/processing/map1.svg\"; */\n\nPShape worldMap;\n\nvoid setup ()\n{\n size(500, 500);\n worldMap = loadShape(\"../static/processing/map1.svg\");\n}\n\nvoid draw ()\n{\n shape(worldMap, 0, 0, 500, 500);\n\n}\n\n\nAnd the HTML:\n\n<!DOCTYPE html>\n<head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n <title>hiToYouToo : Built with Processing and Processing.js</title>\n <meta name=\"Generator\" content=\"Processing\" />\n <!--[if lt IE 9]>\n <script type=\"text/javascript\">alert(\"Your browser does not support the canvas tag.\");</script>\n <![endif]-->\n <script src=\"../static/processing/processing.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\">\n // convenience function to get the id attribute of generated sketch html element\n function getProcessingSketchId () { return 'hiToYouToo'; }\n </script>\n</head>\n<body>\n <div id=\"content\">\n <div>\n <canvas id=\"hiToYouToo\" data-processing-sources=\"../static/processing/hiToYouToo.pde\"\n width=\"500\" height=\"500\">\n <p>Your browser does not support the canvas tag.</p>\n <!-- Note: you can put any alternative content here. -->\n </canvas>\n <noscript>\n <p>JavaScript is required to view the contents of this page.</p>\n </noscript>\n </div>\n </div>\n</body>"
] | [
"javascript",
"jquery",
"google-app-engine",
"svg",
"processing"
] |
[
"MIPS: arrays are not printing correctly",
"So, I'm inputting two arrays and printing one of them (for now), but when I go to print one of the arrays, it prints some values of one and some values of the other array. I have no idea why this would happen. Please help. Here's my code, followed by an example output: \n\n.data\n\n title: .asciiz \"Find The Product of Two Matrices\\n\\n\"\n menuString: .asciiz \"Menu\\n\\n\"\n option1: .asciiz \"1. Enter values and find product\\n\"\n option2: .asciiz \"2. Exit program\\n\\n\"\n inputString: .asciiz \"Enter selection: \"\n\n promptSize: .asciiz \"\\nEnter row size of square matrix: \"\n promptRow: .asciiz \"Row: \"\n promptCol: .asciiz \"Col: \"\n promptMatrix1Float: .asciiz \"Enter a first matrix's float: \"\n promptMatrix2Float: .asciiz \"Enter a second matrix's float: \"\n answer: .asciiz \" Answer:\"\n printFloat: .asciiz \"\\nA Float: \"\n inputFirstMatrix: .asciiz \"\\n\\nInput First Matrix(left-to-right and top-to-bottom):\\n\\n\"\n inputSecondMatrix: .asciiz \"\\n\\nInput Second Matrix(left-to-right and top-to-bottom):\\n\\n\"\n\n\n.globl main\n.text\n\n################################### INPUT SIZE AND MATRICES ####################\n\n\nsize: li $v0, 4\n la $a0, promptSize\n syscall\n\n li, $v0, 5\n syscall\n\n\n\n add $t1, $v0, $v0\n li $t0, 0\n\n li $v0, 4\n la $a0, inputFirstMatrix\n syscall\n\nL1: beq $t0, $t1, L2IndexInit\n\n li $v0, 4\n la $a0, promptMatrix1Float\n syscall\n\n li $v0, 6 #6 is the syscall code for get float\n syscall \n\n sll $t3, $t0, 3\n add $t3, $a2, $t3\n s.d $f0, 0($t3) # Store $f0 at memory location .\n\n\n addi $t0, $t0, 1\n\n j L1 \n\nL2IndexInit:\n\n\n li $v0, 4\n la $a0, inputSecondMatrix\n syscall\n\n li $t0, 0\n\n\nL2: beq $t0, $t1, PrintIndexInit\n\n li $v0, 4\n la $a0, promptMatrix2Float\n syscall\n\n li $v0, 6 #6 is the syscall code for get float\n syscall \n\n sll $t3, $t0, 3\n add $t3, $a1, $t3\n s.d $f0, 0($t3) # Store $f0 at memory location .\n\n\n addi $t0, $t0, 1\n\n j L2 \n\n############################## PRINT MATRIX ################################################# \n\nPrintIndexInit: \n li $t0, 0\n\nPrintMatrix: beq $t0, $t1, End\n\n sll $t4, $t0, 3\n add $t4, $a2, $t4\n l.d $f12, 0($t4)\n\n li $v0, 4\n la $a0, printFloat\n syscall\n\n li $v0, 2 #2 is the syscall code for print float (arg. to print in f12)\n syscall\n\n addi $t0, $t0, 1\n\n j PrintMatrix\n\n\n\n\n\n\n####################################### MAIN FUNCTION AND END ######################\n\nEnd:\n lw $ra, 0($sp)\n addi $sp, $sp, 4\n jr $ra\n\n\n\n\nmain:\n li $v0, 4 \n la $a0, title\n syscall\n\n\n addi $sp, $sp, -4\n sw $ra, 0($sp)\n jal size\n li $v0, 10\n syscall\n\n\n\n\nexample output:\n\n\nFind The Product of Two Matrices\n\n\nEnter row size of square matrix: 2\n\n\nInput First Matrix(left-to-right and top-to-bottom):\n\nEnter a first matrix's float: 2.3\nEnter a first matrix's float: 4.3\nEnter a first matrix's float: 6.5\nEnter a first matrix's float: 4.3\n\n\nInput Second Matrix(left-to-right and top-to-bottom):\n\nEnter a second matrix's float: 3.2\nEnter a second matrix's float: 6.5\nEnter a second matrix's float: 8.9\nEnter a second matrix's float: 3.2\n\nA Float: 6.50000000\nA Float: 8.89999962\nA Float: 3.20000005\nA Float: 4.30000019"
] | [
"arrays",
"floating-point",
"mips"
] |
[
"Facebook Graph API private_replies returning error 10903 This user cant reply to this activity",
"I am attempting to write an App that sends a message with private_replies, but it always returns the following error:\n\n{\n message: '(#10903) This user cant reply to this activity',\n type: 'OAuthException',\n code: 10903,\n fbtrace_id: 'HUzYz7nKBPV'\n}\n\n\nI have read a number of solutions, but none seem to be working for me, so I'm not sure if I've missed something or if the something on the Facebook API side has changed.\n\nThe App I am creating (currently based on a number of tutorials) waits for a user to mention a specific word in a comment on my page and will then send a message to the user via private_replies.\n\nWhen I debug my Apps Page Access Token, I get this info:\n\nAccess Token Info\nApp ID 18**********164 : MTestChatBot\nType Page\nPage ID 25**********999 : MTestPage\nApp-Scoped User ID\nLearn More\n10**********048 : <MY NAME>\nUser last installed this app via API N/A\nIssued 1520423580 (on Wednesday)\nExpires Never\nValid True\nOrigin Web\nScopes manage_pages, pages_show_list, read_page_mailboxes, pages_messaging, pages_messaging_phone_number, pages_messaging_subscriptions, public_profile\n\n\nOne of the 'solutions' I have read states that I need to have to App reviewed by Facebook first to get the read_page_mailboxes subscription, but as shown above, I should already have that permission. It also seems odd to get an App reviewed before I can test it.\n\nI have tried giving a friend developer access to the App and Admin rights to the page. When they post comments I get the same error.\n\nI have tried Publishing the page and all comments still get the same result.\n\nIn case it's of any use, here is a rough version of the App code:\n\n'use strict';\n\nconst FB_PAGE_ACCESS_TOKEN = process.env.FB_PAGE_ACCESS_TOKEN;\nconst FB_VERIFY_TOKEN = process.env.FB_VERIFY_TOKEN;\n\nconst request = require('request');\nconst express = require('express');\nconst body_parser = require('body-parser');\nconst app = express().use(body_parser.json());\n\napp.listen(process.env.PORT);\n\napp.get('/webhook', (req, res) => { \n // Parse params from the webhook verification request\n let mode = req.query['hub.mode'];\n let token = req.query['hub.verify_token'];\n let challenge = req.query['hub.challenge'];\n\n // Check if a token and mode were sent\n if (mode && token) { \n // Check the mode and token sent are correct\n if (mode === 'subscribe' && token === FB_VERIFY_TOKEN) { \n // Respond with 200 OK and challenge token from the request\n console.log('WEBHOOK_VERIFIED');\n res.status(200).send(challenge); \n } else {\n // Responds with '403 Forbidden' if verify tokens do not match\n res.sendStatus(403); \n }\n }\n});\n\napp.post('/webhook', (req, res) => { \n // Parse the request body from the POST\n let data = req.body;\n\n if (data.object === 'page') {\n data.entry.forEach(function(pageEntry) {\n var pageID = pageEntry.id;\n var timeOfEvent = pageEntry.time;\n\n if (pageEntry.hasOwnProperty('changes')) {\n pageEntry.changes.forEach(function(changes){\n if(changes.field === 'feed' && changes.value.item === 'comment' && changes.value.verb === 'add'){\n var messageData = {\n message: 'Hello'\n };\n privateReply(messageData, changes.value.comment_id);\n }\n });\n }\n });\n }\n})\n\nfunction privateReply(messageData, comment_id) {\n request({\n uri: 'https://graph.facebook.com/v2.12/' + comment_id + '/private_replies',\n qs: { access_token: FB_PAGE_ACCESS_TOKEN },\n method: 'POST',\n json: messageData\n }, function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body);\n } else {\n console.error('Private Replies Failed: ', response.statusCode, response.statusMessage, body.error);\n }\n }); \n}\n\n\nAll advice gratefully received."
] | [
"javascript",
"facebook",
"facebook-graph-api",
"chatbot"
] |
[
"Changing the size of lua numbers in compiled lua script",
"My goal is to decompile, modify and recompile a lua script. I can do this easily expect that the header of the resulting binary file changes from the original one.\nThe binary chunk I decompile starts with the following header:\n\n\n 1b4c 7561 5100 0104 0804 0400\n\n\nThe header in the generated file is:\n\n\n 1b4c 7561 5100 0104 0804 0800\n\n\nAs you can see the only thing that changes between them is the value of Size of lua_Number (source, see page 7)\n\nI've tried changing the target platform and even the version but couldn't get the correct header in the end. Is there by any chance a way to set this as an option in some way?"
] | [
"lua",
"bytecode",
"bytecode-manipulation",
"luac",
"luadec"
] |
[
"My java source files cannot be commited",
"i am creating a small Java project and wish to put in on GitHub using eclipse.\n\nEverything is working fine until i go to Team -> Commit, my source files aren't there.\n\nI don't know what to do so i could commit my .java files, any ideas?\n\nHere is a screenshot:\n\n\n\nAs you can see, there were about 4 files in the Files section, but none of them were the java files."
] | [
"java",
"eclipse",
"github",
"egit"
] |
[
"Reading the builtin python modules",
"Possible Duplicate:\n How do I find the location of Python module sources? \n\n\n\n\nI dont understand how to read the code in the builtin python modules. I know how to find out whats in a module for example,\n\nimport os;\n\ndir(os)\n\n\nBut when I try to look for example for the function listdir I cannot find a def listdir to read what it actually does."
] | [
"python",
"module",
"built-in"
] |
[
"C# Pars html String mark text",
"i want to pars a HTML string like:\n\n<b><a href=\"/wiki/Schizophrenie\" title=\"Schizophrenie\">Schizophrenie</a></b> ist eine schwere psychische Erkrankung. Sie\n\n\nor \n\n <h2 class=\"sectionedit2\" id=\"zu_treffende_massnahmen\">zu treffende Maßnahmen</h2>\n<div class=\"level2\">\n<ul><li class=\"level1\"><div class=\"li\">An- und Abfahrtswege freihalten; Einweisung nachrückender Kräfte, evtl. Einbahnregelung vorsehen</div>\n\n\nSo that all the Text gets some extra font style elements (<font style = \"color:red;\">..</font>) like:\n\n<b><a href=\"/wiki/Schizophrenie\" title=\"Schizophrenie\"><font style = \"color:red;\">Schizophrenie</font></a></b><font style = \"color:red;\"> ist eine schwere psychische Erkrankung. Sie</font>\n\n\nor\n\n<h2 class=\"sectionedit2\" id=\"zu_treffende_massnahmen\"><font style = \"color:red;\">zu treffende Maßnahmen</font></h2>\n<div class=\"level2\">\n<ul>\n<li class=\"level1\"><div class=\"li\"><font style = \"color:red;\"> An- und Abfahrtswege freihalten; Einweisung nachrückender Kräfte, evtl. Einbahnregelung vorsehen</font></div>\n\n\nIs there an easy way to do it?"
] | [
"c#",
"html",
"wpf",
"parsing"
] |
[
"How to draw onto a PictureBox image when control resizes?",
"I am using the pictureBox_Paint event to try and draw an overlay onto the image in a PictureBox. \nThis is working fine until I resize the PictureBox (set to use SizeMode.Zoom), when I do this the overlay graphic is drawn off position by the margin between the image and the edge of the PictureBox. I guess I need to use the ImageRectangle somehow but this is not public."
] | [
"winforms",
"picturebox"
] |
[
"How to use jquery with click function",
"$(document).ready(function () {\n$('#cont6').hide();\n$('#cont5').hide();\n$('#cont4').hide();\n$('#cont3').hide();\n$('#cont2').hide();\n$('#cont1_a').click(function () {\n $('#cont1').hide();\n $('#cont2').fadeIn(1000, function () {\n if ($.browser.msie && parseInt($.browser.version) == 7) {\n this.style.removeAttribute('filter');\n }\n });\n return false;\n}); });\n\n\nI have got another hyper link which needs to do the same function as above when clicked how can i integrate both the click function in it so that i don't need to duplicate the code, should i use AND operator for it , any suggestion will be highly appreciated"
] | [
"jquery",
"html",
"click"
] |
[
"How to prevent user from loading \"child\" pages that should be loaded with ajax",
"I have this page, with a Default.aspx working as a \"master\" would work, and loading child pages with jQuery's load() function. Something Like this:\n\n <ul id=\"navigation>\n <li><a href=\"Item1.aspx\"> Item 1</a></li>\n <li><a href=\"Item2.aspx\"> Item 2</a></li>\n </ul>\n <div id=\"contend\">\n <!-- Ajax loaded pages goes here -->\n </div>\n <div id=\"footer\">\n </div>\n\n\nThe problem is: when the user clicks on some item and, let's say, chooses to open on a new window (tab), He will obviously see just the items from that page, not the navigation, footer and anything else from the default page...\n\nI'm searching for a workaround..\n\nmaybe with anchor control via url? like #item1"
] | [
"asp.net",
"ajax",
"jquery"
] |
[
"Git checkout existing branch at tag",
"I'm in a branch now and I am about to create a tag. Creating a tag will save the state of ALL of my branches correct? But later if I want to come back to this tag, how do I check it out with a specific branch? Because if I checkout a tag which contains state for all of my branches, how do I actually go to a specific branch within that tag? I don't want to create a NEW branch with\n\ngit checkout -b branch_name tag_name\n\n\nI want to checkout an EXISTING branch on this tag when I come back to it later. I would imagine it would be something like\n\ngit checkout branch_name tag_name\n\n\nbut I can't find an example of that command anywhere."
] | [
"git",
"version-control",
"github"
] |
[
"Can't get htaccess rule to work: force SSL on all pages, force non-SSL on two specific pages",
"I am no htaccess expert, but after Googling for two hours I gave up. Maybe you can help me?\n\nI have my entire site on SSL. However, I have two pages that reference non-secure dynamic content from elsewhere. I need these to be on http instead of https.\n\nThe first part of my rules work. All the site is forced to SSL except for those two pages. However, the last part doesn't: force those two pages to non-SSL. It is probably very stupid but does anyone see where I go wrong?\n\n#add www. if missing WORKS\nRewriteEngine on\nRewriteCond %{HTTP_HOST} ^[^.]+\\.[^.]+$\nRewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]\n\n#force SSL/https WORKS\nRewriteCond %{HTTPS} !=on\nRewriteCond %{REQUEST_URI} !^/webshop2/localize\\.php\nRewriteCond %{REQUEST_URI} !^/webshop2/layoutstripper\\.php\nRewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]\n\n#force http DOES NOT WORK\nRewriteCond %{HTTPS} on\nRewriteCond %{REQUEST_URI} ^/webshop2/localize\\.php [NC]\nRewriteCond %{REQUEST_URI} ^/webshop2/layoutstripper\\.php [NC]\nRewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]"
] | [
"apache",
".htaccess"
] |
[
"How to enable -mno-outline-atomics AArch64 flag?",
"I've been trying to cross compile an open source library for AArch64.\nWhen I run an executable linking against this library on a Raspberry Pi 4 (running a 64-bit OS), I get an Illegal Instruction error.\nI created a github issue and the library developer suggested I enable the -mno-outline-atomics compiler flag (more details on the github issue here). More details on the flag itself can be found here.\nSo I edited the aarch64 cmake toolchain file (found here) to include the following:\nset(CMAKE_C_FLAGS "-march=armv8-a -mno-outline-atomics")\nset(CMAKE_CXX_FLAGS "-march=armv8-a -mno-outline-atomics")\n\nHowever, when I try to compile the library, I get the following error messages:\n-- CMAKE_TOOLCHAIN_FILE = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/toolchains/aarch64-linux-gnu.toolchain.cmake\n-- CMAKE_INSTALL_PREFIX = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/install\n-- The C compiler identification is GNU 7.5.0\n-- The CXX compiler identification is GNU 7.5.0\n-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc\n-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - broken\nCMake Error at /usr/local/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):\n The C compiler\n\n "/usr/bin/aarch64-linux-gnu-gcc"\n\n is not able to compile a simple test program.\n\n It fails with the following output:\n\n Change Dir: /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp\n \n Run Build Command(s):/usr/bin/make cmTC_65def/fast && /usr/bin/make -f CMakeFiles/cmTC_65def.dir/build.make CMakeFiles/cmTC_65def.dir/build\n make[1]: Entering directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'\n Building C object CMakeFiles/cmTC_65def.dir/testCCompiler.c.o\n /usr/bin/aarch64-linux-gnu-gcc -march=armv8-a -mno-outline-atomics -o CMakeFiles/cmTC_65def.dir/testCCompiler.c.o -c /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp/testCCompiler.c\n aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?\n CMakeFiles/cmTC_65def.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_65def.dir/testCCompiler.c.o' failed\n make[1]: *** [CMakeFiles/cmTC_65def.dir/testCCompiler.c.o] Error 1\n make[1]: Leaving directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'\n Makefile:138: recipe for target 'cmTC_65def/fast' failed\n make: *** [cmTC_65def/fast] Error 2\n\n\nWhy is the compiler complaining about this: unrecognized command line option ‘-mno-outline-atomics’?\nHow can I properly enable the flag using CMake?"
] | [
"c++",
"gcc",
"cmake",
"arm64"
] |
[
"get_categories and get_terms are ignoring non-empty terms",
"So I have an extremely basic query here, which should list all my product categories:\n\n $categories = get_terms([\n 'taxonomy' => 'product_cat',\n 'orderby' => 'name',\n 'number' => 0,\n 'parent' => 0,\n ]); \n\n\nI have 10 parent categories, and it gets 7 and leaves out 3. I've also tried get_categories, to no avail. All 10 parent categories:\n\n\naren't empty\nare published and publicly visible.\nhave no parents of themselves\n\n\nAnyone have any idea what could be causing it?"
] | [
"wordpress",
"woocommerce",
"wordpress-theming"
] |
[
"calling php functions with ajax instead of php files",
"Is it standard practice to be creating lots of separate .php files when using ajax? or is there a way to call certain functions with relative ease?\n\nfor example, for my checkusername code I have to create a separate php file that does this\n\nxhttp.open(\"GET\", \"CheckUsername.php?q=\"+name, true);\n\n\nand now if I was to go and create a bunch of ajax calls I will need lots of separate .php files. is there an easy way to group these up? whether it be in functions or even a folder that I can put them all in?"
] | [
"php",
"ajax"
] |
[
"How to add lights to make a scaned model looks real using AR.js",
"I am new to AR.js and want to make a very simple demo with AR.j. I get a 3d scanning model from sketchfab,and put it into AR.js.\nI tried light=\"type: point\" intensity: 5.1, but the light doesn't looks like the model on sketchfab. When I tried with light=\"type: ambient\", the whole model is black.\n\n<a-entity id=\"point_light_1\" light=\"type: point; intensity: 5.1;\" position=\"0 0 0\"></a-entity>\n\n\nHere is the example from sketchfab and what I get. How could I get the same render effect like sketchfab shows?"
] | [
"javascript",
"ar.js"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.