texts
sequence
tags
sequence
[ "Converting a nested type into a monad transformer stack", "I’m having some trouble with one of the exercises in the Monad Transformers chapter from Haskell Programming From First Principles. Specifically, we are given a structure that looks like (const (Right (Just 1))) and are asked to finish the following: \n\nimport Control.Monad.Trans.Except\nimport Control.Monad.Trans.Maybe\nimport Control.Monad.Trans.Reader\n\nembedded :: MaybeT (ExceptT String (ReaderT () IO)) Int\nembedded = ??? (const (Right (Just 1)))\n\n\nI assume this means that we cannot change the nested structure, although the instructions are only to \"make it work.\"\n\nI've gone through a few routes before concluding that I am stuck. So far, from what I gather, monad transformers are most commonly created with a combination of lifts and dos — aside from the SO Q&As, Diehl summarizes pretty well here. \n\nI've also been working with the map<Monad>T variants from the transformers library to get some interesting / fun results, but I can't seem to find out how to solve the original problem. Any hints would be appreciated — however, if you post a solution, please use the spoiler markup (although I've never seen it used on anywhere other than in Puzzling)." ]
[ "haskell", "nested", "monads", "monad-transformers" ]
[ "Get dynamic time and timeout after certain amount of time", "I am implementing an online exam portal, so that a user can start the mockup test(exam) and choose the anwsers for each question and proceed to the next question. \nRules for the exam is to give 100question to complete in 75mins. \nSo I need my back-end code to check each bit of time and track if the current_time not exceed 75min from the Exam_Start_time\n\nHow is this possible.\n\nI made it like this for time being\n$Start_time\n$Current_time\nand then check the difference on each page refresh and redirect if 75min limit exceed\n\nBut I think its not the better way and if we can trace it dynamically and redirect when the 75min mark reaches to the process the exam result it would be great.\n\nCan any one help me in this context,\nIs there a way if its not possible with PHP, HTML to use Javascript to achieve this\n\nHope to hear from you stacker.....thanks in advances" ]
[ "php", "javascript", "mysql", "html" ]
[ "Disbale tablesorter from sorting by clicking on header but stil support sort by drop down option", "I have found this example in stackoverflow. This is very helpful.\n\nhttp://jsfiddle.net/Mottie/Yke6M/\n\nRight now it allows two ways to sort table contents:\n\n1) sort by clicking on each table header\n2) sort the table by selecting a option drop down.\n\nMy requirement is only sort with drop down menu.\n I want to remove the feature of sorting by clicking on table header.\n\ncan i disable clicking on header?\n\nI am guessing that I can add some css to table header which makes it unclickable. But I dont know if there is something like that in css.\n\nThanks" ]
[ "jquery", "jquery-ui", "jquery-plugins", "tablesorter" ]
[ "Protractor: deleteAllCookies not working", "I need to delete the browser cookies after each test in protractor. I am calling the following method to clear all cookies.\n\n this.After(function () {\n browser.driver.manage().deleteAllCookies()\n })\n\n\nAlthough this method is called after each test it does not clear the cookies." ]
[ "angularjs", "cookies", "protractor" ]
[ "How do I make ID a random 8-digit alphanumeric in Rails 4?", "I'm building a simple application where visitors can create/edit a post and get a permalink to their post, but I want the links to be a little longer and harder to guess.\n\nI found \"how to make ID a random 8 digit alphanumeric in rails?\" that does what I'm trying to do on my site, but it doesn't work on rails 4 as \"attr_accessible\" is no longer available." ]
[ "ruby-on-rails", "ruby", "random", "permalinks" ]
[ "Override border color for disabled FlatStyle ComboBox", "I have a custom ComboBox in a C# WinForms application, and I have been successful in overriding the background color when its both enabled and disabled, and overriding the border when its enabled, but when the control is disabled I cannot figure out how to change the color of its border.\n\nCurrently, I am catching the WndProc messages being sent to the custom control, something like this:\n\nprotected override void WndProc (ref Message m)\n{\n base.WndProc(ref m);\n\n if (m.Msg == WM_PAINT)\n {\n // set the enabled border color here, and it works\n using (var g = Graphics.FromHwnd(Handle)\n {\n using (var p = new Pen(Color.Black))\n {\n g.DrawRectangle(p, 0, 0, Width - 1, Height - 1);\n }\n }\n }\n if (m.Msg == WM_CTLCOLORSTATIC)\n {\n // set the disabled background color here\n ]\n if (m.Msg == WM_NCPAINT)\n {\n // try to set the disabled border color here, but its not working\n using (var g = Graphics.FromHwnd(Handle)\n {\n using (var p = new Pen(Color.Black))\n {\n g.DrawRectangle(p, 0, 0, Width - 1, Height - 1);\n }\n }\n }\n}\n\n\nHere are some images to help understand the problem, I have chosen colors that specifically highlight the problem area, these are not the actual colors I would use:\n\nEnabled comboBox:\n\n\n\nDisabled comboBox:\n\n\n\nNotice the thick SystemGrey border being applied when the comboBox is disabled. This is what I want to remove, it looks worse on older windows systems, these screenshots were taken on Windows 10 but I'm targeting Windows Server 2012 where it produces a strange \"halo\" type effect that extends outside the control.\n\nLooking at the MSDN, it seems like WM_NCPAINT is the message I want, but stepping through the code the border appears to have already been drawn at this point. I also tried looking at the MSDN for WM_CTLCOLORSTATIC, since the name seems promising, but it doesnt seem like it triggers anything but background colors to be set.\n\nIs there another message I should be looking at, or am I approaching this the wrong way? I tried stepping through and looking at each message, but I just cant tell which one is triggering the call for the border to be set.\n\nEdit: See below for the solution, this is a quick and dirty example of what I wanted to achieve, and what the solution code will do:" ]
[ "c#", "winforms" ]
[ "looping sounds in windows phone 7", "I am trying to get a sound to loop when a button is pressed, and then stop the sound when the same button is pressed again. I have multiple sounds that are playing at the same time (all are looping), all the sounds should be able to start and stop in any order. \n\nMy Issue?\n\nIf you press one button then the sound loops fine and it will stop when the button is pressed again, however if you press one button (so one sound is looping) and then press another (to try and play both sounds at the same time) then the first sound is stopped, and I cant for the life of me figure out why?\n\nMy code:\n\n private void button3_Click(object sender, RoutedEventArgs e)\n {\n\n\n SoundEffect sound3;\n int x = 0;\n\n StreamResourceInfo SoundFileInfo = App.GetResourceStream(new Uri(\"tracks/drum (human).wav\", UriKind.Relative));\n\n sound3 = SoundEffect.FromStream(SoundFileInfo.Stream);\n\n SoundEffectInstance sound3instance = sound3.CreateInstance();\n\n\n if (button3.Content.Equals(\"Sound 3\"))\n {\n sound3instance.IsLooped = true;\n sound3instance.Play();\n button3.Content = \"Playing\";\n }\n else\n {\n sound3instance.Pause();\n button3.Content = \"Sound 3\";\n }\n\n }\n\n private void button4_Click(object sender, RoutedEventArgs e)\n {\n SoundEffect sound4;\n\n StreamResourceInfo SoundFileInfo2 = App.GetResourceStream(new Uri(\"Cow Moo 1.wav\", UriKind.Relative));\n\n sound4 = SoundEffect.FromStream(SoundFileInfo2.Stream);\n\n SoundEffectInstance sound4instance = sound4.CreateInstance();\n\n\n if (button4.Content.Equals(\"Sound 4\"))\n {\n sound4instance.IsLooped = true;\n sound4instance.Play();\n button4.Content = \"PLaying\";\n }\n else\n {\n sound4instance.Pause();\n button4.Content = \"Sound 4\";\n }\n }\n\n\nMany Thanks,\n\nJake" ]
[ "c#", "windows-phone-7", "soundeffect" ]
[ "NUnit tests not executed", "I'm trying to configure TeamCity to run the tests we have.\n\nI created a NUnit Build Step, and I selected these parameters:\n\nRunner type: NUnit\nStep name: Tests\nExecute step: Only if all previous steps were successful\nNUnit runner: NUnit 2.6.1\n.NET Runtime: x64, v4.0\nRun tests from: 'Tests**\\bin\\Debug\\Tests.*.dll'\n\nThe rest is blank.\n\nThis is the output in the build log\n\n[14:03:31]Step 2/2: Tests (NUnit) (14s)\n[14:03:31][Step 2/2] Starting: C:\\BuildAgent\\plugins\\dotnetPlugin\\bin\\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit\n[14:03:31][Step 2/2] in directory: C:\\BuildAgent\\work\\743f6358429d804a\n[14:03:39][Step 2/2] Start TeamCity NUnit Test Runner\n[14:03:39][Step 2/2] Running NUnit-2.6.1 tests under .NET Framework v4.0 x64\n[14:03:40][Step 2/2] Tests.Application.XmlImport.dll\n[14:03:44][Step 2/2] Start TeamCity NUnit Test Runner\n[14:03:44][Step 2/2] Running NUnit-2.6.1 tests under .NET Framework v4.0 x64\n[14:03:45][Step 2/2] Tests.Infrastructure.Framework.dll\n[14:03:45][Step 2/2] Process exited with code 0\n\n\nTo be sure that the tests are not run, each assembly has a Assert.Fail() test.\n\nFYI: the project is using .NET 4.5 and the NUnit assemblies are 2.6.2\n\nThanks." ]
[ "nunit", "teamcity", "teamcity-7.0" ]
[ "Deciphering a function overload not found error message", "I have the following code :- \n\nclass A : public B {\n public:\n _container (B* b) { \n container_ = b;\n }\n private:\n B* container_;\n};\n\nvoid foo(const A& a, const B& b) {\n A new_a (a);\n new_a._container(&b);\n}\n\n\nIf I try to compile this using icpc12, I get :- \n\nerror: no instance of overloaded function \"A::_container\" matches the argument list\n argument types are: (const B *)\n object type is: A\n new_a._container (&b);\n\n\nNow, I understand that the first line of the error means there is some sort of type mismatch between the function being called and the function definitions available and I'm trying to narrow down the problem using the other two lines of the error message. \n\nWhat do the second and third lines mean?" ]
[ "c++", "linux", "icc" ]
[ "How to ask keyboard hook to process messages AFTER the parent window", "The title says it all. How can I ask my keyboard hook to tackle incoming keyboard message AFTER the parent window has processed them? Reading the docs I found there is a value named WH_CALLWNDPROCRET that does exactly this, but I need to specify WH_KEYBOARD there (to make it a keyboard hook of course), and the value doesn't appear to be a bit flag, so I can't combine both.\n\nBackground: I'm writing an add-in for Word 2013, which needs to monitor certain keys and take appropriate action only after Word has finished processing those keys. I'm using globalmousekeyhook project for hooking." ]
[ "c#", "winapi", "keyboard-hook", "mousekeyhook" ]
[ "Linux shell command to reverse the field order of varying length text records", "I would like a command line incantation to reverse the field order of arbritrary length text records. Solutions provided in Rearrange columns using cut and Elegant way to reverse column order don't solve this issue since they assume a fixed amount of fields, though maybe they would with minor changes.\n\nSort of like the tac command that exhibits reverse cat functionality. I'd like what the ohce command would do (if it existed) to reverse echo functinality.\n\nFor example:\n\na b c d\ne f\ng h i\n\n\nShould be transformed to\n\nd c b a\nf e\ni h g" ]
[ "linux", "shell", "parsing", "reverse", "command-line-interface" ]
[ "Is there any way to create own breakpoint in my style.css in bootstrap?", "The title says it all, I want to create a custom break point but I don't want to disturb the minified file of bootstrap. My style.css comes after minified file obviously.\n\nEDIT: By breakpoint I mean media query breakpoint." ]
[ "twitter-bootstrap", "twitter-bootstrap-3" ]
[ "how to add Old data to select inputs inform", "this code is ok with text inputs\n\n<input value=\"{{ old('YOM') }}\" id=\"YOM\" class=\"form-control\" type=\"year\" name=\"YOM\" id=\"\">\n\n\nbut want add old data to select tag s and also radio buttons\n\n<select id=\"condition\" name=\"condition\" class=\" form-control\" >\n <option value=\"\" >Select Condition</option>\n <option value=\"Brand New\" >Brand New</option>\n <option value=\"Recondition\" >Recondition</option>\n <option value=\"Used\" >Used</option>\n</select>\n\n<input type=\"checkbox\" name=\"SaleOrRent\" value=\"Sell\">Sell <span></span> \n<input type=\"checkbox\" name=\"SaleOrRent\" value=\"Rent\">Rent\n<input type=\"checkbox\" name=\"SaleOrRent\" value=\"Sell or Rent\">Sell or Rent" ]
[ "laravel" ]
[ "how are these two function signatures passed to then() equivalent?", "async function f() {\n return 2\n}\n\n//example A\nf().then( d => console.log(d) ) //output = 2\n\n//example B\nf().then(console.log) //output = 2\n\nIn example A, the result (the number 2) is passed in as the variable d. This is just a basic fat arrow function.\nIn example B, the result (the number 2) seems to be magically put into console.log. What is the underlying mechanism by which the number 2 makes it into console.log(2)?" ]
[ "javascript", "async-await" ]
[ "SSH a machine behind another machine", "Suppose I have three machines: A, B, C. I would like to login C on A, but A and C cannot connect each other. Usually I do: A->ssh->B, then B->ssh->C, in my terminal. I am playing the VS code remote development and it cannot login the remote machine C with two steps. Is there any solution that I can connect C from A directly?" ]
[ "networking", "visual-studio-code", "ssh", "remote-access" ]
[ "Passing Data to Second View in SwiftUI", "I am trying to pass data (incomeAmount) from the First View to the Second View in my SwiftUI app, but I need to declare the BindingString. What does it mean that I need to declare the BindingString?\nView 1\n\nstruct ContentView: View {\n @State var incomeAmount = ""\n \n var body: some View {\n NavigationView {\n VStack {\n TextField("Your income amount", text: $incomeAmount)\n .frame(width: 300)\n .padding(.bottom, 30)\n \n \n NavigationLink(destination: NewView()){\n \n Text("Continue")\n .frame(width: 300, height: 50, alignment: .center)\n .background(Color.black)\n .cornerRadius(130)\n .foregroundColor(.white)\n .padding(.bottom, 30)\n }\n \n Text("$\\(incomeAmount)")\n \n \n }.navigationTitle("First View")\n }\n }\n }\n\nView 2\n\nstruct NewView: View {\n @Binding var incomeAmount: String\n \n var body: some View {\n NavigationView {\n VStack {\n Text("$\\(incomeAmount)")\n }\n }.navigationTitle("Second View")\n }\n}\n\nstruct NewView_Previews: PreviewProvider {\n static var previews: some View {\n NewView(incomeAmount: <#Binding<String>#>)\n }\n}" ]
[ "swiftui" ]
[ "webpack require, how to pass a string variable?", "In Vue, I'm trying to pass a string into require(),\nthe first option works (passing the string directly).\nhowever when passing the variable containing the string the loading fails,\nany clues???\n\n<template>\n <img :src=\"require('@/assets/channels/email.png')\" />\n// <img :src=\"require(test)\" />\n</template>\n\nexport default {\n data() {\n return {\n test: \"@/assets/channels/email.png\"\n };\n }\n}" ]
[ "webpack", "vue.js", "vue-component", "require" ]
[ "Function with multiple possible arguments that will never return the same value given any sequence of arguments", "Let's say you have a function that takes both x and y, real numbers that are integers, as arguments.\nWhat would you put inside that function, using only mathematical operators, so that no two given sequences of arguments could ever return the same value, be it any kind of value?\nExample of a function that fails at doing this:\nfunction myfunction(x,y){\n return x * y;\n}\n\n// myfunction(2,6) and myfunction(3,4) will both return 12\n// myfunction(2,6) and myfunction(6,2) also both return 12." ]
[ "javascript", "math" ]
[ "How to convert a React.js app into a PWA?", "I am tormented for the second day trying to convert the simplest react web application to PWA. I just can't pass the Lighthouse audit. Can't fix the following problems:\nLighthouse response\nmanifest.json:\n\r\n\r\n{\n \"short_name\": \"Test App\",\n \"name\": \"TestMe\",\n \"icons\": [\n {\n \"src\": \"icons/icon48.png\",\n \"size\": \"48x48\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon64.png\",\n \"size\": \"64x64\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon72.png\",\n \"size\": \"72x72\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon96.png\",\n \"size\": \"96x96\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon144.png\",\n \"size\": \"144x144\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon192.png\",\n \"size\": \"192x192\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon512.png\",\n \"size\": \"512x512\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n },\n {\n \"src\": \"icons/icon1024.png\",\n \"size\": \"1024x1024\",\n \"purpose\": \"any\",\n \"type\": \"image/png\"\n }\n],\n \"start_url\": \".\",\n \"display\": \"standalone\",\n \"theme_color\": \"#000000\",\n \"background_color\": \"#ffffff\",\n \"orientation\": \"portrait\"\n}\r\n\r\n\r\n\nServiceWorker.js\n\r\n\r\nconst staticCacheName = 's-app-v1'\n\nconst assetUrls = [\n 'index.html',\n 'offline.html'\n]\n\nself.addEventListener('install', async event => {\n const cache = await caches.open(staticCacheName)\n await cache.addAll(assetUrls)\n})\n\nself.addEventListener('activate', async event => {\n const cacheNames = await caches.keys()\n await Promise.all(\n cacheNames\n .filter(name => name !== staticCacheName)\n .map(name => caches.delete(name))\n )\n})\n\nself.addEventListener('fetch', event => {\n event.respondWith(\n caches.match(event.request).then(() => {\n return fetch(event.request).catch(() => caches.match('offline.html'))\n })\n )\n});\r\n\r\n\r\n\nI reviewed all the guides on youtube, already like a dog, obediently followed all the commands - and nothing! Cloned the repositories left by the authors of these youtube videos (for example: https://github.com/adrianhajdin/project_weather_pwa https://github.com/vladilenm/pwa-intro) - nothing works either. I'm using macOs catalina 10.15, maybe there is some special policy for caching / updating the react application ?, I just don't know what to look for the problem. React.js sees all files, connects correctly, offline html is issued correctly, but the audit does not pass. + Lighthouse requires some PNG images, I have already crammed more than a dozen of them, but Lighthouse is still swearing. Help!)" ]
[ "javascript", "json", "reactjs", "progressive-web-apps" ]
[ "R, LME4, Analyze the moderating role of a within-subjects level-2 factor in multi-level models", "I tried to model a moderator effect in a multi-level model. The dependent variable "A" was predicted by variable "B" in 340 different conditions "C". So, we could possibly find an interaction BC on A. That would indicate that the effect B differs between the conditions. In the next step, we want to examine the influence of a third variable “D” on this interaction. Therefore, we controlled for “D” in “A” and “B” within each condition “C”. Now, our long data set is twice as long as it was originally and a dummy coded within-subjects level-2 factor” control” indicated weather original “A” and “B” (control = 0)., or “A” and “B” without “D” (control = 1). A significant three-way interaction in the multilevel model would indicate that the covariance of “D” changed the interaction of AB after we controlled for “D”.\nIt is important to note that “A” and “B” (not controlled as well as controlled) were z-standardized variables. “C” was scaled between -2 and 2.\nNow to my problem:\nIf we controlled for D either in “A” or in “B”, but not in both, the estimators in the multi-level model make sense.\nControlled for D in A:\nShow table\n\nControlled for D in B:\nShow table\nBut if we controlled for D in both variables, I don’t understand the results. The degrees of freedom of the main effect of B were estimated like a within subject effect. But it is between subject, isn't it? The estimators of the main effect B, as well as for the interaction between B and C were much too large.\nControlled for D in A and B:\nShow table\nCan someone help me out and explain why the degrees of freedom and the estimators of the main effect of B as well as of the two-way interaction of B and C are so different between the models, if we controlled for D only in one or in both variables.\nThe code for the multi-level analyse ist:\nMLM <- lmer(A ~ B*C*control + (1 + C|Subject), data = df, REML = 0 ,na.action = na.omit)\nI also removed the random slope effect from my code, but it didn't help.\nThanks,\nChris" ]
[ "r", "lme4", "multilevel-analysis" ]
[ "position absolute bottom 0 iphone scrolling issue", "http://bvh.delineamultimedia.com/?page_id=2 -> On this page I have a jQuery animation to show the footer when you click on the arrow to the right it shows content then closes when you click the arrow again. Everything is working fine until you view it on the iPhone. \n\nOn the iphone when you scroll up and DON'T click on the arrow it displays the content for a split second then snaps to the proper spot… is there a way to avoid this? Has anyone else ran into this?" ]
[ "jquery", "ios", "css" ]
[ "Long to Wide Format (multi-column counting strings)", "I am having trouble converting from a long format to a wide format:\nMy data:\n79264 Bacteria Firmicutes\n79264 Bacteria Firmicutes\n79264 Bacteria Firmicutes\n2947 Bacteria Nitrospirae\n2947 Bacteria Nitrospirae\n2947 Bacteria Nitrospirae\n2947 Bacteria Nitrospirae\n2947 Bacteria Nitrospirae\n2947 Bacteria Nitrospirae\n2947 Bacteria Proteobacteria\n\nWhat I want:\n79264 3_Bacteria 3_Firmicutes\n2947 7_Bacteria 6_Nitrospirae,1_Proteobacteria\n\nMy best attempt at this is using something like this below, which would work if I just wanted to average across numeric values in columns 2 and 3:\nawk '{sum[$1]+=$2; sum2[$1]+=$3; count[$1]++} END{for (x in sum) print x, sum[x]/count[x], sum2[x]/count[x]}'\n\nBut counting strings and delimiting different strings within the column has proven too difficult for me. I appreciate any feedback." ]
[ "awk", "data-conversion" ]
[ "Posting data to sql database without reloading page", "the problem is that i am unable to insert data in my database without reloading \ni have tested it without the note_sql.js and my note_sql.php works fine but there seems to be a problem in my js file if some body could point me in the right direction it would be wonderful \n\nIndex.php\n\n <form id=\"noteform\" action=\"note_sql.php\" method=\"POST\">\n <input type=\"text\" name=\"note\"></input>\n <input id=\"sub\" type=\"submit\" value=\"Save Note\" />\n </form>\n <span id=\"result_note\"><span>\n <script type =\"text/javascript\" src=\"jquery/note_sql.js\"></script>\n\n\nnote_sql.js\n\n$(\"#sub\").click(function(){\n\nvar data = $(\"#noteform: input\").serializeArray();\n$.post($(\"#noteform\").attr(\"action\"),data,function(info){$(\"result_note\").html(info); });\n clearInput();\n}); \n\n$(\"#noteform\").submit(function(){\n return false;\n});\n\nfunction clearInput(){\n $(\"#noteform :input\").each(function(){\n $(this).val('');\n });\n}" ]
[ "php", "jquery" ]
[ "MediaRecorder audio volume is very low", "I am trying to record video using MediaRecorder using the following settings:\n\nrecorder.setAudioSource(MediaRecorder.AudioSource.MIC);\nrecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);\nrecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);\nrecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);\nrecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);\n\n\nAfter recording is complete, the recorded video volume is very low. What can be settings of MediaRecorder for the audio volume boost? Or can we control the audio gain using MediaRecorder?" ]
[ "audio", "android-mediarecorder", "video-recording" ]
[ "How can I use ActivePerl's PPM 4 from the command line?", "The version of PPM (4.06, and I run it under Windows) directly puts me into a GUI which is a nice but since I'm quite comfortable with the command-line prompt so I still want to find a way to get a command-line prompt instead of a GUI." ]
[ "perl" ]
[ "Wildfly CLI to check for existence of resources", "I have the same issue, I tried:\n\nif (result.value == true) of /subsystem=datasources/data-source=MyDataSource:read-resource\n data-source remove --name=MyDataSource\n#else\n # none \nend-if\n\n\nBut it tries every time to remove. Even if the datasource is not available" ]
[ "command-line-interface", "wildfly" ]
[ "Battery consumption of android by observer and service", "I am developing an android app in which I want to monitor files. So what I am doing I have created a service in which I am registering an file observer which will monitor the file changes.\n\nAs soon as some events take place it will take the metadata of all the files in sd card and updates the application database by replacing the old data with the new one.\n\nSo I just wanna know should I register the observer in a service or in a activity to save battery of the user and what will be the better choice." ]
[ "android" ]
[ "What does \"probe_score\" means from ffprobe output?", "Given a media file, after running ffprobe -i input.mp4 -show_format -print_format json, I got something like this:\n\n{\n \"format\": {\n \"filename\": \"ooxx.mp4\",\n \"nb_streams\": 2,\n \"nb_programs\": 0,\n \"format_name\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n \"format_long_name\": \"QuickTime / MOV\",\n \"start_time\": \"0.000000\",\n \"duration\": \"231.210000\",\n \"size\": \"65133325\",\n \"bit_rate\": \"2253650\",\n \"probe_score\": 100,\n \"tags\": {\n \"major_brand\": \"isom\",\n \"minor_version\": \"512\",\n \"compatible_brands\": \"isomiso2avc1mp41\",\n \"encoder\": \"Lavf55.33.100\",\n }\n }\n}\n\n\nI'm wondering what does probe_score mean here? How does it get calculated?" ]
[ "ffmpeg", "ffprobe" ]
[ "With ThisWorkbook Not Working", "This script used to working in Office 2010, but since we upgraded to 2016, it no longer works. I have been playing with the code with no solution. Please help! :)\n\nI have a weekly report I receive with orders and use VBA to format it into an Oracle format to upload without user intervention. I am opening the template file (PRIMARY TEMPLATE - Desert Storm.xlsx) and pasting it into a differently named report on a weekly basis (ThisWorkbook). \n\nRuntime error 91: Object variable or with block not set\n\nSub templateOracleLoader()\n 'Customer # Invoice Number Sale Date Prod. Name Price Sales Units Total UPC number Oracle Code Customer name (j) PO# (k)\n 'OPEN TEMPLATE\n Application.AskToUpdateLinks = False\n Application.DisplayAlerts = False\n Dim sPath As String, sFile As String\n Dim wb As Workbook\n sPath = \"C:\\Users\\douglas.futato\\Desktop\\\"\n sFile = sPath & \"PRIMARY TEMPLATE - Desert Storm.xlsx\"\n Set wb = Workbooks.Open(sFile)\n 'COPY TEMPLATE PASTE IN BBU DOC\n Dim tmplt As Workbook\n Set tmplt = Workbooks(\"PRIMARY TEMPLATE - Desert Storm.xlsx\")\n With ThisWorkbook\n tmplt.ActiveSheet.Copy After:=ActiveSheet.paste\n End With\n 'CLOSE TEMPLATE\n Windows(\"PRIMARY TEMPLATE - Desert Storm.xlsx\").Activate\n ActiveWindow.Close False\nEnd Sub" ]
[ "vba", "excel", "excel-2016" ]
[ "Code review , performance perspective", "The code has been written and still so many developer are working. I need to increase the performance of the code. The code uses struts 1.2, Jdk 1.5.\n\nI am reviewing code to increase the performance. \nWhat I need is steps to find bottlenecks in the code. \nHow to avoid in future? \nHow to refactor the code and tools for the same?" ]
[ "java", "jakarta-ee" ]
[ "xml and percent symbols", "I'm using XMLStreamReader to parse a piece of xml:\n\nXMLStreamReader rd = XMLInputFactory.newInstance().createXMLStreamReader(io_xml, \"UTF-8\");\n\n...\n\nif (eventType == XMLStreamConstants.START_ELEMENT) {\n String name = rd.getLocalName();\n if (name.equals(\"key\")) {\n String val = rd.getElementText();\n }\n}\n\n\nProblem is, I'm getting a bad read for the following string: \"<key>cami%C3%B5es%2Babc</key>\"\n\norg.junit.ComparisonFailure: \nexpected:<cami[%C3%B5es%]2Babc> but was:<cami[ C3 B5es ]2Babc>\n\n\nDo I neeed to do anything special within the XML? I already tried to put everything within a CDATA section but I get the same error.\n\n\n\nUsing a \"regular\" parser everything works:\n\nDocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\nDocumentBuilder builder = factory.newDocumentBuilder();\nInputSource is = new InputSource(new StringReader(xml));\nDocument parse = builder.parse(is);\nString value = parse.getFirstChild().getTextContent();\n..." ]
[ "java", "xml", "stax" ]
[ "how to deactivate and activate users from application in ruby on rails", "I am implementing dashboard facility in my ruby on rails application where only Admin can enter and see all users which are registered with application. From dashboard, admin can deactivate or activate users( may be for certain time of period). I have User table which has is_active column. I know , it can be done by setting flag on this column in table. Could you please explain it in details.\n\nFollowing is my User table.\n\ncreate_table \"users\", :force => true do |t|\n t.string \"email\", :default => \"\", :null => false\n t.string \"encrypted_password\", :default => \"\", :null => false\n t.string \"reset_password_token\"\n t.datetime \"reset_password_sent_at\"\n t.datetime \"remember_created_at\"\n t.integer \"sign_in_count\", :default => 0\n t.datetime \"current_sign_in_at\"\n t.datetime \"last_sign_in_at\"\n t.string \"current_sign_in_ip\"\n t.string \"last_sign_in_ip\"\n t.boolean \"is_admin\"\n t.boolean \"is_active\"\n t.datetime \"created_at\", :null => false\n t.datetime \"updated_at\", :null => false\n t.string \"username\"\n end\n\n\nPlease help me in implementing activation and deactivation of users from application(Admin can only this)" ]
[ "ruby-on-rails", "admin", "dashboard" ]
[ "While loop initiatizing but not looping java", "The loop I'm trying to run will initialize but will not continue to run after the first loop. Since I know where the problem i took out most of the code to fix the loop. After i make the second selection the loop will not run. Thank you for any help.\n\npublic static void main(String[] args)\n{\n String number; // enter number \n int stringLength = 0; \n String selection = \"y\" ;\n // Create a Scanner object to read input.\n Scanner keyboard = new Scanner(System.in);\n\n // PrintWriter outputFile = new PrintWriter(\"outDataFile.txt\");\n // outputFile.close();\n\n while (selection == \"y\")\n {\n\n // Get the user's number.\n System.out.print(\"Write your number \");\n number = keyboard.nextLine();\n\n\n System.out.print(\"y/Y to continue, any else to exit\");\n selection = keyboard.nextLine();\n\n\n }\n\n}" ]
[ "java", "while-loop" ]
[ "How replace multi event with observer (Spring4D)", "I have class with 2 events: OnConnect and OnDisconnect:\n\ntype\n TEvent = reference to procedure;\n TConnection = class\n private\n fOnConnect: TEvent;\n fOnDisconnect: TEvent;\n public\n procedure SomeBehavior(aChoice: Boolean);\n property OnConnect: TEvent read fOnConnect write fOnConnect;\n property OnDisconnect: TEvent read fOnDisconnect write fOnDisconnect;\n end;\n\nimplementation\n\n{ TConnection }\n\nprocedure TConnection.SomeBehavior(aChoice: Boolean);\nbegin\n if aChoice then\n fOnConnect\n else\n fOnDisconnect;\n //im not cheacking Assign(Events) to make example simple\nend;\n\n\nnow I would like to do same thing but in more object style.\nI mean use interfaces and observer pattern from String4D. And i made this:\n\ninterface\n\nuses\n Spring.DesignPatterns;\n\ntype\n IObserver = interface\n procedure ReactToConnect(aText: String);\n procedure ReactToDisconnect(aTimeoutInMs: Integer);\n end;\n\n IConnection<T> = interface(IObservable<IObserver>)\n procedure SomeBehavior(aChoice: Boolean);\n end;\n\nimplementation\n\nuses\n System.SysUtils;\n\ntype\n TConnection = class(TObservable<IObserver>, IConnection<IObserver>)\n public\n procedure SomeBehavior(aChoice: Boolean);\n end;\n\n{ TConnection }\n\nprocedure TConnection.SomeBehavior(aChoice: Boolean);\nvar\n procOnConnect: TProc<IObserver>;\n procOnDisconnect: TProc<IObserver>; // what if i want no parameters?\n someText: String;\n someNumber: Integer;\nbegin\n someText := RandomText;\n procOnConnect := procedure(aObserver: IObserver)\n begin\n aObserver.ReactToConnect(someText);\n end;\n someNumber := RandomInt;\n procOnDisconnect := procedure(aObserver: IObserver)\n begin\n aObserver.ReactToDisconnect(someNumber);\n end;\n\n if aChoice then\n Self.NotifyListeners(procOnConnect)\n else\n Self.NotifyListeners(procOnDisconnect);\n\nend;\n\n\nim doing it fisrt time and just want to ask if its proper way? or im doing somethink heretical here?" ]
[ "delphi", "design-patterns", "observer-pattern", "spring4d" ]
[ "using boost::iostreams to read specifically crafted data, then based on that create object and append it to list", "I have an interesting problem. Let's say that i have file with lines filled like this:\n\nname1[xp,y,z321](a,b,c){text};//comment\n#comment\nname2(aaaa);\n\n\nalso I have (simplified) class:\n\nclass something {\npublic:\n something(const std::string& name);\n addOptionalParam(const std::string& value);\n addMandatoryParam(const std::string& value);\n setData((const std::string& value);\n};\n\n\nname corresponds to param name of some class constructor. Things listed in [] brackets are optional, in () are mandatory and everything between {} should be pased as string.\n\nFor the first line one should call constructor with \"name1\" as name; 3 times call addOptionalParam, one once for each item separated with colon; also 3 times addMandatoryParam and setData with \"text\".\n\nI can work out how to do the comments, but everything else is mangled for me...\n\nNow I need some good advice how(or if) this is possible, if I can wor out how to do that for simple objects, I can work out how to handle all the extra gory details like semantic correctness an all that." ]
[ "c++", "parsing", "boost", "serialization", "boost-iostreams" ]
[ "Using Nininject MVC with class libraries", "I'm quite new to IoC frameworks so please excuse the terminology.\n\nSo what I have is a MVC project with the Nininject MVC references.\nI have other class libarys in my project e.g. Domain layer, I would like to be able to use the Ninject framework in there but all of my bindings are in the NinjectWebCommon.cs under the App_Start folder in the MVC project:\n\nprivate static void RegisterServices(IKernel kernel)\n{\n kernel.Bind<IHardwareService>().To<WindowsHardwareService>();\n kernel.Bind<IStatusApi>().To<StatusApiController>();\n}\n\n\nCurrently in my class library I am using constructor injection but sometime I am having to hardcode the dependencies:\n\nvar service = new WindowsHardwareService();\n\n\nWhen I would like to be able to do the following:\n\nIKernel kernel = new StandardKernel(.....);\nvar context = kernel.Get<IHardwareService>();\n\n\nI have not been doing the following because I do not have any modules? \nAll of the documentation I have read is mainly aimed at the regular Ninject library and not the MVC version.\n\nWhat do I need to do, and how can I use the regular Ninject library with the MVC version?\n\nUpdate\n\nThis is what I have tried:\n\nThe aim of this is so that each project can load the module and get the current injected interface.\n\nApp_Start/NinjectWebCommon.cs (In MVC Project)\n\nprivate static void RegisterServices(IKernel kernel)\n{\n var modules = new IoCModules();\n var newKernal = modules.GetKernel();\n\n kernel = newKernal;\n}\n\n\nIoCModules.cs (In Project.Ioc project)\n\npublic class IoCModules\n{\n public IKernel GetKernel()\n {\n var modules = new CoreModule();\n return modules.Kernel;\n }\n}\n\n\nCoreModule.cs (In Project.IoC.Modules project) <-- This is where all the references to all projects are, this get's around any circular dependency issues.\n\npublic class CoreModule : NinjectModule\n{\n public override void Load()\n {\n Bind<IHardwareService>().To<WindowsHardwareService>();\n Bind<IStatusApi>().To<StatusApiController>();\n }\n}\n\n\nBut I am currently getting the following:\n\n\n Error activating IHardwareService\n \n No matching bindings are available, and the type is not self-bindable.\n Activation path:\n \n 2) Injection of dependency IHardwareService into parameter service of constructor of type DashboardController\n \n 1) Request for DashboardController\n \n Suggestions:\n \n 1) Ensure that you have defined a binding for IHardwareService.\n \n 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.\n \n 3) Ensure you have not accidentally created more than one kernel.\n \n 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.\n \n 5) If you are using automatic module loading, ensure the search path and filters are correct." ]
[ "c#", "asp.net-mvc", "ninject", "ioc-container" ]
[ "cloud Firestore connect my flutter windows app", "I already build a flutter android app, and it works with the Cloud_FireStore database. Now I want a connect my Cloud_FireStore database to my flutter Windows app, but I can't find any resources for Cloud_FireStore plugging for flutter Windows or how to connect Cloud_FireStore to Windows app.\n\nmy flutter doctor, \n\nDoctor summary (to see all details, run flutter doctor -v):\n\n[√] Flutter (Channel master, 1.19.0-2.0.pre.131, on Microsoft Windows [Version 10.0.18363.836], locale en-US)\n[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)\n[√] Chrome - develop for the web\n[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.0)\n[√] Android Studio (version 3.6)\n[√] VS Code (version 1.45.1)\n[√] Connected device (4 available)\n\n\nI use Flutter Master channel mode to build Windows apps and no errors.\n\npubspec.yaml\n\ndependencies:\n cloud_firestore:\n firebase_core:\n\n\nthese dependencies use to connect my Cloud_FireStore but it does not work with windows app.\n\nPlease help me!, Thank you." ]
[ "flutter", "google-cloud-firestore", "visual-studio-2019", "flutter-web" ]
[ "How to display dialog box from from c2dmreceiver in android", "At present i am working on c2dm in android.i am sending messages from server but messages are displaying on Log cat.But i want to display dialog when message occur how can i do this.\n\nPlease help me." ]
[ "android" ]
[ "Renaming Multiples Files with Different Names in a Directory using shell", "I've found most of the questions of this kind where the change in name has been same for the entire set of files in that directory.\nBut i'm here presented with a situation to give a different name to every file in that directory or just add a different prefix.\n\nFor Example, I have about 200 files in a directory, all of them with numbers in their filename. what i want to do is add a prefix of 1 to 200 for every file. Like 1_xxxxxxxx.png,2_xxxxxxxx.png...........200_xxxxxxxx.png\n\nI'm trying this, but it doesnt increment my $i everytime, rather it gives a prefix of 1_ to every file.\n\necho \"renaming files\" \ni=1 #initializing\nj=ls -1 | wc -l #Count number of files in that dir\nwhile [ \"$i\" -lt \"$j\" ] #looping \ndo\n for FILE in * ; do NEWFILE=`echo $i_$FILE`; #swapping the file with variable $i\n mv $FILE $NEWFILE #doing the actual rename\n i=`expr $i+1` #increment $i\ndone\n\n\nThanks for any suggestion/help." ]
[ "shell", "rename", "file-rename" ]
[ "Modify mix-blend-mode or filtering behavior in SCSS with an SVG (Vue)", "I'm working on a position: absolute navbar at the top of a page that holds a few svgs in <a>s. I need the SVGs to be black when they are in front of lighter colored divs (other Vue components), and white when in front of darker colored ones. The divs behind the SVGs could be dark red, light blue, etc., and the resulting fill of the svg should only be white or black.\nIs there a way to do a special kind of SCSS thing where I can make my own mix-blend-mode or something? Or some other implementation with SCSS logic where you filter and then take the resulting color the rest of the way to white or black.\nFor example, a dark blue filtered 100% would return a lighter color, which should then complete to white.\nI'm currently implementing a type of a solution by using a scroll handler that checks div positions, their respective background-color values, and then changes inline styles on the SVGs according to what is returned. I'm just hoping there's a clever SCSS/CSS solution out there instead of more JavaScript." ]
[ "css", "vue.js", "sass", "responsive", "mix-blend-mode" ]
[ "Architecture with several data sources using Repository pattern", "I have a project using MVP architecture.\nThis project use the Repository pattern.\n\nI have two data sources, the first one come from a remote JSON Api through PollutionApiService, the second is just trivial data I get from an XML file in the assets folder : air_quality_levels.xml. The network data contains real time pollution levels, the XML file contains the limits standard for these pollution levels.\n\nFor now I just have a Repository implemented for the JSON Api, it looks like this :\n\nInterface\n\npublic interface Repository {\n Observable<Aqicn> getPollutionLevelsFromNetwork(String city, String authToken);\n Observable<Aqicn> getPollutionLevels(String city, String authToken);\n}\n\n\nClass\n\npublic class PollutionLevelsRepository implements Repository {\n private PollutionApiService pollutionApiService;\n private static Observable<Aqicn> pollutionData = null;\n\n\n public PollutionLevelsRepository(PollutionApiService pollutionApiService) {\n this.pollutionApiService = pollutionApiService;\n }\n\n @Override\n public Observable<Aqicn> getPollutionLevelsFromNetwork(String city, String authToken) {\n pollutionData = pollutionApiService.getPollutionObservable(city, authToken);\n return pollutionData;\n }\n\n @Override\n public Observable<Aqicn> getPollutionLevels(String city, String authToken) {\n return getPollutionLevelsFromNetwork(city, authToken);\n }\n}\n\n\nShould I use the same repository (adding more methods) for the data I will get from the XML file in the assets folder ? \n\nIf I have to use two repositories, How should I name this second repository interface ? I never had several repositories so I always use the generic name \"Repository\" for the interface. I can't give it the same name as the class and can't add a \"I\" prefix as I read it's bad practice... Or should I keep this \"Repository\" name and put the new Repository in another package ?\n\nThis is my actual project structure, note that I package by features but I put my both repositories in the common package because it gets data that will be used by my both features (donut and pollutionlevels) :\n\n\n\nIf you have short relevant suggestions about the architecture in general they are welcome." ]
[ "android", "architecture", "repository", "mvp" ]
[ "window scroll event is not firing up when overflow-y: scroll is set to some element in body", "Please refer below sample html\n\n<html>\n<body>\n<div id=\"parent\">\n..............\n</div>\n</body>\n</html>\n\n\nCSS for parent element:\n\n#parent\n{\nposition: absolute;\n min-width: 1020px;\n width: 100%;\n top: 121px;\n bottom: 75px;\n overflow-y: scroll;\n }\n\n\ni am trying to use window scroll event like below\n\n$(window).scroll(function(){\nalert('triggered');\n});\n\n\nbut scroll event is not firing up when i set overflow-y :scroll to parent element. when i remove this css(overflow) scroll event is firing up. so what is the correct behavior ? why window scroll event is not invoking when overflow css there ?" ]
[ "jquery", "html", "css" ]
[ "how to create bar button or UIButton in tableview header in swift 2.2?", "I want to create a UIBarButtonItem or UIButton in UITableview header so when I click on the UITableview header button it should go to the other UIViewcontroller. How can I achieve this programmatically?" ]
[ "ios", "swift", "xcode", "tableview" ]
[ "Upgrading database using my OpenHelper in greendao", "I use GreenDao as my ORM.\nI want migrate schema from oldversion to new version.\nI use this link to implement my mygration.\nSo I wrote my own OpenHelper class and put it to another package. I Implement onUpgrade method like this:\n\npublic class UpgradeHelper extends OpenHelper {\n\npublic UpgradeHelper(Context context, String name, CursorFactory factory) {\n super(context, name, factory);\n}\n\n/**\n * Apply the appropriate migrations to update the database.\n */\n@Override\npublic void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n Log.i(\"greenDAO\", \"My Upgrade Helper -------- Upgrading schema from version \" + oldVersion + \" to \" + newVersion + \" by dropping all tables\");\n switch (newVersion) {\n case 2:\n new MigrateV1ToV2().applyMigration(db, oldVersion);\n break;\n case 3:\n new MigrateV2ToV3().applyMigration(db, oldVersion);\n break;\n default:\n return;\n }\n}\n\n\n}\n\nBut this method never called when I upgrade the version of database from 1 to 2.\nAlso I can not change onUpgrade() Method in generated DaoMaster class, because it is Auto generated.\nWhen I upgrade SCHEMA_VERSION, onUpgrade() method is called but it is in DaoMaster class and I can not modify it." ]
[ "android", "database", "sqlite", "greendao" ]
[ "SQL cannot convert an int to a varchar(15) value and throws: Conversion failed when converting the varchar value ' LBS' to data type int", "I am working on a SQL project that is pulling data from many tables to list them out in an email body. In the body of my email, I am pulling int values that are throwing exceptions because the body needs to eventually be a nvarchar(max). Different types of conversion have not worked for me yet.\n\nThis is SQL running on Microsoft SQL Server Management Studio. I have tried leaving the int unconverted, and a few different conversion methods I have seen elsewhere.\n\nIn the examples, wtpc.Reg_No is a varchar and wtpc.Shipment_Net_Weight is an int.\n\n'Body' = \n...\n+ 'Net: ' +\n CASE\n WHEN wtpc.Reg_No IS NOT NULL THEN wtpc.Shipment_Net_Weight\n ELSE '0'\n END\n + ' LBS'\n+ 'Gross:\n...\n\n\nResults in: Conversion failed when converting the varchar value ' LBS' to data type int.\n\n'Body' = \n...\n+ 'Net: ' +\n CASE\n WHEN wtpc.Reg_No IS NOT NULL THEN str(wtpc.Shipment_Net_Weight)\n ELSE '0'\n END\n + ' LBS'\n+ 'Gross:\n...\n\n\nResults in: Error converting data type varchar to float.\n\n'Body' = \n...\n+ 'Net: ' +\n CASE\n ELSE wtpc.Reg_No IS NOT NULL THEN\n CONVERT(INT, \n CASE \n WHEN IsNumeric(CONVERT(VARCHAR(15), wtpc.Shipment_Net_Weight)) = 1 \n THEN CONVERT(VARCHAR(15),wtpc.Shipment_Net_Weight)\n\n ELSE 0 \n END) \n ELSE '0'\n END\n + ' LBS'\n+ 'Gross:\n...\n\n\nResults in: Conversion failed when converting the varchar value ' LBS' to data type int.\nThis is lifted from this StackOverflow Question\n\nHere is a more complete view:\n\nDeclare @TempResults1 table(\nThisSubject nvarchar(max),\nThisTo nvarchar(max),\nThisCC nvarchar(max),\nThisBody nvarchar(max),\nThisBody2 nvarchar(max))\n\nInsert into @TempResults1\nSelect \n\n'Subject' = \nisnull( @ShipmentNoString, '') + ' - ' + shpr.Last_Name + ', ' + shpr.First_Name + isnull(' - ' + @ModeString, '') \n+ case\n when cstm.broker_agent = -1 then ' - Foreign Port Agent Pre-Alert'\n else ' - Port Agent Pre-Alert'\nend,\n\n... [To and CC are set here similiar to how the subject is set]\n'Body' = \n\n+ 'To: ' + vncb.Vendor_Name\n+ 'Attn: ' +\n case\n when @GsaUsContact is not null then @GsaUsContact\n else @GsaForContact\n end\n+ 'From: ' + usrs.Name\n+ 'Date: ' + format(getdate(), 'ddMMyy')\n... [More similar code]\n+ 'Mode: ' + mode.Mode\n+ 'Net: ' +\n case\n when wtpc.Reg_No is not null then CAST( wtpc.Shipment_Net_Weight AS varchar(15))\n else '0'\n end\n + ' LBS'\n+ 'Gross: ' +\n case\n when wtpc.Reg_No is not null then CAST( wtpc.Shipment_Gross as varchar(15))\n else '0'\n end\n + ' 2LBS'\n+ 'Cube: ' + isnull(wtpc.Shipment_CFT, '0') + ' CFT'\n+ 'Pieces: ' +\n case\n when wtpc.Reg_No is not null then CAST(wtpc.Shipment_Piece_Count, varchar(15))\n else '0'\n end\n + ' PCS'\n+ '<BR>'\n\n+ 'OBL/AWB #: ' + asea.Mawb_Obl_No\n...[More code like above with varchars]\n+isnull('<b> Please send all correspondence to: ' + usrs.email + '.</b>', '')\n\n,Body2 = null" ]
[ "sql", "sql-server" ]
[ "Unused variables in PyCharm", "if \".jpg\" in link or \".png\" in link:\n fd = urllib.request.urlopen(link)\n #Checks the dimensions of said image file\n Image_file = io.BytesIO(fd.read())\n with Image.open(Image_file) as im:\n width, height = im.size\n print(im.size)\n\n\nOkay, so I'm creating a web crawler that is supposed to download images of the size 1920 by 1080. The actual program works, but PyCharm and Codacy says the width and height variables are unused here:\n\nwith Image.open(Image_file) as im:\n width, height = im.size\n\n\nI guess that's right since I don't call them later in the code, but I'm wondering if there is any other way to do this so I don't see the unused code error when looking through the code.\n\nAnother example:\n\nwith Image.open(Image_file) as im:\n width, height = im.size\n #If the dimensions are 1920 by 1080, it will download the file in Wallpapers/filename_#WALL_#PAGE\n #This format makes it easy to check which images was downloaded from which page\n if(im.size == (1920, 1080)):\n wall += 1\n print(\"***FOUND***\\t\" + str(wall))\n urllib.request.urlretrieve(link, \"Wallpapers/filename\"+ str(wall) +\"_\" + str(page) +\".png\")\n\n\nMight be a stupid question but I appreciate all answers. :)" ]
[ "python", "python-3.x", "pycharm", "unused-variables", "codacy" ]
[ "ASP.NET BOILERPLATE: javascript to call application service", "ASP.NET BOILERPLATE: I have a table Asset for which I have created AssetApplicationService with base class CRUDAsync; I have wired up AssetController, & appropriate DTO's, I am able to retrieve data and show on the list as similar to user list.\nwhen I click on Create New Asset,I am able to bring the modal dailog as well until now it is all good, I have copied the user\\index.js and tailored to call my asset application service from javascript...this is where i am struck\n\nvar _assetService = abp.services.app.asset; //line1\nvar _$modal = $('#AssetCreateModal');\nvar _$form = _$modal.find('form');\n\n\nline 1 returns me undefined when I debug through alert(_assetService), not sure why...where as abp.services.app.user, role works fine." ]
[ "aspnetboilerplate", "asp.net-boilerplate" ]
[ "Changing namespace names in MVC 3 applications causes compilation errors in generated files at runtime", "I just started a new project and was reorganizing the source structure including renaming namespaces. After changing a namespace from \n\nCRTReadmissions.Web.Helpers\n\n\nto\n\nCrt.Readmissions.Web.Helpers\n\n\nI get the error shown below when trying to launch the applicaiton indicating that it can't find the old namespace. Any help is greatly appreciated.\n\nThings I've tried\n\n\nClean\\Rebuild\nManually delete bin directory\nManually delete the contents of the directory where the generated file is located\n\n\nError\n\nDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. \n\nCompiler Error Message: CS0246: The type or namespace name 'CRTReadmissions' could not be found (are you missing a using directive or an assembly reference?)\n\nSource Error:\n\nLine 26: using System.Web.Routing;\nLine 27: using Cassette.Views;\nLine 28: using CRTReadmissions.Web.Constants;\nLine 29: using CRTReadmissions.Web.Helpers;\nLine 30: \n\n\nSource File: c:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files\\crtreadmission\\203bedd5\\1b724153\\App_Web_login.cshtml.3f4b83a6.wbzlumh4.0.cs Line: 28" ]
[ "asp.net-mvc-3", "generated-code" ]
[ "which python 2.7.9 file is the correct file for intell proc tessor", "I want to work with scrapy, and the scrapy website suggested to install python 2.7\n\ni went to python website and i saw that the last version of python 2.7 is python 2.7.9\n\ni clicked download and i found this page\n\nhttps://www.python.org/downloads/release/python-279/\n\ni am using windows 64 bit, so i thought that Windows x86-64 MSI installer is the one that i should use, but then i checked that it is not for intell processor.\n\ncould you help me please and tell me which file should i install?\n\nmany thanks" ]
[ "python", "python-2.7", "scrapy" ]
[ "add to cart route node.js", "i want to add to my cart within a node.js express application but without have to refresh or to redirect in the route. is there a way to do this? this is the route of the \"add to cart\" function:\n\nrouter.get('/add-to-cart/:id/:pices', function(req, res) {\n var pices = req.params.pices;\n var productId = req.params.id;\n\n var cart = new Cart(req.session.cart ? req.session.cart : { });\n\n Product.findById(productId, function (err, product) {\n if (err) {\n return res.redirect('/');\n }\n cart.add(product, product._id, pices);\n req.session.cart = cart;\n res.redirect('/products');\n });\n});\n\n\nas you can see I redirect to ('/products') every time I add a product to the cart. is there a way around that so that the page does not refresh every time? \n\nthanks!" ]
[ "javascript", "node.js", "express" ]
[ "Why relative url ./ to home page not working", "I modified my asp.net 2.0 website to be mobile friendly. On desktops and tablets, the navigation menu is a horizontal bar styled with the class mobilemenu, and on all other devices it is a dropdown menu, styled with class mobiledropdown. Everything works except on mobile devices with the dropdown menu, the home page menu item does nothing when selected, but all the other dropdown items navigate correctly. In both cases the url for home page is \"./\" but I also tried hardcoding it with the full http://www plus my domain and that also works for mobilemenu but not mobiledropdown.\n\nI am thinking it must be related to the javascript which is used only for the dropdown.\nThe code is below. it is contained in an include file. the css hides or shows the appropriate menu based on media queries and that all works great.\nThe first div element is for larger devices and is the code that has been used for several years without any issues. I added the mobilemenu class for hiding it on smaller devices. I added the second div for showing the dropdown on smaller devices.\n\n<div class=\"mobilemenu\" style=\"width:90%; margin-left:5%; margin-right:5%; margin-top:0%; margin-bottom:1%; padding:0px;\">\n <div id=\"menu\" style=\"text-align:center;width:100%;height:22px; padding:0px;\">\n <ul id=\"nav\" style=\"line-height: 22px; width:100%; margin:0px; padding:0px;\">\n <li style=\"width:15%;\">\n <a class=\"custom\" href=\"./\">Home</a>\n </li>\n <li style=\"width:20%;\">\n <a class=\"custom\" href=\"Order.aspx\" >Order</a>\n </li>\n <li style=\"width:15%;\">\n <a class=\"custom\" href=\"Company.aspx\" >Company</a>\n </li>\n <li style=\"width:20%; \">\n <a class=\"custom\" href=\"Download.aspx\" >Downloads</a>\n </li>\n <li style=\"width:15%; \">\n <a class=\"custom\" href=\"Blog.aspx\" >Blog</a>\n </li>\n </ul>\n </div>\n\n <div id=\"menu2\" style=\"text-align:left\">\n <select class=\"mobiledropdown\" onChange=\"window.location=this.value\">\n <option value=\"./\" selected=\"\">Home</option>\n <option value=\"Support.aspx\">Support</option>\n <option value=\"Order.aspx\" >Order</option>\n <option value=\"Company.aspx\" >Company</option>\n <option value=\"Download.aspx\" >Downloads</option>\n <option value=\"Blog.aspx\" >Blog</option>\n </select>\n\n </div>\n</div>" ]
[ "javascript", "asp.net" ]
[ "In Jess, how would I add a slot to a template through a rule?", "As an example, I have:\n\n(deftemplate Animal\n(slot has-feathers (default FALSE))\n(slot name (default \"George\"))\n)\n\n\nand in a rule I have:\n\n(defrule bird-test\n?a <-(Animal (has-feathers ?))\n=>\n(printout t ?a.name \" is a bird\" crlf)\n\"Add slot 'bird' to ?a or Animal\"\n)\n\n\nHow would I do this? and thank you in advance\n\nEdit: Thanks guys! I think I understand what I need to do." ]
[ "jess" ]
[ "Another: uncaught typeerror undefined is not a function", "K guys I'm working on a school project (in javascript) and I'm building a dungeon. Most likely not the best code you've ever seen but eh, I'm in school for that.\n\nIm getting the error from:\n\nfunction damageFormula()\n{\n var damage = myDamage(myWeapon); // I get the error on this function\n var doDamage = Math.floor(0.085 * damage * myAttackLvl + (myLevelLvl/5) - (1+15*Math.random()));\n\n return doDamage;\n};\n\n\nThe myDamage function:\n\nfunction myDamage(myWeapon)\n{\n switch(myWeapon)\n {\n case \"Spike Sword\":\n myDamage += 10;\n break;\n case \"Magic Long Sword\":\n myDamage += 20;\n break;\n default:\n myDamage += 3;\n break;\n }\n return myDamage;\n};\n\n\nThe weapon variable is:\n\nvar myWeapon = \"Spike Sword\";\n\n\nAnd the myDamage variable is:\n\nvar myDamage = 10;\n\n\nDoes anyone know why I get this error and/or how to solve it?\n\nIf you need more information, ask me anyting and I'll try to answer it as good as possible." ]
[ "javascript", "function", "typeerror" ]
[ "CoreDNS service Corefile location", "I would like to view the configuration file of CoreDNS service.\nWhen i look in to the coredns deployment file it is shown as\n spec:\n containers:\n - args:\n - -conf\n - /etc/coredns/Corefile\n image: k8s.gcr.io/coredns:1.6.7\n imagePullPolicy: IfNotPresent\n\n\nIs the /etc/coredns/Corefile inside the container\nIf yes,How to view it.. i am unable to get in to the coredns container\nIf i change the coredns config map file, will the /etc/coredns/Corefile also change" ]
[ "kubernetes", "dns", "coredns" ]
[ "Excluding files if source has the same file name, but also destination has bad in the file name", "So I have a source folder and a destination folder. I have setup my bat file to copy files from one to the other if the destination does not have the file name. Now I want to set it up so that if the destination folder has a file, but with \"bad\" in the file name, no files that are similiar in the source do not get copied over to the destination folder. Here are 3 examples with the last example being what I am aiming for.\n\nExamples: \n\nSource:\nMonday_8am.txt\nTuesday_9pm.txt \n\nDestination:\n\"blank\"\n\nAction:\nMonday_8am.txt (copied to destination)\nTuesday_9pm.txt (copied to destination)\n\nSource:\nMonday_8am.txt\nTuesday_9pm.txt \n\nDestination:\n\nTuesday_9pm.txt\n\nAction:\nMonday_8am.txt (copied to destination)\n\nTuesday_9pm.txt (NOT copied to destination)\n\nSource:\nMonday_8am.txt\nTuesday_9pm.txt\n\nDestination:\n\nTuesday_bad_9pm.txt\n\nMonday_9pm.txt\n\nAction:\n\n\"No action\" (destination did not have \"Tuesday_9pm.txt\", but did have Tuesday_bad_9pm.txt)" ]
[ "windows", "robocopy" ]
[ "Program gives same result every time when it should be random", "The goal of this program is to take 2 random variables for a fraction and see if they are already in reduced terms or not. The supposed probability of this is 6/(pi^2). I run 1,000 different combinations of variables and determine how many were and were not already reduced. Then I solve for pi. \n\nBut the output is giving me \"pi is 2.449489742783178\" every time I run it. \n\nAnyone know why? Thanks.\n\nimport java.util.*;\n\npublic class ratio1 {\n\n /**\n * @param args\n */\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n int nonReducedCount = 0; //counts how many non reduced ratios there are\n for(int i =1; i<=1000; i++){\n\n Random rand = new Random();\n int n = rand.nextInt(1000)+1; //random int creation\n int m = rand.nextInt(1000)+1;\n //Ratio ratio = new Ratio(n,m);\n if (gcd(n,m)> 1 ){ // if the ratio was not already fully reduced\n nonReducedCount++; // increase the count of non reduced ratios\n } \n }\n\n int reducedCount = 1000 - nonReducedCount; //number of times the ratio was reduced already\n double reducedRatio = reducedCount / nonReducedCount; //the ratio for reduced and not reduced\n reducedRatio *= 6;\n reducedRatio = Math.sqrt(reducedRatio);\n System.out.println(\"pi is \" + reducedRatio);\n }\n\n public static int gcd(int a, int b) { return b==0 ? a : gcd(b,a%b); }\n\n}" ]
[ "java", "reduce", "pi" ]
[ "How do I use an \"or\" condition in a inline statement?", "Here is what I tried but it was not well received by my my compiler:\n\n<%#(String.IsNullOrEmpty(Eval(\"WK_PHONE_EXT\").ToString()) || ((Eval(\"WK_PHONE_EXT\").ToString().Length = 4) ? \"N/A\" : Eval(\"WK_PHONE_EXT\"))%>\n\n\nI want to check to see if the string is null or empty or if the length is equal to 4 and if so then (\"WK_PHONE_EXT\").ToString will read \"N/A\". How do I do this?" ]
[ "c#" ]
[ "Can you install a .deb package while a .deb package is busy installing?", "I am creating a .deb package but I want to install a .deb package through the 1st installation.\nSo the 1st .deb package should install a .deb package. Is there a way to do this?" ]
[ "debian", "dpkg", "dpkg-buildpackage" ]
[ "simulate form login through scrapy", "I am trying to simulate a login into a website to scrape some data. The following is the source for the form that I got from my browser: \n\n*form method=\"POST\" action=\"/account/login/\" id=\"login_form\" class=\"submit_form\"\ndiv style='display:none'>/div>input type=\"hidden\" name=\"next\" value=\"/\"* \n\nIn scrapy, I do the following as is suggested in the documentation. \n\ndef parse(self, response):\n return [FormRequest.from_response(response, \n formdata={'username': self.uname, \n 'password': self.key}, \n callback= self.afterlogin)]\n\n\ndef afterlogin(self, response):\n #check login succeed before going on\n if \"authentication failed\" in response.body:\n self.log(\"Login failed\", level=log.ERROR)\n else:\n return Request(url=\"http://example.com\",\n callback=self.parse_Page)\n\n\nHowever, I don't seem to be logged in, I don't get any error per se in the logs. I am not sure if I am missing something in the form data?It does appear from the logs that I am being redirected: \n\nDEBUG: Redirecting (301)\nfollowed by \nDEBUG: Crawled (404)\n\nany pointers will be appreciated." ]
[ "python", "web-scraping", "scrapy" ]
[ "Implementation of recursive Mergesort", "I made a recursive merge sort code,but it is not working,can anyone tell me where am I going wrong in the code.\n\nvoid mergesort(int A[],int start,int end)\n{\n int B[(end-start)/2],C[(end-start)/2],i,j,k,flag=0;\n if(start==end)\n return;\n else\n {\n mergesort(A,start,(start+end)/2);\n mergesort(A,(start+end)/2+1,end);\n }\n for(i=start;i<(start+end)/2;i++)\n B[i]=A[i];\n for(i=(start+end)/2+1;i<end;i++)\n C[i]=A[i];\n for(i=start,j=start,k=(start+end)/2+1;i<end;i++)\n {\n if(j==(start+end)/2)\n {\n while(k!=end)\n A[i]=C[k++];\n flag=1;\n }\n if(k==end)\n {\n while(j!=(start+end)/2)\n A[i]=B[j++];\n flag=1;\n }\n if(flag)\n break;\n if(A[j]>C[k])\n A[i]=C[k++];\n else\n A[i]=B[j++];\n }\n return;\n}\n\n\nIn the first part of the code i am trying to divide the array into 2 sub arrays and if i am left with only one element, I start merging and reach the top to obtain the sorted array." ]
[ "c", "algorithm", "sorting", "mergesort" ]
[ "Inlog page, redirects but doesn't read the code", "I've made/copied a fitting and nice inlog page.\nI've made it fully functional except there is one mistake, when the username and password arent in the DB it still redirects?\nThe login form:\n\n <div class=\"login\">\n<h1>Login</h1>\n<form method=\"post\" action=\"connectivity.php\">\n <input type=\"text\" name=\"user\" placeholder=\"Gebruikersnaam\" required/>\n <input type=\"password\" name=\"pass\" placeholder=\"Wachtwoord\" required/>\n <input id=\"button\" type=\"submit\" class=\"btn btn-primary btn-block btn-large\" name=\"submit\" value=\"Log-In\">\n </br>\n\n\nAnd the php code where its getting posted:\n\n <?php\nsession_start();\n$user = $_POST['user'];\n$_SESSION['user'] = $user;\n\n\ndefine('DB_HOST', 'localhost');\ndefine('DB_NAME', 'mkuiper1');\ndefine('DB_USER','mkuiper1');\ndefine('DB_PASSWORD','password');\n\n\n $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die(\"Failed to connect to MySQL: \" . mysql_error());\n $db=mysql_select_db(DB_NAME,$con) or die(\"Failed to connect to MySQL: \" . mysql_error());\n /*\n $ID = $_POST['user'];\n $Password = $_POST['pass'];\n */\n\n function SignIn($data){\n\n //checking the 'user' name which is from Sign-In.html, is it empty or have some text\n if(!empty($data['user'])){\n\n //$query = mysql_query(\"SELECT * FROM WebsiteUsers where userName = '\".$data['user'].\"' AND pass = '\".$data['pass'].\"'\") or die(mysql_error());\n // The above query is sql-injecation valnerable query, use the below query instead\n // Also do not use mysql erxtension anymore is deprecated, use mysqli instead\n // Let us say that your db connection is stored in $con variable\n\n $stmt = $con->prepare(\"SELECT * FROM WebsiteUsers where userName = '$_POST[user]' AND pass = '$_POST[pass]'\");\n $stmt->bind_param('ss', $data['user'],$data['pass']);\n\n if($stmt->execute()){\n $stmt->store_result();\n if($stmt->num_rows>0){\n $result = $stmt->get_result();\n while ($row = $result->fetch_assoc()) {\n $_SESSION['userName'] = $row['pass'];\n //echo \"Login Succesvol!\"; do not echo anything here before redirecting !!!\n $_SESSION['loggedin'] = 1;\n header(\"Location: index.php\");\n }\n }\n }\n } else{\n $message = \"Verkeerde Gebruikersnaam/Wachtwoord!\";\n echo (\"<SCRIPT LANGUAGE='JavaScript'>\n window.alert('$message')\n window.location = '/Sign-In.php';\n </SCRIPT>\");\n }\n }\n\n if(isset($_POST['submit'])){\n SignIn($_POST);\n }\n\n\n\n ?>\n\n\nBut it still goes and stays on connectivty.php, even when the pass and username are incorrect.\n\nSorry for the bad english\n\nJesse" ]
[ "php", "html" ]
[ "Why isn't my datagrid updating?", "I have an object that has as one of its properties, a List. I want to bind a datagrid to that list, such that when I add objects to the grid, the datagrid updates. I tried:\n\nmyDataGrid.DataSource = myObject.MyList;\n\n\nbut when I update the datasource with new rows, the grid doesn't update.\n\nThen I tried:\n\nmyDataGrid.DataSource = null;\nmyDataGrid.DataSource = myObject.MyList;\n\n\nCalling the above code every time I added an item. This resulted in an error when clicking on the grid (specifically, index -1 has no data, something to do with the datagridview.get_current internally. Happens despite the fact that I'm not clicking the -1st row). \n\nSo then I tried:\n\nmyDataGrid.DataBindings.Add(new Binding(\"DataSoruce\",myObject,\"MyList\",false,DataSourceUpdateMode.OnPropertyChanged));\n\n\nThat didn't reflect the updates either, so I added:\n\nmyDataGrid.DataBindings[0].ReadValue();\n\n\nwhenever I added an item, but it has no effect either. I feel like I'm circling around a simpler solution to this problem, but I can't seem to find it. Any pro tips?" ]
[ "c#", "data-binding", "datagridview" ]
[ "soundmanager2: how to determine whether the volume attribute is changeable", "I'm using the soundmanager2 library (http://www.schillmania.com/projects/soundmanager2) to provide crossbrowser audio support, which works great.\nBut IOS devices don't allow the HTML5 audio volume property to be set. So I'd like to detect whether it's possible to use this feature in order to change the appearance of my site (e.g. hiding the volume control)." ]
[ "html5-audio", "soundmanager2", "browser-feature-detection" ]
[ "Creating and array from a txt file using spark shell, scala in particular", "I need some help with a transformation I want to make to a txt file for a homework in scala using command line of spark. Here is the array I created by using a DF:\nscala> tempDF.collect()\nres6: Array[org.apache.spark.sql.Row] = Array([bid|gender|department], [1|M|Informatics], [2|M|Low], [3|M|BusinessAdministration], [5|M|Mathematics], [6|M|Low], [7|M|Economics], [8|M|Economics], [9|M|Economics], [10|M|Economics], [11|M|Informatics], [13|M|Physics], [14|M|Informatics], [15|M|Informatics], [16|M|Economics], [17|M|Informatics], [18|M|Economics], [19|M|BusinessAdministration], [20|M|Mathematics], [21|M|Mathematics], [22|M|Economics], [23|M|Economics], [24|M|BusinessAdministration], [25|M|Informatics], [26|M|Statistics], [27|M|BusinessAdministration], [28|M|Economics], [29|M|Physics], [30|M|Physics], [31|M|Informatics], [32|M|Mathematics], [33|M|Economics], [34|M|BusinessAdministration], [35|M|Economics], [36|M|BusinessAdministration], [37|M|Mathema...\n\nNow how can I transform "bid|gender|department" into columns with the following tuples like "1|M|Informatics" as the values of each column ?\nIn the txt file, "bid|gender|department", is row 0." ]
[ "scala", "apache-spark" ]
[ "No filter for uuid in postgresql", "I want to do a filter in SQL where no value of an uuid is matched. That is, a where condition where no row is matched by the condition.\nWith a regular int4 id, I would do:\nwhere my_id = -1\n\nIf I do the same thing with the uuid, I get:\nwhere my_uuid = '-1'\n\nI get an error:\nERROR: invalid input syntax for type uuid: "-1"\n\nHow can I do this with an uuid? I would need to use a =, so solutions of the form\nwhere my_uuid is null\n\ndon't work for me. Thanks in advance!" ]
[ "sql", "postgresql", "uuid" ]
[ "Javascript add string variable to response", "So I have this response for a node.js program I'm using\n\n'Content-Disposition': 'attachment; filename=\"tts.mp3\"'\n\n\nInstead of tts.mp3 I have a variable called textToConvert.\nHow can I add textToConvert.slice(0,10), and add .mp3 to the end of it to have that as the name of the mp3 file instead of tts.mp3? \n\nThanks in advance" ]
[ "javascript", "string", "node.js", "text", "response" ]
[ "Linux-Embedded: Nanopi kernel build - Led support - sys/class/leds empty", "I am building a kernel for nanopi neo air based on nikkov git files for volumio. The build works fine and image is running on the nanopi fine as well. However the green status led is not working and trigger function not available under sys/class/leds (it is empty)\nHW: Nanopineo air, Armv7\n\n.config generated by makefile looks okey:\n\n\nCONFIG_NEW_LEDS=y\nCONFIG_LEDS_CLASS=y\nCONFIG_LEDS_GPIO=y\nCONFIG_LEDS_TRIGGERS=y\nCONFIG_LEDS_TRIGGER_TIMER=y\nCONFIG_LEDS_TRIGGER_ONESHOT=y\nCONFIG_LEDS_TRIGGER_HEARTBEAT=y\nCONFIG_LEDS_TRIGGER_CPU=y\nCONFIG_LEDS_TRIGGER_GPIO=y\nCONFIG_LEDS_TRIGGER_DEFAULT_ON=y\n\n\nvolumio@volumio:~$ cat /lib/modules/$(uname -r)/modules.builtin shows that the driver has been built-in prepoerly on the nanopi:\n\n\nkernel/drivers/leds/trigger/ledtrig-timer.ko\nkernel/drivers/leds/trigger/ledtrig-oneshot.ko\nkernel/drivers/leds/trigger/ledtrig-heartbeat.ko\nkernel/drivers/leds/trigger/ledtrig-gpio.ko\nkernel/drivers/leds/trigger/ledtrig-default-on.ko\n\n\nThe Dtsi file used has info for LEDS\nleds {\ncompatible = "gpio-leds";\npinctrl-names = "default";\npinctrl-0 = <&leds_npi>, <&leds_r_npi>;\n status {\n label = "nanopi:blue:status";\n gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;\n linux,default-trigger = "heartbeat";\n };\n\n pwr {\n label = "nanopi:green:pwr";\n gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;\n default-state = "on";\n };\n\n pwr_en {\n label = "nanopi:none:pwr_en";\n gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>;\n default-state = "on";\n };\n };\n\n\nBUT no file can be found under sys/class/leds it should normally be there what may explain that the green status LED does not do Heartbeat when kernel starts.\n\n\nFor some reasons these files are not placed properly.\nAny idea what is going on here ?\nThanks" ]
[ "embedded-linux" ]
[ "IObservableVector in Windows Store apps cannot be used as databinding source", "I have been following the developer guidelines from MS to implement Data Virtualisation, which state that IObservableVector must be implemented for random access data virtualization. \n\nI am using Reactive Extensions in a read only asynchronous implementation of IObservableVector<T>, which I am calling AsyncReadOnlyVirtualCollection.\n\nWhen I bind a GridView to an instance of this IObservableVector<SomeConcreteType> then I get an exception at runtime that the type cannot be instantiated due to incompatible types with WinRT. (Unable to compute GUID for type 'Windows.Foundation.Collections.IObservableVector`1[Foo]' because the instantiation contains types that are not supported by Windows Runtime.)\n\nIf I use *object* instead of *SomeConcreteType*, which was suggested on earlier blogs when WinRT and XAML were still in CTP and framework errors were still present, then this works. Given that it is now 2015 and I am now on Windows 8.1, with the latest install of Visual Studio 2013 Community, I can only assume that I must be making some kind of error.\n\nWhy can IObservableVector<ConcreteType> not be used as a data source, if MS guidelines declare it must be for such databinding? If the docs are out of date, what is the correct approach?\n\n---UPDATE---\nIt seems the core code that throws this error is here https://github.com/dotnet/coreclr/blob/d758145b547cc00aba3f0e3f101af27bf118e9af/src/vm/methodtable.cpp in the method BOOL MethodTable::IsLegalNonArrayWinRTType() which is applied to the generic type ConcreteType or Object above\n---MORE---\nOK after hacking through the above GitHub WinRT coreclr code, I see that there are checks to make sure the IObservableVector's generic type is WinRT compatible. I do not know why this is at the moment...can anyone enlighten me?\n\nAnyway, to comply, I moved the concrete type to a new Windows Runtime Component project and added assembly references, while changing the back to \n\nThis now \"works\" (the error goes away)...I now have a separate issue: The original error goes away but the Enumerator is iterated instead of indexer requested.....so not a solution after all....but WHY?\n\n\n\nFURTHER UPDATE\nThe class works if it implements IObservableVector<object> not IObservabeVector<T>. I didn't have time to find out why, but I suspect that it has something to do with inability to cast <T> to <object>...I will post my implementation for discussion on Codeplex as I think the Rx approach is probably novel. I will update here later when this done." ]
[ "c#", "wpf", "xaml", "windows-runtime", "windows-store-apps" ]
[ "Reducing duplication in code", "I currently have multiple code like this for different toppings\n\n// Toppings - Egg\nSystem.out.print(\"Do you want \" + egg.getType() + \"?\");\ninput = keyboard.nextLine();\nchoice = input.charAt(0);\nif (choice == 'y') {\n l.add(egg.getType());\n c.add((double) egg.getCost());\n numberOfToppings = numberOfToppings + 1;\n totalToppingPrice = totalToppingPrice + egg.getCost();\n toppings = toppings + \"Egg\";\n}\n\n\nIt works fine, however i was hoping i could do all toppings in just one block of code. Because i've got around 5 of these, and it takes up far too much, and i've been advised to do so. Anyone got any ideas for how this could be done ? thanks" ]
[ "java" ]
[ "Escaping the colon character ':' in JPA queries", "I'm trying to run a native query through JPA that uses a ':' character. The particular instance is using a MySQL user variable in the query:\n\nSELECT foo, bar, baz, \n @rownum:= if (@id = foo, @rownum+1, 1) as rownum, \n @id := foo as rep_id \nFROM \n foo_table \nORDER BY \n foo, \n bar desc \n\n\nThe JPA code:\n\nQuery q = getEntityManager().createNativeQuery(query, SomeClass.class);\nreturn q.getResultList();\n\n\nHowever, this gives me an exception about not being allowed to follow a ':' with a space. I've tried escaping them with backslashes, I've tried escaping them by doubling them up. Is there any way to actually do this, or am I SOL?" ]
[ "mysql", "jpa", "jpql" ]
[ "What is the format of a date in database ? asp.net", "This is my code \n\n Establish_Connection con = new Establish_Connection();\n string Fname = TxtFirstName.Text;\n string Lname = TxtLastName.Text;\n string Email = TxtEmailSingUp.Text;\n string Password = TxtPasswordSignUp.Text;\n string DOBDay = DDLDay.SelectedValue;\n string DOBMonth = DDLMonth.SelectedValue;\n string DOBYear = DDLYear.SelectedValue;\n string DOB= DOBYear +\"/\"+ DOBMonth +\"/\"+ DOBDay;\n string Gender = LblGender.SelectedValue;\n string UserName = txtUserName.Text;\n\n\n string connStr = ConfigurationManager.ConnectionStrings[\"Database\"].ConnectionString;\n SqlConnection conn = new SqlConnection(connStr);\n\n conn.Open();\n\n try\n {\n string constr = \"INSERT INTO USERS (UserName,FName,LName,DOB,Gender,Email,Password) VALUES (@UserName,@FName,@LName,@DOB,@Gender,@Email,@Password);\";\n SqlCommand cmd = new SqlCommand(constr,conn);\n cmd.Parameters.AddWithValue(\"@Password\", Password);\n cmd.Parameters.AddWithValue(\"@UserName\",UserName);\n cmd.Parameters.AddWithValue(\"@DOB\",DOB);\n cmd.Parameters.AddWithValue(\"@Gender\", Gender);\n cmd.Parameters.AddWithValue(\"@Email\", Email);\n cmd.Parameters.AddWithValue(\"@LName\", Lname);\n cmd.Parameters.AddWithValue(\"@FName\", Fname);\n\n int affectrows = cmd.ExecuteNonQuery();\n\n Response.Write(\"connection established\");\n }\n catch (Exception ex)\n {\n Response.Write(\"error\" + ex.Message.ToString());\n }\n\n }\n\n\nIt keeps telling me about errors in the DOB, and that I need to convert it to date time type, but when I convert it using Convert.ToDateTime(), it still gives me errors. In the database the type is DateTime, anyone can help me with this?" ]
[ "c#", "asp.net", "database", "datetime" ]
[ "Python beginner stuck on creating a new pandas column from output of a package function", "I am trying to use functions from a helpful finance package to calculate the next coupon date of a bond and other information from columns in my existing dataframe. My data appears to be in the correct format because I get the result I expect when I apply the function using the data in the individual cells in the dataframe, but I get an AttributeError: 'Series' object has no attribute 'year' when I try to create a new column with the results of the function as applied to each row. Thanks for any guidance. I tried to put all the relevant info in the screen capture below, but please let me know if any other info might be helpful. Thanks!\njupyter code and error below" ]
[ "python", "pandas", "function", "finance", "attributeerror" ]
[ "Sending props to a React component for a Jest unit test", "In the render part of a component I have the following div:\n\n<div className=\"col-sm-8\" >\n<input ref='full_link' className=\"formctrl\" name='full_link' type='text'\nvalue={browser.getURL(this.props.params.id)} />\n</div>\n\n\nTo write a test unit for this component, I tried to shallow render it (const component = shallow(<myComponent />);) and it returns this error:\n\nTypeError: Cannot read property 'id' of undefined\n\n\nSo I need to send this props to my component in the test. How should I send id from this.props.params.id to the shallow render?" ]
[ "unit-testing", "reactjs", "jestjs", "enzyme" ]
[ "Subject.create() Not working in RoR", "I'm trying to use the Rails Console to create object instances of my models.\n\nIt is possible to create and save an instance to the database using the manual methods like so:\n\n1.9.3p125 :003 > subject = Subject.new\n => #<Subject id: nil, name: nil, position: nil, visible: false, created_at: nil, updated_at: nil> \n1.9.3p125 :004 > subject.name = \"First Name\"\n => \"First Name\" \n1.9.3p125 :005 > subject.position = 1\n => 1 \n1.9.3p125 :006 > subject.visible = 'true'\n => \"true\" \n1.9.3p125 :007 > subject.save\n(0.2ms) BEGIN\nSQL (0.6ms) INSERT INTO `subjects` (`created_at`, `name`, `position`, `updated_at`, `visible`) VALUES ('2012-06-21 13:28:35', 'First Name', 1, '2012-06-21 13:28:35', 1)\n(20.4ms) COMMIT\n => true \n1.9.3p125 :008 > subject.id\n => 1 \n1.9.3p125 :009 > subject.new_record?\n => false \n\n\nI'm totally new to RoR so I've got no idea where to begin trouble shooting this error:\n\n1.9.3p125 :010 > subject = Subject.create(:name => \"Second name\", :position => 2)\nActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: name, position from /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activemodel-3.2.3/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/attribute_assignment.rb:75:in `assign_attributes'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/base.rb:498:in `initialize'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/persistence.rb:44:in `new'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/persistence.rb:44:in `create'\nfrom (irb):10\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'\nfrom /Users/Nick/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'\nfrom script/rails:6:in `require'\nfrom script/rails:6:in `<main>'\n\n\nHere is my Subject model:\n\nclass Subject < ActiveRecord::Base\n attr_accessible :title, :body, :name, :position\nend\n\n\nThanks!\n\nThings I've tried so far:\n\n\nExiting and reentering rails c.\nTyping \"reload!\" into rails c\nReopening terminal" ]
[ "ruby-on-rails", "ruby-on-rails-3" ]
[ "Are web pages hosted on a public domain (S3) vulnerable to OAuth 2.0 token theft via same-origin policy?", "I have a web page that uses JavaScript to access users' Gmail accounts through the Gmail API using OAuth 2.0, and I'd like to host the HTML and JS files on Amazon's S3 service.\n\nFor this reason, I've authorized https://s3-us-west-2.amazonaws.com/ as one of the origin URIs in the Google Developer Console's credential page. My page works great, but it has me wondering:\n\nIf my page shares the same origin URI as every other web page hosted on S3, wouldn't this mean that another page would satisfy the same-origin policy and be allowed access to my page's access tokens?\n\nFor example, say a user just granted my app access to his Gmail account. Google sees an approved origin URI and sends back an access token.\n\nNow imagine some other page hosted on S3 had copied my app's Client ID (publicly stored as a variable in JS) and was repeatedly requesting for an access token from Google. Once my user grants that access to my page, won't the other page also receive the token from Google since it satisfies the same origin URI?\n\nI realize one solution to this potential problem is to host my web page on a domain that I have control over, but I'm curious if that is the only way." ]
[ "javascript", "amazon-s3", "oauth-2.0", "google-api", "google-oauth" ]
[ "Unable to update background-color of nested div in group of divs", "I've hit a road block and I'm not sure where to look.\n\nI have a single div that is 200px by 200px. Within that I have 4 other divs that are 65px by 65px and they are positioned absolute and aligned to all 4 corners of the outer div. I have created a function that when a user clicks on one of the inner divs, that div color is updated and the 3 other divs background-colors are reset. Currently, if I click either of the top 2 divs it works. If I click either of the bottom 2 divs, it doesn't work.\n\nI have a feeling it has something to do with z-index and maybe block alignment, but that is just a guess now.\n\nI've added my code below.\n\nHTML:\n\n<html>\n<head>\n<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\"></script>\n<script src=\"scripts1.js\"></script>\n\n<script>\n$(document).ready(function(){\n BuildHandler();\n});\n</script>\n\n</head>\n<body>\n <div id=\"mini_container\">\n <div id=\"top_left\" class=\"mini_boxes\"></div>\n <div id=\"top_right\" class=\"mini_boxes\"></div>\n <div id=\"low_left\" class=\"mini_boxes\"></div>\n <div id=\"low_right\" class=\"mini_boxes\"></div>\n </div>\n</body>\n</html>\n\n\nscripts1.js\n\nfunction BoxClicked(event){\n var targetBoxID = event.target.id;\n switch (targetBoxID)\n {\n case \"top_left\":\n $(\"#top_left\").css(\"background-color\",\"#0099FF\");\n $(\"#top_right\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_right\").css(\"background-color\",\"#99CCFF\");\n break;\n case \"top_right\":\n $(\"#top_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#top_right\").css(\"background-color\",\"#0099FF\");\n $(\"#low_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_right\").css(\"background-color\",\"#99CCFF\");\n case \"low_left\":\n $(\"#top_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#top_right\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_left\").css(\"background-color\",\"#0099FF\");\n $(\"#low_right\").css(\"background-color\",\"#99CCFF\");\n case \"low_right\":\n $(\"#top_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#top_right\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_left\").css(\"background-color\",\"#99CCFF\");\n $(\"#low_right\").css(\"background-color\",\"#0099FF\");\n }\n}\n\nfunction BuildHandler(){\n var theBoxes = document.getElementsByClassName(\"mini_boxes\");\n for(i=0;i<theBoxes.length;i++){\n theBoxes[i].addEventListener('click', BoxClicked, false);\n }\n}\n\n\nstyle1.css\n\n#mini_container{\nwidth:200px;\nheight:200px;\nbackground-color:#C4CFCE;\nposition:relative;\nz-index:100;\n}\n\n.mini_boxes{\n width:65px;\n height:65px;\n background-color:#99CCFF;\n z-index:200;\n}\n\n#top_left{\n position:absolute;\n top:0px;\n left:0px;\n}\n\n#top_right{\n position:absolute;\n top:0px;\n right:0px;\n}\n\n#low_left{\n position:absolute;\n bottom:0px;\n left:0px;\n}\n\n#low_right{\n position:absolute;\n bottom:0px;\n right:0px;\n}\n\n\nAny pointers would be greatly appreciated." ]
[ "javascript", "jquery", "css" ]
[ "Is it possible to compile Lucene.net 2.9.4 for .Net 2.0?", "I'm trying to integrate Lucene.net into an old .Net 2.0 application. Scanning the mailing list, I've been given the impression that 2.9.4g no longer supports .Net 2.0 but 2.9.4 does. However, the compiled dll disallows the .Net 2.0 framework, and the source makes use of System.Core (which can be added, though I'd rather not if avoidable) and ThreadLocal.\n\nAm I missing something? Does 2.9.4 not support .Net 2.0? If this is the case, what's the most recent version of Lucene.net to support .Net 2.0?\n\nEdit:\n\n2.9.4 and 2.9.4g are two separate versions. As I understand, 2.9.4g was heavily refactored to use newer .Net generics, making it completely incompatible with .Net 2.0. I'm interested in the 2.9.4 version, before the refactoring.\n\nHere's the post that implies 2.9.4 will run under 2.0: http://mail-archives.apache.org/mod_mbox/lucene-lucene-net-dev/201105.mbox/%[email protected]%3E .\n\nEdit 2:\n\nIf 2.9.4 can support .Net 2.0 with modification, could someone point me in the right direction as to how to accomplish that?" ]
[ ".net-2.0", "lucene.net" ]
[ "How to get access to underlying GMSMapView from UIRepresentable MapView", "In my app I have a ViewModel(MapViewModel) class, a UIRepresentable class and ContentView. I am looking for a way to get access to GMSMapView view in the ViewModel that is created as a UIRepresentable class.\n\nContentView.swift:\n\nimport SwiftUI\nimport Combine\n\nstruct ContentView: View {\n @State private var selection = 0\n @State private var dragOffset = CGSize.zero\n @ObservedObject var mapViewModel : MapViewModel = MapViewModel()\n\n var body: some View {\n GeometryReader { geo in\n TabView(selection: self.$selection) {\n MapView()\n .edgesIgnoringSafeArea(.all)\n .tabItem {\n VStack {\n Image(systemName: \"house\")\n Text(\"Home\")\n }\n }\n .tag(0)\n\n Text(\"Second Page\")\n\n .tabItem {\n VStack {\n Image(systemName: \"gear\")\n Text(\"Settings\")\n }\n }\n .tag(1)\n\n Text(\"Third Page\")\n\n .tabItem {\n VStack {\n Image(systemName: \"gear\")\n Text(\"Third Page\")\n }\n }\n .tag(2)\n }\n }\n }\n}\n\nstruct ContentView_Previews: PreviewProvider {\n static var previews: some View {\n ContentView()\n }\n}\n\n\n\nMapViewModel.swift:\n\nimport Foundation\nimport Combine\nimport GoogleMaps\nimport os\n\nclass MapViewModel: NSObject, ObservableObject {\n\n let lm = CLLocationManager()\n var myLocations = [CLLocation]()\n\n\n override init() {\n\n super.init()\n\n lm.delegate = self\n lm.desiredAccuracy = kCLLocationAccuracyBest\n lm.requestWhenInUseAuthorization()\n lm.pausesLocationUpdatesAutomatically = false\n lm.allowsBackgroundLocationUpdates = true\n lm.startUpdatingLocation()\n\n }\n\n}\n\nextension MapViewModel: CLLocationManagerDelegate {\n\n func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {\n //self.status = status\n\n }\n\n func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\n\n os_log(\"locationManager:didUpdateLocations: received location\",log: Log.general, type: .debug)\n }\n}\n\n\n\nMapView.swift:\n\nimport UIKit\nimport SwiftUI\nimport GoogleMaps\n\nstruct MapView: UIViewRepresentable {\n\n func makeUIView(context: Context) -> GMSMapView {\n\n let camera = GMSCameraPosition.camera(withLatitude: 30.267153, longitude: -97.7430608, zoom: 6.0)\n let gmsMapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)\n gmsMapView.delegate = context.coordinator\n return gmsMapView\n }\n\n func updateUIView(_ mapView: GMSMapView, context: Self.Context) {\n\n }\n\n func makeCoordinator() -> Coordinator {\n Coordinator(self)\n }\n\n class Coordinator: NSObject, GMSMapViewDelegate {\n var parent: MapView\n\n init(_ parent: MapView) {\n self.parent = parent\n } \n }\n}\n\nstruct GoogleMapView_Previews: PreviewProvider {\n static var previews: some View {\n MapView()\n }\n}\n\n\nSo any idea on how I can access the gmsMapView object in MapViewModel. I need access to draw lines on the map...Thanks!" ]
[ "swift", "google-maps", "swiftui" ]
[ "MySQL Multiple Search Criteria returns no results but works if removing the last line", "I have this Query on a Mysql DB :-\n\nSELECT DISTINCT model.model_id, model.model_ref, \nmodel.manufact_year, model.discontinued_year, model.mini_spec, \nmodel.equiv_model_id\nFROM model \nLEFT JOIN model_custom_field \nON model_custom_field.model_id = model.model_id\nWHERE model.category_id = 140 AND model.manufacturer_id = 1190\nAND (model_custom_field.custom_detail_id = 1070 AND model_custom_field.custom_detail_val = '15.6')\nAND (model_custom_field.custom_detail_id = 1010 AND model_custom_field.custom_detail_val = 'Dedicated') \n\n\nWhich returns zero results although there is valid data for the search.\n\nIf I remove the last line it works.\n\nWhere I have the brackets on the last two lines it is because custom_detail_id and custom_detail_val are linked.\n\nCan someone please tell me if the format of the stat\nement is correct.\n\n\n\nI Know the last two statements are a contradiction and can't possibly work but I need to know if there is a way round combining the last two maybe in a union." ]
[ "mysql", "search" ]
[ "Error when deploying the artifact to Artifactory from Jenkins", "I am getting error in Jenkins at final step of build. \n\nError is:Failed to deploy artifacts, could not transfer artifact.\nFailed to transfer file Artifactory URL.\nReturn code is 400 -> bad request. \n\n[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project : \n\nFailed to deploy artifacts: Could not transfer artifact from/to snapshots (Artifactory URL): Failed to transfer file: Artifactory URL/project.jar. \n\nReturn code is: 400, ReasonPhrase: Bad Request. -> [Help 1]\n\nPlease let me know what may cause this issue. Any help would be appreciated." ]
[ "jenkins", "jenkins-plugins" ]
[ "How to fill a PdfPTable column by column instead of row by row, using iText", "I am using Java with iText in order to generate some PDFs. I need to put text in columns, so I am trying to use PdfPTable. I create it with:\n\nmyTable = new PdfPTable(n);\n\n\nn being the number of columns. The problem is that PdfPTable fills the table row by row, that is, you first give the cell in column 1 of row 1, then column 2 of row 1, and so on, but I need to do it column by column, because that is how the data is being fed to me.\n\nI would use a Table (which lets you specify the position) like in http://stderr.org/doc/libitext-java-doc/www/tutorial/ch05.html, but I get a \"could not resolve to a type\", and my Eclipse can't find the proper import.\n\nEdit: in case my previous explanation was confusing, what I want is to fill the table in this order:\n\n1 3 5\n2 4 6\n\n\nInstead of this:\n\n1 2 3\n4 5 6" ]
[ "java", "itext", "pdfptable" ]
[ "retrofit2 with coroutine or not, what's the difference?", "when I use retrofit2 with no coroutine, the result is null. but when using that with coroutine, the result is right. I think it's the problem of syncronization. but I found something strange\nusing mutablelivedata, the result is right.\n\nretrofit2 with coroutine\n\n override suspend fun getRetrofit(id : Int): DetailEntity {\n\n withContext(ioDispatcher){\n val request = taskNetworkSource.searchItem(id)\n val response = request.await()\n\n if(response.body !=null){\n Log.d(\"TAG\",\"\"+response.toString())\n data = response\n }\n\n\n }\n return data\n }\n\n\ngood result\n\nD/TAG: DetailEntity(body=DetatilItem(oily_score=6, full_size_image=url, price=54840, sensitive_score=76, description=description, id=5, dry_score=79, title=title), statusCode=200)\n\n\n\nretrofit2 with no coroutine\n\n override suspend fun getRetrofit(id : Int): DetailEntity {\n\n taskNetworkSource.searchItem(id).enqueue(object: Callback<DetailEntity> {\n override fun onFailure(call: Call<DetailEntity>, t: Throwable) {\n\n }\n override fun onResponse(call: Call<DetailEntity>, response: Response<DetailEntity>){\n if(response.body()!=null) {\n Log.d(\"TAG\",response.toString())\n data = response.body()!!\n\n }\n\n }\n })\n\n return data\n }\n\n\nbad result\n\nD/TAG: Response{protocol=h2, code=200, message=, url=https://6uqljnm1pb.execute-api.ap-northeast-2.amazonaws.com/prod/products/5}\n\n\n\nstrange result with mutablelivedata(another project code)\n\n lateinit var dataSet : DetailModel \n var data = MutableLiveData<DetailModel>() \n\n fun getDetailRetrofit(id:Int) : MutableLiveData<DetailModel>{ \n Retrofit2Service.getService().requestIndexItem(id).enqueue(object:\n Callback<DetailResponse> {\n override fun onFailure(call: Call<DetailResponse>, t: Throwable) { \n\n }\n override fun onResponse(call: Call<DetailResponse>, response: Response<DetailResponse>) { \n if(response.body()!=null) {\n var res = response.body()!!.body\n dataSet = DetailModel( res.get(0).discount_cost,\n res.get(0).cost,\n res.get(0).seller,\n res.get(0).description+\"\\n\\n\\n\",\n res.get(0).discount_rate,\n res.get(0).id,\n res.get(0).thumbnail_720,\n res.get(0).thumbnail_list_320,\n res.get(0).title\n )\n data.value = dataSet\n }\n }\n })\n return data\n }\n\n\nand this another project code result is right. comparing this code to retrofit2 with no coroutine code, the difference is only mutablelivedata or not. do I have to use asyncronouse library or livedata? \n\nadded\n\ndata class DetailEntity(val body: DetatilItem,\n val statusCode: Int = 0)\n\ndata class DetatilItem(val oily_score: Int = 0,\n val full_size_image: String = \"\",\n val price: String = \"\",\n val sensitive_score: Int = 0,\n val description: String = \"\",\n val id: Int = 0,\n val dry_score: Int = 0,\n val title: String = \"\")" ]
[ "android" ]
[ "DataTables YADCF Plug In", "I have a DataTable 1.10 which uses the YADCF Plugin, I had some data from a table that loaded in fine, I've now change the table to another table with an identical structure. I am getting the error:\n\nIn Chrome : \n\n jquery.dataTables.yadcf.js:2910 Uncaught TypeError: Cannot read property 'yadcf_data_0' of null(anonymous function) \n@ jquery.dataTables.yadcf.js:2910m.event.dispatch @ datatables.min.js:16r.handle @ datatables.min.js:16m.event.trigger @ datatables.min.js:16(anonymous function) @ datatables.min.js:16m.extend.each @ datatables.min.js:14m.fn.m.each @ datatables.min.js:14m.fn.extend.trigger @ datatables.min.js:16v @ datatables.min.js:134o.error @ datatables.min.js:94j @ datatables.min.js:14k.fireWith @ datatables.min.js:14x @ datatables.min.js:17b @ datatables.min.js:17\n 3index.php:601 \n\n\nand In FireFox :\n\nTypeError: json is null\ninitAndBindTable/<()\n jquery.dataTables.yadcf.js:2910\nm.event.dispatch()\n datatables.min.js:16\nm.event.add/r.handle()\n datatables.min.js:16\nm.event.trigger()\n datatables.min.js:16\n.trigger/<()\n datatables.min.js:16\n.each()\n datatables.min.js:14\nm.prototype.each()\n datatables.min.js:14\n.trigger()\n datatables.min.js:16\nv()\n datatables.min.js:134\nra/o.error()\n datatables.min.js:94\nm.Callbacks/j()\n datatables.min.js:14\nm.Callbacks/k.fireWith()\n datatables.min.js:14\nx()\n datatables.min.js:17\n.send/b()\n datatables.min.js:17\n jquery.dataTables.yadcf.js:2910:1\n\n\nDoes anyone know whats going on here and why the two tables with identical structure just different records are throwing this error?" ]
[ "datatables", "yadcf" ]
[ "Gatsby image fluid stretches to beyond the vertical size of the container", "I'm building a gatsby site to show my photographs. I want a full-screen page for each photograph, and the photo should fill out the page, but respecting the aspect ratio.\nThe problem is that while photos shot in landscape orientation are limited correctly, photos shot in portrait orientation fill out all horizontal space but overflows the vertical space.\nIn the documentation there is the statement\n\nAs mentioned previously, images using the fluid type are stretched to match the container’s width and height\n\nHowever, my observed behavior is that it only stretches to match the width, not height.\nI simplified my problem into this small example, that tries to contain the images in a 400x400px container:\nimport React from "react"\nimport { graphql } from "gatsby"\nimport Layout from "../components/layout"\nimport Img from "gatsby-image"\n\nexport default (props) => {\n const { data } = props;\n return (\n <Layout>\n <div style={{height: "400px", width: "400px", background: "white" }}>\n <Img fluid={ data.file.childImageSharp.fluid } />\n </div>\n </Layout>\n )\n}\n\nexport const query = graphql`\n query($id: String!) {\n file(id: { eq: $id }) {\n childImageSharp {\n fluid(maxWidth: 500, maxHeight: 500, fit: INSIDE) {\n ...GatsbyImageSharpFluid\n }\n }\n }\n }\n`;\n\nIn the landscape example, the image is constrained to the width of the containing div:\n\nIn the portrait orientation example, the image fills out the entire width of the containing div, becoming too high:\n\nHow do I make Gatsby Image scale down to also be restrained to the available vertical space?\np.s. the rounded corners in the example images are remnants of a bootstrap class from an older solution, but its presence did not affect the problem in question." ]
[ "gatsby", "gatsby-image" ]
[ "How to get MIME-TYPE from Base 64 String?", "I am getting base64 for string from backend and i am then decoding it in Javascript to show on browser. \n\nThis string can be any file .pdf, .img, .docx, .zip etc. \n\nMy base64 string does not include the mime-type for example 'data:application/pdf;base64' part. So i need to get mime type of base64.\n\nIs there any way to solve this solution with Javascript or Jquery?" ]
[ "javascript", "jquery", "base64", "mime-types", "content-type" ]
[ "Check if Opera extension installed in developer mode", "Is there some predicate or variable that one can use in the extension code to determine whether it was installed normally or in developer mode?\n\n(I'd like to put some debug output visible only in developer mode.)" ]
[ "javascript", "opera", "browser-extension", "opera-extension" ]
[ "Error in sending message from server to client", "I writing a server program for computing engine in socket programming that displays the average of the numbers given by the client. \nMy code for client:\n\nmain()\n{\n //socket\n //connect\n gets(msg);\n f=sscanf(msg,\"%f\",&num);\n write(sockfd,msg,strlen(msg));\n while ((n1=read(sockfd,result,Z))>0) {\n write(1,result,n1);\n }\n}\n\n\nIn server:\n\nwhile((rfd=read(sockfd,buff,Z))>0) {\n sscanf(buff,\"%f\",&num);\n sum=sum+num;\n}\nsum=sum/n;\nsnprintf(res,Z,\"%f\",sum);\nwrite(sockfd,res,strlen(res));\n\n\nThe program doesnt work. If I remove the write in server then it is working.\nIf I just send a sample msg from server to client removing all computation then it works.\nCould anyone tell me what is the error" ]
[ "c", "sockets", "tcp" ]
[ "overload resolution from magic number to int or long (in range-v3)", "In range-v3, view_facade class has begin() function.\n\ntemplate<typename D = Derived, CONCEPT_REQUIRES_(Same<D, Derived>())>\ndetail::facade_iterator_t<D> begin()\n{\n return {range_access::begin_cursor(derived(), 42)};\n}\n\n\nAnd the range_access::begin_cursor() is implemented like this,\n\ntemplate<typename Rng>\nstatic RANGES_CXX14_CONSTEXPR auto begin_cursor(Rng & rng, long) // --1\nRANGES_DECLTYPE_AUTO_RETURN\n(\n rng.begin_cursor()\n)\ntemplate<typename Rng>\nstatic RANGES_CXX14_CONSTEXPR auto begin_cursor(Rng & rng, int) // --2\nRANGES_DECLTYPE_AUTO_RETURN\n(\n static_cast<Rng const &>(rng).begin_cursor()\n)\n\n\nIn my VS, it looks the second function is always called.\n\nI wonder when the magic number (42) is converted into long to call first function." ]
[ "c++", "c++11", "c++14", "range-v3" ]
[ "json_decode and syntax in php", "I have a problem with a json reading\n\nI use this for read my json :\n\n$json = file_get_contents($url);\n$data = json_decode($json, true);\n\n\nHere's my json :\n\n{\"metadata\":\n{\n\"name\":\"OurDatabase\",\n\"articles\":[\n\n{\"id\":1,\n\"url\":\"http://www.google.com\",\"title\":\"google.com\",\n\"image\":\"http://www.oursite/e34ffadf12cd303dc7ba7e4a.jpg\",\n\"category\":[3]},\n\n{\"id\":2,\n\"url\":\"http://www.google.com\",\"title\":\"google.com\",\n\"image\":\"http://www.oursite/e34ffadf12cd303dc7ba7e4a.jpg\",\n\"category\":[6]}\n]\n}\n\n\nI have try multiple combinaison to recover the title and the id of each articles : \nI think i'm close...\n\nforeach ($data as $value) {\n $id = $data[0]['articles'][$i]['id'];\n $titre = $data[$i]['articles']['articles'][0]['title'];\n}\n\n\nBut.. nothing work... Can you help me ?\nMany thanks" ]
[ "json" ]
[ "Why memcpy() fails copying elements of an array in the same array but with an offset", "I'm trying to copy the content of an array inside itself but with an offset (or from an offset). For example:\nint main(void) {\n char a[4] = { 'a', 'b' , 'c', 'd' }, b[4], c[4];\n\n memcpy(b, a, 4);\n memcpy(c, b, 4);\n\n memcpy(b, b + 1, 3);\n memcpy(c + 1, c, 3);\n\n for(unsigned i = 0; i < 4; i++)\n printf("%c", b[i]);\n printf("\\n");\n\n for(unsigned i = 0; i < 4; i++)\n printf("%c", c[i]);\n\n return 0;\n}\n\ngives the following output:\nbcdd\naaaa\n\nand I was expecting\nbcdd\naabc\n\nThe first memcpy it works but as the second doesn't it looks to me that it is inconsistent so I'm doing something wrong.\nI can't understand what am I doing wrong. Why does it fails. Also, will this still happen if I try to do the same but for an array of structs for example ?" ]
[ "c", "memcpy" ]
[ "How to join Minute based time-range with Date using Pandas?", "My dataset df looks like this:\n\nDateTimeVal Open \n2017-01-01 17:00:00 5.1532 \n2017-01-01 17:01:00 5.3522 \n2017-01-01 17:02:00 5.4535 \n2017-01-01 17:03:00 5.3567 \n2017-01-01 17:04:00 5.1512 \n....\n\n\nIt is a Minute based data\n\nThe Time value starts from 17:00:00 however I want to only change the Time value to start from 00:00:00 as a Minute based data and up to 23:59:00 \n\nThe current Time starts at 17:00:00 and increments per Minute and ends on 16:59:00. The total row value is 1440 so I can confirm that it is a Minute based 24 Hour data \n\nMy new df should looks like this:\n\nDateTimeVal Open \n2017-01-01 00:00:00 5.1532 \n2017-01-01 00:01:00 5.3522 \n2017-01-01 00:02:00 5.4535 \n2017-01-01 00:03:00 5.3567 \n2017-01-01 00:04:00 5.1512 \n....\n\n\nHere, we did not change anything except the Time part.\n\nWhat did I do?\n\nMy logic was to remove the Time and then populate with new Time\n\nHere is what I did: \n\npd.DatetimeIndex(df['DateTimeVal'].astype(str).str.rsplit(' ', 1).str[0], dayfirst=True)\n\n\nBut I do not know how to add the new Time data. Could you please help?" ]
[ "python-3.x", "pandas", "dataframe" ]
[ "Binary translation | Cross compilation", "Say you are writing compilers for different architectures.\nThe architectures have different endianness.\nYou have memory read and write instructions\n\nTake example of a store instruction, where you want to store the value 0xAA0xBB0xCC0xDD.\nNow while writing the assembly for this, do you write two different instructions for the\ndifferent architectures e.g.\n\nFor the little endian: st (reg), 0xDD0xCC0xBB0xAA\n\nFor the big endian: st (reg), 0xAA0xBB0xCC0xDD\n\nOr you write the same instruction, say, st, (reg), 0xAA0xBB0xCC0xDD for both the architectures and let the instruction be parsed by the processor such that it takes care of the endianness of the system?\n\nThe reason why I ask this question is I don't know what a binary translator would do when it has to translate code between architectures of different endianness. If in Architecture A, you see the following line st, (reg), XY do you convert it into st, (reg), YX for the Architecture B ?? If that is the case, then what happens to memory reads?\n\nI would like to know how to take care of endianness, considering memory reads and writes in binary translation." ]
[ "binary", "translation" ]
[ "How to format string variable content in angular template", "In angular template I want to display a string with paragraphs, but the string is coming from api. How can I achieve this. Here is a sample of what I want\nContent here should be in paragraph 1\nContent here should be in paragraph 2\nContent here should be in paragraph 3\n<div *ngIf="msg?.length>0">{{ msg }}</div>\n\nIt is the msg content I want to display in paragraphs" ]
[ "string", "paragraph" ]
[ "Orion Context Provider query multiple entities", "Tax information system contains all Tax information regarding every citizen in the city.\nFollowing FIWARE principles, seems it might make sense Consumers query Orion about entity(citizen) tax information, and the request being forwarded to Context Provider (ie:TaxInformationSystem).\nQuery citizen X tax information -> Orion -> TaxInformationSystem_CP\nAccording to documentation, Context Providers can register themselves as source for specific attributes. This, for example, could make this work:\nhttp://{{orion}}/v2/entities/urn:citizenID/attrs/name/tax\nHowever, this seems to require every citizen to be registered as an entity, so tax information system should register multiple times (one per citizen). (And residenceInformationSystem, and healthInformationSystem, and...)\n"entities": [\n {\n "id" : "citizenID", //one per citizen ???\n "type": "taxInformation"\n }\n],\n\nand that seems, at least, a lot of unnecessary/superfluous work.\nAfter reading a bit more, seems any workaround is not yet implemented/supported\n\nSeems I can't use query parameters http://{{orion}}/v2/entities/tax?citizen=X, as they aren't forwarded to CP\nSeems I can't query any citizen tax http://{{orion}}/v2/entities/X/tax if the entity hasn't be explicitly created first\nSeems I can't set idPattern (currently only .* supported), as it would return all citizens tax, as Broker is not forwarding requests filters neither entity to CP\nNeither typePattern\n\n\n(IIUC, isPattern seems now deprecated in favour of idPattern/typePattern)\n\nAm I doing something wrong? Is registering once per citizen the only way to go?" ]
[ "fiware", "fiware-orion" ]
[ "cts:word-query to search in a json property for a number", "I have a json file, which has properties which have string values and some have integer values.. I have a generic query which queries a given json property for a value using cts:word-query. This works when the json property has string values, but for number values it does not work.. for eg:\n\nFollowing is my json string \n\n{\n \"id\": \"35A7D24661CFB8A7E050480A751E4949\",\n \"moniker\": \"CL-1460933\",\n \"entityType\": \"Cell Line\",\n \"entitySubType\": \"Immortalized\",\n \"bioSafetyLevel\": \"BL2\",\n \"name\": \"WSU-NHL\",\n \"growthFS\": {\n \"id\": \"35A7D24661D1B8A7E050480A751E4949\",\n \"mediumUsed\": \"IMDM + 10% HS\",\n \"percentCO2\": 5,\n \"percentHumudity\": 95,\n \"percentSerum\": 10,\n \"spinnerPlateSpeed\": -1,\n \"temp\": -1,\n \"growthConditions\": \"Suspension\"\n },\n}\n\n\nWhen I do the following \n\ncts:search(fn:doc(),\ncts:json-property-scope-query(\"growthFS\", cts:json-property-scope-query(\"percentHumudity\", \ncts:word-query(\"95\", (\"wildcarded\"), 1))))[1]\n\n\nI do not get the json, but when I do the following\n\ncts:search(fn:doc(),\ncts:json-property-scope-query(\"growthFS\", cts:json-property-value-query(\"percentHumudity\", 95, \"wildcarded\")))[1]\n\n\nI get the documents, I was under the impression that cts:word-query works for any xs:atomicType.. If this is not the case, how can I write a generic cts:query without taking into consideration the atomictype of the string (string or number)." ]
[ "marklogic", "marklogic-8" ]
[ "Ext-js custom html data attributes", "I need to be able to set a 'data-selenium-id' attribute for every (dynamic and not dynamic) child input field. I can set the parent tag (table in this case) with a data selenium id using the override below and I was hoping that it would set all the fields. I am quite new to ext-js and I have to keep the code in the override functions and am struggling to find the answer. the foo: 'bar' line of code below is something I've tried and also have tried calling out the parent id 'TextSearch' and setting attributes that way, however it does not come up with any new attributes. Also, as you can see the top table tag is listed with an ID. This id was created by me for a test, all tags will be created on the fly by ext-js.\n\nExt.override(Ext.AbstractComponent, {\nonBoxReady: function () {\n var me = this,\n el = me.getEl();\n\n el.set({foo: 'bar'});\n if (el && el.dom) {\n\n if (me.itemId || me.name) {\n el.dom.setAttribute('data-selenium-id', me.itemId || me.name);\n } else { \n\n if (me.pickerField && me.pickerField.itemId && me.xtype) { \n el.dom.setAttribute('data-selenium-id', me.pickerField.itemId + '-' + me.xtype);\n }\n if (me.timeField && me.timeField.itemId && me.xtype) { \n el.dom.setAttribute('data-selenium-id', me.timeField.itemId + '-' + me.xtype);\n }\n }\n }\n\n me.callOverridden(arguments);\n}\n\n\n});\n\nHowever I need all input fields that are dynamically created to have this attribute as well. The HTML is below.\n\n\r\n\r\n<table class=\"x-field x-table-plain x-form-item x-form-type-text x-field-toolbar x-box-item x-toolbar-item x-field-default-toolbar x-hbox-form-item\" style=\"width: 130px; table-layout: fixed; right: auto; left: 830px; top: 1px; margin: 0px;\" cellpadding=\"0\"\r\nrole=\"presentation\" id=\"triggerfield-1126\" foo=\"bar\" data-selenium-id=\"TextSearch\">\r\n <tbody>\r\n <tr role=\"presentation\" id=\"triggerfield-1126-inputRow\" class=\"x-form-item-input-row\">\r\n <td role=\"presentation\" id=\"triggerfield-1126-labelCell\" style=\"display:none;\" valign=\"top\" halign=\"left\" width=\"5\" class=\"x-field-label-cell\">\r\n <label id=\"triggerfield-1126-labelEl\" for=\"triggerfield-1126-inputEl\" class=\"x-form-item-label x-unselectable x-form-item-label-left\" style=\"margin-right:5px;\" unselectable=\"on\"></label>\r\n </td>\r\n <td role=\"presentation\" class=\"x-form-item-body x-form-trigger-wrap-focus\" id=\"triggerfield-1126-bodyEl\" colspan=\"3\" style=\"width: 100%;\">\r\n <table id=\"triggerfield-1126-triggerWrap\" class=\"x-form-trigger-wrap\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width: 100%; table-layout: fixed;\">\r\n <tbody role=\"presentation\">\r\n <tr role=\"presentation\">\r\n <td id=\"triggerfield-1126-inputCell\" class=\"x-form-trigger-input-cell\" role=\"presentation\" style=\"width: 100%;\">\r\n <input id=\"triggerfield-1126-inputEl\" type=\"text\" role=\"textbox\" size=\"1\" name=\"triggerfield-1126-inputEl\" placeholder=\"Search events\" class=\"x-form-field x-form-text x-form-focus x-field-form-focus x-field-default-toolbar-form-focus\" autocomplete=\"off\"\r\n data-errorqtip=\"\" style=\"width: 100%;\">\r\n </td>\r\n <td role=\"presentation\" valign=\"top\" class=\" x-trigger-cell x-unselectable\" style=\"width:17px;\" id=\"ext-gen1260\">\r\n <div class=\"x-trigger-index-0 x-form-trigger x-form-clear-trigger x-form-trigger-first\" role=\"presentation\" id=\"ext-gen1259\"></div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>" ]
[ "dom", "extjs", "attributes" ]
[ "Identity operation equivalent for Comparator", "Is there a possible identity representation of Comparator that could exist?\n\nIn the search for simplifying the code in Removing overloaded method in Java, I thought about this and ended up concluding that if every comparison results in objects being equal, the order wouldn't really change making the operation an identity. Hence I ended up with (an inefficient) suggestion such as this:\n\npublic static <T, G> List<G> toListOfNewType(List<T> inputList, Function<T, G> mapperFunction) {\n return toListOfNewType(inputList, mapperFunction, (a, b) -> 0); // overloaded with comparator for 'G' type\n}\n\n\nBut what I now wonder is, would this even hold for objects with their custom compareTo implementations as well? Is it really safe to assume this given the Stream implementation?\n\nEdit: Certain tests that I'd tried and which retained the order were as follows:\n\nList<Integer> integers = List.of(1, 3, 45356, 47424, 34234, 4, 4, 234234, 234, 0, -23, -34);\nSystem.out.println(integers);\nSystem.out.println(integers.stream().sorted((a, b) -> 0).collect(Collectors.toList()));\nSystem.out.println(integers.stream().sorted((a, b) -> 0).parallel().collect(Collectors.toList()));\n\n[1, 3, 45356, 47424, 34234, 4, 4, 234234, 234, 0, -23, -34]\n[1, 3, 45356, 47424, 34234, 4, 4, 234234, 234, 0, -23, -34]\n[1, 3, 45356, 47424, 34234, 4, 4, 234234, 234, 0, -23, -34]\n\nList<String> strings = List.of(\"aadad\", \"Z\", \"vsadasd\", \"zadad\", \"C\", \"Aadasd\");\nSystem.out.println(strings);\nSystem.out.println(strings.stream().sorted((a, b) -> 0).collect(Collectors.toList()));\nSystem.out.println(strings.stream().sorted((a, b) -> 0).parallel().collect(Collectors.toList()));\n\n[aadad, Z, vsadasd, zadad, C, Aadasd]\n[aadad, Z, vsadasd, zadad, C, Aadasd]\n[aadad, Z, vsadasd, zadad, C, Aadasd]\n\nSet<Integer> integerSet = Set.of(1, 3, 45356, 47424, 34234, 4, 234234, 234, 0, -23, -34);\nSystem.out.println(integerSet);\nSystem.out.println(integerSet.stream().sorted((a, b) -> 0).parallel().collect(Collectors.toList()));\nSystem.out.println(integerSet.stream().sorted((a, b) -> 0).collect(Collectors.toList()));\n\n[-34, 45356, 47424, 234, -23, 234234, 1, 34234, 3, 4, 0]\n[-34, 45356, 47424, 234, -23, 234234, 1, 34234, 3, 4, 0]\n[-34, 45356, 47424, 234, -23, 234234, 1, 34234, 3, 4, 0]\n\nSet<String> stringSet = Set.of(\"aadad\", \"Z\", \"vsadasd\", \"zadad\", \"C\", \"Aadasd\");\nSystem.out.println(stringSet);\nSystem.out.println(stringSet.stream().sorted((a, b) -> 0).collect(Collectors.toList()));\nSystem.out.println(stringSet.stream().sorted((a, b) -> 0).parallel().collect(Collectors.toList()));\n\n[zadad, Z, vsadasd, C, Aadasd, aadad]\n[zadad, Z, vsadasd, C, Aadasd, aadad]\n[zadad, Z, vsadasd, C, Aadasd, aadad]" ]
[ "java", "sorting", "java-stream", "comparator" ]
[ "How do I use jQuery to retrieve \"Result One\" using the data-filters attribute?", "How do I use jQuery to retrieve \"Result One A\" and \"Result One B\" using the data-filters attribute? I want to retrieve every result that has \"[\"FilterOne\"]\" as a data filter.\n\n<ul class=\"list\">\n <li data-filters=\"[\"FilterOne\"]\">\n <div class=\"wrapper\">\n <span class=\"target\">Result One A</span>\n </div>\n </li>\n <li data-filters=\"[\"FilterOne\"]\">\n <div class=\"wrapper\">\n <span class=\"target\">Result One B</span>\n </div>\n </li>\n <li data-filters=\"[\"FilterTwo\"]\">\n <div class=\"wrapper\">\n <span class=\"target\">Result Two A</span>\n </div>\n </li>\n <li data-filters=\"[\"FilterThree\"]\">\n <div class=\"wrapper\">\n <span class=\"target\">Result Three A</span>\n </div>\n </li>\n</ul>" ]
[ "javascript", "jquery" ]
[ "reCAPTCHA v3 vb.net Uncaught (in promise) null", "Error in console\nI'm trying to add a captcha to a VB.net page. The only explanation is Uncaught (in promise) null? I added a label which I have in the script but wasn't on the page and the error goes away but it still doesn't work? By the way, I do get the Are you a robot message if I don't check but if I do check, it just reloads the page and doesn't continue the code in the button click event?\nMy code:\nScript:\nvar your_site_key = 'xxxxxxxxxxxxxxxxxx';\n var renderRecaptcha = function () {\n grecaptcha.render('ReCaptchContainer', {\n 'sitekey': 'xxxxxxxxxxxxxxxxxx',\n 'callback': reCaptchaCallback,\n theme: 'light', //light or dark\n type: 'image',// image or audio\n size: 'normal'//normal or compact\n });\n };\n var reCaptchaCallback = function (response) {\n if (response !== '') {\n document.getElementById('lblMessage1').innerHTML = "";\n }\n };\n\nDesign view:\n<div id="ReCaptchContainer"></div>\n<br/><asp:Label ID="lblMessage1" runat="server" />\n\nCode Behind:\nIn button click\nServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12\n If IsReCaptchValid() Then\n \n Else\n lblMessage1.Text = "Are you a robot?"\n Return\n End If\n \n\nFunction:\n Public Function IsReCaptchValid() As Boolean\n Dim result = False\n Dim captchaResponse = "g-recaptcha-response"\n Dim secretKey = "xxxxxxxxxxxxxxxxxxx"\n Dim apiUrl = "https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}"\n Dim requestUri = String.Format(apiUrl, secretKey, captchaResponse)\n Dim request = CType(WebRequest.Create(requestUri), HttpWebRequest)\n\n Using response As WebResponse = request.GetResponse()\n\n Using stream As StreamReader = New StreamReader(response.GetResponseStream())\n Dim jResponse As JObject = JObject.Parse(stream.ReadToEnd())\n Dim isSuccess = jResponse.Value(Of Boolean)("success")\n result = If((isSuccess), True, False)\n End Using\n End Using\n\n Return result\nEnd Function" ]
[ "javascript", "vb.net", "recaptcha-v3" ]
[ "Terraform - reference instance value when calling module throwing errors", "I have the block of code below that creates a bunch of subnets based on a list of names and a list of address_prefixes.\n\nresource \"azurerm_subnet\" \"subnet\" {\n count = \"${length(var.subnet_names)}\"\n name = \"${element(var.subnet_names, count.index)}\"\n resource_group_name = \"${var.vnet_rg_name}\"\n virtual_network_name = \"${data.azurerm_virtual_network.vnet.name}\"\n address_prefix = \"${element(var.subnet_prefixes, count.index)}\"\n service_endpoints = [\"Microsoft.Sql\",\"Microsoft.Storage\",\"Microsoft.AzureCosmosDB\"]\n network_security_group_id = \"${data.azurerm_network_security_group.required_nsg.id}\"\n route_table_id = \"${element(azurerm_route_table.routetable.*.id, count.index)}\"\n depends_on = [\"azurerm_route_table.routetable\"]\n}\n\n\nI am then trying to create some routes using a module but when I try to pass in values for variables using properties from a specific instance of the azurerm_subnet.subnet resource, it throws the error:\n\n\"module.insidedmzroutes.var.subnet_name: Resource 'azurerm_subnet.subnet' not found for variable 'azurerm_subnet.subnet.5.name'\"\n\nmodule \"insidedmzroutes\" {\n source = \"./modules/dmzroutes\"\n subnet_name = \"${azurerm_subnet.subnet.5.name}\"\n vnet_rg = \"${data.azurerm_resource_group.vnet_rg.name}\"\n route_table_name = \"${azurerm_route_table.routetable.5.name}\"\n next_hop_ip = \"${cidrhost(azurerm_subnet.subnet.5.address_prefix, 4)}\"\n subnet_names = [\"${var.subnet_names}\"]\n subnet_prefixes = [\"${var.subnet_prefixes}\"]\n}\n\n\nDoes this not work or do I have the reference constructed incorrectly?" ]
[ "terraform", "terraform-provider-azure" ]