texts
sequence
tags
sequence
[ "How to calculate and display percentages from a binary dataframe", "I am trying to create a table, where I calculate the percentages of applicants in different stages of a recruitment process. I have a dataframe that looks like this: \n\n# A tibble: 6 x 3\n CandidateType Step Amount\n <fctr> <chr> <dbl>\n1 External Hiring 304\n2 Internal Hiring 164\n3 External Interview 950\n4 Internal Interview 512\n5 External Application 8726\n6 Internal Application 828\n\n\nI need to add a column that calculates the percentages of applications that result in an interview, and the percentages of applications that ends up as hirings for each Group (internal and external applicants). It should look something like this:\n\n# A tibble: 6 x 3\n CandidateType Step Amount Pct\n <fctr> <chr> <dbl> <chr>\n1 External Hiring 304 3.48 %\n2 Internal Hiring 164 19.81 %\n3 External Interview 950 10.89 %\n4 Internal Interview 512 61.84 %\n5 External Application 8726 100.00 %\n6 Internal Application 828 100.00 %\n\n\nI've tried solving the problem using the following code, but with no luck:\n\nrecruitmentDFinternal <- recruitmentDF %>% \n filter(CandidateType == \"Internal\") %>% \n percent((Amount) / Amount[3])\n\n\nThe idea here was to use the percent function from the scales package, and create two separate data frames from each type of candidate, to ultimately do a bind_rows to piece them back together, but I had no luck getting the percent function to work. Does anyone have a solution for this problem? I need the Pct column to contain a %-symbol at the end of the percentage." ]
[ "r" ]
[ "Using For loop inside function - not returning all values", "I am having problems displaying the results of function calculateGrowth. As shown below, I would like to find the results for each day of a 10 day period. I used a for loop for obvious reasons. But when I try to display results, all I get back is one result. \n\nfunction calculateGrowth(){\n $days = 0;\n $growth = 10;\n for($days = 0; $days < 10; $days++){\n $totalGrowth = $growth * pow(2, $days/10);\n }\n return $totalGrowth;\n}\n\n\nCurrent Output\n\n18.6606598307\n\n\nDesired Output\n\nDay Growth\n1 - result\n. - result\n. - result\n10" ]
[ "php" ]
[ "Installing Win10 SDK (any version) hangs every time", "I'm trying to install the Win10 SDK (any version - logs below are from 17763) for use in Visual Studio 2019. Every time I try, the install hangs. I finally have to go into Task Manager and kill off several processes. There are usually three for winsdksetup.exe and one Windows Installer. \n\nI've tried installing from the Visual Studio Installer, and also from the standalone SDK installer. They all hang, even the full ISO download of the SDK. Installing it standalone (outside Visual Studio), it gets as far as \"Updating Settings\" (around 45%) and then just sits there. I've left it for hours. I go in and find the same dead processes.\n\nThe logs, of course, are massive. A few relevant bits I've found are messages such as:\n\nMSI (s) (84:D8) [11:40:21:462]: Warning: Local cached package 'C:\\Windows\\Installer\\75742b.msi' is missing.\nMSI (s) (84:D8) [11:40:21:463]: SOURCEMGMT: Source is invalid due to missing/inaccessible package.\nMSI (s) (84:58) [11:43:33:684]: Product: Kits Configuration Installer -- Error 1714. The older version of Kits Configuration Installer cannot be removed. Contact your technical support group. System Error 1612.\n\n\nIt seems like something is missing or broken in my system... does anyone know what it could be, or how to fix this?" ]
[ "visual-studio", "sdk", "windows-10" ]
[ "Regex to ensure a specific word does not occur in the middle of a pattern", "I have a regex which matches a range of characters in a list, but I'd like to prevent it from matching a word.\n\nMy Regex is:\n\n^widget/([\\w\\d~]+)/?(?:[\\w\\d~]+)/?$\n\n\nI'd like it to match like this:\n\n\nwidget/JQYHHU - View widget, should match\nwidget/JQYHHU/ - View widget, should match\nwidget/JQYHHU/bag-of-screws - View widget, should match\nwidget/JQYHHU/bag-of-screws/ - View widget, should match\nwidget/add - View widget, should not match\nwidget/add/ - View widget, should not match\n\n\nIs it possible to add in a condition so it will match characters, but not if they spell the word 'add'?" ]
[ "regex" ]
[ "Problem with jQuery cycle plugin", "I am using the jQuery cycle pluging, and having some trouble after i added a play/pause option.\n\nThe code looks like this;\n\n $('#img').cycle({\n fx: 'fade',\n speed: 'slow',\n timeout: 1000,\n pager: '.imagegallerypager.r2s1',\n pagerClick: function (zeroBasedSlideIndex, slideElement) {\n $('#txt').cycle({\n startingSlide: zeroBasedSlideIndex\n });\n $('#txt').cycle('pause');\n $('#img').cycle('pause');\n\n }\n });\n\n $('#txt').cycle({\n fx: 'none',\n speed: 'slow',\n timeout: 1000\n });\n\n $('#playpause, .imagegallerypager a').click(function () {\n if ($('#playpause').attr('class') == 'pause') {\n $('#txt').cycle('pause');\n $('#img').cycle('pause');\n $('#playpause').html('<img src=\"images/icon_play.gif\" alt=\"Play\" title=\"Play\" />');\n $('#playpause').removeClass('pause');\n $('#playpause').addClass('play');\n }\n else if ($(this).attr('class') == 'play') {\n $('#txt').cycle('resume');\n $('#img').cycle('resume');\n $('#playpause').html('<img src=\"images/icon_pause.gif\" alt=\"Pause\" title=\"Pause\" />');\n $('#playpause').removeClass('play');\n $('#playpause').addClass('pause');\n }\n });\n\n\nThe script runs fine until i press the pause button and then the play button to start the action again. The img runs fine, but the txt seems to have the settings reset (ie fx effet, timeout effect etc) resulting in the img and txt being ofset and no longer following each other. I have tried many different things, but so far no luck.\n\nAny suggestions?" ]
[ "jquery" ]
[ "How can I read qr code inside GDK app?", "I want to read qr code from GDK app to get authorization token.\n\nIs there any build in methods to read QR codes in GDK?" ]
[ "google-glass", "google-gdk" ]
[ "Alternative to Eclipse's Abstract Syntax Tree parser for code manipulation", "Background\n\nI am writing a program that will do some bulk renaming of members and functions in a directory of java source code to de-obfuscate the code based on a look-up table .csv file passed in to the program. \n\nWhat this is for is the source code I have was written against a obfuscated jar. I have a de-obfuscated version of the jar that was run through a customized version RetroGaurd and I would like to parse the mapping file that was passed in to RetroGaurd to de-obfuscate the function calls my source code makes in to the jar. If I just compile my code and run it through RetroGaurd too when I decompile I loose all of my nice commenting and formatting (unless there is a option on RetroGaurd that I missed).\n\n\n\nProblem\n\nI found the Abstract Syntax Tree parser built in to Eclipse and it looks perfect for my uses, however I am not planning on writing my program as a plugin for Eclipse, this is going to be a stand alone jar that can be run on any machine.\n\nMy main concern is as I write my code I am getting a lot of dependencies on internal jars that Eclipse uses. I know that if I conform to the EPL for the library jars I will have no issues distributing it, but I am concerned about this project getting bigger and bigger as I write it as more and more jars from Eclipse's SDK are required.\n\nAre there any other projects out there that would give me the ability to parse Java source code to do find and replace reliably like AST will allow me to, or is there a way to use RetroGaurd (or a program like it) to run the same de-obfuscation but keep my comments and functions the same without needing to run the de-obfuscated program though a de-compiler afterwards?" ]
[ "java", "obfuscation", "abstract-syntax-tree", "deobfuscation" ]
[ "how do i get that date with regex", "I'm trying to get between Last Backup: and the ending span\n\nbut I'm getting blank value?\n\nstring test = @\">Last Backup: 4/27/13</span></\";\n\nstring regex = @\"(?<=Last Backup: )*.(?='</span')\";\n\nvar match = Regex.Match(test, regex);\n\nConsole.WriteLine(match.Value);" ]
[ "c#", "regex" ]
[ "parsing a text file into groups using Scala", "I have a CSV file that is really a set of many CSV files in one. Something like this:\n\n\"First Part\"\n\"Some\", \"data\", \"in\", \"here\"\n\"More\", \"stuff\", \"over\", \"here\"\n\n\"Another Part\"\n\"This\", \"section\", \"is\", \"not\", \"the\", \"same\", \"as\", \"the\", \"first\"\n\"blah\", \"blah\", \"blah\", \"blah\", \"blah\", \"blah\", \"blah\", \"blah\", \"blah\"\n\n\"Yet another section\"\n\"And\", \"this\", \"is\", \"yet\", \"another\"\n\"blah\", \"blah\", \"blah\", \"blah\", \"blah\"\n\n\nI'd like to break it into separate components. Given I know the header for each section, it'd be nice if I could do some kind of groupBy or something where I pass in a set of regexp's representing header patterns and return a Seq[Seq[String]] or something similar." ]
[ "parsing", "scala" ]
[ "Why is IsReadOnly listed as a non-public member?", "I'm looking at an instance of ICollection called pxe in the VS Watch window.\nI understand that the Raw View is meant to show the object without anything extra added.\nThe property IsReadOnly is a member of the ICollection interface and is public by default.\nWhy is it listed in the Non-public members in the Watch window?" ]
[ "c#", ".net", "debugging", "icollection" ]
[ "How to properly use docker for temporary containers", "I am creating a project correction software that sanboxes for each student their assignments.\nI was thinking about docker for doing such mechanism but I am having troubles when using docker CLI.\n\nMust I create an image with a name using docker build . before running it ? I would have to remove the image then\n\nI would appreciate any suggestion, thanks" ]
[ "docker" ]
[ "Connecting Sails Socket IO to Sails server running in consul", "There's this μService architecture running as the backend, with a consul instance managing all the services. There's a particular server, A made with Sails, and with some relevant socket logic I'd like to use from another service B using sails.io.\n\nEach service is running in its own Docker container, but they all connect to the same network.\n\nSo, when developing, I run the A container locally and simulate service B with a node script, with the logic showed here. The service URL is quite simple given that I'm just running the container with an open port, so the URL sails.io uses to connect is localhost:PORT. Everything here well.\n\nThe problem comes when service A is run in the μService architecture. Each service runs in its own URL, for example backend.com/api/SERVICE_NAME, acting like a namespace, with every route under the namespace actually hitting the SERVICE_NAME service. So now sails.io has issues connecting to service A, I presume, because of the change in route.\n\nThes are all the variations I've tried given const io = sailsIOClient(socketIOClient);\n\nio.sails.url = 'http://backend.com/api/SERVICE_NAME';\n\n\nthen \n\nio.sails.url = 'http://backend.com';\nio.sails.path = '/api/SERVICE_NAME'\n\n\nthen\n\nio.sails.url = 'http://backend.com';\nio.sails.path = '/api/SERVICE_NAME/socket.io/'\n\n\nThen I stumbled with this that refers to a path argument on the connect function of socket.io (here's the specific). I tried with that, setting io.sails.autoConnect to false and calling io.sails.connect() but I'm not being able to connect to the Sails app.\n\n Socket is trying to reconnect to Sails...\n_-|>_- (attempt #293)\n\n\nI'm fairly certain the issue is that the client io can't reach the correct route to find the Sails app because of the architecture is set up.\n\nHas someone dealt with a similar scenario? Suggestions are greatly appreciated." ]
[ "docker", "sails.js", "consul", "sails.io.js" ]
[ "Javascript code with eventListener does't work for a video button-control-system", "somebody sent me a code and I tried to run it. The problem is that the Javascript-file is not working properly. The result has to be a button-control-system for my video. I hope someone could take a look at it. \n\nHTML:\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>dfdfs</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"main.css\">\n <script type=\"text/javascript\" src=\"main.js\"></script>\n</head>\n<body>\n\n<!-- Simplified the markup a little, less is more -->\n<div id=\"p1\">\n <a href=\"#/\" id='b1' class='play'> </a>\n <video id=\"v1\">\n <source src=\"http://html5demos.com/assets/dizzy.mp4\" type=\"video/mp4\">\n </video>\n</div>\n\n</body>\n</html>\n\n\nCSS:\n\n/* This container wraps neatly around \n|| the video's width\n*/\n\n#p1 {\n position: relative;\n display: table-cell;\n\n}\n\n\n/* This is to make the button an overlay */\n\n#b1 {\n font-size: 100px;\n color: rgba(0, 255, 255, .3);\n position: absolute;\n z-index: 1;\n height: 100px;\n width: 100px;\n top: calc(50% - 50px);\n left: calc(50% - 50px);\n text-decoration: none;\n}\n\n\n/* These two rulsets use simple HTML entities\n|| for play/pause buttons\n*/\n\n.play::after {\n content: '\\25b6';\n}\n\n.pause::after {\n content: '\\23f8';\n}\n\n\nJAVASCRIPT:\n\n// Reference button and container\nvar btn1 = document.getElementById('b1');\nvar pyr1 = document.getElementById('p1');\n\n// When button is clicked...\nbtn1.addEventListener('click', function(event) {\n\n // Reference video\n var vid1 = document.getElementById('v1');\n\n // Conditions based on state: paused\n if (vid1.paused) {\n vid1.play();\n } else {\n vid1.pause();\n }\n /* Whatever the new state is doesn't matter if...\n || we have either .play or .pause class on button\n || previously and that both classes will toggle\n || at the same time.\n */\n btn1.classList.toggle('play');\n btn1.classList.toggle('pause');\n}, false);\n\n// If the mouse leaves the area of container...\npyr1.addEventListener('mouseout', function(event) {\n\n // If the button has the class .pause...\n if (btn1.classList.contains('pause')) {\n\n // set it's opacity to 0\n btn1.style.opacity = 0;\n\n // and make it fade away\n btn1.style.transition = '1s ease';\n }\n}, false);\n\n// If the mouse enters the container's area...\npyr1.addEventListener('mouseover', function(event) {\n\n // if the button has the class .pause...\n if (btn1.classList.contains('pause')) {\n\n // set it's opacity to 1 \n btn1.style.opacity = 1;\n\n // and make it fade in\n btn1.style.transition = '1s ease';\n }\n}, false);" ]
[ "javascript", "html", "button", "toggle", "event-listener" ]
[ "Is Cordova support finally method?", "I can't understand why that code doesn't work:\n\nthis.doMagic() // <- there is a Promise which do 'reject'\n .then(_ => {\n alert('test 1') // <- this is not working (OK)\n })\n .catch(_ => {\n alert('test 2') // <- it is working (OK)\n })\n .finally(_ => {\n alert('test 3') // <- it is not working (NOT OK)\n })\n\n\nIn the browser everything works fine, but I starting the emulator, 'test 3' does not work\n\nAt first I thought that the may be because of alert does not work. But no. If you put in the catch more alerts, they will work fine\n\nIn general, I have 2 hypothesis:\n\n1) Cordova does not support the finally\n\n2) I don't understand what's going on and make somewhere mistake\n\nSo, where is true?" ]
[ "cordova", "android-emulator", "cordova-plugins" ]
[ "How do I create quantile regression tables using stargazer?", "I computed the following quantile regressions using the quantreg package\n\n qr_10 = rq(inno_DELTA ~ deDomains + R_and_D_pc + Pop_dens + Agr_GDP + Manufacturing_GDP + Service_GDP + Infr_Area_Percent + Res_pc + Debt_GDP + GOV_EXP_GDP + firms_total + factor(landkreis) + factor(jahr), tau = 0.10, data = df_ip_c)\n qr_25 = rq(inno_DELTA ~ deDomains + R_and_D_pc + Pop_dens + Agr_GDP + Manufacturing_GDP + Service_GDP + Infr_Area_Percent + Res_pc + Debt_GDP + GOV_EXP_GDP + firms_total + factor(landkreis) + factor(jahr), tau = 0.25, data = df_ip_c)\n qr_50 = rq(inno_DELTA ~ deDomains + R_and_D_pc + Pop_dens + Agr_GDP + Manufacturing_GDP + Service_GDP + Infr_Area_Percent + Res_pc + Debt_GDP + GOV_EXP_GDP + firms_total + factor(landkreis) + factor(jahr), tau = 0.5, data = df_ip_c)\n qr_75 = rq(inno_DELTA ~ deDomains + R_and_D_pc + Pop_dens + Agr_GDP + Manufacturing_GDP + Service_GDP + Infr_Area_Percent + Res_pc + Debt_GDP + GOV_EXP_GDP + firms_total + factor(landkreis) + factor(jahr), tau = 0.75, data = df_ip_c)\n qr_95 = rq(inno_DELTA ~ deDomains + R_and_D_pc + Pop_dens + Agr_GDP + Manufacturing_GDP + Service_GDP + Infr_Area_Percent + Res_pc + Debt_GDP + GOV_EXP_GDP + firms_total + factor(landkreis) + factor(jahr), tau = 0.95, data = df_ip_c)\n\n\nI am trying to display these regressions using stargazer. The code I am trying to run is the following: \n\nstargazer(qr_10,qr_25,qr_50,qr_75,qr_95, rq.se = \"iid\", type = \"text\", title=\"Regression Results\" ,initial.zero = F,single.row=TRUE, out=\"table_quantile_regression.html\")\n\n\nHowever, I receive the following error message\n\nError in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, : \n singular matrix in 'backsolve'. First zero in diagonal [421]\n\n\nI am assuming that this error message has something to do with the standard error function rq.se in stargazer as for example summary(qr_10, se = \"iid\") works fine. \n\nDoes anybody have a solution for this problem?\nThank you." ]
[ "r", "stargazer", "quantreg", "quantile-regression" ]
[ "angular 2 testing w/router", "I have a component and when a user logs in it routes to a url called /dashboard I am really struggling figuring out why I am getting the following error.\n\ncannot read property 'args' of undefined\n\n\nI have been following the official docs on testing with router found here https://angular.io/docs/ts/latest/guide/testing.html#!#routed-component\nbut it doesnt seem to help. Half my problem is I dont quite understand all the code in the doc. Here is my unit test for the route\n\n beforeEach(async(()=>{\n\n class AuthStub{\n private loggedin: boolean = false;\n login(){\n return this.loggedin = true;\n\n }\n };\n\n class RouterStub{\n navigateByUrl(url:string){return url;}\n }\n\n TestBed.configureTestingModule({\n declarations: [ HomePageContentComponent ],\n providers:[\n {provide: Auth, useClass:AuthStub},\n {provide: Router, useClass: RouterStub}\n ]\n })\n .compileComponents()\n }));\n\n beforeEach(()=>{\n\n fixture = TestBed.createComponent(HomePageContentComponent);\n comp = fixture.componentInstance;\n\n de = fixture.debugElement.query(By.css('.loginbtn'));\n el = de.nativeElement;\n fixture.detectChanges();\n\n });\n\n it('Should log in and navigate to dashboard', inject([Router],(router:Router)=>{\n\n const spy = spyOn(router, 'navigateByUrl');\n\n el.click();\n\n const navArgs = spy.calls.first().args[0];\n\n expect(navArgs).toBe('/dashboard');\n\n })) \n}); \n\n\nSo my question is what is this line of code doing...\n\nconst navArgs = spy.calls.first().args[0];\n\n\nand how can I fix my problem?\n\nService added\n\n@Injectable()\nexport class Auth { \n lock = new Auth0Lock('fakefakefakefakefake', 'fake.auth0.com', {\n additionalSignUpFields: [{\n name: \"address\", \n placeholder: \"enter your address\"\n }],\n theme: {\n primaryColor:\"#b3b3b3\",\n },\n languageDictionary: {\n title: \"FAKE\"\n }\n });\n\n userProfile: any;\n\n constructor(private router: Router) {\n this.userProfile = JSON.parse(localStorage.getItem('profile'));\n\n this.lock.on(\"authenticated\", (authResult) => {\n localStorage.setItem('id_token', authResult.idToken);\n\n this.lock.getProfile(authResult.idToken, (error, profile) => {\n if (error) {\n\n alert(error);\n return;\n }\n\n profile.user_metadata = profile.user_metadata || {};\n localStorage.setItem('profile', JSON.stringify(profile));\n this.userProfile = profile;\n });\n this.router.navigate(['/dashboard']);\n });\n }\n\n public login(){\n this.lock.show();\n\n };\n\n public authenticated() {\n return tokenNotExpired();\n };\n\n public logout() {\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n this.router.navigate(['/logout']);\n };\n}" ]
[ "angular", "karma-jasmine", "angular2-routing", "angular2-testing" ]
[ "I need to convert string in JSP into titlecase", "I have a variable in JSP tag file as below\n\n<span class=\"breadcrumbName\">${breadcrumb.name}</span>\n\n\nI need to convert the text/string from this variable into Title Case ... Can someone please help me with this? Thanks" ]
[ "html", "css", "jsp", "jstl" ]
[ "How to extract the chaining numbers in a matrix in R?", "I wanna extract the chaining numbers in a matrix. \n\nProblem; \n\n [,1] [,2]\n[1,] 1 3\n[2,] 2 4\n[3,] 3 5\n[4,] 5 6\n[5,] 4 7\n[6,] 6 8\n\n\nFor example, 3, second number in first row, is connecting with 3 in third row, then 5 in second column and third row is with 5 in firth row. Consecutively, 5 to 6 to 8. Also, 2 in second row is connecting with 4 to 7. As a results,\n\n[1] 1 3 5 6 8\n\n[1] 2 4 7" ]
[ "r", "matrix", "extract" ]
[ "Strange lua push/pop behavior with the C API", "I noticed that pushing and popping values onto/off the stack in lua using the C API on my target platform (32-bit PowerPC architecture) behaves very oddly. Consider the following test function:\nvoid test_pushing_and_popping(lua_State *lua) {\n printf("### STARTING PUSHING/POPPING TEST ###\\n");\n lua_dump_stack(lua);\n const auto value = static_cast<uint32_t>(0x206D7578);\n lua_pushinteger(lua, value);\n lua_pushnumber(lua, value);\n const auto popped_integer = lua_tointeger(lua, 1);\n const auto popped_float = lua_tonumber(lua, 2);\n printf("Popped integer: %llx\\n", popped_integer);\n printf("Popped float: %f\\n", popped_float);\n lua_dump_stack(lua);\n printf("Asserting equality... ");\n assert(popped_integer == popped_float);\n printf("OK!\\n");\n printf("Wiping the stack...\\n");\n lua_settop(lua, 0);\n lua_dump_stack(lua);\n printf("### PUSHING/POPPING TEST ENDED ###\\n");\n}\n\nI expect this code to run successfully and that the assertion will be passed since the same value is pushed and then popped with lua_pushinteger, lua_pushnumber, lua_tointeger as well as lua_tonumber respectively.\nIndeed, if I run the code on Windows as a 32-bit binary, it works:\n### STARTING PUSHING/POPPING TEST ###\nDumping the lua stack...\nStack element count: 0\nPopped integer: 206d7578\nPopped float: 544044408.000000\nDumping the lua stack...\nStack element count: 2\n1 number 0x206D7578\n2 number 0x206D7578\nAsserting equality... OK!\nWiping the stack...\nDumping the lua stack...\nStack element count: 0\n### PUSHING/POPPING TEST ENDED ###\n\nAlso on Linux as 64-bit binary it works.\nHowever, here's the output on my target platform:\n### STARTING PUSHING/POPPING TEST ###\nDumping the lua stack...\nStack element count: 0\nPopped integer: 8002b2bc00e3a9ac <-- Wrong!\nPopped float: 544044416.000000 <-- Wrong!\nDumping the lua stack...\nStack element count: 2\n1 number 0x80000000 <-- Wrong!\n2 number 0x206d7580 <-- Wrong!\nAsserting equality... <-- Crash (assertion fail)!\n\nWhat? The first value is completely wrong and even the 2nd value is wrong. 544044416.000000 converted to hexadecimal is 0x206d7580 which is also unequal to the pushed value of 0x206D7578. Where does the inaccuracy come from?).\nI'm pretty sure I didn't corrupt anything since I ran the test right after initializing lua:\nprintf("Initializing lua...\\n");\nlua = luaL_newstate(); /* Opens Lua */\nluaL_openlibs(lua); /* Opens the standard libraries */\ntest_pushing_and_popping(lua);\n\nDoes anyone have an idea what could be the problem?" ]
[ "c++", "lua", "32-bit", "powerpc", "lua-api" ]
[ "Doubt on prevention of CSRF", "I had one doubt about CSRF prevention. A lot of sites say that CSRF can be prevented by using 'tokens' which are randomly generated per session.\n\nNow my doubt is,\nsuppose i have a function like : \n\n$.post(\"abcd.php\",{'fbuid':userid,'code':'<?php echo md5($_SESSION['randcode']); ?>'}\n\n\nnow this md5 hash would obviously be visible to any hacker through the source code.He could simply open this page, generate a token, and keep the page open, so that the session doesn't get destroyed, and useanother tab or anything else , to start hacking,\n\nNo ?\n\nOr is my idea of tokens incorrect ?\n\nThanks for your help :D" ]
[ "csrf", "csrf-protection" ]
[ "Passing the Variable and its value from one html page to other html page using jquery", "I have made some calcutation using Jquery in Page1.html by getting the value from inputbox and inputbox1 using get function and store the variable Z and its value by setting in inputbox2 using set function of jquery. Now i want to pass the variable Z and its value in Page2.html. Kindly help me out.\n\n\r\n\r\nJquery Example\r\nPage1.html\r\n\r\n<!DOCTYPE html>\r\n<html>\r\n<body>\r\n\r\n<p>Click the button to get a time-based greeting:</p>\r\nINCOME: <input type=\"text\" id=\"myinput\" value=\"\">\r\nDEDUCTION: <input type=\"text\" id=\"myinput1\" value=\"\">\r\nGROSS INCOME: <input type=\"text\" id=\"myinput2\" value=\"\">\r\n\r\n<button id=\"click1\">CALCULATE NET INCOME</button>\r\n\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<script>\r\n$(document).ready(function(){\r\n $(\"#click1\").click(function a(){\r\n \r\n myfunction();\r\n \r\n });\r\n\r\n \r\nfunction myfunction() {\r\nvar x, y, z;\r\nvar x = $(\"#myinput\").val();\r\nvar y = $(\"#myinput1\").val();\r\n\r\n z = x - y;\r\n \r\n\r\n $(\"#myinput2\").val(z);\r\n \r\n \r\n \r\n}\r\n\r\n</script>\r\n\r\n</body>\r\n</html>\r\n\r\nPage2.html\r\n\r\n<!DOCTYPE html>\r\n<html>\r\n<body>\r\n\r\n<p>Click the button to get a time-based greeting:</p>\r\nINCOME: <input type=\"text\" id=\"myinput3\" value=\"\">\r\n\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<script>\r\n\r\n\r\n</script>\r\n\r\n</body>\r\n</html>" ]
[ "jquery" ]
[ "Esri JS Api 4.18 requires ncp copy of node_modles for BUILD and START. what and were do I need to copy assets for working in storybook.js", "To use the ES modules for esri JS Api 4.18 requires ncp copy of node_modules for BUILD and START. what and where do I need to copy assets for working in storybook.js?\nCopy assets\nYou will need to copy the API’s assets, which includes styles, images, fonts, and localization files, from the @arcgis/core/assets folder to your build folder. A simple way to accomplish this is to configure an NPM script that runs during your build process. For example, use npm to install ncp and configure a script in package.json to copy the folder. Here’s a React example:\n// package.json\n\n {\n "script": {\n "start": "npm run copy && react-scripts start",\n "build": "npm run copy && react-scripts build",\n "copy": "ncp ./node_modules/@arcgis/core/assets ./public/assets"\n }\n }\n\n\nhttps://developers.arcgis.com/javascript/latest/es-modules/" ]
[ "javascript", "esri", "storybook", "arcgis-js-api" ]
[ "How to save the selected indexpaths of an UICollectionViewCell which is inside a UITableViewCell to an array?", "I have UICollectionViewCells inside the UITableView. I am trying to highlight the selected UICollectionViewCell for of each row the UITableView. When the UITableView reloads the selected cells should be highlighted. Here is sample code: \n\nvar selectedIndexes = [IndexPath]()\nvar familyAModelArray : [[Child1]] = []\nvar childAModelArray : [Child1] = []\n\nfunc collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n\n return familyAModelArray[collectionView.tag].count\n\n}\n\nfunc collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n\n\n let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"Cell\", for: indexPath) as! ChildCollectionViewCell\n\n cell.nameLabel.text = childAModelArray[indexPath.row].person! // or childArray\n\n cell.profilePicture.sd_setImage(with: URL(string: \"\\(baseUrl)\\(childAModelArray[indexPath.row].image!)\"), placeholderImage: #imageLiteral(resourceName: \"avatar.png\"), options: [.continueInBackground,.progressiveDownload])\n\n return cell\n }\n\nfunc collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n\n selectedIndexes.append(indexPath)\n\n let i = selectedIndexes[collectionView.tag][indexPath.row]\n\n}\n\n\nHere i got Index out of range:let i = selectedIndexes[collectionView.tag][indexPath.row]\n\nHow to achieve this?Any Idea?Thanks in advance." ]
[ "arrays", "swift", "uitableview", "uicollectionview", "didselectrowatindexpath" ]
[ "Telerik RadGridView.ExportToXlsx - format cells as number", "I need the Excel export of a RadGridView to have a cell format of \"Number\" in Excel, with a format style of \"{0:#,##0.00}\".\n\nI achieved that using .Export, handling the ElementExporting event:\n\ngrid.ElementExporting += Grid_ElementExporting;\ngrid.Export(stream, new GridViewExportOptions()\n{\n Format = ExportFormat.ExcelML,\n ShowColumnHeaders = true,\n ShowColumnFooters = true\n});\n\nprivate void Grid_ElementExporting(object sender, GridViewElementExportingEventArgs e)\n {\n if (e.Element == ExportElement.Cell)\n {\n var column = e.Context as GridViewDataColumn;\n if (column?.DataType?.Name == \"Decimal\")\n {\n e.Value = string.Format(@\"{0:#,##0.00}\", e.Value);\n }\n }\n }\n\n\nHowever I receive an error on opening in Excel \"The file format and extension of X don't match.\", despite it definitely being of .xls extension. I can click past that and it loads correctly.\n\nReading up on it more, it sounds like I should update to use the .ExportToXlsx instead, and getting the files in .xlsx would be a perk anyway.\n\nI change .Export to .ExportToXlxs, and the ElementExporting to ElementExportingToDocument, and the formatting is working, but all cells are back to being of format \"General\" in Excel, whereas I need them as \"Number\".\n\nThere's documentation on applying visual styles:\nhttps://docs.telerik.com/devtools/wpf/controls/radgridview/export/how-to/style-exported-documents\n\nBut not to change the underlying format that I can find.\n\nAny suggestions?" ]
[ "excel", "wpf", "radgridview" ]
[ "SQL - Rank monthly dataset high, medium, low", "I have a table which includes the month, accountID and a set of application scores. I want to create a new column which either gives a 'high', 'medium' or 'low' for the top, middle and bottom 33% of the results each month.\n\nIf I use rank() I can order the application scores for a single month or the whole dataset but I'm unsure how to order it per month. Also, on my version of sql server percent_rank() does not work.\n\nselect \n AccountID\n, ApplicationScore\n, rank() over (order by applicationscore asc) as Rank\nfrom Table\n\n\nI then know I need to put the rank() statement in a subquery and then use a case statement to apply the 'high', 'medium' or 'low'. \n\nselect \n AccountID\n, case when rank <= total/3 then 'low'\n when rank > total/3 and rank <= (total/3)*2 then 'medium'\n when rank > (total/3)*2 then 'high' end ApplicationScore \nfrom (subquery) a" ]
[ "sql", "sql-server", "case", "rank", "percentile" ]
[ "ViewCell ForceUpdateSize not working sometimes", "I am using a custom ViewCell in Xamarin Forms which looks like this:\n\npublic class NativeCell : ViewCell\n{\n public double Height\n {\n get\n {\n return base.Height;\n }\n set\n {\n base.Height = value;\n ForceUpdateSize();\n }\n }\n}\n\n\nI have also created a method to animate the colapse of the ViewCell which works as expected. However, with the overlay that comes with await, each loop iteration lasts up to 100ms instead of 1ms:\n\nasync public void Colapse()\n{\n for (double i = Height; i >= 0; i--)\n {\n Height = i;\n await Task.Delay(1);\n }\n}\n\n\nSo I made another method that used the Stopwatch to do the waiting:\n\nasync public void Colapse()\n{\n var Timer = new Stopwatch();\n\n for (double i = Height; i >= 0; i--)\n {\n Height = i;\n\n Timer.Start();\n while(Timer.Elapsed.TotalMilliseconds < 1)\n {\n }\n Debug.WriteLine(\"-->\" + Timer.Elapsed.TotalMilliseconds);\n Timer.Reset();\n }\n} \n\n\nThis last method reports that the wait time is now usually 1.1ms - 1.3ms. Which is great. However, the Height asignment is not doing anything. Or at least ForceUpdateSize is not triggering." ]
[ "c#", ".net", "xamarin", "xamarin.android", "xamarin.forms" ]
[ "cakephp 2.x pagination with custom ul", "I need to generate html tags like the below .. to be precise, i need to add a class to the anchor tag added to the list, but i dnt seem to get it to work ..\n\n<li class=\"myLIPrevclass\"><a href=\"#\" class=\"myAPREVClass\"></a></li>\n\n<li><a href=\"#\" class=\"active\">1</a></li>\n<li><a href=\"#\">2</a></li>\n<li><a href=\"#\">3</a></li>\n<li><a href=\"#\">4</a></li>\n\n<li class=\"myLINextclass\"><a href=\"#\" class=\"myANEXTClass\"></a></li>\n\n\nThe challenge is, \n\n\ni cant seem to get a class across to the a tag in the next and the previous, i need to solve this\nEven if i leave the a tag blank for the previous and next, CakePHP goes ahead and adds a '>' or '<' which in my case I do not need.\n\n\nThis is what I have tried ..\n\n<?php\necho $this->Paginator->prev(\n __(''), \n array(\n 'tag' => 'li', \n 'class' => 'previous',\n ), \n __(''),\n array(\n 'tag' => 'li',\n 'class' => ''\n )\n );\n\necho $this->Paginator->numbers(\n array(\n 'separator' => '',\n 'tag' => 'li',\n 'currentClass' => 'active',\n 'currentTag' => 'a'\n )\n );\n\necho $this->Paginator->next(\n __(''), \n array(\n 'tag' => 'li', \n 'class' => 'next',\n ), \n __(''),\n array(\n 'tag' => 'li',\n 'class' => ''\n )\n ); \n?>\n\n\nFor the disabled titles (for both previous and next) even if i pass in null, Cake add a '>' or '<', and I don't want that\n\nI have checked \nCreating Pagination With CakePHP For Custom Template Links\nand \nAdd class to pagination links at CakePHP 2.2\n\nMy Cake Version is 2.4.x\n\nI'll appreciate any pointers or help ..\nThanks" ]
[ "cakephp", "pagination" ]
[ "Background color (colorWithPatternImage) not filling entire view for iPad", "I am trying to set the background color with a checkered image I have. I am currently using this in my iPhone app and now am trying to create a universal app. When I use this:\n\n UIImage *bgimg = [UIImage imageNamed:@\"square_bg.png\"];\n self.view.backgroundColor = [UIColor colorWithPatternImage:bgimg];\n\n\nIt works fine for my iPhone app. When it loads on the iPad in portrait mode, there is about 20px worth of white space at the bottom. When it loads in landscape, it is fine. If I rotate from portrait to landscape, then back again, it is also fine. \n\nWhat am I missing that will fill the pattern all the way to the bottom of my view?\n\nUpdate\n\nIf I set the color to a solid color, [UIColor blueColor], the entire screen fills in correctly. So why the discrepancy from colorWithPatternImage and a solid color?\n\nUpdate 2\n\nThe file I am using is a PNG file with dimensions of 252x230. I've used this image to make patterns in the iPhone version of this app with no issues. I'm not sure if the file size or dimensions have any bearing on this issue, but I thought I would put it out there just in case." ]
[ "ios", "uiviewcontroller", "background-color", "uicolor" ]
[ "ignite shutdown node while putting in transaction", "I'm trying Apache Ignite and play with examples. I took an example from screencast about transactions. Started 3 server nodes, and start code that begins transaction and putting 50k elements in cache. While it running i kill 2 of 3 nodes. I expected Ignite to fail commit with error, but in fact there were no any errors and I get partially saved data. It is no fully ACID transaction as said in manuals. May be I don't understand something important?" ]
[ "ignite" ]
[ "dpkg error exit status 2", "Trying to build php from source on Ubuntu 9.10 to enable GD2, but when i run dpkg-buildpackage, it just quits giving me this error:\n\n\n QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null pop -a -R || test $? = 2\n Patch suhosin.patch does not remove cleanly (refresh it or enforce with -f)\n \n make: *** [unpatch] Error 1\n dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2\n\n\nI've googled around, but i really can't find what's causing this, and what i should do about it...\n\nany ideas?" ]
[ "php", "ubuntu", "gd", "dpkg" ]
[ "How to use variables defined with assign in list elements in freemarker", "i have a freemarker problem. I have one hash map called nodes and i iterate trough it like this:\n\n<#list hashmap.collection as nodes>\n .....some displaying\n <#assign nodeName>\n${nodes.name}\n </#assign>\n <#list hashmap2.nodeName.collection as nodes2>\n .......some more displaying\n\n\nAnd this code is not because freemarker is trying to find nodeName key inside the hashmap2... \nIs there a way to do this in freemarker?\n\nThanks for your answers!" ]
[ "list", "hashmap", "freemarker" ]
[ "Converting docx into pdf in java", "I am trying to convert a docx file which contains table and images into a pdf format file. \n\nI have been searching everywhere but did not get proper solution, request to give proper and correct solution:\n\nhere what i have tried :\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport org.apache.poi.xwpf.converter.pdf.PdfConverter;\nimport org.apache.poi.xwpf.converter.pdf.PdfOptions;\nimport org.apache.poi.xwpf.usermodel.XWPFDocument;\n\npublic class TestCon {\n\n public static void main(String[] args) {\n TestCon cwoWord = new TestCon();\n System.out.println(\"Start\");\n cwoWord.ConvertToPDF(\"D:\\\\Test.docx\", \"D:\\\\Test1.pdf\");\n }\n\n public void ConvertToPDF(String docPath, String pdfPath) {\n try {\n InputStream doc = new FileInputStream(new File(docPath));\n XWPFDocument document = new XWPFDocument(doc);\n PdfOptions options = PdfOptions.create();\n OutputStream out = new FileOutputStream(new File(pdfPath));\n PdfConverter.getInstance().convert(document, out, options);\n System.out.println(\"Done\");\n } catch (FileNotFoundException ex) {\n System.out.println(ex.getMessage());\n } catch (IOException ex) {\n\n System.out.println(ex.getMessage());\n }\n }\n\n}\n\n\nException:\n\nException in thread \"main\" java.lang.IllegalAccessError: tried to access method org.apache.poi.util.POILogger.log(ILjava/lang/Object;)V from class org.apache.poi.openxml4j.opc.PackageRelationshipCollection\nat org.apache.poi.openxml4j.opc.PackageRelationshipCollection.parseRelationshipsPart(PackageRelationshipCollection.java:313)\nat org.apache.poi.openxml4j.opc.PackageRelationshipCollection.<init>(PackageRelationshipCollection.java:162)\nat org.apache.poi.openxml4j.opc.PackageRelationshipCollection.<init>(PackageRelationshipCollection.java:130)\nat org.apache.poi.openxml4j.opc.PackagePart.loadRelationships(PackagePart.java:559)\nat org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:112)\nat org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:83)\nat org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:128)\nat org.apache.poi.openxml4j.opc.ZipPackagePart.<init>(ZipPackagePart.java:78)\nat org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:239)\nat org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:665)\nat org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:274)\nat org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)\nat org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:121)\nat test.TestCon.ConvertToPDF(TestCon.java:31)\nat test.TestCon.main(TestCon.java:25)\n\n\nMy requirement is to create a java code to convert existing docx into pdf with proper format and alignment.\n\nPlease suggest.\n\nJars Used:" ]
[ "java", "pdf", "ms-word", "apache-poi" ]
[ "Best practice to edit HTML content through JavaScript", "For now let's ignore users without JavaScript and let's ignore accessibility too.\nI would like to know what's the best practice to inject a content into a HTML document through JavaScript.\n\nSo far, I came up with these solutions:\n\n\ncreate the skeleton of the HTML and fill it through jQuery (using $(tag).text()) (though, correct me if I'm wrong, this prevents me from animating the content)\ninsert all the content in an HTML format through JS, which allows me to do things like $(\"<tag>stuff</p>\").fadeIn() and other things\n\n\nNote that the fading is used just as an example, I would like to know if there's a best practice in general." ]
[ "javascript", "jquery", "html" ]
[ "C# Threaded messages with TcpClient (various errors)", "I need to sent 500 messaged over a TCP connection and receive a response for each message within limited time, using threading to remain within the time. This is new to me and I spent a lot of time searching the forums before I put it up here, so please be patient.\n\nThe best result so far I had was with some variation of:\n\nList<Task> tasks = new List<Task>();\nfor(int i=1;i<500;i++)\n{\n Task task = new Task(new SendMessage(Message(i)).Send);\n tasks.Add(task);\n}\n\n\nthen\n\nforeach(Task task in tasks)\n{\n task.Start();\n}\n\n// Keep track of time (stay within 30s)\nStopwatch s = new Stopwatch();\ns.Start();\nwhile (s.ElapsedMilliseconds < 30000)\n{\n Console.WriteLine((int)(0.001 * s.ElapsedMilliseconds));\n Thread.Sleep(2000);\n}\n\n\nand then \n\npublic class SendMessage\n{\n byte[] msg;\n ASCIIEncoding asen = new ASCIIEncoding();\n NetworkStream stm;\n\n public void Send()\n {\n try\n {\n TcpClient tcpclnt = new TcpClient();\n\n tcpclnt.Connect(\"IPADDRESS\", port);\n\n stm = tcpclnt.GetStream();\n\n stm.Write(msg, 0, msg.Length);\n\n using (XmlReader xmlReader = XmlReader.Create(stm))\n {\n while (xmlReader.Read())\n {\n string requestID = String.Empty;\n string message = String.Empty;\n\n if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == \"requestID\"))\n {\n requestID = xmlReader.ReadInnerXml();\n sw.Write(\"requestID\\t\" + requestID + \"\\t\");\n Console.WriteLine(\"requestID\\t\" + requestID + \"\\t\");\n }\n else if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == \"message\"))\n {\n message = xmlReader.ReadInnerXml();\n sw.WriteLine(\"message\\t\" + message);\n Console.WriteLine(\"message\\t\" + message);\n\n xmlReader.Close();\n }\n }\n }\n }\n catch\n {\n Send();\n }\n }\n public SendMessage( string msg)\n {\n this.msg = asen.GetBytes(msg); \n }\n}\n\n\nBut the application keeps crashing in the reading part. The error I get in this example is \n\n\n XMLException - root element is missing\n\n\nThe try/catch block seems to work but the error is so frequent that it slows the application down to the extent that I cannot keep time consumption acceptable. \n\nVariations I tried involved \n\n\nusing a global static TCPClient that connects in Main instead of in Send()\nusing NetworkStream either global or local in SendMessage\nparcing TCPClient as a reference\nusing threads instead of tasks\nusing other thread-safe reader types (when using threads)" ]
[ "c#", "multithreading" ]
[ "angularjs randomizing and matchings", "i am fiddling with angular and trying to understand when should i make a new controller or not. What i am trying to accomplish in angular is #1 randomizing a list when a user clicks the button. I can auto randomize, but not sure if on ng-click if that should require a new controller for the scope. and second thing i am trying to do is duplicate that list but when partner is clicked--it matches them with a random letter in the list. That involves appending another letter in the list to another. What I am wondering is, what if it is not even-what should happen to the extra letter? any suggestions. I think angular presents a cleaner way to solve problems then jquery.\n\n\r\n\r\nvar myApp = angular.module('myApp', []);\r\nangular.module('myApp', [])\r\n\r\n.controller('myCtrl', ['$scope', function($scope) {\r\n $scope.list = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];\r\n \r\n $scope.random = function() {\r\n return 0.5 - Math.random();\r\n };\r\n $scope.matchme = function() {\r\n alert(\"this\");\r\n };\r\n\r\n\r\n}]);\r\n<script src=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js\"></script>\r\n\r\n<body ng-app=\"myApp\">\r\n\r\n<div ng-controller=\"myCtrl\">\r\n <p ng-repeat=\"i in list\">{{i}}</p>\r\n <p ng-repeat=\"x in list2\">{{i}}</p>\r\n <button ng-click=\"random()\">randomize</button>\r\n<button ng-click=\"matchme()\">partner</button>\r\n\r\n</div>" ]
[ "angularjs" ]
[ "placing background image in a div", "I have a background image that I want to show after the top header. This image should be on the remaining of the page. At later stage I can even have a footer and the image should take up the whole empty space between the header and the footer. I am trying to have this background image in the empty space so that on top of the image I can have my div's that show content etc. \nI was successful in achieving this when I simply put the image in the body background, however, now I want the background image AFTER the top header ended.\n\nExample: http://jsbin.com/opokev/2\n\nCSS:\n\n.backgroundimage {\n background: url(http://s1.postimage.org/ur0h52mvy/Sketch2.jpg) no-repeat center center fixed;\n -webkit-background-size: cover;\n -moz-background-size: cover;\n -o-background-size: cover;\n background-size: cover;\n\n\n}\ndiv#masthead {\n background-color: #262626;\n height: 85px;\n padding: 0;\n position: relative;\n width: 100%;\n z-index: 500;\n}\n\n\nHTML\n\n<link rel=\"stylesheet\" href=\"/stylesheets/style.css\" type=\"text/css\" media=\"screen\" charset=\"utf-8\">\n<body>\n <div id=\"masthead\"></div>\n <div class=\"backgroundimage\"></div>\n</body>" ]
[ "html", "css", "background-image" ]
[ "Where do objects merge/join data in a 3-tier model?", "Its probarbly a simple 3-tier problem. I just want to make sure we use the best practice for this and I am not that familiary with the structures yet.\n\nWe have the 3 tiers:\n\n\nGUI: ASP.NET for Presentation-layer (first platform)\nBAL: Business-layer will be handling the logic on a webserver in C#, so we both can use it for webforms/MVC + webservices\nDAL: LINQ to SQL in the Data-layer, returning BusinessObjects not LINQ. \nDB: The SQL will be Microsoft SQL-server/Express (havent decided yet).\n\n\nLets think of setup where we have a database of [Persons]. They can all have multiple [Address]es and we have a complete list of all [PostalCode] and corresponding citynames etc.\n\nThe deal is that we have joined a lot of details from other tables.\n\n{Relations}/[tables]\n\n\n[Person]:1 --- N:{PersonAddress}:M --- 1:[Address]\n[Address]:N --- 1:[PostalCode] \n\n\nNow we want to build the DAL for Person. How should the PersonBO look and when does the joins occure?\nIs it a business-layer problem to fetch all citynames and possible addressses pr. Person? or should the DAL complete all this before returning the PersonBO to the BAL ? \n\nClass PersonBO \n{\n public int ID {get;set;}\n public string Name {get;set;}\n public List<AddressBO> {get;set;} // Question #1\n} \n\n\n// Q1: do we retrieve the objects before returning the PersonBO and should it be an Array instead? or is this totally wrong for n-tier/3-tier??\n\nClass AddressBO \n{\n public int ID {get;set;}\n public string StreetName {get;set;}\n public int PostalCode {get;set;} // Question #2\n} \n\n\n// Q2: do we make the lookup or just leave the PostalCode for later lookup?\n\nCan anyone explain in what order to pull which objects? Constructive criticism is very welcome. :o)" ]
[ "c#", "linq-to-sql", "business-objects", "3-tier", "n-tier-architecture" ]
[ "How do you nest label elements inside of a ScrollViewer?", "I'm trying to accomplish something like this:\n\n<ScrollViewer Height=\"287\" HorizontalAlignment=\"Left\" Margin=\"12,12,0,0\" Name=\"boxAnswer\" VerticalAlignment=\"Top\" Width=\"294\">\n <Label Content=\"Label\" Height=\"28\" Name=\"label1\" VerticalAlignment=\"top\" />\n</ScrollViewer>\n\n\nExcept I want to be programmatically placed. When I call .IsAncestorOf on the boxAnswer it returns true but I can't set .IsDescendentOf on a label element even though I can create one programmatically." ]
[ "c#", "wpf", "visual-studio-2010" ]
[ "JQuery Error: Uncaught TypeError: Object # has no method 'ready'", "my site is getting the error in this title in the javascript console. Google seems to say that it is because jquery isn't loaded, but it is definitely visible in the head.\n\n<script type=\"text/javascript\">\n $(document).ready(function(){\n $.ajax({\n type: \"GET\",\n url: \"https://www.mjfreeway.com/naturalremedies/mml-connect/45.xml\",\n dataType: \"xml\",\n success: function(xml) {\n $(xml).find(\"products\").each(function() {\n $(this).find(\"product\").each(function() {\n $(\"#output\").append($(this).find(\"title\").text() + \"<br />\");\n });\n });\n }\n });\n });\n</script>\n\n\nthe site is medical marijuana related, so nsfw for some.sorry for the messy head, it's in dev mode.\nhttp://www.kindreviews.com/1/mmc/\n\nThanks,\nzeem" ]
[ "javascript", "jquery", "wordpress" ]
[ "How to define empty variable in object literal?", "I am trying to define an empty variable in an object literal but I'm getting an error \"Uncaught ReferenceError: a is not defined\". Can anyone please help me here? Thanks.\n\nvar obj = {\n a,\n b: 1\n}\n\nconsole.log(obj.a);" ]
[ "javascript" ]
[ "Using in_array() in PHP", "I am trying to display menus and give user rights to my users based on database value using Codeigniter. But its not working, may be the problem is in the view file. I have the following table. \n\nTable Name: module_permission\n\n id user_id delete add edit\n 1 1 0 1 1\n\n\nMy Controller:\n\n$this->load->model('mod_module_permission');\n$data['permit']= $this->mod_module_permission->permission($user_id);\n\n\nMy Model:\n\n $this->db->select('*');\n $this->db->from('module_permission');\n $this->db->where('user_id', $user_id); \n $getData = $this->db->get('');\n if($getData->num_rows() > 0)\n return $getData->result_array();\n else\nreturn null; \n\n\nMy View :\n\n if ( in_array(add=>'1',$permit)) {echo \"YES\";} else {echo \"NO\";}\n\n\nCould you please tell me what change in the view file could make the problem solved?\n\nThanks :)" ]
[ "php", "codeigniter" ]
[ "WebSphere wsadmin script to create custom properties for JMS provider", "I have created a custom JMS provider in WebSphere 8. Now I want to add custom properties to this JMS provider, but the usual procedure does not work.\n\nI created the JMS provider with the following commands (Jython):\n\nserver = AdminConfig.getid('/Cell:cell/Node:node0/Server:appserver/')\njms_provider = AdminConfig.create('JMSProvider', server, '[[name \"ActiveMQ\"] [externalInitialContextFactory \"org.apache.activemq.jndi.ActiveMQWASInitialContextFactory\"] [externalProviderURL \"tcp://10.1.1.1:61616\"]]')\n\n\nUsually, I would get a custom property set in order to popultate it, but I just get \"None\":\n\nwsadmin> print(AdminConfig.showAttribute(jms_provider, 'propertySet'))\n(None)\n\n\nCreating a new one does not work either:\n\nwsadmin> AdminConfig.create('J2EEResourceProperty', jms_provider, [])\n\nWASX7015E: Exception running command: \"AdminConfig.create('J2EEResourceProperty', jms_provider, [])\"; exception information:\n com.ibm.ws.scripting.ScriptingException: WASX7129E: Cannot create objects of type \"J2EEResourceProperty\" in parents of type \"JMSProvider\"\n\n\nHow can I create the initial property set for a JMS provider?" ]
[ "websphere", "wsadmin" ]
[ "PHP best way to call loop function multiple time", "I have a specific directory which may contain zip files.\nI would like to loop through each sub-element of my directory to check if this is a zip. And unzip that. Then process the others files.\nI'm using flysystem to work with my files.\nSo I went for this\n$contents = $this->manager->listContents('local://my_directory , true);\n\nforeach ($contents as $file) {\n if( $file['extension'] == 'zip')\n //Unzip in same location\n}\n\nThe problem is that the files unziped are not in the loop and if the zip file, contain another zip. The second one will be never be unziped.\nSo I thought about it\nfunction loopAndUnzip(){\n \n $contents = $this->manager->listContents('local_process://' . $dir['path'] , true);\n\n foreach ($contents as $file) {\n if( $file['extension'] == 'zip')\n //Unzip and after call loopAndUnzip()\n }\n}\n\nBut the initial function will never be finished and be called over and over if there are zip inside zip.\nIsn't it a performance issue?\nHow to manage this kind of thing?" ]
[ "php", "loops", "foreach" ]
[ "AWS Cognito Equivalent of auth0 Machine-to-Machine Authentication", "What is the AWS Cognito equivalent of auth0 machine-to-machine authentication?\n\nI've read through the docs, but I can't find anything describing that scenario." ]
[ "amazon-web-services", "amazon-cognito", "auth0" ]
[ "How should PLI packets be used in WebRTC video recording", "We are using the licode MCU to streaming video from Google Chrome to the server and record it. The tricky part here is that there is only one Chrome browser involved so the server-side code has to handle sending feedback to the client.\n\nWe added server-side code to send REMB (bandwidth) packets every 5 seconds to the client. This causes the client to increase bitrate so that the video quality is good.\n\nWe did something similar with PLI packets to attempt to improve video quality. The recorded video had blocky artifacts and didn't look good. The current code sends a PLI every 0.8 seconds which causes the client to send a keyframe (full frame of video). This fixes the poor video quality because it forces a keyframe but when there is packet loss (wifi network) it quickly gets bad again.\n\nMy question is how should these PLI packets be used?\n\nI think PLI means:\n\nPLI - Picture Loss Indication" ]
[ "google-chrome", "webrtc", "licode" ]
[ "Controlling the flow of the debugger", "Is there any way to control the flow of the debugger of the Eclipse. I mean when I debugged the following code snippet. (It is labelled in the code snipped below) The debugger goes to 1, 2 and 3. However, I would like to see the value of timeSeries variable before it goes to 3. \n\n if( !(ANOsEmpty && CNFsEmpty) )\n {\n1 -> List< TagesfahrplanVO > timeSeries = getTimeSeries( aEvent );\n2 -> timeSeries = clearList( timeSeries, aEvent );\n }\n\n3 -> if( !CNFsEmpty )\n {\n . \n .\n The rest is omitted.\n\n\nUntil now, in order to solve this problem, I have put a dummy command after 2 and when the debugger lands there, I have see the value of the variable. Is there any better way than this?\n\nEdit\n\nTo make my question clearer, I would say that this example is a little bit tricky. The time series variable is sent to the method and the method should process it and send it back. When the debugger is on 2, the method is not executed. When I continue, it goes directly to the 3 and i cannot see the result of the time series variable because 3 is out of scope of the variable" ]
[ "java", "debugging" ]
[ "Avoid opening the same dialog each time the link is clicked", "I have a menu and each link in the menu is opened with a modal dialog. Im trying to avoid creating the same dialog everytime i click a link more than one time.\n\nI have tried checking\n\nif(outputHolder.hasClass('ui-dialog-content:visible')){return false;} \n $(\"body\").append(outputHolder);\n outputHolder.load($this.attr(\"href\"), null, function() { \n outputHolder.dialog(\n\n\notherwise it will display the dialog..\n\nAny suggestions??\n\ncomplete code \n\nhttp://jsfiddle.net/6qgTr/5/" ]
[ "jquery", "jquery-ui" ]
[ "react-datepicker remove coloring of same day in other months", "If you look at the default implementation of the react-datepicker the day of this month will be highlighted on every month. Is there a way to only highlight/color the day of the current month and not highlight this date in all other months?\nIf you look at the first image the 6 August is highlighted because it is the current date. But 6 September is also highlighted." ]
[ "reactjs", "datepicker", "react-datepicker" ]
[ "transliteration is not being done automatically", "I am using the below posted code to transliterate the input from English to Urdu and Arabic. The transliteration should be done automatically when I hit enter button inside the input field (English text), but that is not happening. However, if I manually hit enter button inside Urdu and Arabic fields then their text is being transliterated. But please tell how can I get the desired behavior i.e. the input text should automatically be transliterated inside Urdu an Arabic fields when I hit enter button inside English field?\n\n\r\n\r\n<html>\r\n\r\n<head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\">\r\n </script>\r\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n <script type=\"text/javascript\">\r\n // Load the Google Transliterate API\r\n google.load(\"elements\", \"1\", {\r\n packages: \"transliteration\"\r\n });\r\n\r\n function onLoad() {\r\n var options_u = {\r\n sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,\r\n destinationLanguage: [google.elements.transliteration.LanguageCode.URDU],\r\n shortcutKey: 'ctrl+g',\r\n transliterationEnabled: true\r\n };\r\n\r\n var options_a = {\r\n sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,\r\n destinationLanguage: [google.elements.transliteration.LanguageCode.ARABIC],\r\n shortcutKey: 'ctrl+g',\r\n transliterationEnabled: true\r\n };\r\n\r\n // Create an instance on TransliterationControl with the required\r\n // options.\r\n var control_u = new google.elements.transliteration.TransliterationControl(options_u);\r\n var control_a = new google.elements.transliteration.TransliterationControl(options_a);\r\n\r\n control_u.makeTransliteratable(['txtUrdu']);\r\n control_a.makeTransliteratable(['txtArabic']);\r\n\r\n $(\"#txtEnglish\").on('keydown', function(event) {\r\n if (event.keyCode == 13) {\r\n $(\"#txtUrdu\").val($(\"#txtEnglish\").val());\r\n $(\"#txtUrdu\").focus();\r\n $(\"#txtUrdu\").trigger(jQuery.Event('keydown', {\r\n keyCode: 13\r\n }));\r\n\r\n $(\"#txtArabic\").val($(\"#txtEnglish\").val());\r\n $(\"#txtArabic\").focus();\r\n $(\"#txtArabic\").trigger(jQuery.Event('keydown', {\r\n keyCode: 13\r\n }));\r\n }\r\n });\r\n } //end onLoad function\r\n\r\n google.setOnLoadCallback(onLoad);\r\n </script>\r\n</head>\r\n\r\n<body>\r\n English: <input type=\"text\" id=\"txtEnglish\" /> <br/> Urdu: <input type=\"text\" id=\"txtUrdu\" /><br/> Arabic: <input type=\"text\" id=\"txtArabic\" />\r\n</body>\r\n\r\n</html>" ]
[ "javascript", "jquery", "transliteration" ]
[ "Worksheet_Change Not Firing after Button Click Macro Added to Module", "I have the following code (which clears the values in dependent drop downs) in the Sheet2 Code Window\n\n Private Sub Worksheet_Change(ByVal Target As Range)\n 'Update by Extendoffice 2018/06/04\n On Error GoTo ErrorHandler\n Application.EnableEvents = False\n If Target.Column = 5 And Target.Validation.Type = 3 Then\n Target.Offset(0, 1).Value = \"\"\n Target.Offset(0, 2).Value = \"\"\n End If\n If Target.Column = 6 And Target.Validation.Type = 3 Then\n Target.Offset(0, 1).Value = \"\"\n End If\n Application.EnableEvents = True\n\n ErrorHandler:\n Application.EnableEvents = True\n End Sub\n\n\nThat code worked fine until I added a Button and the following code (which copies the existing row and inserts the selection into a new row) in Module1. Now the Button Event works fine but the Change event doesn't seem to ever fire.\n\n Sub AddRow()\n Dim LastRow As Long\n Dim NextRow As Long\n With Sheet2\n LastRow = .Range(\"B\" & .Rows.Count).End(xlUp).Row\n NextRow = LastRow + 1\n With .Range(\"B\" & LastRow & \":I\" & LastRow)\n Range(\"B\" & LastRow & \":I\" & LastRow).Select\n Selection.Copy\n Range(\"B\" & NextRow & \":I\" & NextRow).Select\n Selection.Insert Shift:=xlDown\n Range(\"C\" & NextRow & \":I\" & NextRow).Select\n Selection.Clear\n End With\n End With\n End Sub\n\n\nAny Suggestions?" ]
[ "excel", "vba" ]
[ "Intranet Site doesnt display in IE9 (Intermittent)", "I have an ASP MVC 3 website which is used on the intranet. It uses Windows Authentication and I've noticed sometimes on just a few user's machines (they all use IE9), it just doesnt load and the user is presented with a white screen or \"Internet Explorer cannot display this page\" message.\n\nI've set <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\" /> in my <head> tag and I've also unchecked the box \"Display intranet sites in compatibility mode\" under tools > Compatibility View Settings in IE9. \n\nI'm running out of ideas as to what is causing this issue. It's intermittent too which is all the more puzzling. It works fine on everyone else's machine (some even use IE9 and the rest use IE8)." ]
[ "html", "internet-explorer-9", "windows-authentication" ]
[ "How to open specific activity of Microsoft SharePoint App in Android from my application?", "I want to open Dev Site or other Screen of Microsoft SharePoint Android App from another Android App ( Kotlin / Java).\n\nNow only able to open the app, not able to redirect it to the Dev Site or other Screen of Microsoft SharePoint App.\n\nWhen I try to open any other Activiy of Microsoft SharePoint App from another Android app, the app force closed .\n\nThe below code shows that we are able to open Microsoft share point app from another app. \n\n Intent intent =\n getPackageManager().getLaunchIntentForPackage(\"com.microsoft.sharepoint\");\n intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);\n\n\nBut below code crashed when we are try to open another screen of SharePoint App\n\n*DESIRED_ACTIVITY = Any other screen of the SharePoint App\n\n Intent intent = new Intent(Intent.ACTION_SEND);\n intent.setClassName(\"com.microsoft.sharepoint\",\n \"com.microsoft.sharepoint.DESIRED_ACTIVITY\");\n startActivity(intent);\n\n\nAny leads would be highly appreciated.\n\nWorking Flow\n\nRequired flow which not working" ]
[ "android", "sharepoint" ]
[ "Can't target DIVs on page", "I'm having problems targetting the DIVs on this test page I made at http://flexibletheme.tumblr.com/\n\nIn particular I have a div with an id of columns (div#columns), I can't get the background color to change.\n\nAny ideas on how to get the background to render in div#columns?" ]
[ "html", "css" ]
[ "How do I add a resize event to the window in a view using Backbone?", "I have been trying to attach a handler to the resize event in one of my Backbone views. After doing some research I have discovered that you can only attach events to the view's element or its descendants.\nThis is an issue for me because the visual effect I am trying to achieve is not possible using pure CSS and requires some JS to set the dimensions of the content area element based on the window minus the header element.\nIf you are having trouble visualizing what I am trying to do, imagine a thin header and a content area which must occupy the remaining space with no CSS background trickery.\ndefine(\n [\n 'jQuery',\n 'Underscore',\n 'Backbone',\n 'Mustache',\n 'text!src/common/resource/html/base.html'\n ],\n function ($, _, Backbone, Mustache, baseTemplate) {\n var BaseView = Backbone.View.extend({\n\n el: $('body'),\n\n events: {\n 'resize window': 'resize'\n },\n\n render: function () {\n var data = {};\n\n var render = Mustache.render(baseTemplate, data);\n\n this.$el.html(render);\n\n this.resize();\n },\n\n resize: function () {\n var windowHeight = $(window).height();\n\n var headerHeight = this.$el.find('#header').height();\n\n this.$el.find('#application').height( windowHeight - headerHeight );\n }\n });\n\n return new BaseView;\n }\n);" ]
[ "javascript", "backbone.js", "backbone-events" ]
[ "How do you use IPrincipal and IIdentity in the portable class libraries?", "With WIF (Windows Identity Foundation) 4.5, Microsoft created the WindowsPrincipal class, which is a type of ClaimsPrincipal. Of course, these classes aren't portable, but the interfaces behind them are (IPrincipal). The same can be said of the ClaimsIndentity class implementing the IIdentity interface.\n\nThe problem I have is that these classes, and WIF in general is based entirely on the concept of \"claims\", which is awesome... but the two interfaces, IPrincipal and IIdentity are not. Not only that, but the ClaimsPrincipal class also has a collection of Identities instead of just a single Identity associated to it.\n\n\nIPrincipal has Identity and IsInRole members.\nIIdentity has AuthenticationType, IsAuthenticated, and Name members.\n\n\nGiven the fact that the Portable Class Libraries can only access these two interfaces, how does one go about getting the actual claims?\n\nAlso, in the rare instance that a principal has multiple identities, how does one get the \"non-primary\" identities?" ]
[ ".net-4.5", "wif", "portable-class-library", "iprincipal", "iidentity" ]
[ "Adding browser size query to supersize plugin javascript file?", "I am using the supersize slideshow plugin. When the browser size reaches a certain minimum size I want to deactivate this part of the script to prevent the image from centring:\n\n// Adjust image when browser is resized\n$(window).resize(function(){\nbase.resizeNow();\n});\n\n\nHow can I do this?" ]
[ "javascript", "jquery", "browser" ]
[ "how to alternating two string characters in c language", "for example: \ns1 = \"ABC\"\n\ns2 = \"qwerty\"\n\ns3 will be \"AqBwCerty\"\n\nand let all be upper letter\n\nit will be\"AQBWCERTY\"\n\nhow to create it?\n\nthank you~\n\nthis is my current code in the main function:\n\nchar w[100];\nchar s[50] = \"abcderf\";\nchar t[50] = \"ARTYY\";\nint len = strlen(s);\nint len1 = strlen(t);\nint i, j;\nif (len > len1) {\n t[50] + s[50];\n}\nprintf(\"%s\", w);" ]
[ "c" ]
[ "How to access values on leiningen profiles?", "I've got a two profiles defined in project.clj, one locally, one for testing on travis:\n\n:profiles {:dev {:dependencies [[midje \"1.6.0\"]\n [mysql/mysql-connector-java \"5.1.25\"]]\n :plugins [[lein-midje \"3.1.3\"]]\n :user \"root\" :pass \"root\"}\n :travis {:user \"travis\" :pass \"\"}}\n\n\nI'm hoping to be able to get access to the :user and :pass values in my projects. How can this be done?\n\nUpdate:\n\nI also want to be able to use the lein with-profile command... so my tests would have:\n\nlein with-profile dev test\n\n\n-> would use \"root\", \"root\" credentials\n\nlein with-profile dev,travis test\n\n\n-> would use \"travis\", \"\" credentials" ]
[ "clojure", "leiningen" ]
[ "Print out a SQL single query (Yii 1.x)", "I have a massive query that is generated using CDbCriteria as shown below:-\n\n$schema = Yii::app()->db->schema;\n$builder = $schema->commandBuilder;\n\n// how to echo out this query?\n$command = $builder->createFindCommand($schema->getTable('myuser'), $criteria);\n$results = $command->queryAll();\n\n\nI know I can use the 'logging' feature of Yii to view the query, is it possible to just echo out this single query (as opposed to having Yii show me tons of other queries that are being run on the page)." ]
[ "php", "mysql", "yii", "yii-components" ]
[ "Multiple audio buttons: change class of previously playing button when a new one is clicked", "I have multiple .player-button elements, each with its own audio.\n\nThe clicked element plays the audio, pauses the previously playing element and changes class to .playing. \n\nThe problem is that I need to click again on the .playing element to change it's class to .paused. That means that when I click another .player-button the paused one does not change its class to .paused as long as I don't click on it. That means if the user just clicks on the various elements, he will be seeing a whole bunch of nice pause icons! \n\nHere is the FIDDLE: https://jsfiddle.net/VitoLattarulo/mdcan81n/14/\n\njQuery(document).ready(function($) {\n $(\".player-button\").click(function(e) {\n e.preventDefault();\n var song = $(this).prev('audio').get(0);\n\n if (song.paused) {\n song.play();\n $(this).addClass(\"playing\");\n $(this).removeClass(\"paused\");\n } else {\n song.pause();\n $(this).addClass(\"paused\");\n $(this).removeClass(\"playing\");\n }\n });\n\n document.addEventListener('play', function(e) {\n var audios = document.getElementsByTagName('audio');\n for (var i = 0, len = audios.length; i < len; i++) {\n if (audios[i] != e.target) {\n audios[i].pause();\n }\n }\n }, true);\n});\n\n\nI evidently need a way to merge the two functions together but I am still a newbie and cannot figure out how to do it.\n\nI would really appreciate a lot any help! It's the last issue to solve before I can publish my first website ^_^" ]
[ "javascript", "jquery", "html", "audio" ]
[ "Redux Form field does not hide my passwords", "I have trouble trying to hide my password and my confirm password characters.\n\nDoes redux form require the name=\"password\" strictly or can I call name=\"password1\".\n\nThe Field only seems to hide my password characters when I type name=\"password\", even when type=\"password\" already.\n\n\r\n\r\n <form onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>\r\n <div>\r\n <Field\r\n label=\"Username\"\r\n name=\"username\"\r\n component={this.renderField}\r\n type=\"text\"\r\n />\r\n </div>\r\n <div>\r\n <Field\r\n label=\"Email\"\r\n name=\"email\"\r\n component={this.renderField}\r\n type=\"text\"\r\n />\r\n </div>\r\n <div>\r\n <Field\r\n label=\"First Name\"\r\n name=\"first_name\"\r\n component={this.renderField}\r\n type=\"text\"\r\n />\r\n </div>\r\n <div>\r\n <Field\r\n label=\"Last Name\"\r\n name=\"last_name\"\r\n component={this.renderField}\r\n type=\"text\"\r\n />\r\n </div>\r\n <div>\r\n <Field\r\n label=\"Password\"\r\n name=\"password1\"\r\n component={this.renderField}\r\n type=\"password\"\r\n />\r\n </div>\r\n <div>\r\n <Field\r\n label=\"Confirm Password\"\r\n name=\"password2\"\r\n component={this.renderField}\r\n type=\"password\"\r\n />\r\n </div>\r\n {this.renderAlert()}\r\n <div className=\"signin-button\">\r\n <button action=\"submit\" className=\"btn btn-primary\">Sign up!</button>\r\n </div>\r\n <div className=\"g-signin2\" id=\"my-signin2\" data-width=\"200\"/>\r\n <Link to=\"/signin\">Already an user?</Link>\r\n </form>" ]
[ "reactjs", "redux", "redux-form" ]
[ "makefile: multiple automatic variables", "Suppose I have the following:\n\n$: make foo-bar\n\n// makefile contents\n.PHONY foo-\n\nfoo-%:\n echo $*\n\n\nAnd I would like increased flexibility: \n\n# either: \n\n$: make foo-bar:foobar\n\n# or: \n\n$: make foo-bar-foobar\n\n// makefile contents, pseudocode\n\n.PHONY foo- foo-?-?\n\nfoo-%:\n echo $*\n\nfoo-%1-%2:\n echo $*1 $*2\n\n\n\nWith the caveat that I have seen large, automatically generated makefiles that have successfully implemented sophisticated interfaces such as: \n\nmake foo:bar:baz\n\n\nIdeally, it would be possible to implement the logical notation: \n\nmake foo::bar:baz\n\n# but I understand that this may be reaching.\n\n\n\n\nIs any of this possible with modern gnu make? I am not worried about older versions. And the advantage comes from conciseness and cleanliness, as verses some verbose workaround." ]
[ "makefile", "gnu-make" ]
[ "Url.Action not including port number", "I have a partial view which is displayed on a non-HTTPS page, but POSTS to a controller that requires SSL. The form definition is this:\n\n <form id=\"authForm\"\n method=\"post\"\n action=\"@Url.Action(\"authenticate\", \"auth\", new {}, \"https\")\">\n\n\nThe problem I'm having is that, within Visual Studio and when debugging, the host and port are localhost:64043. However, the Url.Action call above doesn't put the port number in, meaning the browser directs to my IIS installation. Do I have to add something else, or override this method? I want my application to be location agnostic.\n\nThanks in advance!" ]
[ "c#", "asp.net-mvc-3", "https" ]
[ "Selecting grouped rows after first two rows SQL Server", "This is a bit of a tricky question/situation and my search fu failed me.\n\nLets say i have the following data\n\n| UID | SharedID | Type | Date |\n|-----|----------|------|-----------|\n| 1 | 1 | foo | 2/4/2016 |\n| 2 | 1 | foo | 2/5/2016 |\n| 3 | 1 | foo | 2/8/2016 |\n| 4 | 1 | foo | 2/11/2016 |\n| 5 | 2 | bar | 1/11/2016 |\n| 6 | 2 | bar | 2/11/2016 |\n| 7 | 3 | baz | 2/1/2016 |\n| 8 | 3 | baz | 2/3/2016 |\n| 9 | 3 | baz | 2/11/2016 |\n\n\nAnd I would like to ommit a variable number of leading rows (most recent date in this case) and lets say that number is 2 in this example. The resulting table would be something like this:\n\n| UID | SharedID | Type | Date |\n|-----|----------|------|-----------|\n| 1 | 1 | foo | 2/4/2016 |\n| 2 | 1 | foo | 2/5/2016 |\n| 7 | 3 | baz | 2/1/2016 |\n\n\nIs this possible in SQL? Essentially I want to filter on an unknown number of rows which uses the date column as the order by. The goal is to get the oldest types and get a list of UID's in the process." ]
[ "sql-server" ]
[ "Padding with p and td html tag", "i have a problem with my p tag and td. For some reason it seems the p does not take the whole space inside the td.\n\nhere is the link\n\ni tried alot of things like changing the display and nothing fixed it." ]
[ "javascript", "html", "css", "html-table" ]
[ "Expected response code 354 but got code \"503\" in Laravel 5.7", "I am trying to send email using smtp protocol in laravel 5.7 XAMPP Localhost. But when the function running, I get an error like this :\n\n\n Expected response code 354 but got code \"503\", with message \"503-All RCPT commands were rejected with this error: 503-Please turn on SMTP Authentication in your mail client. ([127.0.0.1]) 503-[172.xx.xx.x]:63207 is not permitted to relay through this server without 503-authentication. 503 Valid RCPT command must precede DATA \"\n\n\nI have tried php artisan config:cache. But it's still same error.\n\nThis is my .env config :\n\nMAIL_DRIVER=smtp\nMAIL_HOST=mail.domain.com\nMAIL_PORT=465\[email protected]\nMAIL_PASSWORD=********\nMAIL_ENCRYPTION=ssl\n\n\nThis is my function to send the Email :\n\npublic function sendEmail()\n{\n Mail::send('email',['name' => 'Testing', 'message' => 'Just testing'], function ($message) {\n $message->from('[email protected]','ADMIN');\n $message->to('[email protected]');\n $message->subject('TEST');\n });\n}\n\n\nHow can I fix my error?" ]
[ "php", "laravel-5", "smtp" ]
[ "Selecting all non-blank cells in variable range in Excel VBA", "I have I data set on Excel. Starting at column B, it has continuous data from B3 to a variable number that periodically get larger (today it is B114, but tomorrow the data may extend to B116, for example). The data in cell B in continuous and is never deleted. For every row of continuous data in column B, I want to select column B-AG's rows as well. However, the rows after B do NOT have continuous data. \n\nFor example: There is continuous data from B3 to B120. I want to select the range B3:AG120. \n\nThe code I have written to do this in VBA is not working. It correctly stops at B120 (in this example), however, once it reaches the non-continuous data in columns C-AG, it freaks out and selects rows past 120. I am not positive why this code is not working, any help is much appreciated!\n\nFor the record, there are formulas in nearly every cell in the sheet. Only some formula populate the cell with data, however. I want to select every cell regardless of if it is populated with data IF IT IS IN MY RANGE. Otherwise, I do not want to select it. For example, past B120 there are empty cells with formulas in them. I do not want to include those in my range. But if there is an empty cell in D40 (in between B3 and AG120) I do want to include that in the selection. \n\nDim LR As Long, cell As Range, rng As Range\nWith Sheets(\"Sortable(2)\")\n LR = .Range(\"B\" & Rows.Count).End(xlUp).Row\n For Each cell In .Range(\"B3:B\" & LR)\n If cell.Value <> \"\" Then\n If rng Is Nothing Then\n Set rng = cell\n Else\n Set rng = Union(rng, cell)\n End If\n End If\n Next cell\n rng.Select\nEnd With" ]
[ "vba", "excel", "select" ]
[ "Sending xml over http loses indents", "I have a fairly large XML file that I want to send over http to a device. The method I am using is creating the Xmldocument (called doc), converting the outerXML to a string, and sending it using an HttpWebResponse. \n\nHere's a portion of the XML: \n\n <MotionDetection>\n <id>1</id>\n <enabled>true</enabled>\n <samplingInterval>2</samplingInterval>\n <startTriggerTime>500</startTriggerTime>\n <endTriggerTime>500</endTriggerTime>\n <regionType>grid</regionType>\n <Grid>\n <rowGranularity>15</rowGranularity>\n <columnGranularity>22</columnGranularity>\n </Grid>\n</MotionDetection>\n\n\nThe Problem: Whenever I send my code over the internet, it doesn't accept it (giving me a bad request response) because the xml is missing the \"indents\" or vbCrlfs that cause the wireshark sniffer to see it like an xml instead of a bunch of strings smashed together. \n\nIs there a way to send it using httpwebresponse so that those stay within the request? \nOther than, of course, breaking up the string and inserting it by \"hand\"?\n\nHere's my current code, since I also tried it using an upload client instead of httpwebrequest. \n\n Dim doc As New Xml.XmlDocument\n doc.Load(\"test.xml\")\n Try\n Dim url = \"http://\" & currentCamera.ipaddr & \"/Custom/Motion\"\n Dim client As New WebClient\n client.Credentials = New Net.NetworkCredential(currentCamera.Username, currentCamera.Password)\n Dim sentXml As Byte() = System.Text.Encoding.ASCII.GetBytes(doc.OuterXml)\n Dim response2 As Byte() = client.UploadData(url, \"PUT\", sentXml)\n\n Catch ex As Exception\n\n End Try" ]
[ "xml", "vb.net" ]
[ "Has Microsoft Deprecated GFlags and UMDH?", "In Windows Vista I found UMDH to be very helpful, but I can't find it for Windows 7/8, has Microsoft deprecated GFlags and UMDH? If so is there a way that I can get a log of the allocations on the heap by call stack in a Windows 7/8 approved tool?" ]
[ "windows-8", "windows-7", "windows-vista", "gflags", "umdh" ]
[ "How to capture html frame as an image", "I need to open a webpage from Python and capture what I see in browser as an image(or rather what should be seen, because I want to execute it in background). \nThe webpage contains JavaScript - one frame has caption dependent on script evaluation and I want it also to be captured." ]
[ "javascript", "python", "browser", "printscreen" ]
[ "Get the application start up path", "How to get path where the set up is being installed of Swing application?\n\nI want to access the application start up path. How is this possible in Java Swing?" ]
[ "java", "swing", "jar", "setup-project" ]
[ "xs:unique and xs:substitutionGroup", "I have a xs:unique declaration in a schema. It's work well. But when I substitute an element wich is the key, it's doesn't work any more. \n\nIs there something to ensure that the unique key persists with substitution ?\n\nFor instance, I have this xml :\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n <el id=\"1\"/>\n <el id=\"2\"/>\n</root>\n\n\nand this schema :\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n <xs:complexType name=\"typeel\">\n <xs:attribute name=\"id\"/>\n </xs:complexType>\n\n <xs:element name=\"el\" type=\"typeel\"/>\n\n <xs:element name=\"root\">\n <xs:complexType>\n <xs:sequence maxOccurs=\"unbounded\">\n <xs:element ref=\"el\"/>\n </xs:sequence>\n </xs:complexType>\n <xs:unique name=\"idgoooood\">\n <xs:selector xpath=\"el\"/>\n <xs:field xpath=\"@id\"/>\n </xs:unique>\n </xs:element>\n</xs:schema>\n\n\nThat's work very good.\n\nBut, if I add in schema :\n\n <xs:element name=\"el-bis\" type=\"typeel\" substitutionGroup=\"el\"/>\n\n\nI can write my xml :\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n <el id=\"1\"/>\n <el id=\"2\"/>\n <el-bis id=\"3\"/>\n</root>\n\n\nVery good. But, unfortunately, I can write also :\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<root>\n <el id=\"1\"/>\n <el id=\"2\"/>\n <el-bis id=\"2\"/>\n</root>\n\n\nI don't wwant that. I should want the unique key persists across substitution... Is it possible ? If not, what workarounds ?\n\nThanks." ]
[ "xml", "xsd" ]
[ "How can I generate random numbers in python using random?", "I tried to code it using randint and got an attribute error for it.\n\nimport random\ndef generate(start,end,n):\n res=[]\n for j in range(n):\n res.append(random.randint(start,end))\n return res\nstart=1\nend=15\nn=5\nprint(generate(start,end,n))\n\n\nThe interpreter produced the following error:\n\nAttributeError: module 'random' has no attribute 'randint'\n\n\nThis code doesn't raise an error in idle." ]
[ "python", "python-3.x" ]
[ "Python why loop behaviour doesn't change if I change the value inside loop", "Let's say I wrote a piece of code :\n\nfor i in range(10):\n print(i)\n i=11\n\n\nWhy doesn't the loop terminate now ?\n\nEven when I do this :\n\nn=10\nfor i in range(n):\n print(i)\n n=0\n\n\nIt doesn't effect the loop ?\n\nI'm just wondering how python is managing loop variables ?" ]
[ "python" ]
[ "Player doesn't die when it touches the ground with tag ground", "My player doesn't die and the error that the console gives me is: \n\n\n NullReferenceException: Object reference not set to an instance of an\n object Movement.OnCollisionEnter2D (UnityEngine.Collision2D collision)\n (at Assets/Scripts/Movement.cs:74.\n\n\nMy ground has already the tag ground but the game still gives me this. The ground has the collider too + rigidbody2d\n\npublic class Movement : MonoBehaviour\n{\n public float moveSpeed = 300;\n public GameObject character;\n private Rigidbody2D characterBody;\n private float ScreenWidth;\n private Rigidbody2D rb2d;\n private Score gm;\n public bool isDead = false;\n public Vector2 jumpHeight;\n\n void Start()\n {\n ScreenWidth = Screen.width;\n characterBody = character.GetComponent<Rigidbody2D>();\n gm = GameObject.FindGameObjectWithTag(\"gameMaster\").GetComponent<Score>();\n }\n\n // Update is called once per frame\n void Update()\n {\n if (isDead) { return; }\n if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space)) //makes player jump\n {\n GetComponent<Rigidbody2D>().AddForce(jumpHeight, ForceMode2D.Impulse);\n }\n int i = 0;\n while (i < Input.touchCount)\n {\n if (Input.GetTouch(i).position.x > ScreenWidth / 2)\n {\n RunCharacter(1.0f);\n\n }\n if (Input.GetTouch(i).position.x < ScreenWidth / 2)\n {\n RunCharacter(-1.0f);\n }\n ++i;\n }\n }\n\n void FixedUpdate()\n {\n#if UNITY_EDITOR\n RunCharacter(Input.GetAxis(\"Horizontal\"));\n#endif \n\n }\n\n private void RunCharacter(float horizontalInput)\n {\n characterBody.AddForce(new Vector2(horizontalInput * moveSpeed * Time.deltaTime, 0));\n\n }\n\n private void OnCollisionEnter2D(Collision2D collision)\n {\n if (collision.gameObject.CompareTag(\"ground\")) // this will return true if the collision gameobject has ground tag on it.\n {\n isDead = true;\n rb2d.velocity = Vector2.zero;\n GameController.Instance.Die();\n }\n }\n\n void OnTriggerEnter2D(Collider2D col)\n {\n if (col.CompareTag(\"coin\"))\n {\n Destroy(col.gameObject);\n gm.score += 1;\n }\n }\n}" ]
[ "c#", "unity3d" ]
[ "C style array in Objective-C", "With all the useful things you get from NSArray and NSMutableArray, why would you ever use a \"C Style\" array with Objective-C objects?\n\nNSString *array[] = {@\"dog\", @\"cat\", @\"boy\"};" ]
[ "objective-c", "c", "arrays" ]
[ "How to set default filter value through JSON meta data in superset", "I am new in Superset. I have a dashboard on which one filter is there called "District" in which list of values are there like "1,2,3,etc". How can I select default filter, means when page is loaded that filter say "2 or 3" automatically selected through JSON metadata?\nI seen the json meta data structure and default_filter was also there. But I don't know what to type in that so that default filter is selected automatically.\nBelow i am attaching image of my dashboard and json metadata as well..\nThanks in advance!!!\n\njson metadata\n\n{\n "timed_refresh_immune_slices": [\n \n ],\n "expanded_slices": {\n \n },\n "refresh_frequency": 0,\n "default_filters": "{\\"180\\": {\\"__time_range\\": \\"No filter\\"}}",\n "filter_scopes": {\n "180": {\n "district_id": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": [\n \n ]\n },\n "__time_range": {\n "scope": [\n "ROOT_ID"\n ],\n "immune": [\n \n ]\n }\n }\n }\n}" ]
[ "apache-superset", "superset" ]
[ "PHP: Session files contain no data", "I've looked around on the internet, including stack overflow, for a few days trying to resolve my issue with PHP sessions. For one, I've noticed that most of the tutorials simply say \"Here's the code, go use it.\" and not so much \"This is how it works.\" Additionally, all of the issues/answers I find seem to be about information being lost on refresh or after switching pages and none of these apply to me.\n\nThe data in $_SESSION is being stored/loaded no matter which page I view. My issue is, when I view the session files on the server, there is no data in them. Additionally, when I destroy a session or unset the variables the information is still stored and the next time $_SESSION is accessed the old information is retrieved.\n\nTo troubleshoot the behavior of sessions on my server I created an extremely simple script:\n\n<?php\n// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less\nif (!isset($_SESSION['count'])) {\n $_SESSION['count'] = 0;\n} else {\n $_SESSION['count']++;\n}\n\necho $_SESSION['count'];\n?>\n\n\nThis is ALL of the code on the page (viewable here: ). Every time this page is refreshed a new, blank, session file is saved into the specified directory on the server and the counter does not increase. \n\nMore information:\nFor information regarding php install: \nHosted on GoDaddy Shared Hosting - Linux OS\nI will update the permissions on the phpsessions directory to be temporarily browseable shortly. ()" ]
[ "php", "file", "session", "cookies", "session-variables" ]
[ "How to find all possible ways to fit a pattern onto a 3 by 3 grid?", "This is somewhat of a math question, but also somewhat of a coding problem, so I figured I'd post it here. I am writing in python3.\nLet's suppose you have a 3 by 3 grid:\nO O O\nO O O\nO O O\n\nNow I have a pattern, for example A B. I want to find all ways to place this pattern onto the 3x3 grid. Rotation is not allowed. For this particular example all solutions would be:\nA B O | O A B | O O O | O O O | O O O | O O O\nO O O | O O O | A B O | O A B | O O O | O O O\nO O O | O O O | O O O | O O O | A B O | O A B\n\nThe patterns may have any size from 1x2/2x1 up to 3x3. I can't quite wrap my head around formulating an algorithm that can do this. Keys such as A and B may appear 1 to 9 times and I do not know what names they have." ]
[ "python-3.x", "algorithm", "pattern-matching" ]
[ "Auto restart doesn't work with Registry setting", "This is how I set up registry for windows update, but the server doesn't reboot at the scheduled time and I want to set it through registry\nWindows Registry Editor Version 5.00\n\n[HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate]\n"SetActiveHours"=dword:00000001\n"ActiveHoursStart"=dword:00000008\n"ActiveHoursEnd"=dword:00000010\n"SetRestartWarningSchd"=dword:00000001\n"SetAutoRestartDeadline"=dword:00000001\n\n[HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU]\n"NoAutoUpdate"=dword:00000000\n"AUOptions"=dword:00000004\n"AutomaticMaintenanceEnabled"=dword:00000001\n"ScheduledInstallDay"=dword:00000000\n"ScheduledInstallTime"=dword:00000007\n"ScheduledInstallEveryWeek"=dword:00000001\n"AlwaysAutoRebootAtScheduledTime"=dword:00000001\n"AlwaysAutoRebootAtScheduledTimeMinutes"=dword:0000000F\n"NoAutoRebootWithLoggedOnUsers"=dword:00000001\n"AutoRestartDeadlinePeriodInDays"=dword:00000002\n"RebootRelaunchTimeout"=dword:00000001\n"RebootRelaunchTimeoutEnabled"=dword:00000001" ]
[ "windows-10", "registry", "windows-server-2016", "windows-update", "windows-server-2019" ]
[ "Does the class object grows in size as its private members grow?", "I am writing a class for my SLAM algorithm and this is my first large C++ project!\nI do remember that std::unique_ptr should be used when I want to keep some object which should have a dynamic memory, one owner and a long lifetime. So when designing a specific class which its object is being created only once and should have a global lifetime (it is the core class object that holds the map). So my idea was to create the std::unique_ptr which will hold that object:\n\nclass Backend\n{\nprivate:\n std::vector<double> values;\n /// some members\npublic:\n Backend() : values{0} {}\n ~Backend(){}\n // some functions\n};\n\nauto backend_ptr = std::make_unique(Backend());\n\n\nSo my question is: Does the size of backend_ptr will grow if I will increase the size of its private member values overtime? And with your suggestion, do I even need this unique_ptr at all?" ]
[ "c++" ]
[ "Solve Python Pulp without variables", "I have a python pulp linear program which is minimizing costs. In the degenerate case where there are no ways to reduce costs I would like it to return the fixed cost. However pulp seems to add a __dummy variable in the case of no variables, which has a value of None. I have added a minimal working example below.\nfrom pulp import *\nmodel = LpProblem("Degenerate_Model",LpMinimize)\n\nfixed_cost = 10\nmodel += fixed_cost\nprint(model) #Prints MINIMIZE 10 \nmodel.solve()\nprint(model.objective) #prints 0*__dummy + 10\nprint(value(model.objective)) #returns None. Desired output is 10\n\nMy desired output in the above example would be to return 10. Any help is greatly appreciated" ]
[ "python", "linear-programming", "pulp" ]
[ "Unity3D/C# - Async Loading of assets and level causes framedrop", "I'm trying to load a level with a few large assets in Unity 3D, and I can't get rid of stutters and lagging while the content is being loaded.\n\nI divided my main scene in separate sub-levels, and I'm loading them asynchronously.\n\nSo first I'm attempting to pre-load the actual assets from the resources folder :\n\nprivate IEnumerator preLoadAsset(string assetPath)\n{\n ResourceRequest asyncLoad = Resources.LoadAsync(assetPath);\n yield return asyncLoad;\n asyncLoadedAssetsCount += 1;\n preloadSceneAssets();\n}\n\n\nThis step finishes fast with very little impact on performance.\n\nprivate IEnumerator LoadYourAsyncScene(string sceneName)\n{\n AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);\n asyncLoad.allowSceneActivation = true;\n yield return asyncLoad;\n asyncLoadedScenesCount += 1;\n loadAdditiveScenes();\n}\n\n\nMost the lagging happens here, whether I set the scene activation to true or false.\n\nI also set the background loading priority of the app to Low earlier in the script :\n\n Application.backgroundLoadingPriority = ThreadPriority.Low; \n\n\nWhat am I doing wrong? \nIs it even helping to pre-load the assets before loading the additive scene on top, and if not, how can I make use of the pre-loading of the assets in memory efficiently?\n\nNote : the additive scenes are empty except one large asset in each one of them, and no Start/OnEnable/Awake functions are executed" ]
[ "c#", "unity3d" ]
[ "How do I move and Image View while program is running", "So I have an ImageView sitting on a FrameLayout. I want to move this image view when user taps on it and drags it somewhere. This is what I tried to do:\n\nFrameLayout.LayoutParameters params = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);\n\nparams.setMargin(marginLeft, marginTop, 0, 0);\nview.setLayoutParams(params);\n\nThis does not work however. The imageView does not move. Do I need to refresh the view somehow after I set new layout parameters?" ]
[ "android", "move", "margin", "imageview" ]
[ "Cakephp 3 delete filtering by associated data", "In CakePHP 3, suppose I want to delete all Departments that have some Employee named \"John\" (Departments have many Employees, Employees belongs to Department) \n\nThe easiest approach is to filter all those Departments, and delete them one by one in a foreach loop:\n\n$departments = $this->Departments->find()\n ->matching('Employees', function ($q) {\n return $q->where(['Employees.name' => 'John']);\n })\n ->all();\n\nforeach ($departments as $department) {\n $this->Departments->delete($department);\n}\n\n\nThis will result in one SELECT query plus one DELETE query for each record. I'd prefer one only query to be sent and executed by the database. Something like this:\n\nDELETE Departments \nFROM departments Departments \nINNER JOIN employees Employees ON \n Employees.department_id = Departments.id \n AND Employees.name = 'John';\n\n\nReading the docs I find three ways to delete records:\n\n\nUsing the Table object one by one, get the object, then delete it.\nUsing the Table with deleteAll, which takes an array of conditions over the target table, not the associated ones.\nUsing the ORM, again with only an array of conditions.\n\n\nIs there an elegant way to obtain my query using CakePHP 3 and the ORM?" ]
[ "mysql", "cakephp", "cakephp-3.0" ]
[ "Run Code Inside One Thread In Another", "I am writing a Processing project (Processing is based on Java). I want to run the code inside one thread in another thread (the main thread).\n\n//This method runs in the main thread\npublic void draw() {\n\n}\n\n//This is a callback that runs in a separate thread\nvoid addTuioObject(TuioObject tobj) {\n rect(0, 0, 20, 10); \n}\n\n\nThe rect(0,0,20,10) does not run in the main thread (it is supposed to draw a rectangle on the screen). I suppose this is because it runs in a separate thread. How would I make this code run in the main thread?" ]
[ "java", "multithreading", "processing" ]
[ "cakephp2: how to set layout for cake exception", "I have encountered a quite complex situation to render error page\n1) the cake exception NotFoundException is thrown from a plugin;\n2) I want to render a layout from app instead of from this plugin;\n\nI have tried to set $this->layout='default'; in the plugin controller beforeFilter method, but still the plugin layout instead of the app layout is rendered.\n\nI looked into the CakeErrorController but did not find where the layout is set.\n\nany idea how to manage this?" ]
[ "cakephp", "layout", "plugins" ]
[ "Issue while using different scoring metric in Gridsearchcv sklearn", "I am doing elastic-net regression and trying to estimate the best hyper-parameter using GridSearchCV. But when I change scoring in GridSearchCV from default r2 to mean_squared_error, GridSearchCV makes every feature coefficient 0. I don't know why it is happening.\nHere is the code.\nparam={\n'elastic__alpha':np.linspace(.1,1,15),\n'elastic__l1_ratio':np.linspace(0,1,30)\n}\npipe=Pipeline([('scalar',StandardScaler()),('elastic',ElasticNet(max_iter=10000))])\nsearch=GridSearchCV(pipe,param_grid=param,cv=4,scoring=make_scorer(mean_squared_error))\nsearch.fit(train_x,train_y)" ]
[ "python", "scikit-learn", "regression", "hyperparameters", "gridsearchcv" ]
[ "R Sort strings according to substring", "I have a set of file names like:\n\nfilelist <- c(\"filea-10.txt\", \"fileb-2.txt\", \"filec-1.txt\", \"filed-5.txt\", \"filef-4.txt\")\n\n\nand I would like to filter them according to the number after \"-\".\n\nIn python, for instance, I can use the keyparameter of the sorting function:\n\nfilelist <- [\"filea-10.txt\", \"fileb-2.txt\", \"filec-1.txt\", \"filed-5.txt\", \"filef-4.txt\"]\nsorted(filelist, key=lambda(x): int(x.split(\"-\")[1].split(\".\")[0]))\n\n> [\"filec-1.txt\", \"fileb-2.txt\", \"filef-4.txt\", \"filed-5.txt\", \"filea-10.txt\"]\n\n\nIn R, I am playing with strsplit and lapply with no luck so far.\n\nWhich is the way to do it in R?\n\nEdit:\nFile names can be many things and may include more numbers. The only fixed pattern is that the number I want to sort by is after the \"-\". Another (real) example:\n\nc <- (\"boards10017-51.mp4\", \"boards10065-66.mp4\", \"boards10071-81.mp4\",\n \"boards10185-91.mp4\", \"boards10212-63.mp4\", \"boards1025-51.mp4\", \n \"boards1026-71.mp4\", \"boards10309-89.mp4\", \"boards10310-68.mp4\", \n \"boards10384-50.mp4\", \"boards10398-77.mp4\", \"boards10419-119.mp4\", \n \"boards10421-85.mp4\", \"boards10444-87.mp4\", \"boards10451-60.mp4\", \n \"boards10461-81.mp4\", \"boards10463-52.mp4\", \"boards10538-83.mp4\", \n \"boards10575-62.mp4\", \"boards10577-249.mp4\")\"" ]
[ "regex", "r", "sorting" ]
[ "Measure does not work for Month Threshold", "I build this Dax measure \n\n_Access_Daily = CALCULATE(\n DISTINCTCOUNTNOBLANK(ApplicationAccessLog[ApplicationUserID]),\nFILTER('Date','Date'[DateId]=SELECTEDVALUE('DateSelector'[DateId],MAX('DateSelector'[DateId]))))+0\n\n_Access__PreviousDay = CALCULATE(\nDISTINCTCOUNTNOBLANK(ApplicationAccessLog[ApplicationUserID]), FILTER('Date','Date'[DateId]=SELECTEDVALUE('DateSelector'[DateId],MAX('DateSelector'[DateId]))-1 ))+0\n\n\nThe Date Selector table is a disconnected table containing dates from the 20th Jan to now. Dateid is a whole number like 20200131.\nThe Date table is a standard date table with all the dates between 1970 and 2038. Date id is a whole number like 20200131.\nHowever it does not seems to work for the month threshold between Jan and Feb ? So if selected date is 01/02/2020 then it does not return correctly for the 31/01/2020." ]
[ "sql-server", "powerbi", "dax" ]
[ "I keep getting a null pointer exception", "I'm making a library program that keeps a record of any books that are in the collection and how many copies of each book there are. Here is the code\n\nimport java.util.Arrays;\nimport java.util.Scanner;\npublic class Library{\n static String title;\n static String author;\n static int id;\n static int copies;\n static String date;\n static Book[] database = new Book[100];\n static int count=0;\n\n public static void main(String[] args){\n int i;\n Scanner s = new Scanner(System.in);\n do{\n addBook();\n System.out.println(\"would you like to add another book?\");\n i=s.nextInt();\n }while(i == 0);\n database[0].viewDetails();\n database[1].viewDetails();\n checkingOut();\n }\n public static void addBook(){\n Scanner s = new Scanner(System.in);\n System.out.println(\"Enter the title of the book you want to add to the collection\");\n title=s.nextLine();\n System.out.println(\"Enter the author of the book you want to add to the collection\");\n author=s.nextLine();\n System.out.println(\"Enter the publishing date of the book you want to add to the collection\");\n date=s.nextLine();\n System.out.println(\"Enter the ID number of the book you want to add to the collection\");\n id=s.nextInt();\n System.out.println(\"Enter the the number of copies that will be added into the collection\");\n copies=s.nextInt();\n\n Book Book1 = new Book(date, author, copies, id, title);\n database[count] = Book1;\n count++;\n }\n public static void checkingOut(){\n boolean found=false;\n int idSearch;\n int i=0;\n Scanner s = new Scanner(System.in);\n System.out.println(\"Enter the ID number of the book you want to check out\");\n idSearch=s.nextInt();\n while(i<database.length && found!=true){\n if(database[i].getIdentificationNumber() == idSearch){\n found = true;\n }\n i++;\n }\n if(found==true){\n database[i].checkOut();\n System.out.println(\"There are \"+database[i].getNumberCopies()+\" copies left\");\n }\n else{System.out.println(\"There is no book with that ID number!\");}\n }\n}\n\n\nI'm getting a null pointer exception on line 55 of my checking out method, I can't figure out why. Please let me know if you can spot what it is any help would be greatly appreciated." ]
[ "java" ]
[ "Ruby on Rails - pass route param to controller", "i´m new on ruby on rails and testing it to look if it makes sence to switch to this.\n\ni have my route definition in routes.rb\n\nget \"users/:id\" => \"app#user\", as: :uId\n\n\ni want to load the app-controller with view \"user\" and from there load information to user with the id uId\n\nBut how to access in my controller to :uId?\n\nI´ve nothing found which helps me here..." ]
[ "ruby-on-rails", "ruby", "ruby-on-rails-3" ]
[ "IBM Watson Assistant: How to set a context variable from option response?", "I couldn't figure out a problem with IBM Watson Assistant. I've chosen to use an Option type as response. That way, I can see a list on my chatbot where each item is clickable and has an associated value.\nWhen a user clicks one of the options, the associated user input value is sent to the assistant. How can I give this value to a context variable? Is it possible?" ]
[ "ibm-cloud", "watson-assistant" ]
[ "How to increase form loading speed if I set background image for my windows .net form?", "I have a problem with my forms: if I set the background image for my form, that form is very slow while loading. How can I overcome this problem? Can anyone help me?" ]
[ "forms", "background-image" ]
[ "Will I be able to use C# 4 as my scripting language?", "In one of my C# application I use IronPython as a script language. It looks something like this:\n\nstring scriptCode = \"20 * 5\";\nScriptEngine engine = Python.CreateEngine();\nScriptSource source =\n engine.CreateScriptSourceFromString(scriptCode , SourceCodeKind.Expression);\nConsole.WriteLine(source.Execute<int>());\n\n\nWill I be able to do something similar with C# 4.0? Can I use C# as my scripting language instead of IronPython?" ]
[ "ironpython", "c#-4.0" ]
[ "Simple Escp Java : PrintPreviewPane not work in JDK7", "I use this library to do dot matrix printing;\nhttps://blog.jocki.me/simple-escp/\nRunnable runner = new Runnable() {\n @Override\n public void run() {\n \n Gson gsonTemplate = new Gson();\n String jsonStringTemplate = gsonTemplate.toJson(result.get("documentTemplate"));\n Template template = new JsonTemplate(jsonStringTemplate);\n\n \n Gson gson = new Gson();\n String jsonString = new Gson().toJson(result.get("documentValue"));\n java.lang.reflect.Type type1 = new TypeToken<HashMap<String, Object>>() {\n }.getType();\n\n Map<String, Object> map = gson.fromJson(jsonString, type1);\n MapDataSource dataSource = new MapDataSource(map);\n\n PrintPreviewPane printPreviewPane = new PrintPreviewPane();\n printPreviewPane.display(template, dataSource);\n\n jInternalFrameResult.getContentPane().removeAll();\n jInternalFrameResult.repaint();\n jInternalFrameResult.setLayout(new BorderLayout());\n jInternalFrameResult.add(printPreviewPane, BorderLayout.CENTER);\n jInternalFrameResult.setAutoscrolls(true);\n jInternalFrameResult.setFocusable(true); \n }\n};\n\n\nThread t = new Thread(runner, "Code Executer");\nt.start();\n\nIn java 8 (OpenJD, OracleJDK) it works as charm => (tested In Win 7-32&64 bit, 10 64 bit, Ubuntu 18.04).\nBut in java with JDK 7 (OpenJD, OracleJDK) (tested in win xp)\nI got NullPointerException In PrintPreviewPane:\nException in thread "Code Executor" java.lang.NullPointerException at\nsimple.escp.swint.PrintePreviewPane.<init> (PrintPreviewPane.java:81)" ]
[ "java" ]
[ "Objective-C read outlook file", "I would like to write a program on Objective-C to read Outlook .pst files. Is there any MAPI provider or OLEDB connection strings that I can use with Objective-C on OSX?" ]
[ "objective-c", "outlook" ]
[ "How to use the [HandleError] attribute in ASP.NET MVC?", "I've got some custom error handling in my ASP.NET MVC site -> seems to be working fine.\n\nI have an Error Controller, like this :-\n\n/Controller/ErrorController.cs\n\n[AcceptVerbs(HttpVerbs.Get)]\npublic ActionResult Unknown()\n{\n Response.StatusCode = (int)HttpStatusCode.InternalServerError;\n return View(\"Error\");\n}\n\n[AcceptVerbs(HttpVerbs.Get)]\npublic ActionResult NotFound()\n{\n Response.StatusCode = (int)HttpStatusCode.NotFound;\n return View(\"Error\");\n}\n\n\n(i've also removed some other text, like the message to display, etc..)\n\nThe view is located like..\n\n/Views/Error/Error.aspx\n\n\nNow, i'm not sure how I can 'call' the Unknown method (above) when an error occurs. I thought I could use the [HandleError] attribute, but this only allows me to specify a View (and I'm don't think i'm doing that properly, cause the error url is really weird)." ]
[ "asp.net-mvc", "error-handling" ]
[ "How to read tcp/ip headers in PHP?", "I want to get the source endpoint .\nBasically i want to block some ips by geting the port/ip from tcp/ip headers not from http header. Are there any built in methods for PHP to achieve that or i should do a workaround ?" ]
[ "php", "tcp", "header" ]
[ "padding a string with zeros and passing it to another page in asp.net webforms", "I'm trying to pad a textbox value with zeros and pass it to another page with Response.Redirect in asp.net webforms. I cannot get the number to be padded with zeros. If I enter 2 in the textbox it should display 000002 on the second page. Here's my code:\n\nif (cmbSearchBy.Text == \"Account Number\")\n{\n var zeropadding = String.Format(\"{0:00000}\", txtSearchKeyword.Text);\n Response.Redirect(\"AccountTable.aspx?SearchBy=\" + cmbSearchBy.SelectedValue + \"&TableSelection=\" + cmbSelectTable.SelectedValue + \"&SearchTerm=\" + zeropadding + \"\");\n}\nelse\n{\n Response.Redirect(\"AccountTable.aspx?SearchBy=\" + cmbSearchBy.SelectedValue + \"&TableSelection=\" + cmbSelectTable.SelectedValue + \"&SearchTerm=\" + txtSearchKeyword.Text + \"\");\n}" ]
[ "c#", "asp.net", "formatting" ]