texts
sequence
tags
sequence
[ "Allow access to a web admin Nginx", "I am trying to allow only one ip to connect to my admin in ngnix but it gives me an error 403.\nWhat happens is that the Allow option is not working and I don't know why.\nCould you help me?.\n\nMy current configuration is as follows:\n\n location ~ ^/(login_admin) {\n allow 1.1.XX.XXX;\n deny all;\n }\n\n\nThe page is thepage.com/login_admin" ]
[ "nginx", "nginx-config" ]
[ "Core Data table to NSArray", "I have the following Array which retrieved from the Core Data :\n\nNSArray *dataArray = [context executeFetchRequest:request error:&error];\n\n\nso I wrote this code to get each row data individually to send it to REST API:\n\nfor (NSString *str in dataArray) {\n\n NSString *name =[dataArray valueForKey:@\"name\"];\n NSString *dob = [dataArray valueForKey:@\"dob\"];\n int gender =[[dataArray valueForKey:@\"gender\"]integerValue];\n NSString *childId =[dataArray valueForKey:@\"id\"];\n\n int response = [network sendName:name withDateOfBirth:dob andGender:gender forID:childId];\n\n if (response == 200) {\n // [self performSelectorOnMainThread:@selector(postSuccess) withObject:nil waitUntilDone:YES];\n NSLog(@\"Success\");\n\n }\n }\n\n\nbut it's not working, because I couldn't know how data is stored in each index in the array!!\nPlease help, and if I am not doing this correctly please tell me a better way to do it.\n\nThanks." ]
[ "iphone", "ios", "core-data", "core-data-migration", "ticoredatasync" ]
[ "Turn list comprehension to while loop", "I have the following line of code:\n\nmass_grouped3['records_to_select'] = [math.ceil(int((el * target) / freq_sum)) if el > 6 else el for el in mass_grouped3['freq']]\n\n\nI want to rewrite it with while loop, but don't have much experience with while loops and find it difficult. This is what I have for now, but is not working for some reason:\n\ntrgt = 0\nwhile trgt <= 7500:\n if trgt == 7500:\n break\n else:\n for el in mass_grouped3['freq']:\n if el > 6:\n mass_grouped3['records_to_select'] = [math.ceil(int((el * target) / freq_sum))]\n trgt += 1\n else:\n pass\n\n\nI want to do the same, but when the counter hit 7500 to break." ]
[ "python", "python-3.x" ]
[ "Postman returns 204 no content error to post request", "My request's body:\n{\n \"author\":\"Dan Brown\",\n \"title\":\"Da Vinci's code\"\n}.\nAnd I am sending request to http://localhost:49497/api/values.\nIt is returning 204 error.What can be the reason of this problem?\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Web.Http;\n\nnamespace APIlab2.Controllers\n{\n public class TestObject\n {\n public string author{ get; set; }\n public string title { get; set; }\n }\n public class ValuesController : ApiController\n {\n // GET api/values\n List<TestObject> list = new List<TestObject>();\n public IEnumerable<TestObject> Get()\n {\n return list;\n }\n\n // GET api/values/5\n public string Get(int id)\n {\n return \"value\";\n }\n\n // POST api/values\n public void Post([FromBody]TestObject obj)\n {\n list.Add(obj);\n }\n\n // PUT api/values/5\n public void Put(int id, [FromBody]string value)\n {\n }\n\n // DELETE api/values/5\n public void Delete(int id)\n {\n }\n }\n}" ]
[ "asp.net", "post", "postman" ]
[ "Shouldn't the library path default to the workspace path?", "I am doing the HelloWorldSWT tutorial in Version: Kepler Release\nBuild id: 20130606-0932\n and when I run my application I get\n\n\n \n Exception in thread \"main\" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: \n no swt-win32-4332 in java.library.path\n no swt-win32 in java.library.path\n Can't load library: C:\\Users\\CodeCamper.swt\\lib\\win32\\x86_64\\swt-win32-4332.dll\n Can't load library: C:\\Users\\CodeCamper.swt\\lib\\win32\\x86_64\\swt-win32.dll\n \n\n\nWhy doesn't the library path default to my workspace folder where Eclipse is dropping the libraries in automatically.\n\n\n \n C:\\eclipse\\workspace\n \n\n\nAll the necessary files are being imported into this folder when I import libraries to my project. Doing a simple google search the only viable answer I saw was to copy the folders imported in the workspace folder into that local path. I put eclipse on my C drive because I want my eclipse to be easily portable. \n\nWhat setting do I need to change to make the IDE look in my workspace folder for the libraries?\n\n*note I know how to copy and paste the dlls to the location it wants but that is my problem it is very cumbersome and creates an issue if I want my eclipse on a flash drive going on multiple computers." ]
[ "java", "windows", "eclipse", "64-bit" ]
[ "MVC controller returns JSON", "I have this HTML and script : \n\n<form>\n Text :<br>\n <input type=\"text\" name=\"nameid\" id=\"nameid\" value=\"\">\n <br><br>\n <input type=\"submit\" value=\"Send\">\n</form> \n\n$(document).ready(function () {\n\n $(\"form\").submit(function (event) {\n $.ajax({\n type: 'GET',\n url: \"/MyController/MyAction2\",\n data: { nameid: $('#nameid').val() },\n success: function (newdata) {\n var cy = cytoscape({\n container: document.getElementById(\"cy\"),\n elements: JSON.parse(newdata)\n\n });\n });\n }\n });\n\n });\n\n});\n\n\nWhen MyAction2 is called from AJAX, the url goes to MyAction2 and I see raw JSON data. How can I make MyAction2 returns value to the AJAX and I would use it as newdata variable? Thanks." ]
[ "javascript", "jquery", "ajax", "asp.net-mvc" ]
[ "Accessing Local file through JavaScript in embedded webbrowser (iOS)", "Is there way to access local file system folders like Documents folder through a JavaScript that runs on a browser embedded in a native application? \n\nI need the following\n\n\nLoad a JavaScript in a UIWebView\nAccess local file from the JavaScript running in UIWebView\nWrite local file from the JavaScript running in UIWebView" ]
[ "javascript", "iphone", "ios", "html", "uiwebview" ]
[ "Sliding Div tag out on Mouse Over", "I'm trying to create an animation that lets a div slide out while mouse is over it, and stay slid out until the mouse is moved out. What's the best way to achieve this? Sorry, I'm new to React.\nHere's my general code. Sorry for the bad formatting.\n\nreturn (\n <div id=\"homeDiv\">\n <div>\n <Navbar />\n\n </div>\n\n <div className=\"portStyle\">\n\n </div>\n <div className=\"cvStyle1\">\n\n </div>\n <div className=\"nameStyle\">\n <h1 >Lin</h1>\n <h1 >Edmund</h1>\n </div>\n </div>\n)\n\n\nand the related CSS:\n\n\r\n\r\n#homeDiv {\r\n overflow-y: hidden;\r\n overflow-x:hidden;\r\n}\r\n.nameStyle {\r\n height: 100vh;\r\n width: 30%;\r\n display: flex;\r\n justify-content: flex-end;\r\n flex-direction: column;\r\n \r\n}\r\n\r\n.portStyle {\r\n height: 100vh;\r\n width: 20%;\r\n position: relative;\r\n float: right;\r\n background-color: #000;\r\n}\r\n\r\n.cvStyle1 {\r\n height: 100vh;\r\n width: 20%;\r\n position: relative;\r\n float: right;\r\n background-color: #ccc;\r\n \r\n}\r\n\r\n\r\n\n\nNot sure if I should use CSS animations or if I should use React animations for this, as I know CSS does not support onMouseOver unless there is some work around for this. The Navbar element is just a navbar I have aligned to the right of the screen, 20% width and 100vh height." ]
[ "javascript", "html", "css", "reactjs", "animation" ]
[ "Editing HTML code on window open", "What I need is in a window I want to open, there is this:\n\nwidth=\"989\" height=\"560\"\n\n\nAnd I want the width and height to be that of the screen." ]
[ "c#", "html", "edit" ]
[ "Displaying product thumbnail and attribute in Woocommerce cart and checkout", "I am isplaying product attributes in my Woocommerce checkout table, see my previous question: Show Woocommerce taxonomy in emails\n\nI also want to show the product image, so my ideal would be: Product image on the left and beside it product name, in the next row product quantity and after that the attribute. If I use this function\n\n add_filter( 'woocommerce_cart_item_name', add_thumbnail_to_cart_items, 10, 3 );\n function add_thumbnail_to_cart_items( $product_name, $cart_item, $cart_item_key ){ \n\n\n if ( ! is_checkout() ) return $product_name;\n\n $product = $cart_item['data']; \n $thumbnail = $product->get_image(array( 70, 70)); \n\n $opening_div = '<div id=\"checkout_thumbnail\" style=\"float:left; padding-right:15px;\">'; \n return $opening_div . $thumbnail . '</div> ' . $product->get_name(); \n} \n\n\nthe attribute is not shown any longer. How can I display both?" ]
[ "php", "wordpress", "woocommerce", "cart", "checkout" ]
[ "Cannot convert a pandas series into a 2d array?", "I have pandas series. It's size is 10240. Each value in the series is a 2d array of size 143. I am making all the 2d array of size 143 into a 1d array of size 143. After that I am converting the series into a numpy array. So I should get a 2d array of size (10240*143), right? But I am not getting that. I am getting 2d array of shape (10240, ) and of size 10240. I don't know what I am doing wrong. My code is given below.\n\ndef get_subjects(x):\n print(type(x)) #2d list\n print(len(x)) # 2, 143\n x = to_categorical(x, num_classes=len(subjects)+1).sum(axis=0)\n print(type(x)) # numpy array\n print(x.size) # 143\n return x\n\nprint(type(train_data[\"subject_id\"])) # pandas series\nprint(train_data[\"subject_id\"].size) # 10240\nsubject_train = train_data[\"subject_id\"].apply(lambda x: get_subjects(x)).to_numpy()\nprint(type(subject_train)) # numpy array\nprint(subject_train.size) # 10240" ]
[ "python-3.x", "pandas", "numpy" ]
[ "Validating @RequestParam in Spring 3 MVC", "How do I validate Spring @RequestParam so that they are in BindingResult with out having to use some sort of POJO transfer object (@ModelAttribute)?\n\nI could use MapBindingResult and put the request parameters in that but then I have to get that binding result into the model.\n\nWhich I can do with org.springframework.validation.BindingResult.MODEL_KEY_PREFIX + name.\n\nIs there a better way to bind and validate request parameters (instead of making another POJO)?" ]
[ "java", "spring", "validation", "data-binding", "spring-mvc" ]
[ "Get the list of all files under the folder resources", "My unit test project structure looks like this:\n\n.\n└── src\n └── test\n β”œβ”€β”€ java\n β”‚ └── foo\n β”‚ └── MyTest.java\n └── resources\n β”œβ”€β”€ file1\n |-- ...\n └── fileN\n\n\nIn MyTest.java, I would like to get a list of all files under src/test/resources/ :\n\nFile[] files = GET_ALL_RESOURCE_FILES();\n\n\nhow to do it in Java?" ]
[ "java", "junit" ]
[ "Find current UK time", "I'm writing a system which will be used in the US, however it must make reference to the current UK time.\n\nI need an offline solution which will display the current UK time (taking into account GMT and BST)\n\nIs there an inbuilt function in vb.NET which can handle this, or is there a programatic way of retrieving this value?" ]
[ "vb.net", "datetime", "timezone" ]
[ "Carousel slide show in not responsive to smaller device", "Here is my HTML code.\n\n<div id=\"carouselExampleIndicators\" class=\"carousel slide\" data-ride=\"carousel\" >\n <ol class=\"carousel-indicators\">\n <li data-target=\"#carouselExampleIndicators\" data-slide-to=\"0\" class=\"active\"></li>\n <li data-target=\"#carouselExampleIndicators\" data-slide-to=\"1\"></li>\n <li data-target=\"#carouselExampleIndicators\" data-slide-to=\"2\"></li>\n </ol>\n <div class=\"carousel-inner\">\n <div class=\"carousel-item active\">\n <img class=\"d-block w-100\" src=\"background1.jpg\" style=\"height: 700px;\" alt=\"First slide\">\n </div>\n <div class=\"carousel-item\">\n <img class=\"d-block w-100\" src=\"wallpaper.png\" style=\"height: 700px;\" alt=\"Second slide\">\n </div>\n <div class=\"carousel-item\">\n <img class=\"d-block w-100\" src=\"background3.jpg\" style=\"height: 700px;\" alt=\"Third slide\">\n </div>\n </div>\n <a class=\"carousel-control-prev\" href=\"#carouselExampleIndicators\" role=\"button\" data-slide=\"prev\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Previous</span>\n </a>\n <a class=\"carousel-control-next\" href=\"#carouselExampleIndicators\" role=\"button\" data-slide=\"next\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Next</span>\n </a>\n</div>\n\n\nHere I have used all images of different heights and give them fixed height to be looked good on big screen but how do I make them responsive to smaller device because on smaller screen slide show looks too much distorted. I could use media queries but is there any other way around." ]
[ "html", "bootstrap-4" ]
[ "Object spread operator throw error in microsoft edge", "I have code:\nlet a = {a: 'a', b: 'b'};\nlet b = {c: 'c', d: 'd'};\nlet c = {...a, ...b};\n\nIn chrome/firefox/... its display: c = {a: 'a', b: 'b', c: 'c', d: 'd'}, but in microsoft edge it throw error Expected identifier, string or number.\nI try to use cdn.polyfill.io and https://babeljs.io/docs/en/babel-polyfill but no luck.\nWhat i can do to run my webpack code in microsoft edge?" ]
[ "javascript", "object", "microsoft-edge", "spread-syntax" ]
[ "TypeError: Object # has no method 'forEach' at new LoadersList while setting up react project", "I was successful setting up te react development set up. But running npm start is giving following error.\n\nI cant figure out from where this error is getting generated. Pls help!\n\n TypeError: Object #<Object> has no method 'forEach' at new LoadersList \n (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\webpack-\n core\\lib\\LoadersList.js:7:12) at new NormalModuleFactory (C:\\Users\n \\User\\AppData\\Roaming\\npm\\node_modules\\webpack\n \\lib\\NormalModuleFactory.js:16:17) at Compiler.createNormalModuleFactory \n (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\webpack \n \\lib\\Compiler.js:369:28) at Compiler.newCompilationParams (C:\\Users \n \\User\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:382:29) at \n Compiler.compile (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\webpack\n \\lib\\Compiler.js:389:20) at Watching.<anonymous> (C:\\Users\\User\\AppData\n \\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:46:17) at Compiler.next \n (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\n \\lib\\Tapable.js:67:11) at Compiler.invalidAsyncPlugin (C:\\Users\\User\\AppData\n \\Roaming\\npm\\node_modules\\webpack-dev-server\\node_modules\\webpack-\n dev-middleware\\middleware.js:80:3) at Compiler.applyPluginsAsync (C:\\Users\n \\User\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\n \\lib\\Tapable.js:71:13) at Watching._go (C:\\Users\\User\\AppData\\Roaming\n \\npm\\node_modules\\webpack\\lib\\Compiler.js:44:16)\n\n\nPlease suggest. Thanks!" ]
[ "node.js", "reactjs", "webpack", "webpack-dev-server" ]
[ "find size of dictonary in mongo", "I have a collection 'school', which contains two fields,standard and students(studying in that standard).I want to find the number students in a particular standard.\n\nThe structure of school collection is:\n {\n\"_id\" : ObjectId(\"5809cb458c392528de086601\"),\n\"standard\" : 'First',\n\"students\":{\n '1':{name: 'Shawn','age': 6},\n '2':{name: 'Ryan','age': 5},\n '3':{name: 'Caoline','age': 6},\n '4':{name: 'Debian','age': 6},\n '5':{name: 'Zara','age': 5},\n }\n}\n\n\nI know the query to find a particular Standard (eg: 'First'). It would look like this: db.school.findOne({'standard':'First'})\n\nBut I don't know How to find the number of students for that standard. Since students is a dictionary object. So my question is How to find the size of dictionary in MongoDb?" ]
[ "mongodb", "dictionary" ]
[ "Abstract base class definition", "Can this be a definition of an abstract base class : \"contains only pure virtual methods and often serves as an interface specification for derived classes\"\n\nor can the abstract base class also contain other methods(also virtual)" ]
[ "c++" ]
[ "ASP.Net :Error while uploading a file to remote location from localhost?", "Situation:\n\nI working on image gallery type application where i have two different servers. One that will hold the image files(CDN or File Server can say) only. Another will have the web pages that will access those images. \n\nFor example \n\nSite is hosted on http://www.abc.com\nand \nImages are uploaded under directory on http://www.imageserver.com/uploads/images/.\nAssuming I have full access to both of them and also granted read/write permission to the Images directory.\n\nProblem:\n\nWhen I use FileUpload.SaveAs from my localhost {while development}, it throws an exception saying somthing similar to: \n\nThe declared path is not rooted and SaveAs requires rooted path.\n\nPlease help. Thanks in Advance" ]
[ "c#", "asp.net", "file-upload" ]
[ "Javac compilation target 1.7 differs from Eclipse Juno compilation JDK 1.7 when infering Generics", "I currently have a compilation issue with Gradle using target 1.7 and source 1.7 vs Eclipse Juno using the built-in 1.7 jdk.\n\nI have 5 classes : \n\nInfo.java --> Interface that has no methods (for example)\n\npublic interface Info { //... }\n\n\nRealInfo.java --> Interface that extends the Info interface\n\npublic interface RealInfo extends Info { //... }\n\n\nAbstractManager.java --> Abstract class that has the method \"getInfo()\"\n\npublic abstract class AbstractManager<I extends Info>\n{\n public I info;\n public I getInfo()\n {\n return this.info;\n }\n}\n\n\nManager.java --> Interface that has the method \"getInfo()\"\n\npublic interface Manager\n{\n public <I extends Info> I getInfo();\n}\n\n\nDefaultManager.java --> Extends AbstractManager\n\npublic class DefaultManager extends AbstractManager<RealInfo> implements Manager\n{\n //...\n}\n\n\nIf you copy/paste this code into eclipse, everything works fine. There's no compilation error. However, if I build it with Gradle, using target jdk 1.7, the compiler will not like it :\n\nDefaultManager.java:16: error: DefaultManager is not abstract and does not override abstract method <I>getInfo() in Manager\npublic class DefaultManager extends AbstractManager<RealInfo> implements Manager\n ^\n where I is a type-variable:\n I extends Info declared in method <I>getInfo()\n\n\nDo you have any idea on what could happen there?" ]
[ "eclipse", "compiler-construction", "javac", "java-7" ]
[ "H2 Database timestamp insert null", "Good Day,\n\nI need to clear a timestamp on my H2 Database. I can set values but I can't set it to null/clear it!\n\nWhat is the command?\n\nUPDATE TABLE SET DATE='null' WHERE USERNAME='User'\n\n\ndoesnt work!" ]
[ "database", "h2" ]
[ "Scala test unexpected error,')' expected but '}' found", "Here is my code to find maximum from list\n\nobject kp {\n def main(args: Array[String]) {\n\ndef max(xs: List[Int]): Int = xs match {\n case Nil => throw new java.util.NoSuchElementException()\n case List(x: Int) => x\n case x :: y :: rest => max( (if (x > y) x else y) :: rest )\n} \n\nval a = 1 :: 4 :: 5 :: -4:: Nil\nprintln(max(a))\n\n}\n}\n\n\nWhen I want to test my codes in example folder with sbt\n\n[info] Compiling 1 Scala source to /home/milenko/example/target/scala-2.11/classes...\n[error] /home/milenko/example/src/main/scala/example/ListsSuite.scala:138: ')' expected but '}' found.\n[error] }\n[error] ^\n[error] /home/milenko/example/src/main/scala/example/ListsSuite.scala:148: ')' expected but '}' found.\n[error] }\n[error] ^\n[error] two errors found\n\n\nErrors refer to\n\n test(\"maximum with one negative number\") {\n assert(max(List(1,4,5,-4)) === 5 )\n }\n\n\nand\n\n test(\"maximum with some repeated elements\"){\n assert(max(List(2,2,2,2)) === 2 )\n }\n\n\nI do not have a clue why this happens.Here is the whole file\n\nhttp://www.filedropper.com/listssuite\n\nNow I have deleted some test from the file and it has only 135 lines.But I got the same \n\nwc -l ListsSuite.scala \n135 ListsSuite.scala\nmilenko@milenko-desktop:~/example/src/test/scala/example$ cd ~/example\nmilenko@milenko-desktop:~/example$ sbt\n[info] Loading global plugins from /home/milenko/.sbt/0.13/plugins\n[info] Loading project definition from /home/milenko/example/project\n[info] Set current project to progfun1-example (in build file:/home/milenko/example/)\n> test\n[info] Compiling 1 Scala source to /home/milenko/example/target/scala-2.11/classes...\n[error] /home/milenko/example/src/main/scala/example/ListsSuite.scala:138: ')' expected but '}' found.\n[error] }\n[error] ^\n[error] /home/milenko/example/src/main/scala/example/ListsSuite.scala:148: ')' expected but '}' found.\n[error] }\n[error] ^\n[error] two errors found\n[error] (compile:compileIncremental) Compilation failed\n[error] Total time: 1 s, completed 16/03/2017 13:43:43\n\n\nVery strange, what do :138 and :148 indicate?" ]
[ "scala", "sbt" ]
[ "How to calculate eligibility of objects to garbage collector in Java?", "Please clarify my doubt.\n\nclass A{\nLong weight = 1000L;\n}\npublic class B extends A{\n public static void main (String[] args){\n B b = new B();\n B c = new B();\n b = null; \n c = null;//going to gc.\n }\n}\n\n\nHere in the above code, while reaching \"going to gc\" how many objects are eligible for garbage collector?\nAs far as i know args[], b, c and two Long objects totally 5 are eligible. But some says totally 4. They are saying that no two Long object will be created in heap but only one.\n\nPlease clarify my doubt." ]
[ "java", "garbage-collection" ]
[ "Install another package in MSI Installer", "I use MSI Installer for my project's setup. The project is a PowerPoint AddIn.\nTo run my project, I need to install a third party package (an exe file). As I investigated, this package installs on my computer:\n\n\na dll file in the user's application folder\nsome dll files in C:\\WINDOWS\\assembly\\GAC_MSIL\\\n\n\nComing back to my MSI Installer. There are 2 solutions:\n\n1) Including all the package's dll files above into my project, and create a MSI Setup as normal.\n\nI always got error like: \"Retrieving the COM class factory for component with CLSLD {38...} failed due to the following error 80... The specific module could not be found. Exception from HRESULT:0X80...\"\n\n2) Create a custom action in MSI Setup, and try to install the package before installing our project.\n\nAnd when uninstalling the project, we need to uninstall the package first.\n\nAny other solutions? or any suggestion?\nThanks\n\nNote: I am using PowerPoint 2010, 2013, VS Ultimate 2013, VSTO, C#" ]
[ "c#", "visual-studio-2013", "windows-installer" ]
[ "Distinguishing between form inputs", "I have several inputs (file) in my html form. Is there any way on my servlet when the form is submitted that I can get the name attribute of the file tag? I'm asking because the form has 2 different sections for uploading forms, and I need to put the forms into 2 different categories when I process them in the Servlet, and I'm hoping to use the input name prefix to tell what section of the form the file came from. I have prefixes on the input 'name' attributes, but I'm not sure how I can get that on the servlet.\n\nI know with a traditional form, with say an input of type text, I can say: request.getParameter(\"myInputName\") and get the object, but I'm not sure how to handle this with file inputs." ]
[ "html", "apache", "jakarta-ee", "servlets" ]
[ "How to dissalow nginx serving static files when subdomain isn't recognized by django?", "I have a configuration with statics file served by nginx at location /static and django (though gunicorn) on / location.\nMy app in multitenant and i use subdomain for identifying tenant.\nNginx servername is:\nserver_name ~^(.*.)?my-domain.loc$;\nMy django is sending 404 error when accessing / on a subdomain that don't exist. I want to not give response to (ever django or static) when django response is 404 for a subdomain.\n\nany idea ?" ]
[ "django", "nginx", "multi-tenant", "saas", "wildcard-subdomain" ]
[ "adding single quotes to helm value", "In my values.yaml file for helm, I am trying to create a value with quotes but when I run it, it gives a different result\n\nvalues.yaml\n\nannotation: '\"ports\": {\"88\":\"sandbox-backendconfig\"}}'\n\n{{ .Values.annotation }}\n\n\nwhat shows when I do dry run\n\n\"ports\": {\"88\":\"sandbox-backendconfig\"}}\n\n\nhow can I make the single quotes around it show also" ]
[ "kubernetes", "yaml", "kubernetes-helm" ]
[ "Django form save - update boolean field", "I have the following model:\n\nclass Survey(models.Model):\n is_published = models.BooleanField()\n\n\nwhich is set to \"False\" as the default.\n\nI am using modelForm to add this into a form. When I call the save() method on the form, I want to change \"False\" to \"True\" and save this to the db. How do I do that?\n\nI've read through https://docs.djangoproject.com/en/1.11/topics/forms/modelforms/ and it doesn't explain how this would work." ]
[ "django", "forms", "save", "boolean", "modelform" ]
[ "Organizing School Workspace/Writing Makefile", "I am doing some C programming for school and I have found myself reusing libraries that I have created, over and over again (stacks, user input, error handling, etc). \n\nRight now, my personal SVN directory structure looks like this:\n\ntrunk/\n|-- 2520\n| `-- assignments\n| |-- A2\n| |-- Makefile\n| |-- README\n| |-- calculator.c\n| |-- calculatorlib.c\n| `-- calculatorlib.h\n`-- libs\n |-- misc\n | |-- errorlib.c\n | |-- errorlib.h\n | |-- userinputlib.c\n | `-- userinputlib.h\n `-- stacks\n |-- stacklib.c\n `-- stacklib.h\n\n\nSome of these files (userinputlib and errorlib) get used in almost every project I work on for obvious reasons. I want to be able to include these files in a project's workspace (2520/assignments/A2) without having to copy the files because I don't want to manage to copies of a file and I don't want to check in two copies of the same file in SVN.\nI would like to have the library files in the project workspace so my Makefile works without having to do to much manual configuration (or hard-coding paths).\n\nAt first, I thought about symbolic links (which SVN and tar support) but I can't seem to compile my assignment given my headers in another directory.\n\nI can manually compile each header to an object file and do the final linking, but I'm not sure how to do this in a Makefile automatically. \n\nAny help or any alternative to how I have my environment setup is appreciated.\n\nThanks!\n\nEDIT: I forgot to mention that I have searched Google and have found a few pages describing automatic dependency generation (perhaps I want this?) using gcc -MM and I have read over the GNU Make manual but nothing jumped out at me." ]
[ "linux", "svn", "gcc", "makefile", "organization" ]
[ "How to convert below example into implements Runnable interface and override run method", "I have 2 simple classes like bellow. However i would like to implement the runnable interface in the class declaration instead of using it on Thread object declaration . However i am failing to gasp how to convert this into a above format. \n\npublic class Main{\n\n static Runner r1 =new Runner();\n public static void main(String[] args) {\n // TODO Auto-generated method stub\n\n Thread t1 = new Thread (new Runnable() {\n\n @Override\n public void run() {\n // TODO Auto-generated method stub\n try {\n r1.firstThread();\n } catch (InterruptedException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n });\n\n Thread t2 = new Thread (new Runnable() {\n\n @Override\n public void run() {\n // TODO Auto-generated method stub\n try {\n r1.secondThread();\n } catch (InterruptedException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n }\n }\n });\n\n }\n}\n\n\npublic class Runner {\n public void firstThread() throws InterruptedException\n {\n }\n\n public void secondThread() throws InterruptedException\n {\n }\n}" ]
[ "java", "multithreading", "inheritance" ]
[ "Centering the Navigation Bar and its Elements in HTML", "I am having problems creating a centred navigation bar where the child elements are also centred. I used nav-justified which almost works but then that seems to break the model so that when the window is smaller the collapsed menu stops working properly.\n\nHtml code is:\n\n <header id=\"header\">\n <div class=\"container\">\n\n <!-- MOBILE MENU -->\n <button id=\"mobileMenu\" class=\"fa fa-bars\" type=\"button\" data-toggle=\"collapse\" data-target=\".bs-navbar-collapse\"></button>\n\n <!-- NAV MENU -->\n <nav class=\"collapse navbar-collapse bs-navbar-collapse\" role=\"navigation\">\n <ul id=\"onepageNav\" class=\"nav nav-justified\"><!-- id=\"onepageNav\" for homepage only -->\n <li class=\"active\"><a href=\"#how\">How</a></li>\n <li><a href=\"#help\">Help</a></li>\n <li><a href=\"#support\">Support</a></li>\n <li><a href=\"#consultancy\">Consultancy</a></li>\n <li><a href=\"#blog\">Blog</a></li>\n </ul>\n </nav>\n <!-- /NAV MENU -->\n\n </div>\n </header>\n\n\nNot sure what css to include so will add whatever you need to see.\n\nThere are a few questions on this already out there but the answers don't seem to work for me.\n\nReally very grateful for any help and explanations as I am quite new to this.\n\nThank you" ]
[ "html", "css", "navigation", "navbar", "centering" ]
[ "Can't get response of GET request Axios", "I'm calling a GET Request from OpenWeather APIs like below:\n\nconst config = {\n headers: {\n accept: 'application/json',\n },\n data: {},\n };\n const url = 'http://samples.openweathermap.org/data/2.5/forecast?id=524901&appid=b6907d289e10d714a6e88b30761fae22';\n Axios.get(url, config).then((response) => {\n console.log(response);\n }).catch((e) => {\n Alert.alert('error', `${e}`);\n });\n\n\nbut .then() doesnt get called and after about 15 seconds it throw an exception and catch alert is shown (saying Network Error while other API calls are working so network error is not really the problem).\n\nthe url is working in browsers but Axios can't make that call. \nanyone has any idea whats happening?" ]
[ "javascript", "android", "ios", "react-native", "axios" ]
[ "UIWebView fonts not found in iOS 8", "I'm updating my app for iOS 8 and have found UIWebView's do not display Helvetica Neue UltraLight correctly with both italics and bold applied, nor Helvetica Neue Light with the tag.\n\nHas anybody seen this or have any workaround? I've reported this as a bug to Apple, but they never do anything about bug filed.\n\nFor example:\n\nem, i {\n font-family: \"HelveticaNeue-UltraLight\", 'Helvetica Neue UltraLight';\n font-weight:600;\n}" ]
[ "ios", "css", "fonts", "uiwebview", "ios8" ]
[ "There is a JavaScript error in my rails application!", "As the title said, I got a problem! i encountered the \"RJS Error:[object error]\",the code in my application is \n page << \"#{hidden_print(\"#{url_for(:controller => 'tables', :action => 'dispatch', :id => id, :pop => true, :print =>true)}\")} \"\n\nthe method hidden_print is \n\n def hidden_print(url)\n \"window.parent.headFrame.document.all.iframe_helper.src = '#{url}';\" \n end" ]
[ "javascript", "ruby-on-rails", "ruby" ]
[ "How to get debug information for an abstract(?) pimpl in C++?", "I have a wrapper class that delegates its work to a pimpl, and the pimpl is a pointer to a baseclass/interface with no data that is specialized in several different ways.\n\nLike this:\n\nclass Base\n{\n void doStuff=0;\n};\n\nclass Derived\n{\n int x,y;\n void doStuff()\n {\n x = (x+y*2)*x; //whatever\n }\n};\n\nclass Wrapper\n{\n Base* _pimpl;\n void doStuff()\n {\n _pimpl->doStuff();\n }\n};\n\n\nNow this works fine most of the time, but when going into the debugger I can't view x,y of the Derived class (because it could be anything). Normally this is irrelevant, but when something goes wrong seeing the state of Derived can be important, but pimpl obscures the state too much (however that's the original idea of a pimpl, so I guess I can't really complain).\n\nNow I have a tostring() function that prints the state out for debug purposes, but was wondering if there is a better solution, to debug this sort of construct in VisualStudio in particular, but a general solution would be better.\n\nThanks" ]
[ "c++", "visual-studio", "debugging", "pimpl-idiom" ]
[ "How does numpy handle data files with uncertainty values, e.g., 0.6499(6)?", "Here is a snippet of a large data set I am working with:\n\n# p* T* P* U* P*_cs U*_cs Steps dt*\n0.1 6.0 0.6499(6) -0.478(2) 0.6525 -0.452 30000 0.002\n0.2 6.0 1.442(1) -0.942(2) 1.452 -0.890 30000 0.002\n0.3 6.0 2.465(3) -1.376(1) 2.489 -1.298 30000 0.002\n0.4 6.0 3.838(5) -1.785(3) 3.880 -1.681 20000 0.002\n0.5 6.0 5.77(1) -2.131(3) 5.84 -2.000 20000 0.002\n0.6 6.0 8.51(2) -2.382(5) 8.60 -2.225 20000 0.002\n0.7 6.0 12.43(2) -2.501(4) 12.56 -2.318 20000 0.002\n0.8 6.0 18.05(2) -2.416(4) 18.22 -2.207 20000 0.002\n0.9 6.0 26.00(2) -2.058(4) 26.21 -1.823 20000 0.004\n1.0 6.0 37.06(3) -1.361(6) 37.32 -1.100 20000 0.002\n1.1 6.0 52.25(2) -0.216(4) 52.57 0.072 20000 0.002\n1.2 6.0 72.90(5) 1.502(9) 73.28 1.816 20000 0.002\n1.25 6.0 85.71(5) 2.612(8) 86.12 2.939 20000 0.002\n\n\nLoading in this data set using np.loadtxt fails because of the uncertainties for the P* and U* values. Is there a built-in tool for handling this to avoid manually editing the data files? \n\nI am looking at the uncertainties package as a possible solution but I wonder if numpy already has something for this." ]
[ "python", "numpy", "uncertainty" ]
[ "UIImagePNGRepresentation() rotate my UIImage", "The image comes from UIImagePickerViewController:\n\nfunc imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {\n\n if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {\n print(\"1: \\(image)\")\n if let data = UIImagePNGRepresentation(image) {\n print(\"2: \\(UIImage(data: data))\")\n }\n }\n}\n\n\nThe result is following:\n\n\n 1: size {3024, 4032} orientation 3 scale 1.000000\n 2: Optional( size {4032, 3024} orientation 0 scale 1.000000)\n\n\nWhy UIImagePNGRepresentation() changes orientation of the image? How to prevent from this?" ]
[ "ios", "swift", "uiimagepickercontroller" ]
[ "Detecting collision with color on a canvas in HTML5+JavaScript", "I'm searching for a way in JavaScript how I can detect if an object like this:\n\nvar box = {\n x: 5,\n y: 19,\n width: 10,\n height: 5,\n draw: function(ctx){...draw Box on context \"ctx\"},\n touchingColor: function(ctx,color){...}\n}\n\n\nSo basically what I'm looking for is a function touchingColor, that returns true if my box is touching the specified color in the specified context.\n\nIs there a way to accomplish that, or do I need to keep track of the things I drawed on the canvas?" ]
[ "javascript", "html", "canvas", "html5-canvas" ]
[ "Binary operator '*' cannot be applied to two 'Int?' operands", "Trying to calculate BMI ( body mass index ) as an app in Swift. Making the calculate function I cannot find the solution\n\n@IBOutlet weak var height: UITextField!\n@IBOutlet weak var weight: UITextField!\n\n\n\n\n@IBAction func calculate(_ sender: UIButton) {\n\n }\n\n@IBAction func reset(_ sender: UIButton) {\n }\n\nfunc calculateIMC(){\n\n var textHeight = height.text\n var textWeight = weight.text\n var intHeight:Int? = Int(textHeight!) ?? 0\n var intWeight:Int? = Int(textWeight!) ?? 0\n\n let calculateHeight: Int? = (intHeight * intHeight)\n}\n\n\nError message on the last line of code:\n\nBinary operator '*' cannot be applied to two 'Int?' operands" ]
[ "swift", "xcode", "swift5" ]
[ "Playing YouTube Videos using mediaplayer of eclipse", "There are many controls to play youtube videos in eclipse like WebView, YouTubePlayerView, VideoView etc. \n\nMy doubt is can we play it using media player? Found that, url having extension like .mp4 can play using media player. But when tried with youtube video url it shows an error Start Called in state 0 .\n\nif(isYTFlag){ //if youtube url\n\n mediaPlayer.setDataSource(videoURL);\n }\n else{ //local mp4\n\n afd = this.getResources().openRawResourceFd(Integer.parseInt(videoURL));\n mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getDeclaredLength());\n }\n\n\nPlease help to verify" ]
[ "android", "eclipse", "video", "youtube" ]
[ "Not removing vacant space in grid recyclerview", "Using FirebaseRecyclerAdapter to populate RecyclerView\nto hide an item\nholder.itemView.setVisibility(View.GONE);\n\nto show an item\nholder.itemView.setVisibility(View.VISIBLE);\n\nIt's working great for Linear RecyclerView but not removing vacant space in grid RecyclerView\nLinearLayoutManager linearLayoutManager = new GridLayoutManager(this, 2);\nusersList.setLayoutManager(linearLayoutManager);\n\nLike, I mentioned, I am using a Grid Recyclerview, and there is a blank cell or two in between.\nXML (users_layout.xml)\n<?xml version="1.0" encoding="utf-8"?>\n<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"\n android:layout_width="match_parent"\n android:layout_height="wrap_content"\n android:id="@+id/linearLayout"\n android:padding="9dp"\n android:layout_margin="9dp"\n android:gravity="center"\n android:orientation="vertical">\n\n .....\n\n</LinearLayout>" ]
[ "android", "android-recyclerview", "gridlayoutmanager" ]
[ "error A2070: invalid instruction operands while using nested while loop in assembly language", "I am trying nested while loop in assembly using masm. I am getting the \"error A2070: invalid instruction operands\" at line 15 i.e at the endw directive of internal while loop while running the following code.\n\nINCLUDE Irvine32.inc\n.data\ni byte 1\nj byte 2\n.code\nmain PROC \nxor eax,eax\n .while i<5\nmov j, 2\n.while j<i\n mov al, j\n call writeDec\n call crlf\n inc j\n.endw\ninc i\n .endw\nexit\nmain ENDP\nEND main\n\n\nI cant find the reason for this. Can anyone help me?" ]
[ "assembly", "x86", "masm", "irvine32" ]
[ "My rake db:migrate is failing and I can't figure out how to fix it", "when I run the rake db:migrate I get this\n\nInvoke db:migrate (first_time)\n** Invoke environment (first_time)\n** Execute environment\nrake aborted!\nsession_store.rb:3: syntax error, unexpected ':', expecting $end\n...sion_store :cookie_store, key:\n\n\nNow I'm running it on a fresh ubutu box. \n$ rails -v = Rails 3.1.3\n$ ruby -v = ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]\n\nThe file I get error on contains some comments and this line of code\n\nEdm2::Application.config.session_store :cookie_store, key: '_edm2_session'\n\n\nNotes... \nI'm not calling $ sudo rake db:migrate. so the like questions up here doesn't have the answer.\nwhat I've read indicates that the hash is wrong, and putting in the old one seems to stop the bleeding.. But I don't want a hymopheliactic application where I am stopping the bleeding all over. I'd rather know what's causing the issue and fix it at the source. \n\n\n\nIt might help the \"helpers\" to mention that if I call $rails new demo the file session_store has a different format.. it seems to use the old hash markings... this might be a clue to some, but it is just a pointer to this newb" ]
[ "ruby-on-rails", "migration" ]
[ "SQL Inner Join and Grouping", "It's been a while since I've done SQL, but I have a rather pressing issue.\n\nMy db-layout is as following: \n\nNow, starting from a Users.ID, I want to get all the Rounds the user has played. The user could be Hosts.HostID, Host.GuestID, or even both. Where he is both, it should not show op in the results.\n\nThe results I need from the Query are the Hosts.Name and all the fields of Rounds. In general what I want to do is display a list of all the Hosts (actually these are the Games) in which the user has participated, as a Host or as a Guest, along with perhaps a total score. When clicking on this, some dropdown will appear showing the individual round scores, words, ...\n\nNow I was wondering whether this was possible in a single query. Of course I could do a query getting all the Hosts and then per Host a query for each Round, but that doesn't seem that performant. This is what I've come up with so far:\n\nSELECT Rounds.ID, Rounds.GameID, Rounds.Round, Rounds.Score, Rounds.Word\n , Hosts.ID, Hosts.HostID, Hosts.GuestID \nFROM Rounds INNER JOIN Hosts \nON Rounds.GameID = Hosts.ID \nINNER JOIN Users \nON Hosts.hostID = Users.ID \nWHERE Users.ID = 5\n\n\nThe issue is however that it doesn't filter out where the user is both host AND guest, and I can't seem to Group it by Hosts.ID either." ]
[ "sql", "sql-server", "inner-join" ]
[ "Would like to use (kanban) board in Azure Devops with Task cards on the board", "In Azure devops it seems that you are only allowed to use userstories, issues, bugs as cards at the Boards in the menu. Our team would like to use tasks cards instead of a tasks checklist inside a userstory at boards. We would like to see that also a task is also added to the WIP limit if the task hit a column.\n\nIn sprints you are able to use tasks as cards but at boards not for which I am also curious to know why Microsoft has chosen this. Why in sprints it is allowed and at Kanban boards not? \n\nIf anybody has any good idea's or suggestions to work around this please let me know.\n\nWe could also use Userstory more as tasks but that is bit contradicting with the way we are using userstories" ]
[ "azure-devops", "task", "kanban", "sprint" ]
[ "Parsing Out Code Between Comment Blocks PHP", "Lets say I have the following piece of start in a PHP file:\n\n/**\n * @SomethingStart\n */\nprotected static $var1 = '1';\nprotected static $var2 = '2';\nprotected static $var3 = '3';\n/**\n * @SomethingEnd\n */\n\n\nI am trying to figure out how I can first parse out the content between the comments with @SomethingStart and @SomethingEnd (not including the comment and then secondly, how I can replace the content between those two tags." ]
[ "php", "code-generation", "phpdoc" ]
[ "What is the purpose of this code? Is it just duplicating a Date?", "I came across an ancient piece of code by someone who doesn't work in the company anymore.\n\nI'm wondering what the purpose is of this calendar magic:\n\nif (value instanceof Date) {\n Calendar calendar = Calendar.getInstance();\n calendar.setTime((Date) value);\n return new Date(calendar.get(Calendar.YEAR) - 1900, calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));\n}\n\n\nIt seems to me this would return a new Date object with the same values as the original value. Is there some Calendar initialization going on that I'm missing? If the purpose is to return a new object with the same value, I would assume value.clone() does the job:\n\n(Date) originalDate.clone()\n// or\nnew Date(originalDate.getTime())\n\n\nVersion control shows the code never changed. Are there possible side effects of pulling the date through a Calendar first?" ]
[ "java", "date", "calendar" ]
[ "LinkedServer Openquery is throwing this error : ORA-00923: FROM keyword not found where expected", "I am running below query in SQL Server 2012 against a linked server and i am getting below error.\nAm I using an incorrect keyword/function or missing any syntex. \nThe query is running fine when I am running without openquery\n\nORA-00923: FROM keyword not found where expected\n\n\nThe query is below :\n\nselect * from openquery(LinkedServerName,\n'select t.TRANSACTION,t.PARTNER,t.DATE\n\nfrom\n\n(select st.TRANSACTION,st.PARTNER,st.DATE\n,RowNum = ROW_NUMBER() over(partition by st.TRANSACTION order by st.DATE desc)\nfrom tbltransactions st) t where t.RowNum = 1')" ]
[ "sql-server", "oracle", "linked-server", "openquery" ]
[ "Powershell Restore-SQLDatabase not working when all inputs are correct", "I am attempting to automate the process of restoring certain Databases. I am pulling the .bak files from a repo and writing a PS script to restore each one. My code looks like:\n\nRestore-SqlDatabase -ServerInstance \"(LocalDB)\\MSSQLLocalDB\" -Database \"Acct\" -BackupFile \"C:\\myFile.bak\"\n\n\nWhile these inputs would work in a normal SQL Management Studio, I get the error:\n\nRestore-SqlDatabase : System.Data.SqlClient.SqlError: Directory lookup for the file \n\n\"D:\\Data\\Databases\\SQL2008\\myFile.mdf\" \n\nfailed with the operating system error 3(The system cannot find the path specified.).\n\n+ Restore-SqlDatabase -ServerInstance \"(LocalDB)\\MSSQLLocalDB\" -Databas ...\n\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n+ CategoryInfo : InvalidOperation: (:) [Restore-SqlDatabase], SmoException\n\n+ FullyQualifiedErrorId : ExecutionFailed,Microsoft.SqlServer.Management.PowerShell.RestoreSqlDatabaseCommand\n\n\nI get confused because I dont have anything on the D drive and its looking for stuff in there despite not being referenced anywhere. I am also just overall confused on what I am doing wrong despite following the docs to a T.\n\nAll my SQL Servers are up and running." ]
[ "sql-server", "database", "powershell" ]
[ "Jsf form and <p: or <h: messages tag", "I have a simple jsf form. It's working there isn't any problem with this. \nIt's look like this way: \n\n &lt;h:form&gt;\n\n &lt;h:outputLabel value=\"Something::\" for=\"bo_close_select\"&gt;&lt;/h:outputLabel&gt;\n &lt;h:selectOneMenu value=\"#{mainKallerBean.chosedBoCloseType}\" styleClass=\"form-control\"&gt;\n &lt;f:selectItems var=\"item\" itemLabel=\"#{item.description}\" itemValue=\"#{item.id}\" value=\"#{mainKallerBean.showBoCloseTypes()}\"&gt;&lt;/f:selectItems&gt;\n\n &lt;/h:selectOneMenu&gt;\n &lt;h:outputLabel value=\"comment:\" for=\"bo_comment\"&gt;&lt;/h:outputLabel&gt;\n &lt;h:inputTextarea value=\"#{mainKallerBean.boCommentText}\" id=\"bo_comment\" styleClass=\"comment_text_bo_class\" rows=\"5\" cols=\"45\"&gt;\n\n &lt;/h:inputTextarea&gt;\n &lt;h:outputLabel value=\"num:\" for=\"bo_wf_num\"&gt;&lt;/h:outputLabel&gt;\n &lt;h:inputText value=\"#{mainKallerBean.boSrNum}\" styleClass=\"form-control\" id=\"bo_wf_num\"&gt;&lt;/h:inputText&gt;\n\n &lt;p:separator&gt;&lt;/p:separator&gt;\n\n &lt;h:commandButton action=\"#{mainKallerBean.saveKallerBoDone()}\" styleClass=\"btn btn-primary\" value=\"Save\"&gt;&lt;/h:commandButton&gt;\n\n &lt;/h:form&gt; \n\n\nBut, when I try to add &lt;p:messages closable=\"true\" &gt;&lt;/p:messages&gt;tag to it, in my browser i can see an error message:\n\n\n The form component needs to have a UIForm in its ancestry. Suggestion:\n enclose the necessary components within h:form\n\n\nBut the messages tag is inside the h:form tag.\n\nI try to create an empty form for messages tag, but it throws the same error message too. \n\nCould anybody please help me? \n\nThank you!" ]
[ "jsf", "jsf-2" ]
[ "tableView heightForRowAtIndexPath Not working", "I have table view to display comments of users \n\nI need to make height of each row dynamic depending on content height \n\ni searched for it and i found \n\n\n heightForRowAtIndexPath Method \n\n\nbut it's not working or i don't know how to use it ! \n\nhere's my code : \n\nfunc numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {\n return 1\n}\n\nfunc tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {\n let cell = tableView.dequeueReusableCellWithIdentifier(\"cell\", forIndexPath: indexPath)\n let username = cell.viewWithTag(1) as! UILabel\n\n let comment = cell.viewWithTag(2) as! UITextView\n username.text = usernames[indexPath.row]\n\n comment.text = comments[indexPath.row]\n\n return cell\n}\nfunc tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {\n return self.comments.count\n}\n\nfunc tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {\n return UITableViewAutomaticDimension;\n}" ]
[ "ios", "swift", "uitableview" ]
[ "AdMob/iAd - Do impressions count when ad view is in scroll view?", "Does the ad view need to always be visible for an impression to count? Such as could the ad view be at the bottom of a scroll view out of sight until the user reaches the bottom. Most ad views implementations I have seen have the ad view static on top of any content." ]
[ "android", "ios", "scrollview", "admob", "iad" ]
[ "How to convert cid links to http links?", "i'm writing an app that parse emails from a pop3 mailbox.\nI've extracted the attached files of the messages and now i want to convert the link in the message text.\n\nThat means \nI've this : src=\"cid:[email protected]\"\nand i want something like : src=\"http://xxx/image001.png\"\n\ncould you help me whith regexp please ?\npreg_replace('/cid:/', 'http://xxx') and now how to remove the sequence after the '@' ?\n\nthank you" ]
[ "php", "regex", "preg-replace" ]
[ "How to force Identity provider to do authentication on every request from SP", "I have an application and when i logged to the the application, it creates session cookie and SP (Apache 2.4) creates a SAML request and send it along with session cookie to the shibboleth idp V2. on first hit of any protected resource, i am getting response from IDP and SP is doing access control decisions on that,however if i click on any other or same protected resource in the same session,then there is no hit to IDP.My requirement is that on each click on any resource in the application, IDP should be hit every time &amp; send SAML response back to SP. I am guessing that SAML response came very first time is being cached by SP that stops me hitting the IDP again. \nI researched in few sites and found that there is forceAuthn=true attribute to be defined in or section in the Shibboleth2.xml or define \"ShibRequestSetting forceAuthn true\" content in the block in virual host that forces sp to send each request to idp, but it didn't worked out. \nPlease help to know how can we stop response being cached in SP and allow IDP to take new request from SP." ]
[ "cookies", "saml-2.0", "apache2.4", "shibboleth" ]
[ "Discontinuous axis in Matplotlib with categorical variable on axis", "I have a plot of values w/ errorbars with a categorical variable on the X-axis, made using the errorbar method. I have followed the instructions here to create a discontinuity in the X-axis (I'm only showing points with values &gt; or &lt; some absolute threshold).\n\nSo far so good, with one slight issue - the axis break ends up being exactly on a data point on each side, which makes it harder to read on the axis, and also, the datapoints themselves end up split in two, which is kind of awkward.\nI would like the axis break to instead be between datapoints, something like:\n----(last value before break)--/ /--(first value after break)----\nIs there a way to do this?\nThe breakpoints are determined with set_xlim, and I'm not sure if there's a way to do move them off the datapoints with a categorical x-axis...\nsort_res_h = sort_res_a[sort_res_a &gt; threshold]\nsort_res_l = sort_res_a[sort_res_a &lt; -threshold]\n\nax0.errorbar(sort_res_a.index, sort_res_a, yerr=chg_dpm_err, fmt='o')\nax1.errorbar(sort_res_a.index, sort_res_a, yerr=chg_dpm_err, fmt='o')\n\nax0.set_xlim(xmax=sort_res_h.index[-1])\nax1.set_xlim(xmin=sort_res_l.index[0])" ]
[ "python", "matplotlib" ]
[ "Move 2 windows forms together unless the second form is minimized", "So 2 days ago I asked how to move 2 forms together, I got this answer which really helped me. But now I would like to know how to move the first form, while the second one is minimized (so it has to stop moving while minimized, or it will result in a crash from the second form...)?\nI tried this:\n\nprivate void MainForm_LocationChanged(object sender, EventArgs e) {\n // All open child forms to be moved\n Form[] formsToAdjust = Application\n .OpenForms\n .OfType&lt;ChildForm&gt;()\n .ToArray();\n FormsToAdjust formsToAdjust1 = new FormsToAdjust(); //added this\n\n // If the main form has been moved...\nif (formsToAdjust1.WindowState != FormWindowState.Minimized) //and this statement as well\n{\n if (m_PreviousLocation.X != int.MinValue)\n foreach (var form in formsToAdjust) //... we move all child froms aw well\n form.Location = new Point(\n form.Location.X + Location.X - m_PreviousLocation.X,\n form.Location.Y + Location.Y - m_PreviousLocation.Y\n );\n\n m_PreviousLocation = Location;\n}\n}\n\n\nbut it can't work as it will open the second form each time the main form will be moved (yes this was a stupid attempt, but I really can't manage how to go through that problem)...\nSo the goal would be to, if the second form is minimized, keep being able to move the main form, without changing the location of the second one.\nAny help would be really appreciated, I'm going to continue searching by my side (actually searching for a while now) while waiting for a reply.Thanks :)" ]
[ "c#", "winforms" ]
[ "Removing the first observation string of dataset", "I'm importing a bunch of files and trying to read all the characters into one variable. I need the order preserved. I found this code on Stackoverflow that does what I need but it adds the 0 in the front. so instead of the \"0\" i did\n\ndata &lt;- \"\"\n\n\nThis still leaves my data variable with a blank at the beginning. I cannot subset it and remove all the \"\" blanks since my inputs have some that need to remain in there. How can I remove just the first blank \"\" or read all my files without having to add that blank there in the first place.\n\nsetwd(\"C:\\\\Users\\\\J\\\\Desktop\\\\nlp\\\\brown\")\nfiles &lt;-list.files()\ndata &lt;- 0\nfor (f in files) {\n tempData = scan( f, what=\"character\")\n data &lt;- c(data,tempData) \n\n}" ]
[ "r", "nlp", "dataset" ]
[ "On closing the main Swing window, the other thread on the EventQueue gets not created", "I write Java SE 8 desktop application. It's got a Swing UI.\n\nPlatform:\n\n\nEclipse IDE\nWindows 10 OS\n\n\nNow when I close the main window, by pressing on the \"X\" on the top-right-corner, I have a listener to listen for such event.\n\nThe listener right here:\n\n private void listenerForClosingResources(){\n this.addWindowListener(new WindowAdapter() {\n @Override\n public void windowClosing(WindowEvent e) {\n if(e.getID() == WindowEvent.WINDOW_CLOSING){\n CountDownLatch continueOn = new CountDownLatch(1);\n saveUnsavedTmpProject(continueOn);\n\n try {\n continueOn.await();\n }\n catch(InterruptedException ee) {\n ee.printStackTrace();\n } \n }\n }\n }); \n }\n\n\nSo, I use the listener to identify the window closing event, and when that happens I ask the user whether or not to save the project (it's data on DB).\n\nThis method (saveUnsavedTmpProject(continueOn);) leads to the other window which supposed to take the name under which to save the project.\n\nNow the CountDownLatch forces the main window to stay up, up till when the user confirms/rejects saving the project on the other panel.\n\nThe other class method which creates the window, leading to saving the project, is right here:\n\npublic static void getInstance(CountDownLatch continueOn, String openProjectName) {\n if(frame == null) {\n synchronized(SaveAsPane.class) {\n if(frame == null) {\n carryOn = continueOn;\n\n if(!openProjectName.isEmpty()){\n openProject = openProjectName;\n }\n\n EventQueue.invokeLater(new Runnable() {\n public void run() {\n try {\n frame = new SaveAsPane();\n frame.setVisible(true);\n frame.setLocationRelativeTo(MainGUI.getMainGUI());\n\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n }); \n }\n }\n }\n }\n\n\nNow, when I run the app, I don't get inside the run() method (and no window pops-up). But that only happens when I access this method only from the mentioned above listener. Which has the CountDownLatch, and it appears that it stops the execution of the new thread.\n\nThe latch gets counted-down when the user confirms/denies saving the project, so that the execution flow continues on.\nYet, I create the additional thread on the EventQueue.\n\nHow come that the thread gets stopped?" ]
[ "java", "multithreading", "swing", "countdownlatch", "eventqueue" ]
[ "Horizontal centering a flexbox item, with an uneven number of items", "I've got a flex container, with a logo and some links. I want the logo to be centered, and the links over on the right. The best I can seem to do is center the logo in the remaining space, which is not centered on the container.\n\nHere are some of my attempts so far:\n\r\n\r\n.header{background:#CCC;padding:1rem; margin-bottom:2rem;}\r\n.logo{background:skyblue;text-align:center;height:30px;width:200px;}\r\n\r\n/*-----------------------*/\r\n\r\n#header1 {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center; \r\n}\r\n#header1-logo {\r\n justify-self: center;\r\n}\r\n#header1-nav {\r\n justify-self: flex-end;\r\n}\r\n\r\n/*-----------------------*/\r\n\r\n#header2 {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n}\r\n#header2-logo {\r\n margin: 0 auto;\r\n}\r\n&lt;header id=\"header1\" class=\"header\"&gt;\r\n &lt;div id=\"header1-logo\" class=\"logo\"&gt;LOGO&lt;/div&gt;\r\n &lt;nav id=\"header1-nav\"&gt;\r\n &lt;a href=\"#\"&gt;foo&lt;/a&gt;\r\n &lt;a href=\"#\"&gt;bar&lt;/a&gt;\r\n &lt;a href=\"#\"&gt;baz&lt;/a&gt;\r\n &lt;/nav&gt;\r\n&lt;/header&gt;\r\n\r\n&lt;header id=\"header2\" class=\"header\"&gt;\r\n &lt;div id=\"header2-logo\" class=\"logo\"&gt;LOGO&lt;/div&gt;\r\n &lt;nav id=\"header2-nav\"&gt;\r\n &lt;a href=\"#\"&gt;foo&lt;/a&gt;\r\n &lt;a href=\"#\"&gt;bar&lt;/a&gt;\r\n &lt;a href=\"#\"&gt;baz&lt;/a&gt;\r\n &lt;/nav&gt;\r\n&lt;/header&gt;\r\n\r\n\r\n\n\nHow can I center the logo is the actual center of the flex container?" ]
[ "css", "flexbox", "centering" ]
[ "How do I click on checkbox using selenium web driver in Java?", "How do I click on checkbox using selenium web driver in Java?\n\nCode is:\n\n&lt;div class=\"icheckbox_square-purple\" aria-checked=\"false\" \n aria-disabled=\"false\" style=\"position: relative;\"&gt;\n&lt;input type=\"checkbox\" class=\"check initialChk\" value=\"7\" \n id=\"7\" style=\"position: absolute; opacity: 0;\"&gt;\n&lt;ins class=\"iCheck-helper\" \n style=\"position: absolute; \n top: 0%; left: 0%; display: block; \n width: 100%; height: 100%; \n margin: 0px; padding: 0px; \n border: 0px; opacity: 0; \n background: rgb(255, 255, 255);\"&gt;\n&lt;/ins&gt;\n&lt;/div&gt;" ]
[ "java", "selenium", "selenium-webdriver" ]
[ "List a group a names to recall later in code", "I have a list of names that I need to filter a pivot table on. I use a Case Select to make the pivot items that are equal to the names visible and all other not visible. Can I make a one time array or list of these 15 names and call the list/array name within the code instead of using the 15 names in multiple locations? I have to fun a pivot table and sort on these names many times. \n\nThis is what I am trying to avoid. It works as is, but I'm trying to save myself headaches in the future with modifications.\n\nSet table = Worksheets(\"Sheet2\").PivotTables(\"PivotTable2\")\n With table.PivotFields(\"Assigned to\")\n For Each PvI In .PivotItems\n Select Case PvI.Name\n Case \"Antone\", \"Brad\", \"Cavan\", \"Chris\", \"Daneisha\", \"Edward\", \"James\", \"Jonathan\", \"Joesph\", \"Karen\", \"Shaun\", \"Steve\", \"Timothy\", \"Tracey\"\n PvI.Visible = True\n Case Else\n PvI.Visible = False\n End Select\nNext\nEnd With" ]
[ "excel", "vba" ]
[ "How to find an open source dictionary file?", "So I am working on a lstm model for Mongolian and for one of my tools need a dictionary file (whether it's a txt file or json...)\nThe format i'm looking for is like\nmn_word1 en_word1\nmn_word2 en_word2\nmn_word3 en_word3\nmn_word4 en_word4\n...\n\nHowever I cannot find any open source Mongolian dictionary file on the internet. Where can I find such files?" ]
[ "database", "machine-learning", "dataset" ]
[ "Jquery Localscroll ie8", "I'm having a problem with the jquery localscroll plugin, it seems to work fine on all browsers except IE8.\n\nIn IE8 it scroll down and works apart from it doesn't scroll to the right id.\n\n$(document).ready(function(){\n\n $('#nav').localScroll({ duration: 2000, easing: \"swing\"});\n //.parallax(xPosition, speedFactor, outerHeight) options:\n //xPosition - Horizontal position of the element\n //inertia - speed to move relative to vertical scroll. Example: 0.1 is one tenth the speed of scrolling, 2 is twice the speed of scrolling\n //outerHeight (true/false) - Whether or not jQuery should use it's outerHeight option to determine when a section is in the viewport\n $('.parallax__one').parallax(\"50%\", 0.3);\n $('.parallax__two').parallax(\"50%\", 0.4);\n $('.slideleft').parallax(\"50%\", 0.4);\n $('.parallax__four').parallax(\"50%\", 0.3);\n $('.parallax__five').parallax(\"50%\", 0.6);\n $('.return8').parallax(\"65%\", 2);\n });\n\n&lt;header class=\"header\"&gt;\n&lt;div class=\"container\"&gt;\n &lt;ul class=\"menu\" id=\"nav\"&gt;\n &lt;p class=\"ir header__logo\"&gt;&lt;span&gt;&lt;a href=\"#one\" class=\"js-action\" date-action=\"one\"&gt;Logo&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;\n &lt;li class=\"menu__list\"&gt;&lt;a href=\"#two\" class=\"js-action\" date-action=\"two\"&gt;01&lt;b&gt;about&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;\n &lt;li class=\"menu__list\"&gt;&lt;a href=\"#three\" class=\"js-action\" date-action=\"three\"&gt;02&lt;b&gt;the product&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;\n &lt;li class=\"menu__list\"&gt;&lt;a href=\"#four\" class=\"js-action\" date-action=\"four\"&gt;03&lt;b&gt;the future&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;\n &lt;li class=\"menu__list\"&gt;&lt;a href=\"#five\" class=\"js-action\" date-action=\"five\"&gt;04&lt;b&gt;contact&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;\n\n &lt;/ul&gt;\n\n&lt;/div&gt;" ]
[ "jquery", "html", "internet-explorer-8" ]
[ "How else can I debug/rewrite the code below", "I am building a user api and one of the task is to create user by inserting a user into the database but while I came up with a code it worked, but it returned 400 bad request as oppose to 200 ok status\n\ncreate_user.php\n&lt;?php\n// required headers\nheader(\"Access-Control-Allow-Origin: http://localhost/portal/user/\");\nheader(\"Content-Type: application/json; charset=UTF-8\");\nheader(\"Access-Control-Allow-Methods: POST\");\nheader(\"Access-Control-Max-Age: 3600\");\nheader(\"Access-Control-Allow-Headers: Content-Type, Access-Control- \nAllow-Headers, Authorization, X-Requested-With\");\n\n// database connection will be here\n// files needed to connect to database\ninclude_once 'config/database.php';\ninclude_once 'objects/user.php';\n\n// get database connection\n$database = new Database();\n$db = $database-&gt;getConnection();\n\n// instantiate product object\n$user = new User($db);\n\n// submitted data will be here\n// get posted data\n$data = json_decode(file_get_contents(\"php://input\"));\n\n// set product property values\n$user-&gt;first_name = $data-&gt;first_name;\n$user-&gt;last_name = $data-&gt;last_name;\n$user-&gt;email = $data-&gt;email;\n$user-&gt;password = $data-&gt;password;\n$user-&gt;mobile_no = $data-&gt;mobile_no;\n// use the create() method here\n\n// create the user\nif(\n!empty($user-&gt;first_name)&amp;&amp;\n!empty($user-&gt;last_name)&amp;&amp;\n!empty($user-&gt;email)&amp;&amp;\n!empty($user-&gt;password)&amp;&amp;\n!empty($user-&gt;mobile_no)&amp;&amp;\n$user-&gt;create()\n){\n\n// set response code\nhttp_response_code(200);\n\n// display message: user was created\necho json_encode(array(\"message\" =&gt; \"User was created.\"));\n}\n\n// message if unable to create user\nelse{\n\n// set response code\nhttp_response_code(400);\n\n// display message: unable to create user\necho json_encode(array(\"message\" =&gt; \"Unable to create user.\"));\n}\n\n\nuser.php (class)\n\n&lt;?php\n// 'user' object\nclass User{\n\n// database connection and table name\nprivate $conn;\nprivate $table_name = \"users\";\n\n// object properties\npublic $uid;\npublic $first_name;\npublic $last_name;\npublic $email;\npublic $password;\npublic $mobile_no;\n\n// constructor\npublic function __construct($db){\n $this-&gt;conn = $db;\n}\n\n// create() method will be here\n// create new user record\nfunction create(){\n\n// insert query\n$query = \"INSERT INTO \" . $this-&gt;table_name . \"\n SET\n first_name = :first_name,\n last_name = :last_name,\n email = :email,\n password = :password,\n mobile_no = :mobile_no\";\n\n// prepare the query\n$stmt = $this-&gt;conn-&gt;prepare($query);\n\n// sanitize\n$this-&gt;first_name=htmlspecialchars(strip_tags($this-&gt;first_name));\n\n$this-&gt;last_name=htmlspecialchars(strip_tags($this-&gt;last_name));\n $this-&gt;email=htmlspecialchars(strip_tags($this-&gt;email));\n $this-&gt;mobile_no=htmlspecialchars(strip_tags($this-&gt;mobile_no)); \n$this-&gt;password=htmlspecialchars(strip_tags($this-&gt;password));\n\n// bind the values\n $stmt-&gt;bindParam(':first_name', $this-&gt;first_name);\n\n$stmt-&gt;bindParam(':last_name', $this-&gt;last_name);\n\n$stmt-&gt;bindParam(':email', $this-&gt;email);\n\n $stmt-&gt;bindParam(':mobile_no', $this-&gt;mobile_no);\n\n// hash the password before saving to database\n$password_hash = password_hash($this-&gt;password, PASSWORD_BCRYPT);\n$stmt-&gt;bindParam(':password', $password_hash);\n\n// execute the query, also check if query was successful\n\nif($stmt-&gt;execute()){\n return true;\n}\n\nreturn false;\n\n}\n}\n\n\n?>\n\nI expect to see a status code of 200 ok since i have inserted some values inside the body of the postman request. it was suppose to return 400 bad request if the values are empty" ]
[ "php", "pdo" ]
[ "Databases for running statistical tests", "I am trying to apply knowledge i learnt during statistics courses to real world datasets. \n\nI am looking for some real database/tables. Would be helpful if the link to page added as well . Format is not a constraint - i use python and i can well convert to sqlite . \n\nOne example would be [one medium sized table] of for identifying country for given ip address : http://ip-to-country.webhosting.info/node/view/6" ]
[ "python", "database" ]
[ "Iterate through CSV up to a specific row", "I have a current working script that iterates through rows in a CSV file currently, but I want to configure it to only read between a range, such as index 0 - 100, but am stuck on how to accomplish this properly. \n\nHere is my current code:\n\nfor (name, subscriber) in zip(usernames, subscriber_ids):\n #do stuff with name / subscriber in selenium driver\n if len(elements) == 0:\n # logs information\n else:\n #logs information\n\n\nwith open('file', encoding='utf-8-sig') as csvfile:\n readCSV = csv.reader(csvfile, delimiter=',')\n usernames = []\n subscriber_ids = []\n\n for row in readCSV:\n username = row[0]\n subscriberid = row[1]\n\n usernames.append(username)\n subscriber_ids.append(subscriberid)\n\n\nWhat I want to do is just read from row 0 - 100 or start at index 100-200 etc. Any assistance would be appreciated." ]
[ "python-3.x" ]
[ "Why is my collision prediction not detecting any collisions?", "Bullet objects are created with .l for location and .vel for velocity. I'm trying with a large radius of 30 and still they never collide.\n\n- (void)bulletsFired:(NSArray *)bullets li:(int)li {\n [self playBulletSound:li];\n\n for (Bullet *b in bullets) {\n [self addChild:b];\n b.tag = -1;\n b.shotNumber = shotsFired;\n }\n\n for (Bullet *b in bullets) {\n for (Bullet *bb in self.bullets) {\n float timeOfApproach = TimeOfClosestApproach(b.l, b.vel, bb.l, bb.vel, 30, 30);\n if (timeOfApproach &gt; 0) {\n NSLog(@\"time of : %f\", timeOfApproach);\n NSString *keyName = [self.collisions objectForKey:[self keyNameForTime:(int)timeOfApproach]];\n NSMutableArray *timedCollisions = [self.collisions objectForKey:keyName];\n if (timedCollisions == nil) {\n NSMutableArray *newCollisions = [NSMutableArray array];\n [self.collisions setObject:newCollisions forKey:keyName];\n }\n\n NSDictionary *collision = @{@\"b1\" : [NSString stringWithFormat:@\"%d\", bb.shotNumber], @\"b2\" : [NSString stringWithFormat:@\"%d\", b.shotNumber]};\n\n [timedCollisions addObject:collision];\n }\n }\n }\n\n\n [self.bullets addObjectsFromArray:bullets];\n\n [self.scoreCycler score:1];\n}\n\n\nI check for timeOfClosestApproach with this function:\n\nfloat TimeOfClosestApproach(CGPoint Pa, CGPoint Pb, CGPoint Va, CGPoint Vb, float Ra, float Rb) {\n CGPoint Pab = ccpSub(Pa, Pb);\n CGPoint Vab = ccpSub(Va, Vb);\n float a = ccpDot(Vab, Vab);\n float b = 2 * ccpDot(Pab, Vab);\n float c = ccpDot(Pab, Pab) - (Ra + Rb) * (Ra + Rb);\n\n // The quadratic discriminant.\n float discriminant = b * b - 4 * a * c;\n\n // Case 1:\n // If the discriminant is negative, then there are no real roots, so there is no collision. The time of\n // closest approach is then given by the average of the imaginary roots, which is: t = -b / 2a\n float t;\n if (discriminant &lt; 0) {\n t = -b / (2 * a);\n return -1;\n } else {\n // Case 2 and 3:\n // If the discriminant is zero, then there is exactly one real root, meaning that the circles just grazed each other. If the\n // discriminant is positive, then there are two real roots, meaning that the circles penetrate each other. In that case, the\n // smallest of the two roots is the initial time of impact. We handle these two cases identically.\n float t0 = (-b + (float)sqrt(discriminant)) / (2 * a);\n float t1 = (-b - (float)sqrt(discriminant)) / (2 * a);\n t = min(t0, t1);\n\n // We also have to check if the time to impact is negative. If it is negative, then that means that the collision\n // occured in the past. Since we're only concerned about future events, we say that no collision occurs if t &lt; 0.\n if (t &lt; 0) {\n return -1;\n } else {\n\n }\n }\n\n // Finally, if the time is negative, then set it to zero, because, again, we want this function to respond only to future events.\n if (t &lt; 0) {\n t = 0;\n }\n\n return t;\n}\n\n\nI keep getting -1 returned, and the bullets are never predicted to collide, even when they should based on my eyesight.\n\n if (t &lt; 0) {\n return -1;\n } else {\n\n }\n\n\nKeeps getting triggered.\n\nWhat's wrong with my timeOfClosestApproach function?" ]
[ "objective-c", "collision-detection", "game-physics" ]
[ "How to create a Webhook server like Telegram Webhook", "I need to create a Webhook server like Telegram Webhook server.\n\nI googled it but didn't find any resources!\n\nI'm not talking about receiving Webhook requests. I'm talking about creating a complete Webhook server to send HTTP POST requests to specific URLs. And our clients could receive the requests in their URLs by :\n\n$response = file_get_contents('php://input');\n\n\nAny helps would be great appreciated.\n\nP.S: \n\nSorry for my bad English." ]
[ "php", "laravel", "webhooks" ]
[ "I can't find CRYPTO_LOCK in openssl/crypto.h", "I try to install libimobliedevice package, so I install several packages including OpenSSL newest version in formal site of OpenSSL (www.openssl.org/source/gitrepo.html).\n\nHowever, when I entered make command, a error occurs.I append a picture of error.\n\n\n\nSo, I searched Internet and found some information in here (www.openssl.org/docs/man1.0.2/crypto/CRYPTO_lock.html).\n\nI found information that CRYPTO_LOCK is 0x01, but I can't find defined CRYPTO_LCOK in /usr/local/openssl/crypto.h\n\nSo. I changed crypto.h to this (in below site) because this source have CRYPTO_LOCK (web.mit.edu/crypto/arch/sgi_65/include/openssl/crypto.h).\n\nBut, errors occurred more since it is not match other existing OpenSSL files.\n\nSo, I'm stuck in this problem." ]
[ "c", "iphone", "linux", "openssl", "ubuntu-14.04" ]
[ "Regular expression in bean shell preprocessor in jmeter", "Please help me to write the regular expression for the following in jmeter\n\n\n \"connections\":\"1\",\"objects\":\"one\",\n\n\nI need to get value 1. I tried like this\n\n\"connections\":\"(.+?)\"\n\n\nThis works fine when there is a value .\n\nIf there is no value after : i.e.,\n\"connections\":\"\",\nthen reg.ex returns \", (double quotes and comma)\nwhich is creating problem. \n\nI need a regex which accepts alphanumeric and at the same point of time excludes double quotes and comma if there is no value.\n\nPlease help me. Thanks a lot!" ]
[ "regex" ]
[ "Send array to my database from android", "i'm trying to add tags of user interest using MultiAutoCompleteTextView in android studio, but here i get the result in array, how can i send array to MySql using i want help in making php file.\n\nhere is my android code:\n\nimport android.os.Bundle;\nimport android.app.Activity;\nimport android.view.Menu;\nimport android.widget.ArrayAdapter;\nimport android.widget.MultiAutoCompleteTextView;\n\npublic class MainActivity extends Activity {\n\n@Override\npublic void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n String[] str={\"Andoid\",\"Jelly Bean\",\"Froyo\",\n \"Ginger Bread\",\"Eclipse Indigo\",\"Eclipse Juno\"};\n\n MultiAutoCompleteTextView mt=(MultiAutoCompleteTextView)\n findViewById(R.id.multiAutoCompleteTextView1);\n\n mt.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());\n\n ArrayAdapter&lt;String&gt; adp=new ArrayAdapter&lt;String&gt;(this,\n android.R.layout.simple_dropdown_item_1line,str);\n\n mt.setThreshold(1);\n mt.setAdapter(adp);\n}\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.activity_main, menu);\n return true;\n} \n}" ]
[ "php", "android", "mysql", "arrays", "database" ]
[ "How to detect IOS 7 and IOS 8 and widescreen iPhone sizes to make my app universal?", "I am developing universal IOS app for all devices and IOS 7 and IOS 8. and I have this macros:\n\nThis macros is for detecting widescreen iPhone 5, this works for IOS 7:\n\n#define IS_WIDESCREEN_IOS7 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) &lt; DBL_EPSILON )\n\n\nThis macros is also for for widescreen iPone 5, but works only for IOS 8:\n\n#define IS_WIDESCREEN_IOS8 ( fabs( ( double )[ [ UIScreen mainScreen ] nativeBounds ].size.height - ( double )1136 ) &lt; DBL_EPSILON )\n\n\nI need to combine this code to make it work on both IOS 7 and IOS 8and for that I need selector that detects IOS version., here is the code:\n\n#define IS_WIDESCREEN_IOS7 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) &lt; DBL_EPSILON )\n#define IS_WIDESCREEN_IOS8 ( fabs( ( double )[ [ UIScreen mainScreen ] nativeBounds ].size.height - ( double )1136 ) &lt; DBL_EPSILON )\n#define IS_WIDESCREEN ( ( [ [ UIScreen mainScreen ] respondsToSelector: @selector( nativeBounds ) ] ) ? IS_WIDESCREEN_IOS8 : IS_WIDESCREEN_IOS7 )\n\n\nthen the author of the post suggests to quote -\"If you're also targeting iOS 7 or lower, be sure to use feature detection, as calling nativeBounds prior to iOS 8 will crash your app:\" and gives following code:\n\nif( [ [ UIScreen mainScreen ] respondsToSelector: @selector( nativeBounds ) ] )\n{\n /* Detect using nativeBounds - iOS 8 and greater */\n}\nelse\n{\n /* Detect using bounds - iOS 7 and lower */\n}\n\n\nPlease help me here I am a beginner developer and want to understand to to make it work. Where should I put SKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@\"Background\"];?\n\nAll this code is from different post in Stackoverflow post here is it: How to detect iPhone 5 (widescreen devices)?\n\nI uploaded images to drop box here is the link https://www.dropbox.com/sh/pnll2e2jvo0uigs/AACOLbzzQqZlJEZZcBx7TMR1a?dl=0 the folder is called measuredImages. here is the code I use for adding background: #import \"GameScene.h\"\n\n@implementation GameScene\n-(id)initWithSize:(CGSize)size {\n if (self = [super initWithSize:size]) {\nSKSpriteNode *background = [SKSpriteNode spriteNodeWithImageNamed:@\"Background-568\"]; background.anchorPoint = CGPointMake(0.5, 1);\n background.position = CGPointMake(self.size.width/2, self.size.height);\n [self addChild:background];}\n return self;\n}\n\n\nIf someone could put full code with macros and usage in answer I would greatly appreciate it.\n\nImportant\nUPDATE:12.17.2014 \n\nThis problem was solved by including the right launch images and my app run in the right resolution and I used screen bounds [same as in ios7], as Daij-Djan suggested. Thanks to everybody who tried or helped me to solve this problem,I personally want to thank Daij-Djan and sha for help and support. If you need the code for widescreen iphones I will leave it in my own answer below, it runs on all iPhones above iPhone 4 and all iPads." ]
[ "ios", "objective-c", "iphone", "macros" ]
[ "Rails Multiple Input Field in Form to One Integer Attribute in Model", "I am trying to allow a user to input two different things in two different drop down menus from the same form and it will store an integer into a review table.\n\nI want the user to be able to select model_name in one drop down and manufacturer in another drop down. The result will store a bat_id integer into the form. (Telling you which bat the user is selecting)\n\nI have seen a couple questions about date &amp; time but they store the values directly in the model. I am trying to store an integer - bat_id so that the bat_id will directly link the review model to the bat model.\n\nExamples I have found that are close:\n\n\nHow do ruby on rails multi parameter attributes really work (datetime_select)\nRails multiple fields to one model attribute\nUsing multiple input fields for one attribute\nRails Update Single Attribute with Multiple Fields\n\n\nMy form now:\n\n&lt;%= form_for(@review) do |f| %&gt;\n &lt;%= render 'shared/error_messages', object: f.object %&gt;\n &lt;div class=\"field\" align= \"center\"&gt;\n &lt;h3&gt;Select Brand&lt;/h3&gt;\n &lt;%= f.collection_select :manufacturer_id, Manufacturer.all, :id, :manufacturer, include_blank: true %&gt;\n &lt;h3&gt;Select Bat&lt;/h3&gt;\n &lt;%= f.grouped_collection_select :bat_id, Manufacturer.all, :bats, :manufacturer, :id, :model_year_and_name, include_blank: true %&gt;\n &lt;h3&gt;What do you like about this bat?&lt;/h3&gt;\n &lt;%= f.text_area :pros, placeholder: \"Enter what you like...\" %&gt;\n &lt;h3&gt;What do you not like about this bat?&lt;/h3&gt;\n &lt;%= f.text_area :cons, placeholder: \"Enter what you don't like...\" %&gt;&lt;/br&gt;\n &lt;/div&gt;\n &lt;div align=\"center\"&gt;\n &lt;%= f.submit \"Add Review\", class: \"btn btn-large btn-info\" %&gt;\n &lt;/div&gt;\n&lt;% end %&gt;\n\n\nI am submitting to the review table and trying to submit both of these to the bat_id attribute.\n\n&lt;h3&gt;Select Brand&lt;/h3&gt;\n&lt;%= f.collection_select :manufacturer_id, Manufacturer.all, :id, :manufacturer, include_blank: true %&gt;\n&lt;h3&gt;Select Bat&lt;/h3&gt;\n&lt;%= f.grouped_collection_select :bat_id, Manufacturer.all, :bats, :manufacturer, :id, :model_year_and_name, include_blank: true %&gt;\n\n\nIn my bat model I have: has_many :reviews &amp; In my reviews model I have: belongs_to :bat\n\nUPDATE: Is it possible to use a hidden field with the combination of javascript and my two inputs to determine my one output bat_id?\n\nUpdate I changed my dropdown code to what works so that I enter in manufacturer_id &amp; bat_id when both are selected. However I still think there is a way to store one value in my review model. I am using javascript very similiar to this" ]
[ "ruby-on-rails", "forms", "model", "associations" ]
[ "I am having trouble aligning sentences as paragraphs in css", "Here is my code:\n\n\r\n\r\np {\r\n background-color: yellow;\r\n}\r\np.ex {}\r\n&lt;p class=\"ex\"&gt;Security vulnerabilities that put customers at&lt;/p&gt;\r\n&lt;p class=\"ex\"&gt;risk have affected Asda's website for a couple&lt;/p&gt;\r\n&lt;p class=\"ex\"&gt;of years,a security expert has revealed&lt;/p&gt;\r\n\r\n\r\n\n\nI want all of my sentences together to form a paragraph. What am I doing wrong?" ]
[ "html", "css" ]
[ "Creating an alias for xpath expression in xidel with regex and bash", "If you have already used Xidel, you will often need to locate nodes that have a certain class. To do this more easy, I want to create has-class(\"class\") function that serves as an alias for the expression:\n contains(concat(\" \", normalize-space(@class), \" \"), \" class \").\n\nExample:\n\n$ e-xidel.sh example.com '//article/p//img[has-class(\"wp-image\")]'\n\n\ne-xidel.sh contains this code:\n\n#!/bin/bash\n\necho -e \"$(tput setaf 2) Checking... $(tput sgr0)\"\n\npath=$1\nexpression=$2\n\n# expression = '//article/p//img[has-class(\"wp-image\")]'\n# Regex to replace every * has-class(\"class\") * by * contains(concat(\" \", normalize-space(@class), \" \"), \" class \") *\n# ...\n# ...\n# expression = '//article/p//img[contains(concat(\" \", normalize-space(@class), \" \"), \" wp-image \")]'\n\nxoutput=$(xidel $path --printed-node-format=html --output-declaration= -e \"$expression\")\n\necho -e \"$(tput setaf 1) $xoutput $(tput sgr0)\"" ]
[ "regex", "bash", "macos", "xpath", "xidel" ]
[ "Winforms: Smooth the rounded edges for panel", "I have followed this tutorial in order to create a rounded panel. The code in the tutorial is in vb but I was able to convert it to C# so here is my code:\n\n public class SPanel : Panel\n{\n Pen pen;\n float penWidth = 2.0f;\n int _edge = 20;\n Color _borderColor = Color.White;\n public int Edge\n {\n get\n {\n return _edge;\n }\n set\n {\n _edge = value;\n Invalidate();\n }\n }\n\n public Color BorderColor\n {\n get\n {\n return _borderColor;\n }\n set\n {\n _borderColor = value;\n pen = new Pen(_borderColor, penWidth);\n Invalidate();\n }\n }\n\n public SPanel()\n {\n pen = new Pen(_borderColor, penWidth);\n }\n\n protected override void OnPaint(PaintEventArgs e)\n {\n base.OnPaint(e);\n ExtendedDraw(e);\n //DrawBorder(e.Graphics);\n }\n\n private void ExtendedDraw(PaintEventArgs e)\n {\n e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;\n GraphicsPath path = new GraphicsPath();\n\n path.StartFigure();\n path.StartFigure();\n path.AddArc(GetLeftUpper(Edge), 180, 90);\n path.AddLine(Edge, 0, Width - Edge, 0);\n path.AddArc(GetRightUpper(Edge), 270, 90);\n path.AddLine(Width, Edge, Width, Height - Edge);\n path.AddArc(GetRightLower(Edge), 0, 90);\n path.AddLine(Width - Edge, Height, Edge, Height);\n path.AddArc(GetLeftLower(Edge), 90, 90);\n path.AddLine(0, Height - Edge, 0, Edge);\n path.CloseFigure();\n\n Region = new Region(path);\n }\n\n Rectangle GetLeftUpper(int e)\n {\n return new Rectangle(0, 0, e, e);\n }\n Rectangle GetRightUpper(int e)\n {\n return new Rectangle(Width - e, 0, e, e);\n }\n Rectangle GetRightLower(int e)\n {\n return new Rectangle(Width - e, Height - e, e, e);\n }\n Rectangle GetLeftLower(int e)\n {\n return new Rectangle(0, Height - e, e, e);\n }\n\n void DrawSingleBorder(Graphics graphics)\n {\n graphics.DrawArc(pen, new Rectangle(0, 0, Edge, Edge), 180, 90);\n graphics.DrawArc(pen, new Rectangle(Width - Edge -1, -1, Edge, Edge), 270, 90);\n graphics.DrawArc(pen, new Rectangle(Width - Edge - 1, Height - Edge - 1, Edge, Edge), 0, 90);\n graphics.DrawArc(pen, new Rectangle(0, Height - Edge - 1, Edge, Edge), 90, 90);\n\n graphics.DrawRectangle(pen, 0.0F, 0.0F, Width - 1, Height - 1);\n }\n\n void DrawBorder(Graphics graphics)\n {\n DrawSingleBorder(graphics);\n }\n }\n\n\nI did not use the border however the result is the same. Here is a ss:\n\n\n\nI thought smoothing with anti alias would do the trick but I guess i was wrong. The question is how can I smooth the edges?" ]
[ "c#", "winforms", "graphics", "panel" ]
[ "Using continue in a switch statement", "I want to jump from the middle of a switch statement, to the loop statement in the following code:\n\nwhile (something = get_something())\n{\n switch (something)\n {\n case A:\n case B:\n break;\n default:\n // get another something and try again\n continue;\n }\n // do something for a handled something\n do_something();\n}\n\n\nIs this a valid way to use continue? Are continue statements ignored by switch statements? Do C and C++ differ on their behaviour here?" ]
[ "c++", "c", "switch-statement", "break", "continue" ]
[ "Sum of first n numbers and 2-element subsets", "I know it's not strictly a programming question but computer scientists might know the answer. why is the sum of the first n non-negative numbers equal to the number of 2-element subsets?" ]
[ "math" ]
[ "What if the enterprise provisioning profile gets expired, will the apps build with it stops working?", "Quick sanity check - I've read through several related questions and I'm still confused about this topic.\n\nI have build the app with a provisioning profile(in-house) with enterprise account.\nThat provisioning profile is getting expired in next few days and the distribution certificate used for that provisioning profile expires in next year.\nIf the provisioning profile gets expires will the apps which were distributed stops working or they will keep working as distribution cert is intact?" ]
[ "ios", "provisioning-profile", "ios-provisioning", "ios-enterprise" ]
[ "Full image from camera intent", "I am using camera and want to get the full image from bitmap. Currently I have a bitmap size of thumbnail so when I try to scale it, the image looks blurry and stretched. I am also saving the image in my app folder on sdcard. How can I get a full size image from bitmap?\nThanks\n\nIntent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);\n startActivityForResult(intent, CAMERA_PIC_REQUEST);\n\n\n if (requestCode == CAMERA_PIC_REQUEST) {\n\n Bitmap bitmap = (Bitmap) data.getExtras().get(\"data\"); \n\n\n// I have tried scaling and using matrix but doesn't makes the quality of image any better\n\n Bitmap scaledBitmap = Bitmap.createBitmap(612, 936, Config.ARGB_8888);\n\n float scaleX = 612 / (float) bitmap.getWidth();\n float scaleY = 936 / (float) bitmap.getHeight();\n float pivotX = 0;\n float pivotY = 0;\n\n Matrix scaleMatrix = new Matrix();\n scaleMatrix.setScale(scaleX, scaleY, pivotX, pivotY);\n\n Canvas canvas = new Canvas(scaledBitmap);\n canvas.setMatrix(scaleMatrix);\n\n Paint paint = new Paint();\n paint.setAntiAlias(true);\n paint.setFilterBitmap(true);\n paint.setDither(true);\n\n canvas.drawBitmap(bitmap, 0, 0, paint);" ]
[ "android" ]
[ "How to press ArrayList and display an AlertDialog containing information from another ArrayList?", "Ok so here's what I've got so far:\n\npublic class Perks extends ListActivity {\n\n ArrayList&lt;Item&gt; items = new ArrayList&lt;Item&gt;();\n ArrayList&lt;Item&gt; entry = new ArrayList&lt;Item&gt;();\n\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n\n items.add(new SectionItem(\"Tier 1\"));\n items.add(new EntryItem(\"Flak Jacket\"));\n items.add(new EntryItem(\"Ghost\"));\n items.add(new EntryItem(\"Blind Eye\"));\n items.add(new EntryItem(\"Hardline\"));\n items.add(new EntryItem(\"Lightweight\"));\n\n items.add(new SectionItem(\"Tier 2\"));\n items.add(new EntryItem(\"Hard Wired\"));\n items.add(new EntryItem(\"Scavenger\"));\n items.add(new EntryItem(\"Cold Blooded\"));\n items.add(new EntryItem(\"Toughness\"));\n items.add(new EntryItem(\"Fast Hands\"));\n\n items.add(new SectionItem(\"Tier 3\"));\n items.add(new EntryItem(\"Engineer\"));\n items.add(new EntryItem(\"Dead Silence\"));\n items.add(new EntryItem(\"Extreme Conditioning\"));\n items.add(new EntryItem(\"Tactical Mask\"));\n items.add(new EntryItem(\"Awareness\"));\n items.add(new EntryItem(\"Dexterity\"));\n\n EntryAdapter adapter = new EntryAdapter(this, items);\n\n entry.add(new SectionItem(\"Tier 1\"));\n entry.add(new EntryItem(\"Take less explosive damage.\"));\n entry.add(new EntryItem(\"Cannot be detected by enemy UAV while moving.\"));\n entry.add(new EntryItem(\"Unaffected by AI-controlled perks.\"));\n entry.add(new EntryItem(\"Receive bonus score points.\"));\n entry.add(new EntryItem(\"Move faster, take no damage from falling.\"));\n\n entry.add(new SectionItem(\"Tier 2\"));\n entry.add(new EntryItem(\"Immune to counter-UAV and enemy EMPs.\"));\n entry.add(new EntryItem(\"Replenish ammo and grenades from fallen enemies.\"));\n entry.add(new EntryItem(\"Resistence to targeting systems including Dual Band, Target Finder,\" +\n \"Sensor Grenades and player-controlled aircraft.\"));\n entry.add(new EntryItem(\"Flinch less when shot.\"));\n entry.add(new EntryItem(\"Swap grenades faster, use grenades and equipment faster, and safely throw\" +\n \"back frag grenades.\"));\n\n entry.add(new SectionItem(\"Tier 3\"));\n entry.add(new EntryItem(\"Show enemy equipment, delay explosives, and re-roll and booby trap care\" +\n \"packages.\"));\n entry.add(new EntryItem(\"Move silently.\"));\n entry.add(new EntryItem(\"Sprint for a longer duration.\"));\n entry.add(new EntryItem(\"Reduce the effect of flash, concussiona and shock charges.\"));\n entry.add(new EntryItem(\"Enemy movements are easier to hear.\"));\n entry.add(new EntryItem(\"Climb ladders and mantle over objects faster, recover from melee faster and\" +\n \"aim faster after sprinting.\"));\n\n\n setListAdapter(adapter);\n }\n\n @Override\n protected void onListItemClick(ListView l, View v, int position, long id) {\n\n if(!items.get(position).isSection()){\n\n EntryItem item = (EntryItem)items.get(position);\n\n //Toast.makeText(this, \"You clicked \" + item.title , Toast.LENGTH_SHORT).show();\n\n AlertDialog.Builder adb=new AlertDialog.Builder(Perks.this);\n adb.setTitle(item.title);\n adb.setMessage();\n adb.setPositiveButton(\"Ok\", null);\n adb.show();\n }\n\n\n super.onListItemClick(l, v, position, id);\n }\n}\n\n\nWhat I'm trying to do is to have it so that when an \"item\" is pressed, it will show the corresponding \"entry\" in an AlertDialog. Any help on the matter will be greatly appreciated. \n\nThanks :)" ]
[ "android", "oop", "arraylist", "android-alertdialog" ]
[ "Which SVM kernel to use when there is a structured covariance among the features?", "I am trying to use SVM for multi-class classification. The input features are assumed to be generated from a multi-variate Gaussian distribution. Each class corresponds to a different set of mean vector and covariance matrix.\nWhat could be a good kernel for SVM based classification?" ]
[ "svm" ]
[ "SQL deadlock occurred, using three triggers, cross-server, did not find the reason", "I used an Insert-trigger on the Table-A of the Database-A on Server-A. This trigger will put the Inserted-data into Table-B of the\n Database-B on Server-B.\n I used an Insert-trigger on the Table-B of the Database-B on Server-B. This trigger uses the Inserted-data to calculate, and then\n insert the result in the Table-C of the Database-B on Server-B.\n I used an Update-trigger on the Table-C of the Database-B on Server-B. This trigger used the Inserted-data to calculate, and then\n send mail automatically.\n \n\n\nSQL Server now looks as if often deadlock. Is there any good solution?\n\nDescription: First trigger is used for get data, second trigger is the actual logic, the third trigger sends mail according to the result of the second trigger.\n\nTrigger on Table-A of Database-A on Server-A as below:\n\nUSE [Database-A]\nGO\n\nSET ANSI_NULLS ON\nGO\n\nSET QUOTED_IDENTIFIER ON\nGO\n\nCREATE TRIGGER [dbo].[TRIGGER_INSERT_A]\n ON [dbo].[Table-A]\n FOR INSERT\nAS\n BEGIN\n INSERT INTO [Server-B].[Database-B].[dbo].[Table-B] (\n [Server-B].[dbo].[Table-B].[field1],\n [Server-B].[dbo].[Table-B].[field2],\n [Server-B].[dbo].[Table-B].[field3],\n [Server-B].[dbo].[Table-B].[field4],\n [Server-B].[dbo].[Table-B].[field5],\n [Server-B].[dbo].[Table-B].[field6],\n [Server-B].[dbo].[Table-B].[field7]\n ) SELECT\n [field1],\n [field2],\n [field3],\n [field4],\n [field5],\n [field6],\n [field7]\n FROM inserted\n END\nGO\n\n\nTrigger on Table-B of Database-B on Server-B as below:\n\nUSE [Database-B]\nGO\n\nSET ANSI_NULLS ON\nGO\n\nSET QUOTED_IDENTIFIER ON\nGO\n\nCREATE TRIGGER [dbo].[TRIGGER_INSERT_B]\nON [dbo].[Table-B]\nAFTER INSERT\nAS\nBEGIN\n SET NOCOUNT ON;\n\n -- Logic portion is omitted\n -- UPDATE [dbo].[Table-B] OR INSERT [dbo].[Table-B]\nEND\n\nGO\n\n\nTrigger on Table-C of Database-B on Server-B as below:\n\nUSE [Database-B]\nGO\n\nSET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\n\nALTER TRIGGER [dbo].[TRIGGER_UPDATE_C]\nON [dbo].[Table-C]\nAFTER UPDATE\nAS\nBEGIN\n SET NOCOUNT ON;\n\n DECLARE @recipients VARCHAR(MAX)\n DECLARE @subject NVARCHAR(255)\n DECLARE @body NVARCHAR(MAX)\n DECLARE @body_format VARCHAR(20)\n DECLARE @importance VARCHAR(6)\n DECLARE @sensitivity VARCHAR(12)\n\n DECLARE @query NVARCHAR(MAX)\n DECLARE @execute_query_database NVARCHAR(128)\n DECLARE @attach_query_result_as_file BIT\n DECLARE @query_attachment_filename NVARCHAR(260)\n DECLARE @query_result_header BIT\n DECLARE @query_result_width INT\n DECLARE @query_result_separator CHAR(1)\n DECLARE @exclude_query_output BIT\n DECLARE @append_query_error BIT\n DECLARE @query_no_truncate BIT\n\n SELECT\n @recipients = [recipients],\n @subject = [subject],\n @body = [body],\n @body_format = [body_format],\n @importance = [importance],\n @sensitivity = [sensitivity]\n FROM [dbo].[Table-D]\n\n SET @query = 'query portion is omitted'\n SET @execute_query_database = 'Database-B'\n SET @attach_query_result_as_file = 1\n SET @query_attachment_filename = 'Automatic alarm.txt'\n SET @query_result_header = 1\n SET @query_result_width = 256\n SET @query_result_separator = ' '\n SET @exclude_query_output = 0\n SET @append_query_error = 0\n SET @query_no_truncate = 0\n\n -- UPDATE [dbo].[Table-C] here\n\n EXEC [msdb].[dbo].[sp_send_dbmail]\n @profile_name = 'profile_name',\n @recipients = @recipients,\n @subject = @subject,\n @body = @body,\n @body_format = @body_format,\n @importance = @importance,\n @sensitivity = @sensitivity,\n @query = @query,\n @execute_query_database = @execute_query_database,\n @attach_query_result_as_file = @attach_query_result_as_file,\n @query_attachment_filename = @query_attachment_filename,\n @query_result_header = @query_result_header,\n @query_result_width = @query_result_width,\n @query_result_separator = @query_result_separator,\n @exclude_query_output = @exclude_query_output,\n @append_query_error = @append_query_error,\n @query_no_truncate = @query_no_truncate\nEND" ]
[ "sql", "sql-server", "database" ]
[ "Declaring a for loop function in javascript", "I have a for loop that searches for a value in an array in my javascript code in couchDb. I want to make it into a function. This should be fairly simple but I am having trouble with it. This is the for loop(Which works perfectly fine):\n\nif (newDoc.destination &amp;&amp; newDoc.destination.length &gt; 0) {\n for (var i = 0; i &lt; newDoc.destination.length; i++) {\n if (newDoc.destination[i].address) return;\n }\n}\nthrow({forbidden: 'doc.address is required'});\n\n\nAnd this is the way I wrapped it into a function:\n\nfunction arrayReq(field, message) {\n message = message || \"Array must have a \" + field;\n if (newDoc.destination &amp;&amp; newDoc.destination.length &gt; 0) {\n for (var i = 0; i &lt; newDoc.destination.length; i++) {\n if (newDoc.destination[i].field) return;\n }\n }\n throw({forbidden: message});\n}\n\n\nI would think that the return in the function should stop the function from going any further but it still throws the error. Can someone tell me what I am doing wrong? Btw if i change field into address it works fine. Can I not make the address into a changeable variable?" ]
[ "javascript", "arrays", "for-loop", "couchdb", "function-declaration" ]
[ "CakePHP 3.0 retrieving record from database", "Im trying to get client name from database but there is error that says \n\"Trying to get property of non-object \"\n\ncode line in index looks like this\n\n $this-&gt;Html-&gt;link( $camp-&gt;client-&gt;name,['controller' =&gt; 'Clients', 'action' =&gt; 'view', $camp-&gt;id]);\n\n\nthis is controller \n\npublic function index($id = null) {\n $client = $this-&gt;Camps-&gt;Clients-&gt;find()-&gt;where(['Clients.id' =&gt; $camp['client_id']])-&gt;first();\n debug($client);\n if ($id != null) {\n $query = $this-&gt;Camps-&gt;find('all')-&gt;where(['client_id' =&gt; $id]);\n $this-&gt;set('camps', $this-&gt;paginate($query));\n $client = $this-&gt;Camps-&gt;Clients-&gt;get($id);\n } else {\n $query = $this-&gt;Camps-&gt;find('all');\n $this-&gt;set('camps', $this-&gt;paginate($query));\n $client = $this-&gt;Camps-&gt;Clients-&gt;find('all')-&gt;toArray();\n }\n}" ]
[ "php", "cakephp", "cakephp-3.0" ]
[ "Pandas Groupby after fitering based on column values", "Hi I am trying to groupby based on three columns and then aggregate/sum of fourth column. I am only interested if Mo_Year column(float) is 10.2019, 11.2019 and 12.2019 and aggregate the sum of last column Amount. \nI tried filtering with goupby as mentioned below. Filtration for Mo_Year is not happening. \n\nSample dataset as below\n\n Name Mo_Year Item Amount\n A1 10.2019 cat 60\n A2 1.2019 dog 40\n A3 12.2019 cat 10 \n A4 3.2019 dog 30\n A5 4.2019 cat 10\n A1 10.2019 dog 50\n A2 11.2019 cat 30\n A3 3.2019 cat 20\n A4 10.2019 dog 10\n A5 11.2019 cat 70\n\n\ndf_test = df1.groupby(['Name','Mo_Year', 'Item']).filter(lambda x: (x['Mo_Year'] == 10.2019).any() &amp; (x['Mo_Year'] == 12.2019).any()) \n\n\nCan someone help? Thanks." ]
[ "python-3.x", "pandas", "dataframe", "aggregate" ]
[ "get finger print using morpho device in https", "i want to capture finger print using morpho device. i am able to do that but the thing is, i am getting error because the service i am using is http and my website is https. so i have to allow every time my website to read http url.\nwhat actually they are doing is, they are giving a service which allow me to access http://localhost:8080/CallMorphoAPI. but this is for http not https. i installed morpho driver which started this service. so what i want to know if there any way so i can modify this service. I want Finger print scan using morpho 1300 e2 using java api.\n\n\n\nfunction CallFingerAPI()\n{\n var url = \"http://localhost:8080/CallMorphoAPI\";\n var xmlhttp;\n if (window.XMLHttpRequest)\n {// code for IE7+, Firefox, Chrome, Opera, Safari\n\n xmlhttp=new XMLHttpRequest();\n\n }\n else\n {// code for IE6, IE5\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\n }\n xmlhttp.onreadystatechange=function()\n {\n if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)\n {\n fpobject = JSON.parse(xmlhttp.responseText);\n console.log(fpobject.Base64BMPIMage);\n\n // Call Servlet\n function uploadThumb(image){\n var formdata = image; \n var fr = new FormData();\n fr.append(\"data\", formdata);\n var id = \"&lt;%=patientId%&gt;\";\n var url = \"ThumbUpload?patientId=\"+id;\n var xmlhttp = new XMLHttpRequest();\n\n xmlhttp.onreadystatechange = function(){\n if(xmlhttp.readyState === 4 &amp;&amp; xmlhttp.status === 200){\n var response = xmlhttp.responseText;\n response = response.replace(/\\r?\\n|\\r/g, \"\");\n response = response.trim();\n if(response === \"Uploaded\"){\n alert(\"Uploaded\");\n }\n else{\n alert(\"Error\");\n }\n }\n\n };\n try{\n xmlhttp.open(\"POST\",url,true);\n xmlhttp.send(fr);\n }catch(e){alert(\"unable to connect to server\");\n }\n }\n uploadThumb(fpobject.Base64BMPIMage);\n template = fpobject.Base64ISOTemplate; \n\n\n }\n }\n\n var timeout = 5;\n xmlhttp.open(\"POST\",url+\"?\"+timeout,true);\n xmlhttp.send();\n\n}" ]
[ "javascript", "java", "asp.net", "jsp" ]
[ "Test not passing when db context n separate using blocks", "I trying to do in memory ef core testing.\n\nI have something similar to this:\n\nStartup\n\nservices.AddEntityFrameworkNpgsql().AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;\n options.UseNpgsql(Configuration.GetConnectionString(\"PostgresConnection\"), x=&gt;x.UseNetTopologySuite()))\n .BuildServiceProvider(); \n\n\nTest method\n\n public void Add_writes_to_database()\n {\n var options = new DbContextOptionsBuilder&lt;ApplicationDbContext&gt;()\n .UseInMemoryDatabase(databaseName: \"Add_writes_to_database\")\n .Options;\n\n // Run the test against one instance of the context\n using (var context = new ApplicationDbContext(options))\n {\n var service = new BlogService(context);\n service.Add(\"http://sample.com\");\n }\n\n // Use a separate instance of the context to verify correct data was saved to database\n using (var context = new ApplicationDbContext(options))\n {\n Assert.AreEqual(1, context.Blogs.Count());\n Assert.AreEqual(\"http://sample.com\", context.Blogs.Single().Url);\n }\n }\n\n\nWhen the context is split into 2 using blocks like above it does not pass the test.\n\nBut when its all wrapped in one context it works ok.\n\nAny ideas?" ]
[ "unit-testing", "ef-core-2.0" ]
[ "Laravel 5.3 Mailable.php not found", "I want to make send mail with Laravel 5.3 and it gives me this error when I try to: vendor/composer/../laravel/framework/src/Illuminate/Mail/Mailable.php): failed to open stream: No such file or directory. I checked te directory and saw that this file really does not exist.\nIn the controller where I want to send the mail I use\n\nuse Illuminate\\Support\\Facades\\Mail;\n\nuse App\\Mail\\OrderMail;\n\n\nSo how can I generate this file to send the mail ?" ]
[ "php", "laravel", "email", "laravel-5.3" ]
[ "YARN - Number of map/reduce tasks that can run in a container", "I am implemetting a MR ETL job and I have only mapper tasks and no reducer tasks. \n\nI always see only one mapper running inside a container. \n\nIs it possible to run multiple mapper inside a container or only one map/reduce task can run inside a container?" ]
[ "mapreduce", "yarn", "hadoop2" ]
[ "doxygen relative image paths and source directory structure", "I use doxygen for documentation, and I have my sources under git. \nI want paths in my documentation to be relative to the project dir, as I check it out in different places.\n\nAs the html subdir is generated by doxygen, it is not under version control. \n\nHowever, it seems if I want to use relative paths for images, I need to put the images somewhere under the html directory - I played with using \"../images\" as IMAGE_PATH, that does not work.\n\nMy images should be under version control.\n\nIs there a good way to organize my sources to make this work?" ]
[ "git", "version-control", "doxygen" ]
[ "In R, plot a histogram of how many time-points have viable data for each participant", "I have a large data frame for which I want to be able to plot a histogram of the number of viable sessions -- indicated by any value other than NA -- for all participants in order to determine whether they are completing a sufficient number of sessions to be included in analysis and whether there is a clear cut-off point for how many sessions most people have scores for. Each participant should complete 10 sessions for the study, but some have missing sessions, indicated by NA. \n\nThe real data frame is large and contains participant data I can't show, but I've recreated a smaller sample version here that has the essential columns which are the participant ID, the score they got during each session, and the session number.\n\n\n\nCode to recreate the data frame:\n\ndat &lt;- cbind(c(rep(1:3,10)), c(rep(c(12, 32, NA, 44, 45, NA, NA, 8, 54, NA, NA, 12, 13, 14, NA),2)), c(rep(1,3), rep(2,3), rep(3,3), rep(4,3), rep(5,3), rep(6,3), rep(7,3), rep(8,3), rep(9,3), rep(10,3)))\ncolnames(dat) &lt;- c(\"ID\", \"score\", \"session.num\")\n\n\nThank you in advance for your help. Please let me know if my question requires clarification." ]
[ "r", "dataframe", "plot", "ggplot2", "histogram" ]
[ "spellcheck=false on contentEditable elements", "For normal input elements you can turn off the spell checking by using a HTML attribute (at least under FF). The same spellcheck=\"false\" does not seem to work on a contentEditable element. Is there another solution for contentEditable elements?" ]
[ "html", "spell-checking", "contenteditable" ]
[ "android studio 3.1: can custom adapter display null image id?", "please excuse me for my poor english, my question might look silly, but i wondering how custom array adapter work in the android studio 3.1\n\nfirst i create a custom adapter to handle my array of object it looks like this:\n\npackage com.example.android.miwok;\n\nimport android.support.annotation.NonNull;\nimport android.support.annotation.Nullable;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.ArrayAdapter;\nimport android.widget.ImageView;\nimport android.widget.TextView;\nimport android.app.Activity;\n\nimport java.util.ArrayList;\n\npublic class WordAdapter extends ArrayAdapter&lt;Word&gt; {\n\n public WordAdapter(Activity context, ArrayList&lt;Word&gt; words){\n // Here, we initialize the ArrayAdapter's internal storage for the context and the list.\n // the second argument is used when the ArrayAdapter is populating a single TextView.\n // Because this is a custom adapter for two TextViews and an ImageView, the adapter is not\n // going to use this second argument, so it can be any value. Here, we used 0.\n super(context,0,words);\n }\n\n @NonNull\n @Override\n public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {\n View listItemView = convertView;\n // Check if the existing view is being reused, otherwise inflate the view\n if(listItemView == null) {\n listItemView = LayoutInflater.from(getContext()).inflate(\n R.layout.list_item, parent, false);\n }\n\n Word currentWord = getItem(position);\n\n TextView defaultWord = (TextView) listItemView.findViewById(R.id.default_text_view);\n defaultWord.setText(currentWord.getDefaultTranslation());\n\n TextView miwokWord = (TextView) listItemView.findViewById(R.id.miwok_text_view);\n miwokWord.setText(currentWord.getMiwokTranslation());\n\n ImageView img = (ImageView) listItemView.findViewById(R.id.img);\n img.setImageResource(currentWord.getImageResourceId());\n return listItemView;\n }\n}\n\n\nmy object structure looks like this:\n\npackage com.example.android.miwok;\n\npublic class Word {\n private String mDefaultTranslation;\n private String mMiwokTranslation;\n private int mImageResourceId;\n\n public Word(String DefaultTranslation, String MiwokTranslation){\n mDefaultTranslation = DefaultTranslation;\n mMiwokTranslation = MiwokTranslation;\n }\n\n public Word(String DefaultTranslation, String MiwokTranslation, int imageResourceId){\n mDefaultTranslation = DefaultTranslation;\n mMiwokTranslation = MiwokTranslation;\n mImageResourceId = imageResourceId;\n }\n\n public String getDefaultTranslation() {\n return mDefaultTranslation;\n }\n\n public String getMiwokTranslation() {\n return mMiwokTranslation;\n }\n\n public int getImageResourceId() {\n return mImageResourceId;\n }\n}\n\n\nas you can see the word object have 2 constructor the first one takes 2 string values and one int value which is an image resource id, the second one takes only 2 String value.\n\nthe code run perfectly with no error which makes me confused because when I use the second object constructor i expected to get an empty list in the activity because the wordAdapter need an image id to work but it works perfectly, any hint guys;" ]
[ "java", "android-studio" ]
[ "Add /usr/local/bin to $PATH calling popen from Excel 2016 (OSX)", "I am using Excel 2016 on a Mac. Inside a VBA script, I have\n\nPrivate Declare PtrSafe Function popen64 Lib \"libc.dylib\" Alias \"popen\" (ByVal command As String, ByVal mode As String) As LongPtr\nPrivate Declare PtrSafe Function pclose64 Lib \"libc.dylib\" Alias \"pclose\" (ByVal file As LongPtr) As Long\nPrivate Declare PtrSafe Function fread64 Lib \"libc.dylib\" Alias \"fread\" (ByVal outStr As String, ByVal size As LongPtr, ByVal items As LongPtr, ByVal stream As LongPtr) As Long\nPrivate Declare PtrSafe Function feof64 Lib \"libc.dylib\" Alias \"feof\" (ByVal file As LongPtr) As LongPtr\n\n' @internal\nPublic Type ShellResult\n Output As String\n ExitCode As Long\nEnd Type\nPublic Function ExecuteInShell(command As String) As ShellResult\n Dim result As LongPtr\n Dim chunk As String\n Dim read As Long\n\n result = popen64(command, \"r\")\n\n If result = 0 Then\n ' TODO Investigate why this could happen and what should be done if it happens\n Exit Function\n End If\n\n Do While feof64(result) = 0\n chunk = VBA.Space$(50)\n read = fread64(chunk, 1, Len(chunk) - 1, result)\n If read &gt; 0 Then\n chunk = VBA.Left$(chunk, read)\n ExecuteInShell.Output = ExecuteInShell.Output &amp; chunk\n End If\n Loop\ncleanup:\n ExecuteInShell.ExitCode = pclose64(result)\nEnd Function\nSub Process_Click()\n Dim result As ShellResult\n result = ExecuteInShell(\"echo $SHELL &amp; whoami &amp; echo $PATH &amp; pwd\")\n Debug.Print (result.Output)\n End Sub\n\n\nWhen I run Process_Click, I see the following:\n\n/bin/bash\n/Users/tim/Library/Containers/com.microsoft.Excel/Data\n/usr/bin:/bin:/usr/sbin:/sbin\ntim\n\n\nNote the the order is odd, as if each is running on a separate thread (that's probably a hint I'm doing something wrong!). I would like to run a program (rscript) which is in /usr/local/bin. However if I run ExecuteInShell(\"/usr/local/bin/rscript\") I get no output. Strangely also, if I ExecuteInShell(\"ls\") I see the right contents, but I get a blank result if I ExecuteInShell(\"ls /usr/local/bin\"). Perhaps there is some escaping issue?\n\nTL;DR. I need to either add /usr/local/bin to my popen $PATH or call my script using /usr/local/bin/rscript but I can't! Any assistance much appreciated." ]
[ "excel", "vba", "macos" ]
[ "Microsoft outlook doesn't shows German umlauts", "I have an email send through SMTP which contains some German characters (umlauts). The encoding used is 'UTF-8', but the content is not displaying correctly. \n\nBut when I choose the 'view source' in outlook app (by right click), the result shows all the umlauts. See in high lighted.\n\n\nHow to solve this problem? The content of the mail is created programmatically through the following code.\n\nMimeMessage mimeMessage = mailSender.createMimeMessage();\nMimeMessageHelper helper = new MimeMessageHelper(mimeMessage, false, \"utf-8\");\nmimeMessage.setContent(\"&lt;html&gt;&lt;head&gt;&lt;meta charset=\\\"UTF-8\\\"&gt;&lt;/head&gt;&lt;body&gt;Hallo Saju Paul,&lt;p&gt;Wir.....\", \"text/html\");\n\nhelper.setTo(\"[email protected]\");\nhelper.setSubject(\"Setze dein Passwort zurΓΌck\");\nhelper.setFrom(\"[email protected]\");\nmailSender.send(mimeMessage);\n\n\nwhere mailSender is \n\norg.springframework.mail.javamail.JavaMailSender\n\n\nHow to solve this problem?" ]
[ "utf-8", "outlook", "jakarta-mail", "spring-framework-beans" ]
[ "Qt output (qDebug qWarning etc) does not work if application is executed via cronjob", "I created a reproduction sample for this:\n\n#include &lt;iostream&gt;\n#include &lt;QtCore/QLoggingCategory&gt;\n#include &lt;QtCore/QDebug&gt;\n#include &lt;QtCore/QtCore&gt;\nusing namespace std;\nint main () {\n int i;\n QLoggingCategory::setFilterRules(\"*.debug=true\\n\");\n QLoggingCategory LogO(NULL);\n if (LogO.isDebugEnabled()) {\n cout &lt;&lt; \"QDebug enabled\\n\";\n } else {\n cout &lt;&lt; \"QDebug disabled!\\n\";\n }\n cout &lt;&lt; \"Start!\\n\";\n qDebug() &lt;&lt; \"qStart!\";\n cerr &lt;&lt; \"print to stderr.\\n\";\n qWarning() &lt;&lt; \"qWarning\";\n return 0;\n}\n\n\nBuild steps:\n\ng++ -c -fPIC -I/usr/include/qt5 main.cpp -o main.o\ng++ -fPIC main.o -L /usr/lib64 -lQt5Core -o testapp\n\n\nWhen executing the application in an interactive shell, output redirection works as expected:\n\nSetup:\n\n./testapp &gt; out 2&gt; err\n\n\nOutput:\n\n&gt;&gt;cat out:\nQDebug enabled\nStart!\n\n&gt;&gt;cat err:\nqStart!\nprint to stderr.\nqWarning\n\n\nHowever, it does not work if the application is executed as a cronjob, the output of qDebug() and qWarning() is missing:\n\nSetup:\n\n* * * * * username /home/username/temp/build/testapp 1&gt; /home/username/temp/log/out 2&gt; /home/username/temp/log/err\n\n\nOutput:\n\n&gt;&gt;cat /home/username/temp/log/out\nQDebug enabled\nStart!\n\n&gt;&gt;cat home/username/temp/log/err\nprint to stderr.\n\n\nEnviroment vars\n\nThe output of env in the interative shell is as follows:\n\nLS_COLORS=*long string*\nSSH_CONNECTION=*censored*\nLANG=en_US.UTF-8\nHISTCONTROL=ignoredups\nHOSTNAME=*censored*\nXDG_SESSION_ID=492\nUSER=username\nSELINUX_ROLE_REQUESTED=\nPWD=/home/username/temp/build\nHOME=/home/username\nSSH_CLIENT=*censored*\nSELINUX_LEVEL_REQUESTED=\nSSH_TTY=/dev/pts/0\nMAIL=/var/spool/mail/username\nTERM=xterm\nSHELL=/bin/bash\nSELINUX_USE_CURRENT_RANGE=\nSHLVL=1\nLOGNAME=username\nDBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus\nXDG_RUNTIME_DIR=/run/user/1000\nPATH=/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/username/.local/bin:/home/username/bin\nHISTSIZE=1000\nLESSOPEN=||/usr/bin/lesspipe.sh %s\n_=/usr/bin/env\nOLDPWD=/home/username/temp/build/logs\n\n\nThe output of env when called via cronjob is as follows:\n\nLS_COLORS=*long string*\nLANG=en_US.UTF-8\nHISTCONTROL=ignoredups\nHOSTNAME=*censored*\nXDG_SESSION_ID=995\nUSER=username\nPWD=/home/username\nHOME=/home/username\nMAIL=/var/spool/mail/username\nTERM=xterm\nSHELL=/bin/bash\nSHLVL=1\nLOGNAME=username\nDBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus\nXDG_RUNTIME_DIR=/run/user/1000\nPATH=/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/username/.local/bin:/home/username/bin\nLESSOPEN=||/usr/bin/lesspipe.sh %s\n_=/usr/bin/env" ]
[ "qt", "cron", "qdebug" ]
[ "According to top, my node.js application is using 100% of my CPU", "The application is actually open-source: http://www.github.com/zackster/CompassionPit-Node--\n\nWhat are the high-level steps to profiling my application to see where it's soaking up CPU resources?" ]
[ "node.js" ]
[ "\"Failed to load resource: the server responded with a status of 404\" express docker", "I got error message in browser \"Failed to load resource: the server responded with a status of 404\" and I am using Node/Express, Mongo Database and Docker.\nEverything works fine without a Docker.\n\nFolder structure:\n\n\n\n\nbackend\n\n\nserver\n\n\nserver.js\n\n\nfrontend\n\n\nsrc\n\n\nindex.html\n\n\ndist\nwebpack.config.js\npackage.json\nDockerfile\ndocker-compose.yml\n\n\n\n\nserver.js\n\napp.use('/', express.static(__dirname + '../../dist/'));\n\n\n\r\n\r\napp.get('/gallery', (req, res) =&gt; {\r\n Gallery.find({}, {name: 1, path: 1, _id: 0, image: 1}).then(\r\n gallery =&gt; {\r\n res.json({gallery});\r\n },\r\n e =&gt; {\r\n res\r\n .status(500)\r\n .send(e)\r\n .send('Undefined error');\r\n },\r\n );\r\n});\r\n\r\n\r\n\n\nindex.html\n\n\r\n\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n\r\n&lt;head&gt;\r\n &lt;meta charset=\"UTF-8\"&gt;\r\n &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"&gt;\r\n\r\n &lt;title&gt;Gallery&lt;/title&gt;\r\n &lt;base href=\"/\"&gt;\r\n &lt;link href=\"https://fonts.googleapis.com/css?family=Roboto:400,500,700\" rel=\"stylesheet\"&gt;\r\n\r\n\r\n&lt;/head&gt;\r\n\r\n&lt;body&gt;\r\n &lt;div id=\"root\"&gt;&lt;/div&gt;\r\n\r\n\r\n\r\n\r\n &lt;script type=\"text/javascript\" src=\"dist/frontend-output.js\"&gt;&lt;/script&gt;\r\n&lt;/body&gt;\r\n\r\n&lt;/html&gt;\r\n\r\n\r\n\nwebpack.config.js\n\n\r\n\r\nconst frontend = {\r\n resolve: {\r\n modules: [path.resolve(__dirname, 'frontend'), 'node_modules'],\r\n },\r\n mode: 'development',\r\n entry: './frontend/js/index.js',\r\n\r\n output: {\r\n path: path.resolve(__dirname, '/dist/'),\r\n publicPath: '/',\r\n filename: 'frontend-output.js',\r\n },\r\n\r\n module: {\r\n rules: [\r\n {\r\n test: /\\.(js)$/,\r\n exclude: /node_modules/,\r\n use: {\r\n loader: 'babel-loader',\r\n options: {\r\n presets: ['env', 'stage-0', 'react'],\r\n },\r\n },\r\n },\r\n {test: /\\.css$/, use: ['style-loader', 'css-loader']},\r\n {test: /\\.(jpe?g|png|gif|svg)$/i, use: ['url-loader', 'file-loader']},\r\n {\r\n test: /\\.(jpe?g|png|ttf|eot|gif|svg|woff(2)?)(\\?[a-z0-9=&amp;.]+)?$/,\r\n use: 'base64-inline-loader?limit=1000&amp;name=[name].[ext]',\r\n },\r\n ],\r\n },\r\n\r\n plugins: [\r\n new HtmlWebpackPlugin({\r\n publicPath: '/',\r\n template: './frontend/src/index.html',\r\n }),\r\n ],\r\n devServer: {\r\n historyApiFallback: true,\r\n },\r\n};\r\n\r\n\r\n\n\npackage.json {scripts}\n\n\"server\": \"node ./backend/server/server.js\",\n\"webpack\": \" webpack-dev-server --host 0.0.0.0 --disable-host-check\",\n\"start\": \"run-p webpack server \" /* run-p is part of npm-run-all package*/\n\n\nDockerfile\n\nFROM node:latest\nWORKDIR /app\nCOPY . /app\nEXPOSE 3000\n\n\ndocker-compose.yml\n\nversion: \"3\"\nservices:\n app:\n container_name: projectX\n image: docker-node-express-mongoapp\n restart: always\n build: .\n command: npm run start\n ports:\n - \"3000:3000\"\n\n\n mongo:\n container_name: mongo\n image: mongo\n command: [\"mongod\", \"--bind_ip_all\"]\n volumes: \n - /app:/data/configdb\n - mongo-data:/data/db\n ports:\n - \"27017:27017\"\n\nvolumes:\n mongo-data:\n\nIf I type in the browser \"192.168.99.100:3000/gallery\" I had only data (json) response from database but not any html/css code.\n\nWhen I try manually send index.html to the browser with:\n\napp.get('/', function(request, response) {\n response.sendFile(path.resolve(__dirname + '../../../frontend/src/index.html'),\n );\n});\n\n\nI have problem with load frontend-output.js. (404 not found)\n\nThank you very much for help :)" ]
[ "javascript", "node.js", "express", "docker", "webpack" ]