texts
sequence
tags
sequence
[ "chrome Extension , pass data to an Iframe", "It seems like this has been asked before but I cannot get it to work. My question is \n\nI want to create popup dialog that contains an IFrame, (or something to the like if a better idea exists). What will happen is the user will right click and invoke 'Make Applicant', I want to take the page the user is on, and send it to the iframe, where the iframe will do the parsing, display the results and the user will chose to edit and\\or save the applicant. \n\nIn this situation I get the following error:\n\n\n Error in event handler for runtime.onMessage: DataCloneError: Failed\n to execute 'postMessage' on 'Window': HTMLBodyElement object could not\n be cloned.\n at chrome.runtime.onMessage.addListener.request (chrome-extension://ljkbppmibpdchehdfdhijcoaenhnblhm/content.js:16:30)\n\n\nI am not sure how to achieve this: Pass the innerHTML to the iframe for parsing and displaying.\n\nbackground.js\n\nchrome.contextMenus.create({ \n contexts: ['all'],\n id: 'applicantParser',\n title: 'Make Applicant'\n });\n\nchrome.contextMenus.onClicked.addListener(() => {\n chrome.tabs.query({active: true, currentWindow: true}, tabs => {\n chrome.tabs.sendMessage(tabs[0].id, {type: 'requestParseApplicant'});\n });\n});\n\n\nmanifest.json\n\n{\n \"name\": \"TW Extension\",\n \"description\" : \"TW Extension\",\n \"icons\": { \n \"16\": \"icon-16.png\"\n },\n \"version\": \"1.0\",\n \"manifest_version\": 2,\n \"browser_action\" :\n {\n \"default_icon\" : \"icon-16.png\",\n \"default_popup\": \"index.html\"\n },\n \"content_scripts\": [{\n \"js\": [ \"content.js\"],\n \"matches\": [ \"<all_urls>\"],\n \"all_frames\": true\n }],\n \"background\": {\n \"scripts\": [\"background.js\"]\n },\n \"permissions\": [\"contextMenus\", \"storage\", \"activeTab\", \"debugger\"],\n \"web_accessible_resources\" : [\"index.html\", \"x.js\"]\n }\n\n\ncontent.js\n\nchrome.runtime.onMessage.addListener(request => {\n console.log( request );\n console.log(document.body.innerHTML);\n if (request.type === 'requestParseApplicant') {\n var bodyHtml = \"<dialog style='height:70%; width:50%;'>\";\n bodyHtml += \"<iframe id='parseApplicant' style='height:100%'></iframe>\";\n bodyHtml += \"<div style='position:absolute; top:0px; left:5px;'><button>x</button></div>\";\n bodyHtml += \"</dialog>\";\n document.body.innerHTML += bodyHtml;\n\n const dialog = document.querySelector(\"dialog\");\n dialog.showModal();\n const iframe = document.getElementById(\"parseApplicant\"); \n //iframe.src = chrome.extension.getURL(\"index.html\");\n iframe.src = chrome.runtime.getURL(\"index.html\");\n iframe.contentWindow.postMessage({call:'sendValue', value: document.body});\n iframe.frameBorder = 0; \n dialog.querySelector(\"button\").addEventListener(\"click\", () => {\n dialog.close();\n });\n }\n});" ]
[ "javascript", "iframe", "google-chrome-extension" ]
[ "Best way to join 2 tables using hibernate", "I have 2 hibernate entities/tables and need to combine information from both for use in a view. The tables are\n\nTable Client:\n clientId,\n firstName,\n lastName,\n phone,\n cellPhone\n\nTable Appointment:\n apptTime,\n clientId (and some other fields I don't need now)\n\n\nThere is a one-to-many relationship between client and Appointment, based on clientID. In regular SQL I'd just say something like:\n\nSelect \n client.clientId, \n appt.apptTime,\n client.firstName,\n client.lastName \nfrom \n Client client, \n Appointment app \nwhere \n client.clientId = appt.clientId\n\n\nand use the recordset that was returned.\n\nI'm not sure how to do this in Hibernate. Should I create a ClientAppt entity and then do something like the above select (modified somewhat for HQL)? \n\nNote, I thought of using SecondaryTable approach, but I think that requires a 1 to 1 relationship? I suppose I could map a one to many, but is there an alternative? This is a one time change and mapping a one to many relationship might be a bit expensive for something this small?\nWhat is the best approach?\nThanks" ]
[ "hibernate" ]
[ "What alternatives are there to identifying mobile devices without using their IMEI, SerialID, etc.?", "Recently I came across an old project for Nokia Asha with app tracking in it.\n\nFor every screen accessed by the user a Http request would be made to report to the analytics service and one of the parameters sent was the IMEI in the mobile device.\n\nAs far as I know, retrieving information like the IMEI on Windows Phone and iPhone is not permitted but on Android it's still an available function but requires the permission to read the state and identity of the phone which I've been told scare some users.\n\nFrom what I'm seeing, using this kind of information is being discouraged in which case what alternatives are being more encouraged to implement to identify a device when it comes to analytics services or similar?" ]
[ "mobile", "analytics", "mobile-application" ]
[ "How to read data from a PDF using SAS Program", "Problem Statement:\nI am unable to read data from a PDF file using SAS.\nWhat worked well:\nI am able to download the PDF from the website and save it.\nNot working (Need Help):\nI am not able to read the data from a PDF file using SAS. The source content structure is expected to remain the same always. Expected Output is attached as a jpg image.\nIt would be a great learning and help if someone knows and help me how to tackle this scenario by using SAS program.\n\nI tried something like this:\n/*Proxy address*/\n%let proxy_host=xxx.com;\n%let port=123;\n\n/*Output location*/\nfilename output "/desktop/Response.pdf";\n\n/*Download the source file and save it in the desired location*/\nproc http \nurl="https://cdn.nar.realtor/sites/default/files/documents/ehs-10-2020-overview-2020-11-19_0.pdf" \nmethod="get" \nproxyhost="&proxy_host." \nproxyport=&port \nout=output; \nrun;\n\n%let lineSize = 2000;\n\ndata base;\n format text_line $&lineSize..;\n infile output lrecl=&lineSize;\n input text_line $;\nrun;\n\nDATA _NULL_ ;\nX "PS2ASCII /desktop/Response.pdf\n/desktop/flatfile.txt";\nRUN;" ]
[ "sas", "data-science", "pypdf2", "data-scrubbing", "pdf2data" ]
[ "node-inspector shows 'No Properties' for objects", "I'm pretty new in the debugging scene, especially with node-inspecor.\n\nAfter I had installed node-inspector, I started my simple node app with the --debug parameter and was able to see the debug view at localhost:8080/debug?port=5858.\n\nWhen I let the app stop at this breakpoint: \n\nrouter.get('/people', function(req, res) {\n var num = 1;\n var str = 'rarf';\n var obj = {x: 1, y: 2}\n\n console.log(req) // breakpoint\n});\n\n\nand hover with the curser on the identifier, it shows as follows:\n\n\nreq: Incoming Message - No Properties \nres: Server Response - No Properties\nstr: \"rarf\"\nnum: 1\nobj: Object - No Properties\n\n\nWhy can't I see the properties of objects?" ]
[ "node.js", "debugging", "node-inspector" ]
[ "Azure SignalR Service - Multiple Server Configurations", "When implementing Azure Application Services that implement a SignalR Hub, is it possible to determine which Application Services should be included in the pool of available Servers when establishing a client connection?\n\nExample:\n\nWe have one Azure SignalR service hosting one SignalR Hub. We then reference an implementation of that SignalR Hub in TWO DIFFERENT Web Apis (FunApi1, FunApi2). The overall functionality of these Apis is not guaranteed to be the same. \n\nUpon the connection of a client, when Azure SignalR establishes a persistent connection to a Hub Server, is it possible to ensure that all clients connect ONLY to FunApi1? \n\nIs there any documentation on how the service chooses servers (round-robin, etc)? Is it simply an unsupported use case?" ]
[ "asp.net-core", "azure-signalr" ]
[ "Matlab: collect all results from multiple run script", "I'm got a script that produce a column of 36 values.\nI would save these 36 values in rows in Excel.\n\nAt the moment, I have to run the script each time so I can change the xlrange value, eg: A1 to A1000.\n\nI tried looping the script, and tried to write the values into a new column of a new variable, say mm.\n\nFor i=1:1000\nScriptnamehere\nmm(i,:)=m or mm(:,i)\n\nWrite in excel script here\nEnd\n\n\nIt failed to recognize i for mm." ]
[ "matlab" ]
[ "specify which button to move up wth soft keyboard in Android", "I have multiple buttons in my layout aligned to bottom, when I want to type into an Edittext and the soft keyboard shows, how can I specify which button to move up with the soft keyboard." ]
[ "android", "button", "android-relativelayout" ]
[ "Json data search from MySQL table", "My MySQL table contain json column academics.\nTable values look like this :\nid academics\n--------------------------------------------------------\n100 ["CBSE-Afternoon-12-A","CBSE-Morning-12-B"]\n200 ["CBSE-Afternoon-12-C","CBSE-Morning-12-D"]\n300 ["CBSE-Afternoon-12-E","CBSE-Afternoon-12-F"]\n\nI have to find the id from the above table based on the search key:\nCBSE-Morning-12 & CBSE-Afternoon-12\n\nI have tried the below query\nSELECT id \nFROM ACADEMIC_TABLE \nWHERE JSON_SEARCH(academics, 'all', 'CBSE-Morning-12%') IS NOT NULL\n\nit returns id: 100,200 correctly.\nBut I need to search with two keywords like condition in JSON\n[CBSE-Morning-12 & CBSE-Afternoon-12 ] and return id 100,200,300\nPlease help me" ]
[ "mysql", "arrays", "json" ]
[ "NSAttributedString with emojis warns of using Times-Roman on macOS", "Any idea what the following means? We're not requesting .AppleColorEmojiUI! Any NSAttributedString with Emojis ends up showing this in the console.\n\nCoreText note: Client requested name \".AppleColorEmojiUI\", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:]." ]
[ "macos", "cocoa", "nsattributedstring", "core-text" ]
[ "Spring Reactive processing Server Side Events", "How to recieve streaming data via Server Side Events Content-Type: text/event-stream using Spring Flux features? Is it possible to handle such responses with WebClient?\n\nSource end-point:\n\n@GetMapping(path = \"/\", produces = MediaType.TEXT_EVENT_STREAM_VALUE)\npublic Flux<CurrencyStats> get() {\n return getStream();\n}\n\n\nI tried to get data that way, but it seems to be wrong.\n\nWebClient webClient = WebClient.create(\"http://example.com\");\n return webClient\n .get()\n .uri(\"/sse\")\n .accept(MediaType.TEXT_EVENT_STREAM)\n .retrieve()\n .bodyToFlux(String.class).doOnNext(\n string -> {\n // print that string\n }\n );" ]
[ "spring-webflux" ]
[ "Linear Regression on smoothed timeseries in R", "I perform a regression with two timeseries objects. It works like that (dummy values):\n\nts1 <- ts(1:10,start=0,frequency=1)\nts2 <- ts(1:10,start=0,frequency=1)\nclass(ts1) # \"ts\"\nlagmat = \"ts1 ~ ts2\"\narmod <- dyn$lm(as.formula(lagmat))\n\n\nThe problem arises when the timeseries are smoothed before the regression:\n\nts1 <- ts(1:10,start=0,frequency=1)\nts2 <- ts(1:10,start=0,frequency=1)\nts1 <- smooth(ts1)\nts2 <- smooth(ts2)\nclass(ts1) # \"tukeysmooth\" \"ts\" \nlagmat = \"ts1 ~ ts2\"\narmod <- dyn$lm(as.formula(lagmat))\n\n\nError in zooreg(coredata(x), start = xtsp[1], end = xtsp[2], frequency = frequency) : \n “data” : attempt to define invalid zoo object\n\nMy idea was to extract the timeseries object somehow. With tho following lines before the regression it works:\n\nts1 <- ts(as.vector(ts1),start=start(ts1), frequency=frequency(ts1))\nts2 <- ts(as.vector(ts2),start=start(ts2), frequency=frequency(ts2))\n\n\nWhy does the first version not work and is there a better way to do it than creating new timeseries?" ]
[ "r", "time-series", "smoothing" ]
[ "EF Core complex where clause", "EF Core 3.1 throws when running the following query, complaining that it could not generate the right SQL for it.\nvar searchPatterns = new string[] { "a", "b", "c" };\n\nvar matches = from entity in _dbContext.Entity\n where searchPatterns.Any(x => entity.Column1.Contains(x))\n select entity;\n\nIn raw sql, this could translate to something like\nselect * from entity\nwhere exists (select x from @SearchPatterns where entity.column1 like '%:' + x + '%'))\n\n(where @SearchPatterns is a table parameter that holds the records a, b, and c)\nHow can I rewrite the query to make it possible for EF Core to accept it?\nEdit The actual query that I am building is much more complicated than the simplified version I presented above. Thus, I am not considering FromSqlRaw() as an option that I am willing to use." ]
[ "sql", "ef-core-3.1" ]
[ "How to parse_dates for the Imported CSV File in google colab ?? the CSV file is imported from the Local drive", "In Google Colab I have imported the CSV file from local drive, using the below code :\n\nfrom google.colab import files\nuploaded = files.upload()\n\n\nthen to read the CSV file to parse_date I have the below code :\n\nimport pandas as pd\nimport io\ndf = pd.read_csv(io.StringIO(uploaded['Auto.csv'], parse_dates = ['Date'],date_parser=parse))\nprint(df)\n\n\nit show's the error message as below :\n\nTypeError: StringIO() takes at most 2 arguments (3 given)\n\n\nBut when importing file from github it works good for example shown below :\n\ndf = pd.read_csv('https://raw.githubusercontent.com/master/dataset/electricity_consumption.csv', parse_dates = ['Bill_Date'],date_parser=parse) #this code works good from github\n\n\nso I want to parse_dates for the csv file imported from the Local drive ??? Kindly help me on this??? \n\nData set looks like this :" ]
[ "python", "pandas", "csv", "parsing", "google-colaboratory" ]
[ "Fully duplicate mouse movement into touch event", "I recently bought an Acer Iconia W510. All the touch events work fine, 1-finger click, double click etc. I have a windows application (WPF 4) that runs on a touch table (running windows 7, developed with pixelsense 2.0). I understand that there is no direct compatibility with windows 8. The application has a few buttons and a map where you are able to pan around. There are also a few clickable buttons. All these functions work with the mouse (left click) but not with a touch event. Is there a way / hack of copying the mouse movement to a touch event? In that way I am able to use touch to pan around.\n\nThanks!\n\nTom" ]
[ "windows-8", "touch", "tablet", "pixelsense", "wpf-4.0" ]
[ "jQuery: What is returned if $('#id') doesn't match anything?", "What is returned if $('#id') doesn't match anything? I figured it would be null or false or something similar so I tried checking like so:\n\nvar item = $('#item');\nif (!item){\n ...\n}\n\n\nBut that didn't work." ]
[ "javascript", "jquery", "css", "jquery-selectors" ]
[ "BigQuery raises Pagination token expired on first getQueryResults", "We're seeing sporadic cases (4x today) of query errrors that BigQuery raises at the firs attempt to call getQueryResults (e.g. without a pagination token). The error is:\n\nHttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/.../queries/job_...?alt=json returned \"Pagination token expired\">\n\nThe status of the job on a get() call returned 'DONE'. \n\nThis is the output of a bq wait for the failed job:\n\nWaiting on ... (0s) Current status: DONE\nJob \n\nJob Type State Start Time Duration Bytes Processed \n\n\n\nquery FAILURE 24 May 08:00:06 0:00:00 \n\nErrors encountered during job execution. Pagination token expired\n\nNote that this happened within seconds after submitting the query job.\n\nAny ideas on what could be happening here?" ]
[ "google-bigquery" ]
[ "SoftKeyboard in Dialog Activity pans the activity behind", "Just as the title says, from one activity I start a dialog activity that contains an editText. When I click it and the softKeyboard comes up, it pans the DialogActivity but it also affects the activity behind. \n\nThis is the manifest entry for the parent activity\n\n<activity\n android:name=\".BasketStep2Activity\"\n android:parentActivityName=\".home.Start\"\n android:windowSoftInputMode=\"stateAlwaysHidden|adjustPan\" >\n <meta-data\n android:name=\"android.support.PARENT_ACTIVITY\"\n android:value=\".home.Start\" />\n </activity>\n\n\nand this is the manifest entry for the dialog activity\n\n<activity\n android:name=\".SelectRelais\"\n android:configChanges=\"keyboardHidden|orientation|screenSize\"\n android:windowSoftInputMode=\"adjustPan|stateHidden\" \n android:theme=\"@style/AppDialog\" >\n </activity>\n\n\nThe parent activity pans to the bottom as if there was an editText with focus there. If i use \"adjustResize\", everything is obviously messed up. Is there a way to prevent any changes to the background activity?" ]
[ "android", "resize", "android-softkeyboard", "pan", "adjustpan" ]
[ "Chrome extension and .click() loops using values from localStorage", "I have made a Chrome extension to help using a small search engine in our company's intranet. That search engine is a very old webpage really convoluted, and it doesn't take parameters in the url. No chance that the original authors will assist: \n\n\nThe extension popup offers an input text box to type your query. Your\nquery is then saved in localStorage \nThere is a content script inserted in\nthe intranet page that reads the localStorage key and does a document.getElementById(\"textbox\").value = \"your query\"; and then does\ndocument.getElementById(\"textbox\").click();\n\n\nThe expected result is that your search is performed. And that's all. \n\nThe problem is that the click gets performed unlimited times in an infinite loop, and I cannot see why it's repeating. \n\nI would be grateful if you would be able to assist. This is my first Chrome extension and all what I have been learning about how to make them has been a great experience so far. \n\nThis is the relevant code:\n\nThe extension popup where you type your query\n\npopup.html\n\n<input type=\"search\" id=\"cotext\"><br>\n<input type=\"button\" value=\"Name Search\" id=\"cobutton\">\n\n\nThe attached js of the popup\n\npopup.js\n\nvar csearch = document.getElementById(\"cotext\");\nvar co = document.getElementById(\"cobutton\");\nco.addEventListener(\"click\", function() {\n localStorage[\"company\"] = csearch.value;\n window.open('url of intranet that has content script applied');\n});\n\n\nAnd now the background file to help with communication between parts:\n\nbackground.js\n\nchrome.extension.onRequest.addListener(function(request, sender, sendResponse) {\nsendResponse({data: localStorage[request.key]});\n});\n\n\nAnd finally the content script that is configured in the manifest to be injected on the url of that search engine. \n\nincomingsearch.js\n\nchrome.extension.sendRequest(\n{method: \"getLocalStorage\", key: \"company\"},\n function(response) {\n var str = response.data;\n if (document.getElementById(\"txtQSearch\").value === \"\") {\n document.getElementById(\"txtQSearch\").value = str;\n }\n document.getElementById(\"btnQSearch\").click();\n });\n\n\nSo as I mentioned before, the code works... not just once (as it should) but many many times. Do I really have an infinite loop somewhere? I don't see it... For the moment I have disabled .click() and I have put .focus() instead, but it's a workaround. I would really like to use .click() here. \n\nThanks in advance!" ]
[ "javascript", "google-chrome-extension", "local-storage", "onclicklistener" ]
[ "How to force Spring Boot to redirect to https instead of http?", "I use Spring Boot + Spring Security. We use nginx on production which proxy_pass requests to our application. The problem is that app redirects to http instead of https (when user logs out). \n\nHow to force Spring to redirect to https on production env and still redirect to http on dev env?" ]
[ "spring", "configuration", "spring-security", "spring-boot" ]
[ "jQuery for hiding other columns options(dynamic) except column one. and onClick it shows other", "I am having a problem regarding jQuery. In my (codeigniter)view file i have created a columns which are fetching data from the database perfectly. All i want is to put a jQuery that shows only column_one(id : col_1) firstly, and all the remaining columns would be blank. when i click on any option of the first column it shows second column options.\n\nI am newbie to jQuery and i wonder if i can do this. Sorry, in advance if it is a silly one!\n\nHere is my script i am trying in my view file. Hope you all can get what i am trying.\n\nScript :\n\n$('document').ready(function()) {\nvar link = \"<?php echo base_url(); ?>\" ;\n\n//click cat_1, get cat_2\n$('#cat_1').click(function() {\n\n var cat_1 = $(this).val();\n\n\n// getting data of cat_level_2 from cat_1\n\n$.post(link + 'admin/admin_cat/category/cat_level_2' , {cat_1:cat_1}, function(data)\n {\n $('#cat_3').html('');\n $('#cat_level_4').html('');\n $('#cat_2').html(data);\n });\n}); \n\n\n$('#cat_2').click(function(){\nvar cat_2 = $(this).val();\n\n\n// getting data of cat_level_2 from cat_1\n\n$.post(link + 'admin/admin_cat/category/cat_level_3 ' , {cat_2:cat_2}, function(data)\n {\n $('#cat_3').html(data);\n $('#cat_level_4').html('');\n\n });\n}); \n} \n\n\nHere i have created a columns in view file. which is fetching data from database.\n\nColumns : \n\n<div class=\"category-col\">\n <select size=\"15\" name='cat_1' id='cat_1'>\n\n\n\n <?php foreach ($dropdown as $cat_1) ?>\n <?php { ?>\n\n <option\n value=\" <?php echo form_dropdown('cat_level', $dropdown);?> \">\n </option>\n\n <?php } ?>\n\n </select>\n </div>\n <script type=\"text/javascript\">\n\n\n </script>\n\n <div class=\"category-col\">\n\n <select size=\"15\" name='cat_2' id='cat_2'>\n\n\n\n\n <?php if(isset($cat_level_2) && $cat_level_2 != false){ ;?>\n\n <?php foreach ($cat_level_2 as $cat_2) {?>\n\n <option value=\"\">\n <?php echo $cat_2; ?>\n </option>\n\n <?php } }?>\n\n\n </select>\n\n </div>\n\n <div class=\"category-col\">\n <select size=\"15\" name='cat_3' id='cat_3'>\n\n <?php if(isset($cat_level_3) && $cat_level_3 != false){ ;?>\n\n <?php foreach ($cat_level_3 as $cat_3) {?>\n\n <option value=\"\">\n <?php echo $cat_3; ?>\n </option>\n\n <?php } }?>\n\n </select>\n </div>\n\n\nThanks for the consideration mates!" ]
[ "php", "jquery", "codeigniter" ]
[ "Why does the C++ modulo operator return 0 for -1 % str.size()?", "I'm confused why the following code produces this output:\n\n#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main()\n{\n int i = -1;\n string s = \"abc\";\n int j = s.size();\n int x = 1 % 3;\n int y = i % j; \n int z = i % s.size(); \n cout << s.size() << endl; // 3\n cout << x << endl; // 1\n cout << y << endl; // -1\n cout << z << endl; // 0\n}\n\n\nWhy is z = 0? Does it have to do with casting?" ]
[ "c++", "implicit-conversion", "modulus", "mod" ]
[ "Jquery Loading After CSS", "I have (Joomla) a web page with the following elements;\n\n<section id=\"sp-top-bar\">\n <!-- html content -->\n</section>\n\n<section id=\"sp-footer\">\n <!-- html content -->\n</section>\n\n\n\nThe #sp-top-bar is styled via custom.css - with a background-color: blue.\nThe #sp-footer is styled via template.css - with a background-color: green.\n\n\nI am using jquery to force the #sp-top-bar to use the same background colour as is set for #sp-footer in the template.css file. (I know there are others ways to set the colour but I'm experimenting with jquery so please bear with me!).\n\nThis is my jquery code, which works.\n\njQuery(function ($) {\n var brand = $('#sp-footer');\n var bg = brand.css('background-color');\n $(\"#sp-top-bar\").css({\n backgroundColor: bg\n })\n});\n\n\nMy jquery code is in the <head> of the document, after my template.css file.\n\nWhen my page loads, the #sp-top-bar initially flashes blue for a split second, then successfully changes to the #sp-footer green. \n\nI've had a look at the source code and my template.css file is loading before my jquery code - presumably this is the issue?\n\nIs there anything I can do to avoid this initial background colour flash in the #sp-top-bar?\n\nThanks" ]
[ "javascript", "jquery", "html", "css" ]
[ "Elastic Beanstalk not running any commands when deploying asp.net using \"Publish to AWS\" Visual Studio command", "I just registered at AWS services (micro, free) and trying to deploy asp.net mvc 4 application.\nEverything is working fine, web application deployed and running (the web part, database, etc), but when i am trying to write to filesystem (for example, when i`m saving a file), i'm gettig an exception\n\n\n System.UnauthorizedAccessException: Access to the path \n 'C:\\inetpub\\wwwroot.logs\\xxx.log\n\n\nThe folder \"C:\\inetpub\\wwwroot\\.logs\" exists.\n\nI tried to grant a permission to folder to DefaultAppPool using commands.\nI have following web project structure:\n\n\nWebHost\n\n\n.ebextensions\n\n\naws.config\n\n\n\n\naws.cofig has following content:\n\ncontainer_commands:\n 01-logscreate:\n command: \"mkdir C:\\inetpub\\wwwroot\\.logs > create-logs.log\"\n cwd: \"C:/inetpub/wwwroot/.ebextensions\"\n 01-logspermission:\n command: \"icacls \\\"C:/inetpub/wwwroot/.logs\\\" /grant DefaultAppPool:(OI) (CI) > p-logs.log\"\n cwd: \"C:/inetpub/wwwroot/.ebextensions\"\n\n\nWhen i accessing the file, i resolving the full path using \n\nHostingEnvironment.MapPath(\"~/.logs/xxx.log\")\n\n\nBut when i trying to write to this file, a get an exception.\n\nRelative path of '.ebextensions' in deployment package is\n\n\n Content\\D_C.git\\udsmonitoring.app\\WebHost\\obj\\Debug\\Package\\PackageTmp\\.ebextensions\n\n\nThanx in advance" ]
[ "c#", "asp.net", "amazon-web-services", "amazon-elastic-beanstalk" ]
[ "How to integrate facebook log in in react native", "I want to integrate the social log in in react native.\nI used reacct-native-fbsdk module and has set the basic settings.\nSo when I press the facebook button, it passed to the facebook.com\nHowever, the error occurred like this image.\n\n\nPlease let me know the reason.\nThanks and best wishes." ]
[ "facebook", "react-native", "mobile" ]
[ "Not able to view the navigation bar in Android app despite including the necessary syntaxes", "I tried to include the navigation bar in an existing app. but the contens of the activity is also not shown on inclusion \nthis is my code --\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n\n<android.support.v4.widget.DrawerLayout \n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n xmlns:tools=\"http://schemas.android.com/tools\"\n android:id=\"@+id/drawer_layout\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"start\"\n android:fitsSystemWindows=\"true\"\n tools:context=\".common.components.main.HomeActivity\"\n tools:openDrawer=\"start\">\n\n <FrameLayout\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\">\n\n <include layout=\"@layout/nav_toolbar\" />\n <include layout=\"@layout/activity_home_contents\" />\n\n\n </FrameLayout>\n\n\n <android.support.design.widget.NavigationView\n android:id=\"@+id/nav_view\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"match_parent\"\n android:fitsSystemWindows=\"true\"\n app:headerLayout=\"@layout/nav_header_main\"\n app:itemTextAppearance=\"@style/TextAppearance.AppCompat.Body1\"\n app:itemTextColor=\"#FFFFFF\"\n app:menu=\"@menu/activity_main_drawer\" />\n\n</android.support.v4.widget.DrawerLayout>\n\n\nThis is the contents of my nav_toolbar layout\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v7.widget.Toolbar \nxmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"wrap_content\"\nandroid:id=\"@+id/toolbar1\"\nandroid:background=\"@color/colorPrimary\"\nandroid:theme=\"@style/ThemeOverlay.AppCompat.Dark\"\n>\n\n</android.support.v7.widget.Toolbar>\n\n\nSimilarly I have activity_home_contents in scroll view as \n\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\nxmlns:tools=\"http://schemas.android.com/tools\"\nandroid:layout_width=\"match_parent\"\nandroid:layout_height=\"match_parent\"\nandroid:fillViewport=\"true\"\nandroid:background=\"@color/white\"\nandroid:scrollbars=\"none\"\n>\n\n<RelativeLayout android:orientation=\"vertical\"\n android:id=\"@+id/home\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:paddingTop=\"30dp\"\n tools:context=\".common.components.main.HomeActivity\">\n\n ......\n\n\nAnd code snipplet from HomeActivity.java is\n\n.....\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_home);\n floodEvacApplication = (FloodEvacApplication) \n getApplicationContext();\n lastAddress = floodEvacApplication.getLatestAddress();\n if (lastAddress == null) {\n initGoogleAPI();\n }\n\n\n Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar1);\n setSupportActionBar(toolbar);\n\n\n DrawerLayout drawer = (DrawerLayout) \n findViewById(R.id.drawer_layout);\n ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(\n this, drawer, toolbar, R.string.navigation_drawer_open, \n R.string.navigation_drawer_close);\n drawer.addDrawerListener(toggle);\n toggle.syncState();\n getSupportActionBar().setDisplayHomeAsUpEnabled(true);\n\n NavigationView navigationView = (NavigationView) \n findViewById(R.id.nav_view);\n navigationView.setNavigationItemSelectedListener(this);\n\n}\n ......\n\n\nI tried various ways avaliable online and searched online but couldn't able to display the activity_home_contents also but if I remove the navigation drawer and display the activiy_home then I am able to display it." ]
[ "java", "android", "xml", "navigation-drawer" ]
[ "How set a identification to Canvas Path?", "Good morning everyone.\n\nI'm building a graph for the enterprise system where I work, but I came across a problem where I need to insert some kind of identification, that I may be rescued by JavaScript (name, id, label, ...).\n\nSomeone could tell me how I could do to identify each element of the graph separately? To be more exact, what I'm wondering identifies each element arc is created.\n\n\n\nIf someone wanted to see the code to understand it better, I'll put the link here:\n  - JS Bin" ]
[ "html", "canvas", "path", "html5-canvas", "identification" ]
[ "How do you handle errors for Facebook SDK functions like FB.getLoginStatus()?", "Under certain circumstances, using functions like FB.getLoginStatus() will cause console errors such as:\n\n\n Given URL is not allowed by the Application configuration.: One or more of the given...\n\n\nThe problem is that if an error like this occurs, the callback to the function never gets called. Is there any way to handle errors of this kind? try/catch doesn't work, and the function doesn't return anything directly. I also want to avoid a timeout hack if possible.\n\nThere is nothing in the docs explaining how to deal with errors of this kind either: \nhttps://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus\n\nNote: I am not trying to solve the error above, I am trying to figure out to handle it" ]
[ "javascript", "facebook", "facebook-javascript-sdk" ]
[ "How to register icon for custom extention", "Can I register an icon in Blackberry for my own file extension (*.mgn), so that my icon will appear in the file manager and in the file selection dialog instead of the standard icon? I used Invocation Framework to register the extension itself.\n\nI tried to specify the icon in the config.xml but failed\n\n<rim:invoke-target id=\"MyExtMgn\">\n <type>APPLICATION</type>\n <icon>\n <image>img/mgn-icon.png</image>\n </icon>\n <filter>\n <action>bb.action.OPEN</action>\n <mime-type>*</mime-type>\n\n <property var=\"uris\" value=\"file://\"/>\n <property var=\"exts\" value=\"mgn\"/>\n </filter>\n</rim:invoke-target>" ]
[ "blackberry", "blackberry-simulator", "blackberry-webworks", "blackberry-cascades" ]
[ "Datatables ajax for sorting by different parameter", "I am using datatables jquery plugin and the AJAX method. My AJAX returns something similar to the following:\n\n[\n[\"1463\",\"Example title 1\",{\"display\":\"02\\/03\\/2015 12:15:00\",\"timestamp\":\"1425297601\"},1,\"1\",0,0,0,0,0,0,0,0],\n[\"1462\",\"Example title 2\",{\"display\":\"02\\/03\\/2015 11:45:00\",\"timestamp\":\"1425295802\"},1,\"1\",0,0,0,0,0,0,0,0],\n[\"1461\",\"Example title 3\",{\"display\":\"02\\/03\\/2015 11:30:00\",\"timestamp\":\"1425295220\"},1,\"1\",0,0,0,0,0,0,0,0]\n]\n\n\nWhere it should display the first value in field 2 but sort by the second. This works fine when the data is provided to the table on page load, but not in an ajax call.\n\nMy HTML/Script for the table is:\n\n<script type=\"text/javascript\">\n$(document).ready(function() { \n $('#resultsLatestPosts').DataTable({\n dom: 'T<\"clear\">frtip',\n autoWidth: false,\n iDisplayLength: 50,\n scrollY: \"420px\",\n paging: false,\n tableTools: {sSwfPath:'/includes/js/DataTables-1.10.4/extensions/TableTools/swf/copy_csv_xls_pdf.swf',aButtons:[\"copy\",\"xls\",\"pdf\"]}, \n ajax: 'index.php?ajax=1&function=getLatestPosts',\n ajaxDataProp: '', \n })\n})\n</script>\n\n<table id=\"resultsLatestPosts\" class=\"display\">\n <thead>\n <tr>\n <th>Post Title</th>\n <th>Sent</th>\n <th>Accounts Sent to</th>\n <th>Posts Sent</th>\n <th>Social Leads</th>\n <th><img src=\"/images/icons/vendor_postdetails/download-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Downloads\" title=\"Downloads\" /><span style=\"display:none\">Downloads</span></th>\n <th><img src=\"/images/icons/vendor_postdetails/followers-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Connections\" title=\"Connections\" /><span style=\"display:none\">Connections</span></th><th><img src=\"/images/icons/vendor_postdetails/retweet-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Retweets\" title=\"Retweets\" /><span style=\"display:none\">Retweets</span></th>\n <th><img src=\"/images/icons/vendor_postdetails/like-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Likes\" title=\"Likes\" /><span style=\"display:none\">Likes</span></th>\n <th><img src=\"/images/icons/vendor_postdetails/favourite-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Favourites\" title=\"Favourites\" /><span style=\"display:none\">Favourites</span></th>\n <th><img src=\"/images/icons/vendor_postdetails/reply-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Comments/Replies\" title=\"Comments/Replies\" /><span style=\"display:none\">Comments/Replies</span></th>\n <th><img src=\"/images/icons/vendor_postdetails/extended-followers-icon-32.png\" data-toggle=\"tooltip\" data-placement=\"left\" alt=\"Extended Reach\" title=\"Extended Reach\" /><span style=\"display:none\">Extended Reach</span></th></tr>\n </thead>\n</table> \n\n\nTo clarify. If my json was returning:\n\n[\"1463\",\"Test post\",{\"render\":{\"display\":\"02\\/03\\/2015 12:15:00\",\"filter\":\"1425297601\"}},1,\"1\",0,0,0,0,0,0,0,0]\n\n\nHow can I mimic the sorting actions found here:\nhttps://datatables.net/reference/option/columns.render#object\n\nPlease can someone explain what I'm missing. Thanks." ]
[ "jquery", "datatables", "jquery-datatables" ]
[ "How to make HTTP JavaScript request in login session", "I realized that SharePoint exposes a REST GET API. While I am logged into SharePoint, I am able to invoke the API using my browser URL bar without explicitly writing credentials into the GET request. However, I would like to be able to make a request based on that same session in a JavaScript HTTP request (without filling in credentials). Is that possible? If so, how does one do it?" ]
[ "javascript", "json", "http", "sharepoint", "sharepoint-2013" ]
[ "Change the IP address of OpenShift Origin VM", "I am trying to run OpenShift Origin VM (Vagrant+VirtualBox) but I need to assign another IP.\nI have tried to use in Vagrant file:\n\nconfig.vm.network \"private_network\", ip: \"192.168.33.10\"\n\n\nWhen testing it is fully ignoring it. The console says:\n\nhttps://10.2.2.2:8443/console\n\n\nWhen accessing \n\nhttps://127.0.0.1:8443/console\n\n\nI see OpenShift and \"Loading...\" but then it redirects to\n\nhttps://10.2.2.2:8443/oauth/authorize?client_id=openshift-web-console&response_type=token&state=%2F&redirect_uri=https%3A%2F%2F10.2.2.2%3A8443%2Fconsole%2Foauth\n\n\nAny ideas?" ]
[ "openshift-origin" ]
[ "Rails Multiple Table Inheritance: Get parent errors from child", "I'm using active_record-acts_as gem to implement multiple table inheritance. My scenario:\n\nclass Vehicle < ActiveRecord::Base\n actable\n before_destroy :some_validations\n\n def some_validations\n if some_condition\n errors.add(:base, \"cant be deleted\")\n return false\n else\n return true\n endif\n end\n\nend\n\nclass Plane < ActiveRecord::Base\n acts_as :Vehicle\nend\n\nclass Train < ActiveRecord::Base\n acts_as :Vehicle\nend\n\n\nIf I execute:\n\np = Plane.first\np.destroy\n\n\nIt returns false as expected, however, upon executing:\n\np.errors.messages I get:\n\n{}\n\n\nHow can I get parent's errors upong calling child.errors?" ]
[ "ruby-on-rails", "inheritance" ]
[ "Four square push api - application provider", "I am writing a four square application and after reading the push API, I realized that my users will have to authenticate and add a callback URL and all that good stuff listed below:\n\n\"To turn on real-time APIs for your consumer, access your consumer's details page by clicking on its name at https://foursquare.com/oauth. Then click the “Edit this Consumer” button in the upper right of the page.\n\nTo change your consumer's real-time API settings, pick the desired state from the drop-down menu on that page titled “Push API notifications.” Then click “Save this Consumer. ” You should now see your new notification settings reflected on the details page for your consumer.\n\nIf you have not activated a real-time API in the past, you will note that the Push URL field is blank on the details page. To actually receive real-time pushes from foursquare, you will need to edit your consumer again and add a HTTPS-compliant URL in this field.\"\n\nMost of my users are not tech savvy to do this. How do I as an application provider automate or pre-poulate some fields in order to make it easy for them to register for the push api for my app?\n\nThanks!" ]
[ "api", "foursquare" ]
[ "how to find out which dragged item was dropped", "what I am trying to do is create a site that drags items into the drop area and once dropped that specific dragged item calls to a function thats slides in another certain div. I can not figure out why I cant get the if --- else if working. My goal is to have a clean function that sees which item was dragged/dropped and depending on the dropped item I want a specific \"something to happen\" such as a page slide in.\nhere is my jquery code:\n\n$(document).ready(function(){\nvar i;\nvar banners = ('#banners');\nvar tryout = ('#try2');\nvar navItem = [banners, tryout];\nvar dropItem = (\".nav\");\n\n\n// DRAGGABLE \n$(dropItem).draggable({\n\n});\n\n$(\"#dropArea\").droppable({ \n drop: function() { \n\n if (\"dragged Item \" == banners){\n $(\".panel\").toggle(\"fast\");\n $(this).toggleClass(\"active\")\n }\n\n else if (\"dragged Item \" == tryout){\n // and so on...\n }\n }\n\n}); \n\n}); \n\n\nEDIT ADDITION HERE is where I am now example here www.diskrim.com/tryout\n $(dropItem).draggable({\n\n});\n\n$(\"#dropArea\").droppable({ \n drop: function(event, ui) { \n\n if (ui.draggable = navItem[0]){\n alert(\"banners\");\n\n }\n else if (ui.draggable = navItem[1]){\n alert(\"just pop up\");\n\n }\n else{\n\n }\n\n }\n\n}); \n\n});" ]
[ "jquery" ]
[ "Why should an Angular controller instance be published into a scope property?", "In recent 1.2.x angular versions (maybe also older) controllers can be initialized using expression as\n\n<div ng-controller=\"demoController as vm\"></div>\n\n\nThe documentation explains this as:\n\n\n The controller instance can be published into a scope property by\n specifying as propertyName.\n\n\nhttp://code.angularjs.org/1.2.4/docs/api/ng.directive:ngController\n\nIn which scenarios does this help?" ]
[ "javascript", "angularjs" ]
[ "service bus explorer 2.6.5.0 unauthorized error", "I am trying to connect the Topic in Azure Cloud using service bus explorer 2.6.5.0 by connection string from my laptop, but got 401 error,\n\n\n <15:14:46> Exception: The remote server returned an error: (401) Unauthorized. claim is empty. TrackingId:4acae37e-7b78-4a10-9d02-db96c2e69f40_G8, SystemTracker:mytopic.servicebus.windows.net:$Resources/EventHubs, Timestamp:1/25/2018 8:14:46 PM\n\n\nHow to fix this?" ]
[ "azureservicebus", "explorer", "unauthorized" ]
[ "Apply method to all elements in enumerable with LINQ", "I have a list, trying to accomplish the following. I want to run a mapper method for each item in the list...can't seem to get the syntax correct\n\nvar viewModelList = result.MyEnumerable.Select(MyMapper(item goes here))\n\n public static MyViewModel MyMapper(Item item)\n {\n var viewModel = new MyViewModel();\n //do some stuff\n return viewModel;\n }" ]
[ "c#", "linq", "enumerable" ]
[ "How to find the canonical name with nslookup", "I need to find the canonical name of three websites using nslookup.\nWhen I do nslookup -a google.es 8.8.8.8 the answer is non authoritative but I need an authoritative answer.\nWhat can I do to have the canonical name of "google.es", "upc.edu" and "uoc.es" with an authoritative answer using nslookup?" ]
[ "dns", "nslookup" ]
[ "Android: Google MapView within ViewFlipper", "I have a layout which uses a ViewFlipper to keep a tabbar visible at all times throughout the app.\n\nThe main activity extends TabActivity. For one of my views I want to have a mapview, I have tried this code to no success:\n\n<ViewFlipper android:id=\"@+id/layout_tab_one\"\n android:layout_width=\"fill_parent\" android:layout_height=\"fill_parent\">\n\n <ListView android:id=\"@+id/listview\" \n android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\" />\n\n <com.google.android.maps.MapView\n android:id=\"@+id/mapview\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"fill_parent\"\n android:clickable=\"true\"\n android:apiKey=\"myapikey\">\n </com.google.android.maps.MapView> \n <ListView android:id=\"@+id/lazylistview\"\n android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\" />\n <include android:id=\"@+id/cell1\" layout=\"@layout/detail\" />\n <ListView android:id=\"@+id/listview2\" \n android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\" />\n\n </ViewFlipper>\n\n\nThe app crashes on launch. I have put the user library for google maps into the manifest and I am also running the app using the Google API, still no luck.\nAny suggestions?\nThanks!" ]
[ "android", "maps", "android-mapview" ]
[ "How to implement application events logger", "In my application there is a need to log various events occurring in application.\nFor example I need to log an event of downloading file from server and specify downloading time, server IP-address and so on.\nStructurally all that data is spread across various classes in the application. \n\nMy solution is to create a singleton class, name it for example 'ApplicationEvents', and process application events in it. For \nexample:\n\nvoid OnFileDownloaded() {\n ...\n ApplicationEvents::Instance()->FileDownloaded(fileId_);\n}\n\n\nBut this looks like a mess in a code, and nearly impossible to test. \n\nAlternative solution would be to create ApplicationEvent in main function and pass it to classes constructors as a parameter.\nTo avoid mess in a code, decorator or proxy pattern can be used. \n\nFor example: 'FileDownloader' and decorating class 'LoggingFileDownloader'.\nBut the structure of application will be more complicated, many classes will just pass pointer to ApplicationEvents through to other classes, and probably it's overkill in my case.\n\nWhich solution will be best?" ]
[ "c++", "oop", "logging" ]
[ "using array fields in mongoDB", "I'm working on a scheme that will heavily use array fields in mongo documents,\nare there any known problems with the approach of holding rather large arrays of other documents etc?\n\nperformance issues?\n\nbeing rather new to mongo and coming from SQL background the approach seems \"out of place\" for me since it's bit different than the approach of grouping all records in a table by a set of \"primary keys\" instead of holding the \"primary keys\" once and holding the rest of the data in arrays.\n\nthe \"primary keys\" approach is my other option to use in mongo as well\n\nwhat is best?" ]
[ "mongodb", "mongoid" ]
[ "Domain Name without \"www\" does not work for CloudFront", "I have\n\nAn AWS S3 bucket as a static site\nA CloudFront distribution with ACM SSL certs\nA Name.com domain name\nA Heroku web app\n\nI successfully have www.domain.com pointing to my abc123.cloudfront.net website. I also have api.domain.com successfully pointing towards my heroku app. I used ACM to generate a certificate for www.domain.com and Heroku handles its own SSL stuff as well.\nThat's pretty good, but just to be anal, I want domain.com to also point to my CF address. However it does not. This is how I set up my CF and DNS and wonder if anyone has any ideas. I've gone through about 20 SO questions and articles with no luck. Also Name.com URL forward does not seem to work.\nDNS Settings\n\n\nCloudFront Settings" ]
[ "amazon-web-services", "dns", "amazon-cloudfront" ]
[ "Removing dynamic tab pages from tab control", "I have a TabControl called tc_Dashboard what I want to do is add dynamic tabs to that TabControl and remove them dynamically as well.\n\nThis is what I use to make the first dynamic tab.\n\ntabTitle = \"+\";\nTabPage tab = new TabPage(tabTitle);\ntc_Dashboard.Controls.Add(tab);\n\n\nwhen I try to remove it using the following code its give me an ArgumentNullException unhandled error.\n\nif(tc_Dashboard.SelectedTab.Text == \"+\")\n{\n tc_Dashboard.TabPages.Remove(tc_Dashboard.TabPages[\"+\"]);\n}\n\n\nI've tried searching online for a solution but without success\nAny help would be appreciated" ]
[ "c#", "dynamic", "tabs", "tabcontrol" ]
[ "How to perfom an action when Tab in a CustomTabBar is pressed?", "I have a CustomTabBar created working as expected. Apart from selecting tabs, I want to perform an action (refresh some info) on one of my viewcontrollers when this tab is already selected. I mean, I have a tab selected and I press that tab again and fire an action of the ViewController.\n\nAny suggestion?" ]
[ "objective-c", "uitabbarcontroller", "custom-controls" ]
[ "How to get not escaped value from json", "I have inserted some test data like below:\n\nINSERT INTO tblDataInfo (lookupkey, lookupvalue, scope) \nVALUES ('diskname', '/dev/sdb', 'common')\n\n\nyours sincerely\n\nI wanted to query this data and like to obtain the query output in JSON format.\n\nI have used the query \n\nselect lookupvalue as 'disk.name' \nfrom tblDataInfo \nwhere lookupkey = 'diskname' FOR JSON PATH;\n\n\nThis query returns \n\n[{\"disk\":{\"name\":\"\\/dev\\/sdb\"}}]\n\n\nwhich is escaping all my forward slashes (/) using the escape character (\\). How can I have my output not to put escape-character (\\)?" ]
[ "json", "sql-server" ]
[ "using curl from localhost", "I'm just trying to fetch the yahoo web page. www.yahoo.com\n\nIf I run my simple script from my hosted site, it works. \n\nIf I try it from my localhost. All I get is a header response with:\n\"w32.fp.re1.yahoo.com uncompressed/chunked Wed Apr 27 15:13:48 PDT 2011\"\n\nHere is my code:\n\n <?php\n\nfunction curl_download($Url){\n\n // is cURL installed yet?\n if (!function_exists('curl_init')){\n die('Sorry cURL is not installed!');\n }\n\n\n // OK cool - then let's create a new cURL resource handle\n $ch = curl_init();\n\n // Now set some options (most are optional)\n\n // Set URL to download\n curl_setopt($ch, CURLOPT_URL, $Url);\n\n // Set a referer\n curl_setopt($ch, CURLOPT_REFERER, \"http://www.example.org/yay.htm\");\n\n // User agent\n curl_setopt($ch, CURLOPT_USERAGENT, \"MozillaXYZ/1.0\");\n\n // Include header in result? (0 = yes, 1 = no)\n curl_setopt($ch, CURLOPT_HEADER, 0);\n\n // Should cURL return or print out the data? (true = return, false = print)\n curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\n // Timeout in seconds\n curl_setopt($ch, CURLOPT_TIMEOUT, 10);\n\n // Download the given URL, and return output\n $output = curl_exec($ch);\n\n // Close the cURL resource, and free system resources\n curl_close($ch);\n\n return $output;\n}\n\n\nprint curl_download('http://www.yahoo.com/');\n?>" ]
[ "php", "curl", "libcurl" ]
[ "Types and Typeclasses in Haskell: Missing field in record construction", "I have three datatypes:\n\ndata Person = Person { firstName :: String \n , lastName :: String \n , age :: Int \n , height :: Float \n , phoneNumber :: String \n , flavor :: String \n } deriving (Eq,Show, Read) \n\ndata Car = Car {company :: String, model :: String, year :: Int} deriving (Eq,Show,Read) \n\ndata Things = C Car | P Person deriving (Eq,Show,Read) \n\n\nAnd I want to find the Car's coordinates in a [[Things]].\n\nI tried: \n\nenumerate = zip [0..]\n\nfindCar :: [[Things]] -> [(Int, Int)]\nfindCar things = do\n [(x, y)\n | (y, row) <- enumerate things\n , (x, thing) <- enumerate row\n , thing == C (Car { })]\n\n\nBut I got an Exception: 'Missing field in record construction company'.\n\nHow can I find coordinates of Car in a [[Things]] in a proper way?" ]
[ "haskell", "exception", "constructor", "record" ]
[ "R OR comparing two booleans, I want F | NA to return F", "I have a situation where I have two vectors with 1's, 0's and NA's. I want to take the highest non-NA value at each index.\n\nEg. take these two vectors v1 and v2:\n\nv1 = c(1,0,1,0,0,1,NA,NA,0,1)\nv2 = c(1,NA,1,0,1,NA,1,NA,0,1)\n\n\nYou could convert them to boolean and do v1 | v2 but then there is the following problem:\n\n1 | 0 = T\n0 | 1 = T\n1 | 1 = T\n0 | 0 = F\nNA | NA = NA <--- Good\n1 | NA = T <-- Good\n0 | NA = NA <--- I want this to return F\n\n\nThere's another solution using apply and max, but the problem is that max(c(NA,NA), na.rm=T) returns -Inf.\n\nAny way to do this in a one liner?" ]
[ "r" ]
[ "Does react native have a third-party library to restart or shut down Android TV?", "issue\nhello,Now there is a function to control Android TV shutdown and restart according to TV app,\nbut I couldn't find the library associated with it.At the same time, I am a pure front-end engineer,I don't know much about Android.\nDo you need to design native Android development?\nOperating environment/version\ndevelopment:react-native v0.63.2\nrun: Android TV\nExpected effect\nAndroid TV can be turned off by functions such as buttons.\nFinal,Thank you for your reply." ]
[ "android", "react-native" ]
[ "nested while loops php mysql", "I have this code:\n\n<?php \n\nif( isset($_POST['groups'])){ \n\n $groups = $_POST['groups']; \n $subject = $_POST['subject']; \n\n$sql=\"SELECT \n a.groupcode, a.groupstudents, a.studentid, \n b.groupcode, b.coursename, b.studentid, b.date, b.class1, b.attend, b.attendno \n\nFROM table_1 a, table_2 b\n\nWHERE b.groupcode = '$groups' AND b.coursename = '$subject' AND \n (a.studentid = b.studentid AND a.groupcode = b.groupcode)\";\n\n$result=mysqli_query($GLOBALS[\"___mysqli_ston\"], $sql); ?>\n\n<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\" > \n<tr> \n <td align=\"center\"><strong><font size=\"2\">Students</font></strong></td> \n <td align=\"center\"><strong><font size=\"2\">Date</font></strong></td> \n <td align=\"center\"><strong><font size=\"2\">Attendance</font></strong> </td> \n</tr> \n\n<?php \nwhile($rows=mysqli_fetch_array($result)){ \n\n $date = $rows['date']; $date2 = date(\"d-F-Y\", strtotime($date));\n\n $class1 = $rows['class1'];\n if ($class1 == 0) $class1 = \"No Class\"; if ($class1 == 1) $class1 = \"Absent\";\n if ($class1 == 3) $class1 = \"Present\"; if ($class1 == 2) $class1 = \"Late\";\n?> \n\n<tr> \n<td align=\"center\"><font size=\"2\"><?php echo $rows['groupstudents']; ?></font> </td>\n<td align=\"center\"><strong><font size=\"2\"><?php echo $date2; ?></font></strong> </td> \n<td align=\"center\"><font size=\"2\"><?php echo $class1; ?></font></td>\n</tr>\n\n<?php \n }\n?> \n\n\nwhich gives the below output.\n\n\nNow my question is how to modify my code (use nested loops?!) so the output is:\n\n\n\nThank you kindly.\n\nNB: Sorry, I do not have enough reputation to attach images. I have uploaded them on an external site." ]
[ "php", "mysql", "nested-loops" ]
[ "How to sort for min/max from a dictionary of tuples?", "src_type is a dictionary of tuples with the data structured as (start,end,frequency)\n\nIn [303]: src_type\nOut[303]: \n{'A': (440468754.0, 442213325.0, 25),\n'B': (440448179.523912, 442202204.43813604, 285),\n'C': (440447107.044571, 442268070.552849, 4914),\n'D': (440448307.44081604, 442254145.172575, 443),\n'E': (440458084.535652, 442253729.048885, 3060)}\n\n\nI would like to find the min of \"start\" and the max of \"end\"\n\nThese are my solutions: \n\n1 (simple and crappy)\n\nend_ts = 0\nfor i in src_type.values():\n if end_ts < i[1]:\n end_ts = i[1]\nstart_ts = end_ts\n\nfor i in src_type.values():\n if start_ts > i[0]:\n start_ts = i[0]\n\n\n2 (with some help from SO about sorting {})\n\nb = src_type.items()\nb.sort(key=lambda x:x[1][0])\nmin_start = b[0][1][0]\nb.sort(key=lambda x:x[1][1])\nmax_end = b[-1][1][1]\n\n\nIs their a better an elegant solution ?" ]
[ "python", "sorting", "dictionary" ]
[ "Creating pagination links with search parameters", "I want to know how to approach implementing pagination with user input as search parameters. I understand the basics of pagination without user input and have no trouble doing that, it's when user input comes in that it confuses me. I don't know how to make the page-number links use the correct query based on what has been searched.\n\nFor example the basic idea: \n\nHTML\n\n<input type=\"text\" name=\"id\" placeholder=\"ID\">\n<input type=\"text\" name=\"name\" placeholder=\"Name\">\n<button id=\"btn_search\">Search</button>\n\n<div id=\"search_results\"></div>\n\n\nJS\n\n$(\"#btn_search\").on('click', function() {\n $.ajax({\n url: 'process.php',\n type: 'POST',\n data: {id: $(\"input[name=id]\").val(), name: $(\"input[name=name]\").val()},\n success: function(result) {\n $(\"#search_results\").html(result);\n }\n });\n});\n\n\nPHP\n\n// Grab submitted search parameters and store in variable\n if (isset($_POST[\"id\"]) && !empty($_POST[\"id\"])) {\n $id = $_POST[\"id\"];\n } else {\n $id = null;\n }\n if (isset($_POST[\"name\"]) && !empty($_POST[\"name\"])) {\n $name = $_POST[\"name\"];\n } else {\n $name = null;\n }\n $count_query = \"SELECT COUNT(*) FROM users\";\n // Code here to get total row count for pagination\n $query = \"SELECT * FROM users WHERE id = ? AND name = ?\";\n $stmt = $connection->prepare($query);\n $stmt->bind_param('is', $id, $name);\n $stmt->execute();\n // Dump as table\n\n\nI'm thinking the right approach is something like this: \n\n<ul class=\"pagination\">\n <li><a href=\"paginate.php?id=<?php echo $id; ?>&name=<?php echo $name; ?>\"></a></li>\n <li><a href=\"paginate.php?id=<?php echo $id; ?>&name=<?php echo $name; ?>\"></a></li>\n</ul>\n\n\nAnd then include one more parameter for the page number via a for loop.\n\nIs it safe to do this with some client-side input validation? And do I have a valid approach?\n\nEDIT \n\nNaveed's answer was helpful so I'll mark it as answered. This article: https://jadendreamer.wordpress.com/2012/11/20/php-tutorial-searching-and-pagination/ helped me out a lot with understanding how to do this. It is old but explains everything well. I ended up using the tags to pass back the query parameters." ]
[ "javascript", "php", "jquery", "ajax", "pagination" ]
[ "Simple DatePicker in React (Module not found: Can't resolve 'react-datepicker')", "I have a simple datepicker component:\nimport React, { useState } from "react";\nimport DatePicker from "react-datepicker";\n\nimport "react-datepicker/dist/react-datepicker.css";\n\nexport const SimpleDatePicker = () => {\n const [startDate, setStartDate] = useState(new Date());\n return (\n <DatePicker selected={startDate} onChange={date => setStartDate(date)} />\n );\n};\n\nAnd I am trying to call this for my form:\nimport { SimpleDatePicker } from "../SimpleDatePicker";\nexport const TravelForm = () => (\n<SimpleDatePicker />\n);\n\nBut I am getting this error: Module not found: Can't resolve 'react-datepicker'\nI checked the answers for this but still couldnt solve my problem." ]
[ "reactjs", "datepicker", "react-datepicker" ]
[ "Where to put JUnit test in Android project", "To run my JUnit tests on my Android application, do I have to create a different project or I can include them in my project? If yes, how?" ]
[ "android", "testing", "junit", "android-testing" ]
[ "Need Input | SQL Dynamic Query", "Have a requirement where I need to build a dynamic query based on user input and send the count of records from result set. \n\nSo there are 6 tables which I needs to make a join Inner for sure and rest table join will be based on user input and this should be performance oriented. \n\nHere is the requirement \n\nselect count(A.A1) from table A\n\nINNER JOIN table B on B.B1=A.A1 \nINNER JOIN table B on C.C1=B.B1 \nINNER JOIN table D on D.D1=C.C1 \nINNER JOIN table E on E.E1=D.D1 \nINNER JOIN table F on F.F1=E.E1 \n\n\nNow if user select some value in UI , then have to execute query as \n\nselect count(A.A1) from table A\n\nINNER JOIN table B on B.B1=A.A1 \nINNER JOIN table B on C.C1=B.B1 \nINNER JOIN table D on D.D1=C.C1 \nINNER JOIN table E on E.E1=D.D1 \nINNER JOIN table F on F.F1=E.E1 \nINNER JOIN table B on G.G1=F.F1 \n\nWhere G.Name like '%Germany%'\n\n\nUser can send 1- 5 choices and have to build the query and accordingly and send the result set \n\nSo if I add all the joins first and then add where clause as per the choice , then query will be easy and serve the purpose, but if user did not select any query then I am creating unnecessary join for the user choices. \n\nSo which will be better way to write having all the joins in advance and then filtering it or on demand join and with filters using dynamic query.\n\nCould be great if someone can provide valuable inputs." ]
[ "sql", "sql-server-2012" ]
[ "How to run CNTK c# EvalDLL Wrapper program on GPU?", "I was successful on training and evaluate networks based on the CIFAR-10 samples. I'm using my own images with specific size . The networks were trained with GPU and able to evaluate with CPU. However, I'm not able to evaluate it with with GPU. The evaluation is using C# EvalDLL Wrapper. The deviceID is change from -1 to 0 to indicate the GPU # as shown below:\n\nmodel0.CreateNetwork(string.Format(\"modelPath=\\\"{0}\\\"\", modelFilePath), deviceId: 0); \n\nDid I missed something? \nCan anyone run GPU on C# EvalDLL Wrapper program ?\n\nI'm using binary version of the CNTK (not CPU_Only)." ]
[ "c#", "gpu", "cntk" ]
[ "An indexed array of an array of objects", "How do I create (in PHP) and array of an array of objects? For example, say I have:\n\n$arr[0] = array(\"eref_id\" => \"A001\", \"eref_child\" => \"A100\", \"level\" => 1);\n$arr[1] = array(\"eref_id\" => \"A002\", \"eref_child\" => \"A200\", \"level\" => 2);\n$arr[2] = array(\"eref_id\" => \"A003\", \"eref_child\" => \"A300\", \"level\" => 3);\n$arr[3] = array(\"eref_id\" => \"A003\", \"eref_child\" => \"A310\", \"level\" => 3);\n\n\nAn I want a new array where the elements of \"arr\" are the \"eref_id\" and \"eref_child\" but the index to the array is the \"level\" element. So basically, \n\n$newarr[1] would contain $arr[0]\n$newarr[2] would contain $arr[1]\n$newarr[3] would contain $arr[2]\n\n\nand $arr[3] (since both have a \"level\" of 3). \n\nThis would contain an array of $arr[2] and $arr[3].\n\nHopefully this makes sense" ]
[ "php" ]
[ "send function to child component hooks", "edited: solved, missing curly brakets in arguments\nhope you can clarify this issue:\nI have parent component:\nfunction App() {\nconst [change, setChange] = useState(true);\n\n\nconst handleChange=(mode)=>{\n setChange(mode);\n console.log('change',change);\n \n}\n\n return (\n <>\n \n <Navigation modes={handleChange}/>\n\nand I am trying to send handlechange to the child component to change "change" state(sorry for the naming). I have the child component as it follows:\nexport default function Navigation({modes}) {\n const [mode, setMode] = useState(true);\n\nconst handleMode=(mode)=>{\n setMode(mode)\n }\n\nuseEffect(() => {\n modes(mode);\n }, [ mode ]);\n\nreturn (\n \n \n <div className="nav__switch">\n <Switch handleMode={handleMode}/>\n </div>\n\n \n\nand the final component, the one that will update the mode:\nexport default function Switch({modes}) {\n const [mode, setMode] = useState(true);\n\n\n useEffect(() => {\n modes(mode)\n }, [mode]);\n\n const modeChange=()=>{\n\n mode?setMode(false):setMode(true);\n console.log(mode)\n }\n\n\nthere is a modeChange function that changes the state of mode that will be taken as an argument for the function on the parent element, however I am getting the error saying that "modes" is not a function, I console logged it and I can see that it is an object with default properties.\nDoes anybody knows what I am doing wrong here?\nthanks" ]
[ "reactjs", "react-hooks" ]
[ "how to schedule a task, pop up an alert and go to phone home screen?", "I want to schedule a task, rise an alert box to notify the user then \"quit\" my application and automatically go to the phone home screen. But I dont know how to do that. I tried following code but it's not working. May someone help me? Thanks.\n\ntimer.schedule(task, calendar.getTime());\n\nIntent intent = new Intent(Intent.ACTION_MAIN);\nintent.addCategory(Intent.CATEGORY_HOME);\nintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\nstartActivity(intent); \n\nf.alert(context, title, msg + \"Task scheduled for: \" calendar.getTime());\n\n\nThe alert method is one I wrote from alertDialog and it's working fine. But no alert is shown when I execute the code. Maybe I'm using the wrong context?\n\n[EDIT]\nThere is the whole story. I've two scenarios. I allow the user to run the task now or later. If he choose \"Now\", he get a screen with the progress bar telling him to wait until task is done. Else if he choose \"Later\" I want to schedule the task with Timer, show an alert or a toast, then go to the home screen. The task waiting background to be executed. So, to skip the progress bar (waiting for right time to run the task), I want to \"quit\" the application then go to the phone home screen." ]
[ "android", "timer", "android-alertdialog" ]
[ "C# invoke chained delegate methods asynchronously", "Suppose I have a delegate which refers to bar number of methods. When I invoke the delegate either like this someDelegate(someParameter); or like this someDelegate.Invoke(someParameter);, methods that this delegate refers to are actually invoked synchronously, one after another, right? Is there a way to make this calls Asynchronous ?" ]
[ "c#", "asynchronous", "delegates" ]
[ "Fix java.net.ProtocolException: Expected ':status' header not present issue from NGINX", "I use NGINX as a the web server for my load balancers. Recently the version we're using was updated from 1.12 to 1.14 and has started causing the below error in older versions of Android/Java applications I need to support. \n\njava.net.ProtocolException: Expected ':status' header not present\n\nI know this is an issue related to okhttp and looking through other SO questions, I can see that most people recommend updating the okhttp library in the mobile apps. In my case though this isn't an option. So my question is, is there a way I can fix this issue with out updating the Android app or downgrading the version of NGINX that my web servers are using?" ]
[ "android", "nginx" ]
[ "\"zsh: command not found: meteor\" on Windows 10", "I just installed Meteor on Windows 10 and here's what I get when I run meteor -v in the Hyper terminal (under zsh) : zsh: command not found: meteor.\n\nWhen I run the same command in CMD.exe, the result is different : \n\nrun: You're not in a Meteor project directory.\n\nTo create a new Meteor project:\n meteor create <project name>\nFor example:\n meteor create myapp\n\nFor more help, see 'meteor --help'.\n\n\nThe PATH in Windows is the following : C:\\Users\\Me\\AppData\\Local\\.meteor. Could you tell me why it doesn't work under Zsh? Did I miss something?\n\nThanks a lot!" ]
[ "windows", "meteor", "zsh", "oh-my-zsh" ]
[ "Simulink errors when trying to simulate design", "I am trying to simulate a design in MATLAB/Simulink and for whatever reason I am getting errors preventing me from simulating the design. I have taken screenshots showing the design and the error messages, thanks in advance for any help ???\n\n\n\n\n\nIf you need any more information, please ask ... :)" ]
[ "matlab", "simulink", "xilinx" ]
[ "Sort pandas dataframe by date or column", "The solutions I have found in a similar question are not working for me. I have a pandas DataFrame including mock sales data. I want to sort by date since they are currently out of order. I have tried converting to a datetime object. I also tried creating a Month and Day column and sorting by them but that did not work either. Date is in YYYY-MM-DD format\nHere is my solution:\nimport pandas as pd\nimport datetime\ndata = pd.read_csv(path)\n# sort by date (not working)\ndata['OrderDate'] = pd.to_datetime(data['OrderDate'])\ndata.sort_values(by='OrderDate')\ndata.reset_index(inplace=True)\n# sort by month then day (not working)\ndata.sort_values(by='Month')\ndata.sort_values(by='Day')\ndata.reset_index(inplace=True)\n# export csv\ndata.to_csv(fileName, index=False)" ]
[ "python", "pandas", "sorting", "datetime" ]
[ "How to cope around memory overflow with Pivot table?", "I have two medium-sized datasets which looks like:\n\nbooks_df.head()\n\n ISBN Book-Title Book-Author\n0 0195153448 Classical Mythology Mark P. O. Morford\n1 0002005018 Clara Callan Richard Bruce Wright\n2 0060973129 Decision in Normandy Carlo D'Este\n3 0374157065 Flu: The Story of the Great Influenza Pandemic... Gina Bari Kolata\n4 0393045218 The Mummies of Urumchi E. J. W. Barber\n\n\nand\n\nratings_df.head()\n\n User-ID ISBN Book-Rating\n0 276725 034545104X 0\n1 276726 0155061224 5\n2 276727 0446520802 0\n3 276729 052165615X 3\n4 276729 0521795028 6\n\n\nAnd I wanna get a pivot table like this:\n\nISBN 1 2 3 4 5 6 7 8 9 10 ... 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952\nUser-ID \n1 5.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n4 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n5 0.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n\n\nI've tried:\n\nR_df = ratings_df.pivot(index = 'User-ID', columns ='ISBN', values = 'Book-Rating').fillna(0) # Memory overflow\n\n\nwhich failed for:\n\n\n MemoryError:\n\n\nand this:\n\nR_df = q_data.groupby(['User-ID', 'ISBN'])['Book-Rating'].mean().unstack()\n\n\nwhich failed for the same.\n\nI want to use it for singular value decomposition and matrix factorization.\n\nAny ideas?\n\nThe dataset I'm working with is: http://www2.informatik.uni-freiburg.de/~cziegler/BX/" ]
[ "python", "pandas", "numpy" ]
[ "Disabling Image plugins for some elements", "I have html:\n\n<div class='editable' id=\"a\"><img src='./test.jpg'></img></div>\n<div class='editable' id=\"b\"><img src='./test1.jpg'></img></div>\n\n\nI want to attach aloha editor for both divs but with image plugin for only one of them.I have tried a lot.Searched a lot.Can anyone help me?" ]
[ "aloha-editor" ]
[ "Hosting WPF control in Windows Forms Application", "In my WPF control, i have implemented asynchronous pattern to perform non UI tasks by the following way.\n\n internal static void Execute(Action action)\n {\n if (System.Windows.Application.Current != null)\n {\n if (System.Windows.Application.Current.Dispatcher.CheckAccess())\n action();\n else\n System.Windows.Application.Current.Dispatcher.BeginInvoke(action, null).Wait();\n }\n }\n\n\nThis works fine for WPF applications. When i used my WPF control in Windows Forms Application with the help of ElementHost, i am not able to use the above method, since System.Application.Current will be null.\n\nNow I have to know the following things.\n\n1) Is it possible to access UI thread within my WPF control, when the control has been hosted in Windows Forms Application?\n\n2) If possible, kindly guide me how to achieve it." ]
[ "winforms", "wpf-controls" ]
[ "Custom Control missing assembly reference", "A friend of mine created a control(Multi Select Combo Box) and compiled it into a DLL. I have added the DLL to my references and namespace in my WPF window as such:\n\nxmlns:mc=\"clr-namespace:MultiSelectComboBox;assembly=MultiSelectComboBox\"\n\n\nWhen using the control:\n\n<mc:MultiSelectUserControl Name=\"mscControl\" />\n\n\nThe problem is once i add the xaml to use the control, the window goes gray with Invalid Markup.\nThe error list shows 2 errors, ie:\n\n\n The name \"MultiSelectUserControl\" does not exist in the namespace \"clr-namespace:MultiSelectComboBox;assembly=MultiSelectComboBox\". \n\n\nAnd\n\n\n The type 'mc:MultiSelectUserControl' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. \n\n\nbut if i run the application, the control works perfectly. Its just extremely frustrating designing the GUI when this keeps happening. I did do research on it but came up with nothing helpful. \n\nWhy is this happening and what am I doing wrong?" ]
[ "c#", "wpf", "wpf-controls" ]
[ "Computed properties using Realm LinkedObject instances return nil", "I'm experiencing slightly unusual behaviour when attempting to use computed properties to access linked Objects in a Realm Object subclass.\n\nfinal class Patient: Object {\n\n dynamic var name: String = \"\"\n\n var parameters = List<Parameter>()\n\n}\n\nfinal class Parameter: Object {\n\n dynamic var name: String = \"\"\n\n dynamic var patient: Patient? {\n return LinkingObjects(fromType: Patient.self, property: \"parameters\").first\n }\n\n}\n\n\nThe patient property on the Parameter class returns nil but, if you replace the code with the following, we get the expected behaviour:\n\nvar p = LinkingObjects(fromType: Patient.self, property: \"parameters\")\n\nvar q: Patient? {\n return p.first\n}\n\n\nI suspect this is something to do with Realm's internal representation of LinkingObject. The code I used originally was referenced in a previous StackOverflow question and was accepted as a functional solution thus I guess it worked then so perhaps something has changed? Xcode 7, Swift 2.2" ]
[ "ios", "swift", "realm" ]
[ "MediaStreamSource video streaming in UWP", "I just started to experiment with MediaStreamSource in UWP. \nI took the MediaStreamSource streaming example from MS and tried to rewrite it to support mp4 instead of mp3.\nI changed nothing but the InitializeMediaStreamSource part, it now looks like this:\n\n{\n var clip = await MediaClip.CreateFromFileAsync(inputMP3File);\n var audioTrack = clip.EmbeddedAudioTracks.First();\n var property = clip.GetVideoEncodingProperties();\n\n // initialize Parsing Variables\n byteOffset = 0;\n timeOffset = new TimeSpan(0);\n\n var videoDescriptor = new VideoStreamDescriptor(property);\n var audioDescriptor = new AudioStreamDescriptor(audioTrack.GetAudioEncodingProperties());\n\n MSS = new MediaStreamSource(videoDescriptor)\n {\n Duration = clip.OriginalDuration\n };\n\n // hooking up the MediaStreamSource event handlers\n MSS.Starting += MSS_Starting;\n MSS.SampleRequested += MSS_SampleRequested;\n MSS.Closed += MSS_Closed;\n\n media.SetMediaStreamSource(MSS);\n} \n\n\nMy problem is, that I cannot find a single example where video streams are used instead of audio, so I can't figure out what's wrong with my code. If I set the MediaElement's Source property to the given mp4 file, it works like a charm. If I pick an mp3 and leave the videoDescriptor out then as well. But if I try to do the same with a video (I'm still not sure whether I should add the audioDescriptor as a second arg to the MediaStreamSource or not, but because I've got one mixed stream, I guess it's not needed), then nothing happens. The SampleRequested event is triggered. No error is thrown. It's really hard to debug it, it's a real pain in the ass. :S" ]
[ "c#", "uwp", "visual-studio-2017", "video-streaming", "mediastreamsource" ]
[ "sapui5 data from json", "Have problem to read data from json. My login.json file\n\n{\n \"Users\": [\n {\n \"login\" : \"admin\",\n \"password\" : \"admin\"\n }\n ]\n}\n\n\nHere is my login.xml.view\n\n<core:View\n controllerName=\"sap.ui.demo.myFiori.view.login\"\n xmlns=\"sap.m\"\n xmlns:l=\"sap.ui.layout\"\n xmlns:core=\"sap.ui.core\" > \n <Page\n title=\"{i18n>LoginIn}\">\n <VBox \n class=\"marginBoxContent\" >\n <items>\n <Label text=\"User\" />\n <Input\n\n id=\"nameInput\"\n type=\"Text\"\n placeholder=\"...\" />\n <Label text=\"password\" />\n <Input\n id=\"passwInput\"\n type=\"Password\"\n placeholder=\" ...\" />\n <Text id=\"description\" class=\"marginOnlyTop\" />\n<Button text=\"Login\" press=\"handleContinue\" />\n </items>\n </VBox>\n </Page>\n</core:View>\n\n\nand login.controller.js\n\njQuery.sap.require(\"sap.ui.demo.myFiori.util.Formatter\");\n\nsap.ui.controller(\"sap.ui.demo.myFiori.view.login\", {\n\n handleContinue : function (evt) {\n\n var name = this.getView().byId(\"nameInput\").getValue(); \n var paswd = this.getView().byId(\"passwInput\").getValue(); \n\n if (name == \"log\" && paswd == \"pass\") {\n var context = evt.getSource().getBindingContext();\n this.nav.to(\"Master\", context); \n}\nelse {\n jQuery.sap.require(\"sap.m.MessageToast\");\n sap.m.MessageToast.show(\"Wrong login\");\n\n }\n\n}\n});\n\n\nThis login screen works, but I can't get login and password from json file and currently these data are taken from if sentence, which is not good. Any suggestions?" ]
[ "json", "cordova", "sapui5" ]
[ "In a looping linked list, what guarantee is there that the fast and slow runners will collide?", "Now I remember reading on a stack overflow answer that the fast and slow runners will always collide in a linked list loop and that the difference in speed by 2 is arbitrary.\n\nIf the difference between the fast and slow runners is 2, then I haven't been able to come up with a counter example but if the difference between the runners is 3 then I can't seem to make the runners collide in the following example.\n\nSuppose we had 2 runners, slow and fast, inside a linked list loop. The loop has 8 nodes, 1st node being labelled 0, 2nd being 1, and so on. Slow is at index 0 and fast is at 1, then they never collide:\n\nslow fast \n0 1\n1 4\n2 7\n3 2\n4 5\n5 0\n6 3\n7 6\n0 1 # pattern seems to restart here\n\n\nThis example and the statement that the runners inside a loop will always collide are contradictory, as the fast runner can keep jumping over the slow runner.\n\nI haven't taken a course on algorithms yet so please try to explain what I have got wrong as simply as possible." ]
[ "algorithm", "data-structures", "linked-list", "theory", "floyd-cycle-finding" ]
[ "Compiling simple gtk+ application", "I try to compile simple gtk+ application in Anjuta IDE. Application is a simple window:\n\n# include <gtk/gtk.h>\n\nint main( int argc, char *argv[])\n{\n GtkWidget *label; \n GtkWidget *window; \n gtk_init(&argc, &argv);\n window = gtk_window_new(GTK_WINDOW_TOPLEVEL);\n gtk_window_set_title(GTK_WINDOW(window), \"Здравствуй, мир!\");\n label = gtk_label_new(\"Здравствуй, мир!\");\n gtk_container_add(GTK_CONTAINER(window), label);\n gtk_widget_show_all(window);\n g_signal_connect(G_OBJECT(window), \"destroy\", G_CALLBACK(gtk_main_quit), NULL);\n gtk_main();\n return 0;\n}\n\n\nIn make file i have:\n\nGTK_CFLAGS = -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/include/pixman-1 \n\nGTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 \n\n\nBut i see error, when i try to compile project: gtk/gtk.h - No such file or directory\n\nThank you." ]
[ "gtk" ]
[ "Selecting object with collection of objects from many-to-many relationship", "I have three tables: Athletes, Teams, and Team_Athletes. Team_Athletes joins the other two tables in a many-to-many relationship. What I'm doing is querying the database to return an object with the Athlete and with a collection of Teams. I'm currently doing this with the following two queries:\n\n var query = (from a in db.Athletes\n join ta in db.Team_Athletes on a.Id equals ta.AthleteId\n join t in db.Teams on ta.TeamId equals t.Id\n where t.OrganizationId == organizationId \n orderby a.LastName, a.FirstName\n select new\n {\n Athlete = a,\n Team = t\n }).ToArray();\n\n var result = from i in query\n group i by i.Athlete into g\n select new \n {\n Athlete = g.First().Athlete,\n Teams = g.Select(i => i.Team).ToArray()\n };\n\n\nI'd like to know how to combine the queries together if possible, but I can't come up with anything that works. Thoughts?" ]
[ "c#", "linq", "entity-framework" ]
[ "Validate that DataTable cell is not null or empty", "I would like to check if the value in a Data Table cell is either null or empty/blank space. The String.IsNullOrEmpty() method does not work as the row[\"ColumnName\"] is considered an object.\n\nDo I need to do a compound check like the following or is there something more elegant?\n\nif (row[\"ColumnName\"] != DBNull.Value && row[\"ColumnName\"].ToString().Length > 0)\n{\n // Do something that requires the value to be something other than blank or null\n}\n\n\nI also thought of the following ...\n\nif (!String.IsNullOrEmpty(dr[\"Amt Claimed\"].ToString()))\n{\n // Do something that requires the value to be something other than blank or null\n}\n\n\nbut I figured if the value of the cell was null an exception would be thrown when trying to convert to a string using ToString()" ]
[ "c#", "datatable", "null" ]
[ "same result from both re.search() and re.match() are the same, but not the same by comparison operator", "here is my code,\nphone_list = ['234-572-1236 Charles', '234-753-1234 Crystal', '874-237-7532 Meg']\n\nimport re\nresult1 = [re.match(r'\\d{3}-\\d{3}-\\d{4}', n) for n in phone_list]\nresult2 = [re.search(r'\\d{3}-\\d{3}-\\d{4}', n) for n in phone_list]\n\nprint(result1)\nprint(result2)\n\n# why they are not the same?\nprint(result1 == result2)\nprint(result1[0] == result2[0])\nprint(result1[1] == result2[1])\nprint(result1[2] == result2[2])\n\nI use re.match() and re.search() to obtain the same result.\nbut when compare the result by comparison operator, it all gives me False, why?" ]
[ "python", "regex", "comparison-operators" ]
[ "Insert fixed text into svg path", "<svg version=\"1.1\" viewBox=\"0 0 700 700\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n \r\n <path fill=\"#009688\" stroke=\"#fff\" id=\"AR\" d=\"M34.5,204.7 L37.7,201.6 L37.7,197.6 L40.7,195.5 L45.3,194.6 L54.1,197.7 L56.9,197.6 L59.2,199.9 L64.4,195.5 L67.0,195.5 L69.5,191.5 L70.2,186.8 L72.4,183.2 L78.8,181.7 L76.7,175.1 L80.6,168.0 L82.9,160.7 L88.8,160.1 L91.1,156.8 L96.0,158.6 L120.4,158.9 L131.3,164.3 L137.7,165.0 L143.2,168.3 L147.3,177.9 L155.0,183.5 L160.3,185.9 L162.1,189.9 L176.4,193.0 L183.0,193.4 L186.3,197.3 L181.3,200.6 L177.3,207.6 L174.3,209.7 L167.1,208.4 L164.7,209.0 L161.8,212.6 L161.1,219.2 L159.2,223.6 L159.8,228.6 L158.3,232.0 L154.6,236.3 L152.0,239.1 L144.9,241.8 L137.8,240.0 L132.7,234.7 L128.5,233.8 L125.3,231.1 L122.0,231.3 L120.0,235.7 L115.2,234.8 L114.8,238.4 L108.9,233.4 L103.7,238.2 L101.2,235.1 L101.7,233.0 L98.0,228.2 L94.4,227.6 L91.5,223.0 L87.0,223.0 L85.7,226.1 L81.9,229.1 L79.2,227.4 L74.2,229.0 L70.1,226.1 L69.5,223.3 L66.4,224.1 L65.2,227.5 L61.9,226.9 L61.2,223.6 L49.3,219.9 L45.4,213.3 Z\">\r\n </path> \r\n \r\n <path fill=\"#009688\" stroke=\"#fff\" id=\"CS\" d=\"M122.0,378.2 L120.1,372.2 L109.2,366.5 L101.6,368.3 L94.1,366.7 L91.5,363.7 L90.1,358.1 L87.4,356.2 L76.4,355.2 L71.5,349.8 L73.7,346.5 L85.3,345.6 L86.8,342.7 L85.3,339.9 L77.3,336.8 L75.7,333.6 L73.4,333.1 L74.4,330.4 L78.9,329.1 L80.9,322.7 L84.9,320.2 L84.5,316.6 L88.3,312.3 L88.6,306.4 L90.6,303.4 L90.0,298.8 L85.7,293.9 L85.1,291.3 L86.7,285.2 L92.1,281.6 L95.3,275.2 L101.2,274.0 L111.5,278.4 L117.8,275.6 L119.6,275.9 L122.2,280.8 L127.5,281.4 L128.6,275.3 L134.5,274.8 L138.4,272.1 L145.6,274.4 L148.4,269.9 L151.2,268.1 L159.5,267.0 L162.0,272.6 L166.0,274.4 L166.2,277.3 L168.7,277.7 L174.2,283.0 L175.9,286.0 L176.9,294.5 L175.0,298.6 L177.0,304.2 L173.7,312.7 L166.1,319.7 L165.4,323.0 L170.5,324.5 L170.8,328.3 L164.8,335.2 L161.8,344.6 L158.4,349.7 L153.9,361.6 L149.7,363.1 L147.4,360.4 L144.1,360.2 L140.6,356.8 L137.6,356.8 L136.0,361.5 L132.6,367.6 L132.3,377.5 L130.8,378.6 Z\">\r\n </path> \r\n \r\n <path fill=\"#009688\" stroke=\"#fff\" id=\"TM\" d=\"M159.5,267.0 L151.2,268.1 L148.4,269.9 L145.6,274.4 L138.4,272.1 L134.5,274.8 L128.6,275.3 L127.5,281.4 L122.2,280.8 L119.6,275.9 L117.8,275.6 L111.5,278.4 L101.2,274.0 L95.3,275.2 L92.1,281.6 L86.7,285.2 L85.1,291.3 L85.7,293.9 L90.0,298.8 L90.6,303.4 L88.6,306.4 L88.3,312.3 L84.5,316.6 L78.9,311.2 L71.1,308.1 L68.0,307.8 L64.3,305.2 L59.8,298.8 L56.1,300.2 L48.2,294.8 L40.1,285.0 L36.9,280.1 L33.0,276.5 L36.3,272.8 L33.5,264.6 L35.9,257.8 L37.0,249.2 L35.6,247.6 L31.5,250.9 L27.6,245.9 L26.2,239.8 L22.4,233.7 L15.9,230.5 L6.0,221.1 L4.1,214.5 L0.0,208.3 L3.3,204.8 L15.2,205.5 L17.2,202.7 L23.0,205.1 L27.0,208.3 L32.8,207.1 L34.5,204.7 L45.4,213.3 L49.3,219.9 L61.2,223.6 L61.9,226.9 L65.2,227.5 L66.4,224.1 L69.5,223.3 L70.1,226.1 L74.2,229.0 L79.2,227.4 L81.9,229.1 L85.7,226.1 L87.0,223.0 L91.5,223.0 L94.4,227.6 L98.0,228.2 L101.7,233.0 L101.2,235.1 L103.7,238.2 L108.9,233.4 L114.8,238.4 L115.2,234.8 L120.0,235.7 L122.0,231.3 L125.3,231.1 L128.5,233.8 L132.7,234.7 L137.8,240.0 L144.9,241.8 L152.0,239.1 L154.6,236.3 L157.0,239.1 L158.3,245.7 L160.9,248.6 L164.4,255.5 L167.2,257.0 L162.5,261.2 Z\">\r\n </path>\r\n \r\n <text font-family=\"Verdana\" font-size=\"30\" fill=\"#fff\">\r\n <textPath xlink:href=\"#AR\">\r\n AR\r\n </textPath>\r\n </text> \r\n\r\n <text font-family=\"Verdana\" font-size=\"30\" fill=\"#fff\">\r\n <textPath xlink:href=\"#CS\">\r\n CS\r\n </textPath>\r\n </text> \r\n \r\n <text font-family=\"Verdana\" font-size=\"30\" fill=\"#fff\">\r\n <textPath xlink:href=\"#TM\">\r\n TM\r\n </textPath>\r\n </text> \r\n</svg>\r\n\r\n\r\n\n\nHow to insert horizontal fixed text (centered to path if possible)?\n\nI have used some like this but the text is rotated and out of the path (see code snippet)\n\n <text font-family=\"Verdana\" font-size=\"30\" fill=\"#fff\">\n <textPath xlink:href=\"#TM\">\n TM\n </textPath>\n </text>\n\n\nthis was expected:" ]
[ "svg" ]
[ "Get class(es) of active item in Fancybox 2 Callback", "I am trying to get the class(es) of the current active fancybox link through the beforeLoad callback.\n\nHTML example:\n\n<a href=\"example.png\" class=\"lightbox pdf-opening\">Link</a>\n<a href=\"example2.png\" class=\"lightbox pdf-closing\">Link</a>\n\n\njQuery/Fancybox code:\n\n$(document).ready(function() {\n\n $(\".lightbox\").fancybox(\n {\n beforeLoad: function(){\n var pdf_type_string = $(\".lightbox\").eq(this.index).attr('class').split(' ').slice(-1);\n var test = pdf_type_string.toString();\n var pdf_type = test.substr(4);\n alert(pdf_type);\n },\n title: '<a class=\"lightbox_link_to_tickets\" href=\"/your-visit/booking-online/\">Book your tickets here</a>',\n type: 'image'\n }\n );\n\n});\n\n\nthis.index always returns 0, even when clicking the second link, which (in theory to me) should return 1 when clicking the second link...\n\nAny help greatly appreciated.\n\nPaul\n\nSolution\n\nThe solution for me was the following:\n\n$(document).ready(function() {\n $(\".lightbox\").fancybox(\n {\n beforeLoad: function(){\n var pdf_type_object = $(this.element).attr('class').split(' ').slice(-1);\n var pdf_type_string = pdf_type_object.toString();\n var pdf_type = pdf_type_string.substr(4);\n this.title = '<a class=\"lightbox_link_to_tickets\" href=\"/your-visit/booking-online/\">Book your tickets here</a> - <a class=\"lightbox_link_to_tickets\" href=\"/inc/images/your-visit/timetables-and-fares/'+pdf_type+'.pdf\">Downloadable PDF</a>';\n },\n type: 'image'\n }\n ); \n});" ]
[ "jquery", "fancybox" ]
[ "Hive connection to dbvisualizer using Kerberos Authentication", "I am using windows machine and trying to setup hive with DbVisualizer using hive uber jar. However getting the error as mentioed below. Not sure why ? \nhttps://github.com/timveil/hive-jdbc-uber-jar\n\nI am using following exe to generate keytab file on windows. \nhttp://web.mit.edu/KERBEROS/dist/index.html\n\nAnd All the steps mentioned on the github page. \n\nIf I use user principal, I am getting following error. \n\n\n dbc:hive2://aaa.corp.ad.abc:2181,bbbb.corp.ad.abc:2181,ccc.corp.ad.abc:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;[email protected]\n\n\nError Message\n\nLong Message:\nKerberos principal should have 3 parts: [email protected]\n\nDetails:\n   Type: java.lang.IllegalArgumentException\n\nStack Trace:\njava.lang.IllegalArgumentException: Kerberos principal should have 3 parts: [email protected]\n   at org.apache.hive.service.auth.KerberosSaslHelper.getKerberosTransport(KerberosSaslHelper.java:48)\n   at org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:425)\n   at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:202)\n   at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:166)\n   at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)\n   at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)\n   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\n   at java.lang.reflect.Method.invoke(Unknown Source)\n   at com.onseven.dbvis.g.B.D.ā(Z:1548)\n   at com.onseven.dbvis.g.B.F$A.call(Z:1369)\n   at java.util.concurrent.FutureTask.run(Unknown Source)\n   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\n   at java.lang.Thread.run(Unknown Source)\n\n\nAnd if I use server principal as mentioned below error is different. \n\n\n dbc:hive2://aaa.corp.ad.abc:2181,bbbb.corp.ad.abc:2181,ccc.corp.ad.abc:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;principal=krbgt/[email protected]\n\n\nError:\n\nLong Message:\nCould not open client transport for any of the Server URI's in ZooKeeper: GSS initiate failed\n\nDetails:\n   Type: java.sql.SQLException\n   SQL State: 08S01" ]
[ "hadoop", "hive", "dbvisualizer" ]
[ "How can I determine whether a string is in a variable using an if statement?", "I'm currently learning Perl and I'm trying to figure out how to do an \nif string in variable { do stuff\n}\n\nI've tried many different ways such as using the eq, and =~ but it returns all the keywords within keywords.txt in oppose to the specific keyword that's found in $line\n\nHere's my script:\n\n#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nmy $keywords = 'keywords.txt';\nopen( my $kw, '<:encoding(UTF-8)', $keywords )\n or die \"Could not open file '$keywords' $!\"\n ; # Open the file, throw an exception if the file cannot be opened.\nchomp( my @keywordsarray = <$kw> )\n ; # Remove whitespace, and read it into an array\nclose($kw); # Close the file\n\nmy $syslog = 'syslog';\nopen( my $sl, '<:encoding(UTF-8)', $syslog )\n or die \"Could not open file '$keywords' $!\"\n ; # Open the file, throw an exception if the file cannot be opened.\nchomp( my @syslogarray = <$sl> ); # Remove whitespace, and read it into an array\nclose($sl); # Close the file\n\nforeach my $line (@syslogarray) {\n foreach my $keyword (@keywordsarray) {\n if ( $keyword =~ $line ) {\n print \"**\" . $keyword . \"**\" . \"\\n\";\n }\n }\n}" ]
[ "perl", "if-statement" ]
[ "The time complexity of counting sort", "I am taking an algorithms course and there I saw that the time complexity of counting sort is O(n+k) where k is the range of numbers and n is the input size. My question is, when the difference between k and n is too much, such as when k=O(n2)or O(n3), can we say that the complexity is O(n2) or O(n3)? Then in this case counting sort is not a wise approach and we can use merge sort. Am I right?" ]
[ "algorithm", "sorting", "asymptotic-complexity" ]
[ "numbering issues of using Algorithms package", "I am using algorithms package to writing my thesis, and having a question on numbering issue. The thesis is composed of several chapters, and each chapter may include a set of algorithms, procedures and heuristics, and each of which is presented using algorithms package. \n\nAfter using \\floatname to customize the captions, I now have\nAlgorithm 1.1, Algorithm 1.2, Procedure 1.3 Procedure 1.4, Algorithm 2.1, Algorithm 2.2, Procedure 2.3 Procedure 2.4\n\nThis is not the numbering scheme what I want, which should look like\n\nAlgorithm 1.1, Algorithm 1.2, Procedure 1.1 Procedure 1.2, Algorithm 2.1, Algorithm 2.2, Procedure 2.1 Procedure 2.2 \n\nCan you let me know any hint for doing this? Thanks." ]
[ "latex" ]
[ "ToPagedListAsync() - The provider for the source IQueryable doesn't implement IDbAsyncQueryProvider", "I have been trying to sort out this for hours and could not find a solution.\nI am using a Web Api MVC project and trying to convert an IEnumerable list to a paged list async. I'm able to compile but I'm still getting a runtime error on the ToPagedListAsync() line.\n\n\n The provider for the source IQueryable doesn't implement IDbAsyncQueryProvider. Only providers that implement IDbAsyncQueryProvider can be used for Entity Framework asynchronous operations. For more details see http://go.microsoft.com/fwlink/?LinkId=287068.\"\n\n\n1st Layer:\n\npublic async Task<IEnumerable<MatchingCriteria>> GetMatchingCriterias(int id)\n{\n return await _ctx.MatchingCriterias.Include(mc => mc.RuleDefinition).Where(mc => mc.RuleDefinitionId == id).ToListAsync();\n}\n\n\n2nd Layer:\n\ninternal async Task<IEnumerable<MatchingCriteria>> GetMatchingCriterias(int id)\n{\n using (CrawlerDbContext db = new CrawlerDbContext())\n {\n var matchCriteriaMgr = new MatchingCriteriaManager(db);\n return await matchCriteriaMgr.GetMatchingCriterias(id);\n }\n}\n\n\nController: \n\npublic async Task<ActionResult> Index(int? id, string sortOrder, string currentFilter, string searchString, int? page){\n var matchingCriterias = await _crawlerProvider.GetMatchingCriterias(id.Value);\n\n //...\n IQueryable<MatchingCriteria> matchCrit = matchingCriterias.AsQueryable();\n //Error here -> return View(await matchCrit.ToPagedListAsync(pageNumber, pageSize));\n}\n\n\nif I do instead in the controller:\n\nvar matchingCriterias = _db.MatchingCriterias.Include(mc => mc.RuleDefinition);\n\n\nthen: \n\nreturn View(await matchingCriterias.ToPagedListAsync(pageNumber, pageSize)\n\n\nThat works well!\n\nI could return a DbSet on the nested methods but I could not use the ToListAsync() in the 1st layer;\n\nIs there a way to make the list IQueryable?Any other ideas or suggestions?" ]
[ "linq", "asynchronous", "model-view-controller" ]
[ "Varying outputs with a synchronized method", "I have written a multi-threaded and synchronized incrementing function but it doesn't show a consistent output :-\n\n$ java Main\ncount: 999883\n\n$ java Main\ncount: 1000000\n\n$ java Main\ncount: 999826\n\n$ java Main\ncount: 1000000\n\n$ java Main\ncount: 1000000\n\n\nI have a synchronized counter :-\n\npublic class Counter {\n public int count;\n synchronized void inc() {\n count = count+1;\n }\n int getCount() {\n return count;\n }\n}\n\n\nA thread class that is initialized with a counter object and increments it 1000 times :-\n\npublic class CountPrimesRunnable implements Runnable {\n private Counter c;\n\n public CountPrimesRunnable(Counter c) {\n this.c = c;\n }\n\n public void run() {\n for (int i = 0; i < 1000; i++)\n c.inc();\n }\n}\n\n\nAnd the Main class that creates 1000 threads at a time :-\n\npublic class Main {\n public static void main(String[] args) {\n int numberOfThreads = 1000;\n Thread[] worker = new Thread[numberOfThreads];\n Counter c = new Counter();\n for (int i = 0; i < numberOfThreads; i++)\n worker[i] = new Thread(new CountPrimesRunnable(c));\n\n for (int i = 0; i < numberOfThreads; i++)\n worker[i].start();\n\n System.out.println(\"count: \" + c.count);\n }\n}\n\n\nWhat is it that I am missing ?" ]
[ "java", "multithreading" ]
[ "Java virtual heap space", "My application has a feature that generates images(jpg) , it uses a lot of heap space (more then allowed on host server). Is their any way i can make it to use less heap memory. I mean, just like our Computers uses virtual memory when RAM is full. Is their any way for java to use external memory as virtual heap space ?" ]
[ "java", "memory", "heap", "virtual-memory" ]
[ "Replace multiple occurance in string", "I want to replace some of the words from the user's input using customized characters. The string will be like this\n\nvar userInput = \"five plus five equal to ten multiply 5\";\n\n\nThis is what I tried to do \n\nconst punctLists = {\n name: 'star',\n tag: '*'\n },\n {\n name: 'bracket',\n tag: ')'\n }, {\n name: 'multiply',\n tag: '*'\n }, {\n name: 'plus',\n tag: '+'\n }, {\n name: 'double equals',\n tag: '=='\n }, {\n name: 'equal',\n tag: '='\n }]\nvar matchPunction = punctLists.find(tag => tag.name == userInput);\nif (matchPunction) {\n userInput = matchPunction.tag;\n}\n\n\nBut it is not working. \nI want something like this :\n\nvar userInput = \"5+5 = 10*5\";\n\n\nAny idea?" ]
[ "javascript" ]
[ "variables with same content are not equal .... why?", "Why do i receive false if both variables have equal content?\n\nfunction A() { return {k:'k'}; }\nfunction B() { return {k:'k'}; }\n\nvar a = new A;\nvar b = new B;\n\n var s='';\n\nfor (prop in a) {\n if (typeof a[prop] != \"function\") {\n s += \"a[\" + prop + \"] = \" + a[prop] + \"; \";\n }\n}\nalert(s);\n\n\nfor (prop in b) {\n if (typeof b[prop] != \"function\") {\n s += \"b[\" + prop + \"] = \" + b[prop] + \"; \";\n }\n}\nalert(s);\n\n\nalert( a == b ); // false?\n\n\nhttp://jsfiddle.net/wZjPg/\n\nsame happens even if i assign both a and b same function\n\nvar obj = {};\n\nfunction A() { return {k:'k'}; }\n\nvar a = new A;\nvar b = new A;\n\nalert( a == b ); // false?\n\n\nhttp://jsfiddle.net/3rzrR/\n\nand same here\n\nk={zor:1};\nb={zor:1};\n\nalert(k==b); //false\n\n\nhttp://jsfiddle.net/5v8BJ/" ]
[ "javascript" ]
[ "How to trigger an event everytime a notification is pushed on my AWS SQS destination?", "I am using AWS SQS for Amazon MWS Order APIs. Everytime someone orders from a seller account who has added me as his developer, Amazon will send the notification to my AWS SQS Application.I can pull the notifications from there. But for this, I will have to create a scheduler to pull the notifications. Can I use any other AWS as a listener just to trigger my own service everytime a notification is pushed on my destination by Amazon? Can I use Lambda functions for it? I am new to AWS so I know only I little about it." ]
[ "amazon-web-services", "aws-lambda", "amazon-sqs", "amazon-mws" ]
[ "How to join on three different tables", "I am trying to fill my table with Companynames, but they all come from another table (depending on type of company)\n\nSo, for example, i have a 'regardingobjectid' in my current table, which is equal to the 'id' from the table 'opportunity'. In this table 'opportunity' there is no companyname, only a 'parentaccountid' which refers to an 'Id' in the table 'account', in which the name is known.\n\nSo the regardingobjectid from my current table matches with an id in another table, from which I have to take another column to match with a column in ANOTHER table to get the name.\n\nDoes anyone have a clue on how to do it? I tried multiple left joins but I can't get it right.\n\nI use SQL Server.\n\nHere is a piece of my code from what I tried:\n\nSELECT\ne.regardingobjectid as CompanyId,\ncase\n when e.regardingobjectid_entitytype = 'account' then a.name\n when e.regardingobjectid_entitytype = 'lead' then l.companyname\n when e.regardingobjectid_entitytype = 'opportunity' then o.name\n when e.regardingobjectid_entitytype = 'incident' then a.name\n when e.regardingobjectid_entitytype = 'contact' then a.name\n when e.regardingobjectid_entitytype = 'salesorder' then a.name\nend as Companyname\nfrom emails e\n\nleft join opportunity o on e.regardingobjectid = o.id\nleft join account a on e.regardingobjectid = a.id\nleft join lead l on e.regardingobjectid = l.id\nleft join incident i on e.regardingobjectid = i.id\nleft join contact c on e.regardingobjectid = c.id\nleft join salesorder s on e.regardingobjectid = s.id\n\n\nThis fills my table for the categories account, lead and opportunity, but not for the categories incident, salesorder and contact.\n\nIn the tables opportunity, account, and lead are names. But, in the tables incident, contact and salesorder there are no names. The names from the salesorder, contact and incident labelled companies are in the account table.\n\nFor example, the CompanyId from this select statement is the same as 'id' from the table incident. In this table incident, there is an 'accountid' which corresponds to the 'id' in the table account, from which I want the name.\n\nI managed to get the name for 'incident', but now my names for account are gone…\nWhen i type my joins like this: \n\nleft join crm_systemuser u on p.owneridyominame = u.fullname\nleft join crm_incident i on i.id = p.regardingobjectid\nleft join crm_account a on a.id = i.blue10_accountid\nleft join crm_opportunity o on o.id = p.regardingobjectid\nleft join crm_account s on s.id = p.regardingobjectid\nleft join crm_lead l on l.id = p.regardingobjectid\n\n\nMy incidents, leads and opportunities fills with names. However, when I switch order:\n\n left join crm_account a on a.id = e.regardingobjectid\n left join crm_systemuser u on e.owneridyominame = u.fullname\n left join crm_incident i on i.id = e.regardingobjectid\n left join crm_account on a.id = i.blue10_accountid\n left join crm_opportunity o on o.id = e.regardingobjectid\n left join crm_lead l on l.id = e.regardingobjectid\n\n\nMy incidents are empty again but my accounts are filled with names…" ]
[ "sql", "sql-server" ]
[ "match link from JSON", "I have this string.\n\n{\"videoID\":\"10156327104658120\",\n\"playerFormat\":\"inline\",\n\"playerOrigin\":\"newsfeed\",\n\"external_log_id\":null,\n\"external_log_type\":null,\n\"rootID\":\"10156327104658120\",\n\"playerSuborigin\":\"misc\",\n\"canUseOffline\":null,\n\"playOnClick\":true,\n\"videoDebuggerEnabled\":false,\n\"videoPlayerVisibilityBehavior\":\"2\",\n\"videoViewabilityLoggingEnabled\":false,\n\"videoViewabilityLoggingPollingRate\":-1,\n\"videoPlayerPauseWhenBlur\":false,\n\"videoScrollUseLowThrottleRate\":true,\n\"playInFullScreen\":false,\n\"type\":\"video\",\n\"src\":\"https:\\/\\/video-frx5-1.xx.fbcdn.net\\/v\\/t42.1790-2\\/28100902_1709246409132048_3547885085212540928_n.mp4?efg=eyJybHIiOjMwMCwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoic3ZlX3NkIn0\\u00253D&oh=5ca37733bd3004fe2591152502e63def&oe=5A84637D\",\"width\":340,\"height\":340,\"trackingNodes\":\"FH-R\",\n\"downloadResources\":null,\n\"subtitlesSrc\":null,\n\"spherical\":false,\n\"sphericalParams\":null,\n\"animatedGifVideo\":false,\n\"defaultQuality\":null,\n\"availableQualities\":null,\n\"playStartSec\":null,\n\"playEndSec\":null,\n\"playMuted\":null,\"disableVideoControls\":false,\"loop\":false}\n\n\nHow can I match value of \"src\" key." ]
[ "json", "regex", "string", "match" ]
[ "Perl: How to push a hash into an array that is outside of a subroutine", "I originally experimented with trying to send a hash object through Thread::Queue, but according to this link, my versions of Thread::Queue and threads::shared is too old. Unfortunately, since the system I'm testing on isn't mine, I can't upgrade.\n\nI then tried to use a common array to store my hashes. Here is the code so far:\n\n#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nuse threads;\nuse Thread::Queue;\nuse constant NUM_WORKERS => 10;\n\nmy @out_array;\ntest1();\n\nsub test1\n{\n my $in_queue = Thread::Queue->new();\n foreach (1..NUM_WORKERS) {\n async {\n while (my $job = $in_queue->dequeue()) {\n test2($job);\n }\n };\n }\n\n my @sentiments = (\"Axe Murderer\", \"Mauler\", \"Babyface\", \"Dragon\");\n\n $in_queue->enqueue(@sentiments);\n $in_queue->enqueue(undef) for 1..NUM_WORKERS;\n $_->join() for threads->list();\n\n foreach my $element (@out_array) {\n print \"element: $element\\n\";\n }\n}\n\nsub test2\n{\n my $string = $_[0];\n my %hash = (Skeleton => $string);\n push @out_array, \\%hash;\n}\n\n\nHowever, at the end of the procedure, @out_array is always empty. If I remove the threading parts of the script, then @out_array is correctly populated. I suspect I'm implementing threading incorrectly here.\n\nHow would I correctly populate @out_array in this instance?" ]
[ "multithreading", "perl" ]
[ "How to output type definitions in vs2015 community", "I am trying to output types definition(appBundle.d.ts) file in vs2015 community.\nI have seen that there is a compiler option '--declaration', so i tried to just add it into the tsconfig.json file like following:\n\n{\n \"compilerOptions\": {\n \"declaration\": \"www/scripts/appBundle.d.ts\", // <------\n \"noImplicitAny\": false,\n \"noEmitOnError\": true,\n \"removeComments\": false,\n \"sourceMap\": true,\n \"out\": \"www/scripts/appBundle.js\",\n \"target\": \"es5\"\n }\n}\n\n\nBut it's not working; the appBundle.js is beeing generated as expected, but appBundle.d.ts is not showing up." ]
[ "typescript", "visual-studio-2015", "tsconfig" ]
[ "Magento: can not create shipment for orders with an invoice", "im having problem with creating shipment for some orders programmatically.\nfor the orders without an invoice, they get dispatched without any problems.\n\ni have pasted my code here, could you please help me to solve this issue.\n\n<?php \n /*\ncheck if orderId is set \n*/\nif(isset($orderId)){\n$Semail = false;\n$includeComment = true;\n$shipment = false;\n\n\n/*\nUpdate order control systems table with tracking \n*/\n$dispatchOrder = $sql->query(\"update _trackingOrders SET trackingNumber = '\".$trackingNumber.\"' where order_number = '\".$orderId.\"'\");\n$dispatchOrderCustomer = $sql->query(\"update _trackingCustomer SET orderStatus = 'dispatched' where order_number = '\".$orderId.\"'\");\n/*\nEnd of updates\n */\n\nif(($dispatchOrder)&&($dispatchOrderCustomer)){\n\n /*\n Load order by id\n */\n $order = Mage::getModel('sales/order')->load($orderId);\n\n /*\n check if order exist\n */\n if (!$order->getId()) {\n echo 'The order no longer exists.';\n return false;\n }\n**EDIT:**\n /*\ncheck if order can be invoiced\n*/\n if(!$order->canInvoice()){\n echo 'order can not be invoiced';\n return false;\n }\n/*\ncheck if order can be ship\n*/\n if (!$order->canShip()) {\n echo 'Order can not be shipped';\n return false;\n }\n /*\n * New shipment coding begins here \n */ \n $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment();\n\n /*\n **END OF EDIT**\n */\n/* \nget all items from the order\n*/\nforeach ($order->getAllItems() as $orderItem) {\n\nif (!$orderItem->getQtyToShip()) {\n continue;\n}\nif ($orderItem->getIsVirtual()) {\n continue;\n}\n\n$item = $convertor->itemToShipmentItem($orderItem);\n\n$qty = $orderItem->getQtyToShip();\n\n$item->setQty($qty);\n$shipment->addItem($item);\n} \n\n\n\n/*\nshipment details\n*/\n$tracking = array();\n$tracking['carrier_code'] = 'Royalmail';\n$tracking['title'] = $shippingMethod;\n$tracking['number'] = $trackingNumber;\n\n/*\nadd shipment tracking details\n*/\n$track = Mage::getModel('sales/order_shipment_track')->addData($tracking);\n$shipment->addTrack($track);\n\n/*\nregister current shipment\n*/\nMage::register('current_shipment_'.$orderId.'', $shipment);\n\n/*\nregister shipment\nadd comment to shipment\nsend shipment email\n*/ \n$shipment->register();\n$shipment->addComment($comments, $Semail && $includeComment);\n$shipment->setEmailSent(true);\n\n/*\nset order state as processign\nset order is in process\nset order status as complete\n*/\n$shipment->getOrder()->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);\n$shipment->getOrder()->setIsInProcess(false);\n$shipment->getOrder()->setStatus('complete');\n\n\n/*\nget shipment order\nadd statushistory\n*/\n$_order = $shipment->getOrder();\n$_order->addStatusHistoryComment($comments, 'complete')\n ->setIsVisibleOnFront(1)\n ->setIsCustomerNotified(1);\n $_order->sendOrderUpdateEmail('1', $comments);\n $_order->save();\n\n\n/*\nsave transactions\n*/\n$transactionSave = Mage::getModel('core/resource_transaction')\n->addObject($shipment)\n->addObject($shipment->getOrder())\n->save();\n\necho \"order has been dispatched\";\n?>\n\n\nThanks inadvance.\n\nJey" ]
[ "php", "magento", "magento-1.5" ]
[ "WP_QUERY : Return posts by tags , filtered by post formats", "I have the following code snippet, which is supposed to return 6 posts which are related to the current post by tag and the 6 posts should be the ones with a video post format taxonomy :\n\nif('artists' == get_post_type()){\n $taxs = wp_get_post_tags($post->ID);\n $name = the_title();\n if($taxs){\n $tax_ids = array();\n foreach ($tax_ids as $individual_tax){\n $tax_ids[] = $individual_tax->term_id;\n }\n gs = array(\n 'post_type' =>'post',\n 'tag__in'=> $tax_ids,\n 'tax_query' =>array( \n array(\n 'taxonomy' => 'post_format',\n 'field' => 'slug',\n 'terms' => array('post-format-video')\n ),\n ),\n 'post__not_in' => array($post->ID),\n 'posts_per_page' => 6,\n 'ignore_sticky_posts' => 1,\n );\n $video_query = new WP_QUERY($args);\n // other code comes here .........\n\n\nThe problem is that when I run the query, it returns all posts with a video post format, rather than those that have the related tags as the current post being viewed. Please help me solve this. \n\nLet me put this in an example : The current post has a tag called 'oranges'. In the related posts section, I want it to display posts that also have a tag called oranges but only those with a video post format taxonomy." ]
[ "php", "logical-operators", "wordpress" ]
[ "Toolbar doesn't allow to use a match-parent layout in it", "I've designed a toolbar but it doesn't let me make a match-parented layout. Its left side is locked and it doesn't allow me to put the TextView there, but the right side is doing well;\nI've watched too many videos on YouTube about designing toolbar but they didn't have such this problem.\n You can see that in this picture.\n<?xml version="1.0" encoding="utf-8"?>\n<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"\n xmlns:app="http://schemas.android.com/apk/res-auto"\n xmlns:tools="http://schemas.android.com/tools"\n android:layout_width="match_parent"\n android:layout_height="?attr/actionBarSize"\n android:background="@color/colorPrimaryDark"\n android:elevation="10dp">\n\n <androidx.constraintlayout.widget.ConstraintLayout\n android:layout_width="match_parent"\n android:layout_height="match_parent">\n\n <androidx.appcompat.widget.AppCompatImageButton\n android:id="@+id/icon_more"\n style="@style/Widget.AppCompat.Button.Borderless"\n android:layout_width="?attr/actionBarSize"\n android:layout_height="?attr/actionBarSize"\n android:src="@drawable/ic_more_vert"\n android:tint="@android:color/white"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toEndOf="parent"\n app:layout_constraintTop_toTopOf="parent" />\n\n <androidx.appcompat.widget.AppCompatImageButton\n android:id="@+id/icon_search"\n style="@style/Widget.AppCompat.Button.Borderless"\n android:layout_width="?attr/actionBarSize"\n android:layout_height="?attr/actionBarSize"\n android:src="@drawable/ic_search"\n android:tint="@android:color/white"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toStartOf="@+id/icon_more"\n app:layout_constraintTop_toTopOf="parent" />\n\n <TextView\n android:id="@+id/textView"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:text="چی بخوریم ؟"\n android:textColor="@android:color/white"\n android:textSize="18sp"\n android:textStyle="bold"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintStart_toStartOf="parent"\n app:layout_constraintTop_toTopOf="parent" />\n\n </androidx.constraintlayout.widget.ConstraintLayout>\n\n</androidx.appcompat.widget.Toolbar>\n\nbuild.gradle (Module: app) :\ndependencies {\n implementation fileTree(dir: "libs", include: ["*.jar"])\n implementation 'androidx.appcompat:appcompat:1.2.0'\n implementation 'androidx.constraintlayout:constraintlayout:2.0.1'\n implementation 'com.google.android.material:material:1.2.1'\n testImplementation 'junit:junit:4.13'\n androidTestImplementation 'androidx.test.ext:junit:1.1.2'\n androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'\n\n}\n\n✔ I've got no conflict with AndroidX libraries.\nShall I use fragments to solve the problem?\nWhy does it occur?" ]
[ "android", "android-studio", "android-layout", "material-design", "android-toolbar" ]
[ "Can you use OpenID Connect without obtaining OAuth credentials?", "In Google's OpenID Migration Guide, for transitioning from OpenID 2.0 to OpenID Connect, step 1 is that I need to obtain OAuth credentials for my application.\n\nOne thing I like about \"regular\" OpenID is that I can allow my users to authenticate from any IDP of their choosing. Whether they use Google, Yahoo, or any other endpoint, as a developer I don't need to go through the trouble of manually obtaining OAuth credentials from each of those providers and configuring my application to support them.\n\nAs providers discontinue support for traditional OpenID, is there a way for me to allow users to continue using their current IDPs without me having to go through each one and manually obtaining OAuth credentials?" ]
[ "oauth", "openid", "google-openid", "openid-connect" ]
[ "How to iterate over a dataframe with criteria and plot the results?", "I have a df that has data over the last 6 months. I want to split this up into 7 unique dataframes, each one housing the data on a given day. Monday, Tuesday, etc. I already have a column called "weekday" to help with this.\nHere's the data I'm working with:\n+---+------------+----------+-----------+------------+\n| | Date | Activity | Weekday | Hours |\n+---+------------+----------+-----------+------------+\n| 0 | 2020-06-01 | Gen Ab | Monday | 347.250000 |\n| 1 | 2020-06-02 | Gen Ab | Tuesday | 286.266667 |\n| 2 | 2020-06-03 | Gen Ab | Wednesday | 169.583333 |\n| 3 | 2020-06-04 | Gen Ab | Thursday | 312.633333 |\n| 4 | 2020-06-05 | Gen Ab | Friday | 317.566667 |\n| 5 | 2020-06-08 | Gen Ab | Monday | 285.800000 |\n| 6 | 2020-06-09 | Gen Ab | Tuesday | 213.166667 |\n+---+------------+----------+-----------+------------+\n\nThis code doesn't work, but it's what I'm trying to accomplish:\nday = grouped['Weekday'].unique()\n\nfor day in day:\n f"df_{str(day)}" = grouped.loc[(grouped['Activity'] == 'Gen Ab')\n & (grouped['Weekday'].isin([f'{day}']))].reset_index(drop=True)\n\nThe formatted string would be the name of the new df. So "df_Monday", "df_Tuesday", etc.\n.isin also uses a formatted string since I'm filtering for every day.\nFinally, I want to plot each of the dataframes into a line graph so we can see the data of each day over time.\nI'm sure there's a better way to plot the data (my end goal) but I would also like to know how to do this loop here in case I want to use something similar in the future.\nCan anyone help with both these things?" ]
[ "python", "pandas", "matplotlib" ]
[ "Attempting to change webpack-dev-server host", "When trying to change the host in webpack-dev-server from 0.0.0.0 to localhost.\n\nI looked in the code (bin/web-pack-dev-server generated for Rails 5.1.3), tried to understand it, and noticed what I thought was a --host parameter\n\nPORT=8080 bin/webpack-dev-server --host=localhost\n\n\nthe --host=localhost flag won't work. \n\nFrom bin/web-pack-dev-server:\n\nbegin\n dev_server = YAML.load_file(CONFIG_FILE)[\"development\"][\"dev_server\"]\n\n DEV_SERVER_HOST = \"http#{\"s\" if args('--https') || dev_server[\"https\"]}://#{args('--host') || dev_server[\"host\"]}:#{args('--port') || dev_server[\"port\"]}\"\n puts DEV_SERVER_HOST\nrescue Errno::ENOENT, NoMethodError\n puts \"Webpack dev_server configuration not found in #{CONFIG_FILE}.\"\n puts \"Please run bundle exec rails webpacker:install to install webpacker\"\n exit!\nend" ]
[ "ruby-on-rails", "webpack", "webpack-dev-server", "react-rails", "webpacker" ]
[ "How to get values from an array of promises?", "for (var year = year_from; year <= year_to; year++) {\n for (var month = month_from; month <= 12; month++) {\n for (var day = day_from; day <= 31; day++) {\n var url = \"something_url\" + year + \"/\" + month + \"/\" + day + \"/\";\n var current_date = day + \".\" + month + \".\" + year;\n try {\n var options = {\n uri: url,\n transform: function (body) {\n var $ = cheerio.load(body);\n $('div[class=\"post\"]').each(function (month, elem) {\n var nested = $(this).find('div[class=\"text\"]');\n var nested_a = nested.find('a');\n var nested_href = nested_a.attr('href');\n var nested_text = nested_a.text();\n var lc_nested_text = nested_text.toLowerCase();\n var s_lc_nested_text = lc_nested_text.toString();\n if (s_lc_nested_text.indexOf(query1) > -1) {\n post.name1 = s_lc_nested_text;\n post.url1 = f_url + nested_href;\n post.date1 = current_date;\n }\n });\n }\n };\n\n prs.push(rp(options));\n }\n catch {\n console.log('parse error');\n }\n }\n }\n}\n\nPromise.all(prs)\n .then((result) => {\n res.send(result);\n }).catch(err => console.log(err)); \n\n\n\nI get the result from the request to the API with request-promise and put it in an array of promises. After I send this result to the browser and there I get the following:" ]
[ "node.js", "for-loop", "promise", "request-promise" ]