texts
sequence
tags
sequence
[ "Emulate touch scroll in Java", "I am searching for a way to create a touch application in Java (NOT for mobile devices) with a touch scroll support.\nIve been searching so far and I am investigating how this could be done - what ive found is the MT4J (http://www.mt4j.org/) but it seems that it would not support that (please correct me if i am wrong).\nSo my question is, how can i emulate a scroll event on a horizontal touch / swipe?\n\nThanks for help!\nKind Regards,\nAlex" ]
[ "java", "touch", "javafx", "desktop-application" ]
[ "How to bypass socket?", "I have installed a streaming server \"Lighttpd\" (light-tpd) which runs on port 81.\n\nI have a C program that listens to http requests on port 80 using a server socket created by socket api.\n\nI want that as soon as I get a request on the port 80 from a client I forward that to the streaming server and the remaining conversation takes place b/w the Streaming Server and client & they bypass my C program completely.\n\nThe problem is client would be expecting msgs from socket at port 80 (i.e from the socket of my C program) since it had sent request to port 80 only rather than from the Streaming server which gives service on port 81.\ncan anyone help me out on this issue of bypassing the socket on port 80 for replying to the client.\n\nSolution I think: my program can be a middle man...It will forward the request to port 81 of streaming server and when it get replies from there it forwards them to the client...but bypassing would be efficient and I don't know how to do that. Please help me out.\n\nThanks in advance" ]
[ "sockets" ]
[ "Datatype of columns with null values only in python", "I need to find out the datatype of columns with null values only.\ndf.columns[df_test.isnull().sum()>0] \n\nis giving me the list of columns which has null values , but i need the list of columns with datatypes.\nCan you please help !!!" ]
[ "python", "pandas" ]
[ "How can I nest layouts in rails", "I have Account controller which contains actions like \"change password\", \"change email\", etc.\nEvery view will have the same sidebar, which I want to abstract out to additional account layout.\n\n application layout (header, footer) \n \\/\n account layout (sidebar)\n \\/\n view\n\n\nIs it possible to do without editing layouts/application?\n\nI have tried to create app/view/layouts/account.html.erb, and use yield inside, but in this case, rails skips layouts/application and starts with layouts/account." ]
[ "ruby-on-rails", "ruby-on-rails-3" ]
[ "Marshal Array of Strings from C++ to C#", "I'm using the Microsoft Docs example on Marshaling strings. The code doesn't crash, but not does return the expected strings in C#. The strings are unmodified when the native code is called, so I'm wondering if this example might be outdated? \n\nIf this example doesn't work for someone else is there another way of Marshaling C++ array of strings to C#?\n\nC++ example here:\nhttps://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/as6wyhwt(v=vs.100)?redirectedfrom=MSDN\n\nPINVOKELIB_API int TestArrayOfStrings( char* ppStrArray[], int count )\n{\n int result = 0;\n STRSAFE_LPSTR temp;\n size_t len;\n const size_t alloc_size = sizeof(char) * 10;\n\n for ( int i = 0; i < count; i++ )\n {\n len = 0;\n StringCchLengthA( ppStrArray[i], STRSAFE_MAX_CCH, &len );\n result += len;\n\n temp = (STRSAFE_LPSTR)CoTaskMemAlloc( alloc_size );\n StringCchCopyA( temp, alloc_size, (STRSAFE_LPCSTR)\"123456789\" );\n\n // CoTaskMemFree must be used instead of delete to free memory.\n\n CoTaskMemFree( ppStrArray[i] );\n ppStrArray[i] = (char *) temp;\n }\n\n return result;\n}\n\n\nC# corresponding example here:\nhttps://docs.microsoft.com/en-us/dotnet/framework/interop/marshaling-different-types-of-arrays\n\ninternal static class NativeMethods\n{\n[DllImport(\"..\\\\LIB\\\\PinvokeLib.dll\", CallingConvention = CallingConvention.Cdecl)]\n internal static extern int TestArrayOfstrings(\n [In, Out] string[] stringArray, int size);\n}\n// string array ByVal \n string[] strArray = { \"one\", \"two\", \"three\", \"four\", \"five\" };\n Console.WriteLine(\"\\n\\nstring array before call:\");\n foreach (string s in strArray)\n {\n Console.Write(\" \" + s);\n }\nint lenSum = NativeMethods.TestArrayOfstrings(strArray, strArray.Length);\nConsole.WriteLine(\"\\nSum of string lengths:\" + lenSum);\nConsole.WriteLine(\"\\nstring array after call:\");\nforeach (string s in strArray)\n{\n Console.Write(\" \" + s);\n}" ]
[ "c#", "c++", ".net", "string", "marshalling" ]
[ "Run a autohotkey (ahk) script from java", "is there a way to run a script with parameters from java?\nNot an executable file, but an AutoHotKey script.\n\nI tried this, but since it is not a valid executable file it doesn't work.\n\nControl class :\n\npackage org.bsep.acp;\n\nimport java.io.IOException;\n\n/**\n * This class allow you to send string to your\n * computer as keystrokes.\n * \n * escape car is '\n * special char are {space}, {Enter}, {F1}, {F2}, etc\n * \n * @author Eildosa\n */\npublic class StringSender {\n\n Runtime runtime;\n private final static String AHK_BRIDGE = \"C:\\\\perso\\\\WorkspaceScripts\\\\skyrimTools\\\\src\\\\org\\\\bsep\\\\acp\\\\ahkBridge.ahk\";\n\n public StringSender() {\n runtime = Runtime.getRuntime();\n }\n\n public void sendString(String data) throws IOException, InterruptedException {\n runtime.exec(new String[] { AHK_BRIDGE, data} );\n Thread.currentThread();\n Thread.sleep(1000);\n }\n\n}\n\n\nTest :\n\nRuntime runtime = Runtime.getRuntime();\nruntime.exec(NOTEPAD);\nThread.currentThread();\nThread.sleep(4000);\nStringSender stringSender = new StringSender();\nstringSender.sendString(\"Writing from java through AHK.\");\n\n\nException :\n\nException in thread \"main\" java.io.IOException: Cannot run program \"C:\\perso\\WorkspaceScripts\\skyrimTools\\src\\org\\bsep\\acp\\ahkBridge.ahk\": CreateProcess error=193, %1 n?est pas une application Win32 valid\n at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)\n at java.lang.Runtime.exec(Runtime.java:617)\n at java.lang.Runtime.exec(Runtime.java:485)\n at org.bsep.acp.StringSender.sendString(StringSender.java:25)\n at org.bsep.acp.VariousTests.ahkBridgeTester(VariousTests.java:23)\n at org.bsep.acp.VariousTests.main(VariousTests.java:13)\nCaused by: java.io.IOException: CreateProcess error=193, %1 n?est pas une application Win32 valid\n at java.lang.ProcessImpl.create(Native Method)\n at java.lang.ProcessImpl.<init>(ProcessImpl.java:376)\n at java.lang.ProcessImpl.start(ProcessImpl.java:136)\n at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)\n ... 5 more\n\n\nTranslation : this is not a valid win32 application.\n\nThanks." ]
[ "java", "windows", "autohotkey" ]
[ "How To send multiple SMS using php loop", "There is a problem with send multiple SMS using loop, not working.. \n\nthe codes are :\n\n while ($row = mysql_fetch_array($result)) {\n\n $dealer_name = $row['dealer_name'];\n $dealer_contact_no = $row['contact_no'];\n\n $date = new DateTime($row['date']);\n $date = $date->format('d-M-y');\n $due_date = new DateTime($row['due_date']);\n $due_date = $due_date->format('d-M-y');\n\n //////////////////sms body \n $msg = '';\n $msg .= 'Bill Payable-' . \"%0A\";\n $msg .= 'Bill No:' . $row['ref_no'] . \"%0A\";\n $msg .= 'Date:' . $date . \"%0A\";\n $msg .= 'Total Amt:' . $row['total_amount'] . \"%0A\";\n $msg .= 'Pending Amt:' . $row['pending_amount'] . \"%0A\";\n $msg .= 'Due Date:' . $due_date . \"%0A\";\n $msg .= 'Days:' . $row['days'] . \"%0A\";\n $msg .= '-' . $sender_name;\n\n $username = \"*********\";\n $password = \"*********\";\n $text = $msg;\n $phones = $dealer_contact_no;\n\n if (strlen($phones) == 10) {\n $url = 'http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=' . $username . '&password=' . $password . '&sendername=NETSMS&mobileno=' . $phones . '&message=' . $text;\n\n $ch = curl_init(); \n curl_setopt($ch,CURLOPT_URL,$url);\n curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);\n $output = curl_exec($ch);\n curl_close($ch);\n }\n }\n\n\nHow to execute the url again and again to send multiple SMS..\nplease help.. earlier i used header() function but it works only with single row fetched.." ]
[ "php", "bulksms" ]
[ "Canvas Path2d inner shadow", "I create svg and i wanna convert svg to canvas.\nI do the following:\n\nvar canvas = document.getElementById(\"canvas\");\nvar ctx = canvas.getContext(\"2d\");\nvar p = new Path2D(\"M10 10 h 80 v 80 h -80 Z\");\nctx.fillStyle = '#cb1a2f';\nctx.shadowColor = \"rgba(0, 0, 0, 0.5)\";\nctx.shadowBlur = 24;\nctx.fill(p);\n\n\nBut I want to make the shadow inside the square. I have a completely different figure SVG. this SVG is purely an example." ]
[ "canvas", "svg", "shadow" ]
[ "Cant fetch variable after submitting the form", "The variable $role_id1 is not being fetched in $role_id in $_POST['add sub menu'].\n I want to store $role_id1 in $role_id and insert into database.Afer i click the submit button the role_id1 is fetching the parent menu but after i click add sub menu the role_id is storing 0 at backend.But i want it to store the vale of role_id1 which is being fetched after i click submit.Suggest any solution if possible.\n\n <?php\n\n $dbcon = new MySQLi(\"localhost\",\"root\",\"\",\"menu\");\nif(isset($_POST['add_main_menu']))\n{\n$menu_name = $_POST['menu_name'];\n$parent_id = 0;\n$role_id = $_POST['role_id'];\n$menu_link = $_POST['mn_link'];\n$sql=$dbcon->query(\"INSERT INTO menu VALUES('','$menu_name','$parent_id','$role_id','$menu_link')\");\n}\n if(isset($_POST['add_sub_menu']))\n{\n$parent_id = $_POST['parent'];\n$name = $_POST['sub_menu_name'];\n\n$role_id = $role_id1;\n$menu_link = $_POST['sub_menu_link'];\n\n$sql=$dbcon->query(\"INSERT INTO menu VALUES('','$name','$parent_id','$role_id','$menu_link')\");\n} \n\n?>\n\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<title>Dynamic Dropdown Menu</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" media=\"all\" />\n</head>\n<body>\n<div id=\"head\">\n<div class=\"wrap\"><br />\n<h1><a href=\"index.php\">Back to menu</a></h1>\n</div>\n</div>\n<center>\n<pre>\n<form method=\"post\">\n <input type=\"text\" placeholder=\"menu name :\" name=\"menu name\" /><br />\n\n <input type=\"text\" placeholder=\"role id :\" name=\"role_id\" /><br />\n <input type=\"text\" placeholder=\"menu link :\" name=\"mn_link\" /><br />\n <button type=\"submit\" name=\"add_main_menu\">Add main menu</button> \n </form>\n </pre>\n<br />\n<pre>\n<form method=\"post\">\n<select name=\"role_id\">\n<option selected=\"selected\">select role id</option>\n\n<?php\n$res=$dbcon->query(\"SELECT distinct role_id FROM menu\");\nwhile($row=$res->fetch_array())\n{\n ?>\n <option value=\"<?php echo $row['role_id']; ?>\"><?php echo $row['role_id']; ?></option>\n<?php\n }\n ?>\n </select><br />\n <input type=\"submit\" value=\"submit\" name=\"submit\">\n\n<?php if(isset($_POST['submit']))\n{\n?>\n <select name=\"parent\">\n <option selected=\"selected\">select parent menu</option>\n<?php\n$role_id1 = $_POST['role_id'];\n\n$res=$dbcon->query(\"SELECT * FROM menu where role_id= $role_id1 AND parent_id=0 \");\n while($row=$res->fetch_array())\n {\n?>\n <option value=\"<?php echo $row['id']; ?>\"><?php echo $row['name']\n;\n\n?></option>\n<?php\n\n\n }\n }\n\n\n\n ?>\n </select><br />\n <input type=\"text\" placeholder=\"menu name :\" name=\"sub_menu_name\" /><br />\n <input type=\"text\" placeholder=\"menu link :\" name=\"sub_menu_link\" /><br />\n <button type=\"submit\" name=\"add_sub_menu\">Add sub menu</button>\n </form>\n </pre>\n <a href=\"index.php\">back to main page</a>\n </center>\n\n </body>\n </html>" ]
[ "php", "mysql" ]
[ "Chrome extension only runs sometimes", "I recently started learning a little javascript and made a basic chrome extension, but the problem is that it only sometimes works. What I want it to do is replace the text in any input box to be that of the variable specified in the code, and it works, but not all the time. When I load a site, for example google.com, it might work as I type in the search box, but then doesn't if I refresh the page, and then it might works if I refresh again. \n\nhere is my code:\n\nmanifest.json\n\n{\n \"manifest_version\": 2,\n \"name\": \"My Cool Extension\",\n \"version\": \"0.1\",\n\n \"content_scripts\": [\n {\n \"matches\": [\n \"<all_urls>\"\n ],\n \"js\": [\"jQuery.js\", \"content.js\"]\n }\n ],\n\n \"browser_action\": {\n \"default_icon\": \"icon.png\"\n } \n}\n\n\ncontent.js\n\nwindow.onload = function () {\n var inputs = document.getElementsByTagName('input');\n for (i = 0; i < inputs.length; i++) {\n inputs[i].onkeyup = function () {\n\n var text = \"Text to fill in\";\n this.value = text.substring(0, this.value.length);\n\n };\n }\n};\n\n\nI am waiting for the window to fully load before typing.\nI have also run it on another computer, same problem.\nAnyone have any ideas?" ]
[ "javascript", "html", "google-chrome", "google-chrome-extension", "textbox" ]
[ "Determine which page a query was executed upon", "My site contains a \"Developers Window\" which shows various breakdowns on the query's ran to produce the current page. But obviously due to the nature of the site we've got maybe 10 files all included to create one page.\n\nWe're using a PDO class and we wanted a way to display the file in which ran the query, and even better if possible the line number.\n\nMy only approach would be to add in the filename each time we run a query.\n\n$dB->fetchRow('DO QUERY', FILE_NAME);\n\n\nAnyone got any way we could implement this?\n\nThanks," ]
[ "php", "mysql", "pdo" ]
[ "How could I specify assignee while using git push option to create a MR?", "I want to create a MR via the command line and specify the assignee at the same time.\nI know the following cmd can create a MR to the target branch.\ngit push -o merge_request.create -o merge_request.target=develop\n\nHowever, is there any option that can enable me to specify the assignee?\nFor example, I've tried but it never works.\ngit push -o merge_request.create -o merge_request.target=develop -o merge_request.assignee=0 #(or whatever)" ]
[ "git", "gitlab", "gitlab-api" ]
[ "AngularJS Material Dialog using component as template", "I have an angular component which I want to use in an AngularJS Material dialog:\n\nreturn $mdDialog.show({\n template: '<publish-dialog user=\"$ctrl.user\" target-collection=\"$ctrl.targetCollection\"></publish-dialog>',\n controller: function () {\n this.user = user;\n this.targetCollection = targetCollection;\n },\n controllerAs: '$ctrl',\n targetEvent: event,\n clickOutsideToClose: true\n});\n\n\nThe problem is, that when defining the template like this, the generated html looks like this:\n\n<md-dialog>\n <publish-dialog>\n <md-toolbar></md-toolbar>\n <md-dialog-content></md-dialog-content>\n <md-dialog-actions></md-dialog-actions>\n </publish-dialog>\n<md-dialog>\n\n\nThe component element is breaking the between md-dialog and md-toolbar, md-dialog-content and md-dialog-actions leads to a layout break and the md-toolbar and the md-dialog-actions are not fixed.\n\nSo my question is, is there a way to only render the component template contents without the component element (<publish-dialog></publish-dialog>)?" ]
[ "css", "angularjs", "angularjs-material" ]
[ "Set Property of a Realtionship to label in Neo4j", "I have a few Realtionships in Neo4J with the label "[r:Absatraction]". They all have a Property on them like "SysML:refine" or "SysML:trace" or "SysML:verify".\nThese "Abstractions connect differently labeled nodes. Now I want Neo4j to replace the Label "Abstraction" with the labels from the "SysML" Property. So that on the graph one can see "[r:refine],[r:verify]...".\nI tried: apoc.create.addLabels, but it only seems to work for nodes.\nIs there a way to do that?" ]
[ "neo4j", "cypher", "neo4j-apoc" ]
[ "Schedule a C# application", "i developed an application to connect to a pop3 mail, read the emails and insert them into a database. I need this service to do the task once an hour. Could somebody please help me with this because i'm stuck?\n\nstatic void Main(string[] args)\n {\n TcpClient Server;\n NetworkStream NetStrm=null;\n StreamReader RdStrm=null;\n string Data, tmpMessage=\"\", mail=\"\", szTemp, CRLF = \"\\r\\n\", ch=\"\";\n byte[] szData;\n int i=0, counter=0;\n MySqlConnection connection = new MySqlConnection();\n [snip]\n Console.WriteLine(RdStrm.ReadLine());\n connection.Close();\n Console.ReadLine();\n }\n\n\nI'm not much of a programmer so please excuse my bad use of the language.\nAll the functionality is inside here but i just don't know how to time it and make it run continously.\nThanks a lot" ]
[ "c#", "scheduled-tasks" ]
[ "Efficient way of generating latin squares (or randomly permute numbers in matrix uniquely on both axes - using NumPy)", "For example, if there are 5 numbers 1, 2, 3, 4, 5\n\nI want a random result like\n\n[[ 2, 3, 1, 4, 5]\n [ 5, 1, 2, 3, 4]\n [ 3, 2, 4, 5, 1]\n [ 1, 4, 5, 2, 3]\n [ 4, 5, 3, 1, 2]]\n\n\nEnsure every number is unique in its row and column.\n\nIs there an efficient way to do this?\n\nI've tried to use while loops to generate one row for each iteration, but it seems not so efficient.\n\nimport numpy as np\n\nnumbers = list(range(1,6))\nresult = np.zeros((5,5), dtype='int32')\nrow_index = 0\nwhile row_index < 5:\n np.random.shuffle(numbers)\n for column_index, number in enumerate(numbers):\n if number in result[:, column_index]:\n break\n else:\n result[row_index, :] = numbers\n row_index += 1" ]
[ "python", "numpy", "scipy" ]
[ "rest api xml consume error com.fasterxml.jackson.core.JsonParseException: Unexpected character '\"' (code 34) in prolog; expected '<'", "I have a simple xml string which i want to pass to other service using restTemplate and want to serialize back to xml\nBut i am getting constant error message com.fasterxml.jackson.core.JsonParseException: Unexpected character '&quot;' (code 34) in prolog; expected '&lt;'\nCan you please help me what i am doing wrong -\nXml String\n&lt;?xml version='1.0' encoding='UTF-8'?&gt;\n&lt;note&gt;\n &lt;to&gt;Tove&lt;/to&gt;\n &lt;from&gt;Jani&lt;/from&gt;\n &lt;heading&gt;Reminder&lt;/heading&gt;\n &lt;body&gt;Don't forget me this weekend!&lt;/body&gt;\n&lt;/note&gt;\n\nKafkaTopicListener.java\nKafkaListener(topics = &quot;test-topic&quot;, groupId = &quot;group-id&quot;, containerFactory = &quot;kafkaListenerContainerFactory&quot;)\n public void listen(String payload) throws Exception {\n \n System.out.println(&quot;KafkaTopicListener.listen : payload ::&quot;+payload.toString());// this is an xml string\n \n HttpHeaders headers = new HttpHeaders();\n \n headers.setContentType(MediaType.APPLICATION_XML);\n headers.setAccept(Arrays.asList(MediaType.APPLICATION_XML));\n \n HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(payload, headers);\n \n restTemplate.postForEntity(validationURL, entity, String.class); \n }\n\nmy receiver service(different app running on different port) is\nReceivingClass.java\n@RequestMapping(value = &quot;/testByteArray&quot;, method = RequestMethod.POST, consumes = &quot;application/xml&quot;)\n public void testByteArray(@RequestBody Object payload) throws IOException, ClassNotFoundException {\n \n System.out.println(&quot;MailController.testByteArray String::&quot;+payload.toString());\n \n }\n\nI am using jackson-dataformat-xml jar in my dependency for xml parsing.. but getting the parsing exception as below -\n2021-03-11 13:01:27.531 WARN 25328 --- [nio-9003-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character '&quot;' (code 34) in prolog; expected '&lt;'\n at [row,col {unknown-source}]: [1,1]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character '&quot;' (code 34) in prolog; expected '&lt;'\n at [row,col {unknown-source}]: [1,1]]\n2021-03-11 13:01:27.764 WARN 25328 --- [nio-9003-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character '&quot;' (code 34) in prolog; expected '&lt;'\n at [row,col {unknown-source}]: [1,1]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character '&quot;' (code 34) in prolog; expected '&lt;'" ]
[ "java", "xml", "spring-boot", "rest", "jackson" ]
[ "Excel COUNTIF with strings, separated by comma", "I am trying to write a simple formula to count how many times a particular name appears in a column. I am using COUNTIF as it is a pretty straight forward process but I cannot work out how to make it happen for a name in particular. This is the case:\n\n\n\nThe column named Age will display cells with one or more names, separated by commas in case there are more than one value. Putting \"Young\" as an example is easy to tell the COUNTIF formula to give me the number representing how many times this word appears, either being the only value in cell or as a part of a cell with a longer string value by giving the formula the \"Young\" statement.\n\nThe problem comes when I want the formula to count how many times \"Mature\" appears in my column. I cannot work out the way to make it count only when it says \"Mature\" without also taking all the \"Early_Mature\" or \"Semi_Mature\"\n\nI know this is easy for whoever knows the basics of Excel so I don't think there is need to give more details.\n\nThanks" ]
[ "excel", "excel-formula", "formula", "countif" ]
[ "Get new and modified (real status) file by git", "My Situation\n\nI want to get new and modified files and then do something such as compress.Out of consideration to efficacy, I can not search all files every time. So git comes into my mind.\n\nI know git status can help me to get all changed files and then I can filter them by myself.But there is a problem.Let me hold an example.\n\nI have a file named text.txt whose content is Hello. Then I modified its content to Hello World.Now I execute git add test.txt. Finally I recover its content to Hello.\n\n\nIf this time I also executegit add test.txt, then git status gives me nothing.It's right because in fact the file not modified.\nIf this time I do not, the git status shows\n\n\n\n Changes to be committed:\n modified: test.txt\n \n Changes not staged for commit:\n modified: test.txt\n\n\nMy Question\n\nIs there any way to do such thing by git?\n\nEdit\n\nMaybe git does not work in this situation.So is there other way?" ]
[ "linux", "git", "file", "version-control" ]
[ "Android emulator for small screen device", "Hi i want to check my app on emulator that is on 2.7in and 3.2in.\n\ncan i do it with the android simulator? because it always open me a big emulator" ]
[ "java", "android", "android-emulator" ]
[ "iOS: How do I swap landscape orientation Xs and Ys", "My app is going to be landscape only. I am have major problems with width, height, x, and y variables. Is there a way to swap all width, height, x, and y values so I don't have to reverse all the coordinates in my app? (I.e. (x,y) has to become (y,x) and something.width has to be something.height.)\n\nHere is a concrete example of my problems:\n\n-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event\n{\n UITouch *touch = [[event allTouches] anyObject];\n CGPoint touchPoint = [touch locationInView:unitArea];\n\n if (CGRectContainsPoint(self.view.frame, touchPoint))\n {\n NSLog(@\"released in area\");\n }\n}\n\n\nThis isn't working in landscape... It is using the wrong coordinates, and in some places, it will output \"released in area\", but not in the actual area that the view is located.\n\nunitArea bounds are &lt;UIView: 0x6a52420; frame = (20 0; 300 480); transform = [0, -1, 1, 0, 0, 0]; autoresize = RM+BM; layer = &lt;CALayer: 0x6a524a0&gt;&gt;\n\n\nThis is showing as my view's bounds when it should be (0 20; 480 300).\n\nEdit, more information:\n\nHere is my (premade) orientation method:\n\n- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation\n{\n if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {\n return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);\n } else {\n return YES;\n }\n}\n\n\nAnd in the Project summary my \"Supported Device Orientations\" are only set to landscape." ]
[ "ios", "ios5" ]
[ "How to reach and show a picture which is inside a Seagate Gigabit Ethernet BlackArmor Disk with vb6", "Actually i have no idea how this kinda disks works. Its the first time i deal with such disk. I putted some pictures in a folder named as oldpics and with a vb code i wanna reach it but some how i just cant find the picture inside it and its imposible cause i know that the picture is in that folder.\n\n'This A_PicRoad is = \"\\\\198.162.1.20\\oldpics\\\" which is exist for sure\nIf mdiMain.fsoexist.FileExists(mdiMain.A_PicRoad &amp; stock &amp; \".jpg\") Then\n\n pic1.Picture = LoadPicture(mdiMain.A_PicRoad &amp; stock &amp; \".jpg\")\n\n Set img = New ImageFile\n img.LoadFile mdiMain.A_PicRoad &amp; stok &amp; \".jpg\" \n\nEnd If\n'But somehow cant find the picture and leaving this if statement without processing anything..\n\n\nso what could be causing that?\n\nEdit: I just remember that at first i must enter a username and pass while reaching \\\\198.162.1.20\\ after that i can reach \\\\198.162.1.20\\oldpics\\.." ]
[ "vb6", "image", "ethernet", "network-drive" ]
[ "How to change text colour when text box clicked in Macro enabled Powerpoint 2013?", "So I would like the text to change colour from grey to black... How do I do this on Powerpoint 2013 and where would I apply the code? Sorry in advance for not supplying any code I just don't know where to start." ]
[ "vba", "powerpoint" ]
[ "Correlation between two moving-average smoothed variables", "I have two time-series variables: mood and another external indicators. I want to compute the association between these variables. Let's say both have values for day 1 to N.\n\nI compute two types of associations:\n\nBy simply correlating these two vectors of N elements each.\nBy correlating the variables after they are smoothed with moving-averages. So, I compute the moving-averages of these variables with a window of M. This is computed by taking the average of first M elements, then moving forward by leaving the first element and including the M+1-th element, and so on. Finally, I compute the correlation between these two vectors of N-M+1 elements each.\nI don't see any correlation in the first case, however, in the seconds case I see a significantly moderate correlation. I am wondering if it is correct to use the correlations obtained by the second case. If not why?\n\nDoes the smoothening introduces temporal autocorrelation in both variables, which is the reason the I get significant correlation in the second case?\n\nI tried to search for this but found only the question below that has no accepted answer yet.\n\nhttps://math.stackexchange.com/questions/1239077/is-it-valid-to-get-a-correlation-between-moving-averages" ]
[ "time-series", "correlation", "smoothing" ]
[ "Rule Engine in JavaScript", "Is there any Rule engine in JavaScript? \n\nThe question is in this context:\n\n\nConsider a web application having a form that users fill up.\nAs a user fills up each field and proceeds to the next, business logic written in JavaScript controls the visibility(and other attributes) of form elements further down the page.\nThe same business logic is also applied at the server side after the form gets submitted, albeit, in Java to guard against any mishaps/manipulations at the browser side.\nNow, Wouldn't it be nice if we have a JSR 94/Drools/JRules like rule engine that would execute rules in both Java and in JavaScript? With such a rule engine, I can avoid hard coding my rules, and I also retain the flexibility of having client-side as well as server-side validation\n\n\n(PS: I've tried the AJAX route and seen that the application becomes a lot less responsive, making it hard to sell to users who've been accustomed to a hand-coded, pure-javascript version.)" ]
[ "javascript", "drools", "rule-engine", "jrules" ]
[ "Have a clickable page", "What I want is to have a page with a Textblock in the middle. Also I want the page to be clickable (as in you should be able to click anywhere on the entire page and the function will be called).\n\nWhat I've tried is to have the TextBlock in a Viewbox and to set stretch to full, but that made the textblock text out of proportion. And if I set it to Uniform it only takes up however much space it needs. So either way it doesn't work.\n\nAlso the textblock needs to automatically resize itself when the page gets bigger / smaller (i.e. set Height and Width to \"Auto\"), I've tried a lot and nothing works, so any help is appreciated. Below is what I currently have.\n\n&lt;Viewbox x:Name=\"MainViewbox\" Stretch=\"Uniform\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\" Margin=\"1, 1, 1, 1\"&gt;\n &lt;TextBlock x:Name=\"MainTextBlock\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\" TextAlignment=\"Center\" Text=\"6\" Height=\"Auto\" Width=\"Auto\" Foreground=\"LightSkyBlue\"/&gt;\n&lt;/Viewbox&gt;\n\n\nThis Almost works but I can only click on the six, not on the whole screen.\n\nAnyway thanks in advance!" ]
[ "c#", "xaml", "resize", "textblock", "viewbox" ]
[ "How to add Windows Credentials to Credentials Manager on Windows programmatically?", "I have looked at this question's selected answer\nRetrieve Credentials from Windows Credentials Store using C#\n, which uses the CredentialManagement NuGet package to get and set credentials on Windows.\n\n\n Credential Management package is a wrapper for the Windows Credential Management API that supports both the old and the new style of UI\n\n\nI was able to set new credentials that way, however they were set as Generic Credentials. \n\npublic static bool SetCredentials(\n string target, string username, string password, PersistanceType persistenceType)\n {\n return new Credential\n {\n Target = target,\n Username = username,\n Password = password,\n PersistanceType = persistenceType\n }.Save();\n }\n\n\nAccording to this, there are at least 4 different types of credentials that the Windows Credentials Manager can use:\n\n\nWindows Credentials\nCertificate-Based Credentials\nGeneric Credentials\nWeb Credentials\n\n\nThe credentials I need to set are intended to allow access to a specific local web server, and when I have added them manually as Windows Credentials they work, when they get added as Generic Credentials by the application, or myself, they don't work.\n\n\n\nI couldn't find enough information about this here, so what I need to know is how to add Windows Credentials to the Windows Credentials Manager by using this package, or in any other way that can be done programmatically.\n\nUPDATE: I managed to solve my issue by doing it the way it's shown on this question: C# Using CredWrite to Access C$. However, since I didn't want to answer the same thing here as well, I will leave the question open in case someone knows how to do it differently, or else I will vote to close it.\n\nUPDATE 2: Although by the time the previous update was posted the solution that was found then was working, it's not working now. So I'm still looking for a way to completely solve this problem. I'm sure the previous link can still be useful for someone else though." ]
[ "c#", "windows-7", "windows-10", "credentials", "credential-manager" ]
[ "android-studio Undeclare as deprecated", "How do I undeclare something as deprecated in android studio?\n\nThe specific case of mine: java.lang.String is declared as deprecated in every (also new) Project. I can't find any solution to this, neither at stackoverflow, the android studio settings/docs nor in the rest of the whole internet ':D\n\nAndroid studio gave me (while declaring a variable) the option to declare 'String' as deprecated, and I wanted to try it, but thought I would to be able to undeclare it in the same easy fashion.. but nope. \n\nAny suggestions?" ]
[ "java", "android-studio" ]
[ "what's the range of the formatted output of `cout`", "In my program, there will be two lines of output: numbers in the first line are integers less than 1000; numbers in the second line are floats between 0 and 10. The format of the output I want is like:\n\nright format\n\nand here is how I try (all outputs are the last four lines):\ncase 1 - 5\n\n\noutput without format; in the picture we can see the numbers that should be printed\nline 1 without format and line 2 with format\nnumbers in line 1; only the first one is right, and the number that is bigger than 100 is in scientific notation\nboth lines with format\njust like case 2, and &lt;&lt;setw(3)&lt;&lt;setfill('0') seems only works for one time to change 43 to 043, and then it won't work any more\nWith noshowpoint added. If i print *(p + 2)alone, it always prints 118with or without format. But if I print *(p + 2) in the for loop, the output is still 1.2e+002 except for the first one. But if I print the number 118 directly, the output is right.\n\n\nSo, which part of my code is wrong? And what is the right way to output the answer in right format?" ]
[ "c++" ]
[ "How to skip \"This project is using version xxx of android gradle plugin, which is incompatible with this version of android studio\" dialog?", "When ever updating each and every incremental build of Android Studio Canary, the below dialog appears and asks to update gradle plugin. The asked version is just a patch from 7.0.0.-alpha02 to 7.0.0.-alpha03\n\nHow can I fix this, can anything be done to skip this kind of silly updates when updating android studio?" ]
[ "android", "android-studio", "gradle", "intellij-idea", "android-gradle-plugin" ]
[ "Create New Date with string in VB.net", "I have string with format:\n\nDim date As String = \"2014/08/20 21:00\"\n\n\nI can't create new date with this format string\n\n Dim date2 As DateTime =DateTime.Parse(date ,CultureInfo.InvariantCulture)\n\n\nCan convert string \"2014/08/20 21:00\" to \"20/08/2014 9:00 PM\" ?" ]
[ "vb.net", "datetime" ]
[ "Google Chart add data from array", "Hi guys so I'm trying to draw a chart with Google chart\n\nthis is my code:\n\n google.charts.load('current', {'packages':['bar']});\n google.charts.setOnLoadCallback(drawStuff);\n\n\n function drawStuff() {\n\n var data = new google.visualization.arrayToDataTable([\n\n\n ['', 'Total: '],\n\n\n [info[\"name\"] , info[\"qn\"]], //first element\n [info[\"name\"] , info[\"qn\"]], //second element\n\n\n ]);\n\n\n\n var options = {\n\n\n legend: { position: 'none' },\n\n axes: {\n\n },\n bar: { groupWidth: \"80%\" }\n };\n\n var chart = new google.charts.Bar(document.getElementById('top_x_div'));\n // Convert the Classic options to Material options.\n chart.draw(data, google.charts.Bar.convertOptions(options));\n };\n\n\nMy question is: How can I insert data from an array to the chart? \n\nPS: the first element is supposed to be the first element of the array and the second element is supposed to be the second one.\n\nMy array:\n\n var cont = 1;\nvar rowtbl = document.getElementById(\"tabella\").rows.length;\nrowtbl = rowtbl - 1; //number rows table\nwhile(cont &lt;= rowtbl){\n var nomi;\n var qnt;\n nomi = document.getElementById(\"tabella\").rows[cont].cells[0].innerHTML;\n qnt = document.getElementById(\"tabella\").rows[cont].cells[1].innerHTML;\n var info = {name: nomi, qn: qnt};\n cont = cont +1; \n\n}" ]
[ "javascript", "charts", "google-visualization" ]
[ "How to store drawable in an array", "I want to download a bunch of images and would like to store it as drawable in an array. So I tried declaring a drawable array.But it returns me nullPointer exception when I access that array. \n\nMy question is, how to declare an array type as drawable ?" ]
[ "android", "drawable" ]
[ "jQuery UI Splitter/Resizable for unlimited amount of columns", "Using jQueryUI Splitter or Resizable functions I want to create a layout that allows an unlimited amount of columns to be added and all columns need to be resizable. \n\nSo it is like this fiddle: https://jsfiddle.net/f3gLh3mw/\n\nBut in this fiddle the HTML contains out of nested sets instead of inline. Which limits the possibilities as with the above fiddle you can only have equal widths for 2,4,8,16,32 etc columns. Everything in between shows up crooked as you can see in the Fiddle.\n\nWhen researching this I came on this SO question: jQuery UI and Splitter\n\nIf you look at the top answer then it shows a structure like:\n\n&lt;div class=\"wrap\"&gt;\n &lt;div class=\"resizable resizable1\"&gt;&lt;/div&gt;\n &lt;div class=\"resizable resizable2\"&gt;&lt;/div&gt;\n&lt;/div&gt;\n\n\nFull fiddle: http://jsfiddle.net/8qzTJ/86/\n\nWhich is the structure I want but the Javascript is hardcoded for only 2 resizable items. \n\nSo here is the question: \n\nHow to modify the last fiddle so it works with any amount of .resizable divs. \n\nOr does anyone know of a plugin that can do this. \n\nThanks everyone for helping!" ]
[ "javascript", "jquery", "html", "jquery-ui" ]
[ "Class \"cache\" not found - Prestashop", "I'm working on a prestashop friend's installation. So I took it from Github, set setting.php to my localhost but I have the following error :\n\nClass 'Cache' not found in /Applications/MAMP/htdocs/prestashop/classes/ObjectModel.php on line 1470\n\n\nBut I don't know how to fix it :/\n\nCan you help me ?\n\nThanks" ]
[ "class", "prestashop" ]
[ "Open chrome:// protocols in Chrome Extension?", "I have an extension that reads bookmarks and allows to open them, but it can't open bookmarks like 'chrome://extensions' or 'chrome://settings'. Local files also not doing anything.\nwindow.location = 'chrome://settings'\n\ngives an error: &quot;Not allowed to load local resource: chrome://settings/&quot;\nWhat permission do i need to do that?" ]
[ "google-chrome", "google-chrome-extension" ]
[ "Fragment Replace is causing problems yet again", "My activity XML\n\n&lt;android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"&gt;\n\n\n &lt;FrameLayout\n android:id=\"@+id/contentFrame1\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"&gt;&lt;/FrameLayout&gt;\n\n&lt;/android.support.design.widget.CoordinatorLayout&gt;\n\n\nI have an attachView method that invokes from onCreate of the activity\n\n@Override\nprotected void attachView() {\n // Get the fragment from dagger\n getFragmentManager().\n beginTransaction().\n setCustomAnimations(R.animator.slide_up, 0, 0, R.animator.slide_down).\n replace(R.id.contentFrame1, new MatchFragment2()).\n addToBackStack(\"MatchFragment\").\n commit();\n getFragmentManager().executePendingTransactions();\n\n new Handler().postDelayed(new Runnable() {\n @Override\n public void run() {\n getFragmentManager().\n beginTransaction().\n setCustomAnimations(R.animator.slide_up, 0, 0, R.animator.slide_down).\n replace(R.id.contentFrame1, new VictorFragment()).\n addToBackStack(\"VictorFragment\").\n commit();\n getFragmentManager().executePendingTransactions();\n getFragmentManager().getBackStackEntryCount(); //this reads 2\n }\n }, 3000);\n}\n\n\nWhen I press back from the VictorFragment , I am greeted with MatchFragment.\nShouldn't the VictorFragment be the lone existing fragment in the scenario and pressing back from it should exit the activity?" ]
[ "android", "android-fragments" ]
[ "Is it possible to index a private maven repository in IntelliJ?", "Using IntelliJ IDEA 2016.2, it complains that I have an un-indexed repo\n\nThe following repositories used in your gradle projects were not indexed yet: \nhttp://xxxxx.artifactoryonline.com/xxxxx/repo\nIf you want to use dependency completion for these repositories artifacts,\nOpen Repositories List, select required repositories and press \"Update\" button\n\n\nHowever, when I go to preferences > build/execution/deployment > build tools > maven > repositories, and hit the update button for that repo, it just remains in an error state and there's no message in the event log.\n\nWhen I hit the \"test\" button for the url, IntelliJ says \"service connection failed, no repositories found\". Nowhere does it allow for specifying credentials, only a url, so I suspect a credential issue or that maybe IntelliJ refuses to index private repos that require authentication.\n\nMy question is: Does IntelliJ IDEA 2016.2 allow you to index private maven repos? If so, how do you enter credentials?" ]
[ "maven", "intellij-idea", "artifactory" ]
[ "preg_match for certain part of the comments", "i want to find certain part of the comments. following are some examples\n\n/*\n * @todo name another-name taskID\n */\n\n/* @todo name another-name taskID */\n\n\ncurrently im using following regular expression\n\n'/\\*[[:space:]]*(?=@todo(.*))/i'\n\n\nthis returns following:\n\n* @todo name another-name taskID\nor\n* @todo name another-name taskID */\n\n\nhow can i just get just @todo and names, but not any asterisks?\n\ndesired output\n\n@todo name another-name taskID\n@todo name another-name taskID" ]
[ "php", "regex", "preg-match", "preg-match-all", "preg-replace-callback" ]
[ "How to find function to match spectific data in mongoDB", "we have to find data if this key-value exists together.\n\n1. orgId = PQR\n\n2. tagId = 123\n\nThis is array of objects.\n\n [{\n \"_id\" : \"c6114ee0\",\n orders:[{\n \"orgId\" : \"ABC\",\n \"tagId\" : \"123\"\n },\n {\"orgId\": \"PQR\",\n \"tagId\": \"456\"\n },\n {\"orgId\": \"XYZ\"\n }\n ]\n },\n {\n \"_id\" : \"c6114ee1\",\n orders:[{\n \"orgId\" : \"SDE\",\n \"tagId\" : \"446\"\n },\n {\"orgId\": \"PQR\",\n \"tagId\": \"123\"\n },\n {\"orgId\": \"UJI\"\n }\n ]\n }]\n\n\noutput\n\n {\n \"_id\" : \"c6114ee1\",\n orders:[\n {\"orgId\": \"PQR\",\n \"tagId\": \"123\"\n }\n ]\n }\n\n\nwe have used this condition\n\n\n db.collection.find({\"orders.orgId\":\"PQR\",\"orders.tagId\":\"123\"},function(err, result){\n })\n\n\nit returns both documents.\n\nNOTE:\n we have not be used aggregate" ]
[ "node.js", "mongodb", "express", "mongoose" ]
[ "Problem with setNeedsDisplayInRect (quartz2d, iPhone)", "I have written a function that draws x number of squares in a random position every 2 seconds. A square cannot be drawn in the same position twice. Once the app has completed a cycle the grid will be filled in. Now, this works fine when the number of squares drawn is &lt;=8, however when this is higher a square is randomly drawn into the same position as a previous square. \n\nInstead of drawing a square into a random position I have tried drawing them from top-bottom and this works perfectly. \n\nI've been debugging this for a couple of days and I believe the problem lies with setNeedsDisplayInRect. \n\nHope someone can help. Sorry if I have rambled, its getting late and my head is mashed, lol :)\n\nBelow is the code....\n\n- (void)drawRect:(CGRect)rect {\nint count = [writeSquares count];\n\nCGContextRef context = UIGraphicsGetCurrentContext();\n\nint radius = 4;\n\nfor (int i = 0; i &lt;count; i++)\n{\n Square *square = [writeSquares objectAtIndex: i];\n\n CGContextSetLineWidth(context, 1);\n //CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n CGContextSetFillColorWithColor(context, [square color].CGColor);\n CGContextMoveToPoint(context, CGRectGetMinX([square squareRect]) + radius, CGRectGetMinY([square squareRect]));\n CGContextAddArc(context, CGRectGetMaxX([square squareRect]) - radius, CGRectGetMinY([square squareRect]) + radius, radius, 3 * M_PI / 2, 0, 0);\n CGContextAddArc(context, CGRectGetMaxX([square squareRect]) - radius, CGRectGetMaxY([square squareRect]) - radius, radius, 0, M_PI / 2, 0);\n CGContextAddArc(context, CGRectGetMinX([square squareRect]) + radius, CGRectGetMaxY([square squareRect]) - radius, radius, M_PI / 2, M_PI, 0);\n CGContextAddArc(context, CGRectGetMinX([square squareRect]) + radius, CGRectGetMinY([square squareRect]) + radius, radius, M_PI, 3 * M_PI / 2, 0); \n CGContextClosePath(context);\n CGContextFillPath(context);\n\n //NSLog(@\"x = %f x = %f\", CGRectGetMaxX([square squareRect]), CGRectGetMinX([square squareRect]));\n}\n\n//NSLog(@\"Count %i\", [writeSquares count]);\n\n[writeSquares removeAllObjects];\n\n\n}\n\n-(void)drawInitializer:(int) counter{\n\nif(extra != 0) {\n [self setNeedsDisplay];\n [grid removeAllObjects];\n [self calculateGrid];\n counter = counter + extra;\n clear = YES;\n extra = 0;\n}\n\nfor(int i=0; i&lt;counter; i++) {\n int count = [grid count];\n NSLog(@\"counter %i\", count);\n if(count != 144) {\n srandom(time(NULL));\n int r = random() % [coordinates count];\n\n Coordinate *coordinate = [coordinates objectAtIndex:r];\n\n\n Square *square = [Square new];\n [square setSquareRect: CGRectMake ([coordinate x] * 25, [coordinate y] * 25, 20, 20)];\n [square setColor: [UIColor randomColor]];\n [writeSquares addObject:square];\n [grid addObject:square];\n [square release];\n\n [self setNeedsDisplayInRect:CGRectMake ([coordinate x] * 25, [coordinate y] * 25, 20, 20)];\n\n [coordinates removeObjectAtIndex:r];\n [coordinate release];\n }\n else {\n extra++;\n }\n}\n\n//[newlock release];\n\n\n}" ]
[ "iphone", "quartz-2d", "drawrect" ]
[ "How to install OpenCV on Solo 3dr", "How to install OpenCV or Python-OpenCV on 3dr Solo computer (Linux 3dr_solo 3.10.17 armv71)?\n\nIs there any .tar or .rpm package available for download?" ]
[ "python", "opencv", "dronekit-python", "dronekit" ]
[ "Qrcode scanner in xamain.forms windows phone 8.1", "Qrcode scanner in xamain.forms windows phone 8.1, when we use zxing.net.mobile so app is crash at scanning time." ]
[ "c#", "windows-phone-8.1", "xamarin.forms", "qr-code", "zxing" ]
[ "How to create the multiple cells when i select row in UItableview", "I have number of some names have in tableview when I click the particular Name the tableview want to reload and add some more cells from selected name.then again click the sub cell and load some more cell. How can I do this any one help me" ]
[ "iphone", "ios", "ios5", "uitableview" ]
[ "AsyncTask and Activity how to do it", "My main application does this: It retrievs data from the internet and has 3 button, when OnClicked, i am going to 3 other screens. because the data loading may be a little slow, I want to use an async Task. This is my sample code for asynctask.\n\nclass LoginProgressTask extends AsyncTask {\n @Override\n protected Boolean doInBackground(String... params) {\n try {\n Thread.sleep(4000); // Do your real work here\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n return Boolean.TRUE; // Return your real result here\n }\n\n @Override\n protected void onPreExecute() {\n showDialog(AUTHORIZING_DIALOG);\n }\n\n @Override\n protected void onPostExecute(Boolean result) {\n // result is the value returned from doInBackground\n removeDialog(AUTHORIZING_DIALOG);\n }\n}\n\n\nand this is my sample of my main activity:\n\npublic class MainScreen extends Activity {\n @Override\n public void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n MainTheme();\n }\n public void MainTheme(){\n retrieve_data(); //function for getting the data\n ... action with the buttons, onClicks Listener\n }\n}\n\n\nMy question is how can I mix those codes in One activity to make it work, becuase I haven't understood AsyncTask. Or what I should return in the doInBackground?" ]
[ "android", "android-asynctask" ]
[ "Android signed apk - Keystore", "I am creating a new thread as I could not fix my problem from existing threads and googling.\n\nI just finished my new update of one of my published apps. I tried to generate a signed apk with the same keystore I always use and ofcourse the passwords that I had save in a txt file. But when I try to sign the apk, I get an error \n\n\n java.io.IOException: Keystore was tampered with, or password was\n incorrect\n\n\nSince I am sure about the passwords, how can I fix this error? I really do not want to delete my app and make a fresh one.\n\nTank you in advance." ]
[ "java", "android" ]
[ "Error: This PlotModel is already in use by some other PlotView control", "I have two tabs that is bind to one viewmodel which contain a PlotModel of oxyplot and view model selected through a DataTemplate.\nWhen click on the first tab the viewmodel was bind properly but when switch to second tab above exception defined in title throw.\nAll of control is same in two tab.\nIs it possible bind one object to two controls?" ]
[ "wpf", "xaml", "mvvm", "viewmodel", "oxyplot" ]
[ "how to force interface object to do some indexing action?", "I got log data source looks like:\n\n\n {\"LogtypeA\":{\"content\":\"listen_logs\":[{\"useful_key1\":val1,\"useful_key2\":val2},{\"useful_key1\":val1}]}}\n\n\nThen I use simplejson to parse them. The value of listen_logs is a slice that contain at least one map.\nThe code is:\n\nfor _, v := range js.Get(\"LogTypeA\").Get(\"content\").Get(\"listen_logs\").MustArray() {\n _obj := reflect.ValueOf(v)\n fmt.Println(_obj.Kind())\n }\n\n\nIf I replace MustArray() with Array(), it will report incorrect variable and constant declarations.\nUsing reflect module I will find that the _obj.Kind() is map, but I can't use any indexing method to get values from v such as:\n\n_val1 := v[\"useful_key1\"]\n\n\nor\n\nfor i, v := range v {...}\n\n\nBecause type interface{} does not support indexing.\nSo how should I extract those useful keyX from those logs?" ]
[ "json", "go" ]
[ "How to add extra js script into Vue.js", "I am creating a website (Laravel + Vue.js) where in admin panel, I have to attach a script which will style checbox but Vue is not letting me add \n\n&lt;script&gt;&lt;/script&gt;\n\n\ntag more than one and also does not show any error.\nI have tried to place the script in multiple places but nothing happened.\nI have tried to show them without vuejs and they look like this:\n\nBut in Vue.js they dont appear.\n\n\nCan Anybody tell me the solution for it ?\n\nCode:\n\n&lt;template&gt;\n...\n&lt;div class=\"form-group m-form__group row\"&gt;\n &lt;div class=\"col-lg-4\" &gt;\n &lt;label class=\"col-form-label\"&gt; Active: &lt;/label&gt;\n &lt;input name=\"active\" data-switch=\"true\" type=\"checkbox\" data-on-text=\"Yes\" data-off-text=\"No\" data-on-color=\"success\" data-off-color=\"danger\"&gt;\n &lt;/div&gt;\n &lt;div class=\"col-lg-4\" &gt;\n &lt;label class=\"col-form-label\"&gt; Confirmed: &lt;/label&gt;\n &lt;input name=\"confirmed\" data-switch=\"true\" type=\"checkbox\" data-on-text=\"Yes\" data-off-text=\"No\" data-on-color=\"success\" data-off-color=\"danger\"&gt;\n &lt;/div&gt;\n &lt;div class=\"col-lg-4\" &gt;\n &lt;label class=\"col-form-label\"&gt; Show in Search: &lt;/label&gt;\n &lt;input name=\"show\" data-switch=\"true\" type=\"checkbox\" data-on-text=\"Yes\" data-off-text=\"No\" data-on-color=\"success\" data-off-color=\"danger\"&gt;\n &lt;/div&gt;\n&lt;/div&gt;\n ...\n\n&lt;/template&gt;\n\nBelow script changes checboxes to as shown above in image.\n&lt;script src=\"/assets/demo/default/custom/components/forms/widgets/bootstrap-switch.js\"&gt;&lt;/script&gt;\n\n&lt;script&gt;\n...\nexport default{}\n&lt;/script&gt;" ]
[ "javascript", "vuejs2" ]
[ "How to Write A Typed Action Without Parameters", "A Github issue suggests that we can use TypedAction.defineWithoutPayloadfor this purpose but I couldn't find any relevant examples on how to do so.\n\nI use this for login when an accessToken is being stored in the payload. If the token is present, the user gets access to private pages.\n\nexport const login = (token: string) =&gt; typedAction(\"LOGIN\", token);\n\n\nNow, on the logout button, I am trying to implement an action that removes the stored value in the payload. In this case, there will be no parameters for dispatching the action. So how can I write the typedAction?\n\nIf I use: \n\nexport const logout = () =&gt; typedAction(\"LOGOUT\");\n\n\nI start getting an error on my payload of my reducer that property doesn't exist on type logout. \n\nHere's my reducer:\n\nexport const tokenReducer = (\n state: IState['token'] = null,\n { type, payload }: AppAction,\n): typeof state =&gt; {\n switch (type) {\n case 'LOGIN':\n return payload;\n case 'LOGOUT':\n return null;\n default:\n return state;\n }\n};\n\n\nCodesandbox: https://codesandbox.io/s/keen-brook-kntkm?file=/src/store/actions/login.ts:50-118\n\nEmail: [email protected]\nPassword: check\n\nEdit:\n\nexport interface IState {\n token: string | null;\n }\n\n\nconst initialState: IState = {\n token: null\n};\n\n\nError on action.payload if I use state: typeof initialState or state = initialStateas per IDE's suggestion:\n\nType 'string' is not assignable to type 'IState'.ts(2322)\n\n\nIf I try state: initialStatethen obviously:\n\n'initialState' refers to a value, but is being used as a type here. Did you mean 'typeof initialState'?ts(2749)\n``" ]
[ "javascript", "reactjs", "typescript", "redux", "react-redux" ]
[ "How to change the scroll angle of scrollView in android?", "Is there any way to change the scrolling angle of the ScrollView or RecyclerView in android?\nI know, by default some Android views will have horizontal and Vertical scrollings, but I want to know if it is possible to change the scroll in a particular angle or else diagonally?\n\nHow to create such custom components?\n\nHere is an example with screenshots, I wonder how Microsoft Excel Android App achieved this.\n\nPlace your finger on the cell D10 and drag the sheet towards the cell A1 \n\n\n\nHere is the result, the sheet scrolled diagonally, i.e., scrolled vertically and horizontally simultaneously" ]
[ "android", "uiscrollview", "android-recyclerview", "scrollview", "android-custom-view" ]
[ "jssor slider having issue for safari browser", "I have embed jssor slider to my webpage. It works fine in all browser but for safari it slows down while slide.\nSlider is having page size. means width:100%; height:100%;\nProblem is only for safari." ]
[ "jssor" ]
[ "Not able to install deploy to container plugin in jenkins", "i am not able to install deploy to container plugin in jenkins." ]
[ "jenkins" ]
[ "How to deploy client server application java", "Good day,\nwe have a client-server application in java, with javaSocket, it's work perfect in local, i want to use the client side in another computer/internet, the problem is i don't know how to config/use public ip (not local host), how can we chat with different ip ? how to connect to the server with another IP ?\nPs: i use android mobile hotspot to share wifi, i don't have router.\nThank you" ]
[ "java", "sockets", "client-server" ]
[ "Advanced search with Apache SOLR", "I have a problem to filter data.\nI already have a data that contain size per product.\n\n{\"product_name\":\"new jeans\",\"product_size_url\":\"27\"},\n{\"product_name\":\"new sporty shoes \",\"product_size_url\":\"39\"},\n{\"product_name\":\"new shoes \",\"product_size_url\":\"45\"}\n\n\nHow do I build the query to show data that contains size 27,45 ?\n\nI Really need help for this case.\nThanks." ]
[ "apache", "solr" ]
[ "Sharepoint bug database - any good?", "We've been using Sharepoint as a poor man's bug tracking database for the last couple of projects that we did. No one is really happy with the solution so I'm looking for alternatives. I happened to stumble upon the Bug Database Template for Sharepoint. If it is halfway decent it might be a good choice for us since the transition would be smooth as the team is already used to Sharepoint.\n\nAnyone have any experience using this template? Any major problems? Any major missing features? Is there any documentation out there beyond that download page?\n\nThanks for the help." ]
[ "sharepoint", "bug-tracking" ]
[ "Is it possible to pass command-line arguments to @ARGV when using the -n or -p options?", "I think the title of my question basically covers it. Here's a contrived example which tries to filter for input lines that exactly equal a parameterized string, basically a Perlish fgrep -x:\n\nperl -ne 'chomp; print if $_ eq $ARGV[0];' bb &lt;&lt;&lt;$'aa\\nbb\\ncc';\n## Can't open bb: No such file or directory.\n\n\nThe problem of course is that the -n option creates an implicit while (&lt;&gt;) { ... } loop around the code, and the diamond operator gobbles up all command-line arguments for file names. So, although technically the bb argument did get to @ARGV, the whole program fails because the argument was also picked up by the diamond operator. The end result is, it is impossible to pass command-line arguments to the Perl program when using -n.\n\nI suppose what I really want is an option that would create an implicit while (&lt;STDIN&gt;) { ... } loop around the code, so command-line arguments wouldn't be taken for file names, but such a thing does not exist.\n\nI can think of three possible workarounds:\n\n1: BEGIN { ... } block to copy and clear @ARGV.\n\nperl -ne 'BEGIN { our @x = shift(@ARGV); } chomp; print if $_ eq $x[0];' bb &lt;&lt;&lt;$'aa\\nbb\\ncc';\n## bb\n\n\n2: Manually code the while-loop in the one-liner.\n\nperl -e 'while (&lt;STDIN&gt;) { chomp; print if $_ eq $ARGV[0]; }' bb &lt;&lt;&lt;$'aa\\nbb\\ncc';\n## bb\n\n\n3: Find another way to pass the arguments, such as environment variables.\n\nPAT=bb perl -ne 'chomp; print if $_ eq $ENV{PAT};' &lt;&lt;&lt;$'aa\\nbb\\ncc';\n## bb\n\n\nThe BEGIN { ... } block solution is undesirable since it constitutes a bit of a jarring context switch in the one-liner, is somewhat verbose, and requires messing with the special variable @ARGV.\n\nI consider the manual while-loop solution to be more of a non-solution, since it forsakes the -n option entirely, and the point is I want to be able to use the -n option with command-line arguments.\n\nThe same can be said for the environment variable solution; the point is I want to be able to use command-line arguments with the -n option.\n\nIs there a better way?" ]
[ "perl", "command-line-interface", "command-line-arguments" ]
[ "Dispose() is not called for View", "In a viewpager, i have added a view in 10 pages. My requirement is need to dispose unused view contents (ie) currently 1 view is displayed in viewpager and need to dispose unused 9 views contents. So i have override the Dispose() as like below. \n\n protected override void Dispose(bool disposing)\n {\n DisposeContent();\n base.Dispose(disposing);\n }\n\n\nBut, the dispose() is not being called, when navigates to next page. \n\nCan you please help me out how to dispose the unused view contents?" ]
[ "xamarin", "view", "memory-leaks", "xamarin.android", "dispose" ]
[ "Vuepress not displaying documents correctly", "I updated a pre-existing vuepress documentation, which runs and works as expected when delopyed on localhost:8080/, however once I push the updates to gh hub pages it does not display correctly.\n\ncode i use to deploy:\n\nset -e\n\nnpm run docs:build\n\ncd docs/.vuepress/dist\n\ngit init\ngit add -A\ngit commit -m \"Deploy documentation\"\n\ngit push-f [email protected]:NAME/REPO.git master:gh-pages\n\n\nI have no error messages durning run time or deploy.\nBut when I check the actual documentation on github, it displays funny. and the links do not work.... as when I check the pages dev eniroment on the console 404 errors appear... it seems that there might be something wrong with the dist.js files in assets....\n\nNot sure how to fix this...please help. Thx!\n\nImages 1: Displays black blocks \nImages 2 Error in the dev console\n(I have no errors messages durning build only in the console)" ]
[ "github", "github-pages", "vuepress" ]
[ "How to invoke the action \"Cancel Request\" from the Requests page?", "I've tried looking for the action definition in the page's graph without any results. There are no public PXActions associated to that button. \n\nWhen the graph is instantiated, Visual Studio's intellisense does not show any references to that action or to a linked method.\nThis is occurring in different Acumatica versions.\n\nThere are also no references to the inclusion of this button in the Actions dropdown with the AddMenuAction() method\n\nI find it odd that this particular action would be hidden.\n\nThanks!" ]
[ "acumatica" ]
[ "String interpolation parsing not working properly", "I have the following simple, fresh, single-view project in Xcode 10 with Swift 4.2\n\nI introduced a typo in the string interpolation of the first string, but the compiler does not complain and the code runs.\n\nclass ViewController: UIViewController {\n override func viewDidLoad() {\n super.viewDidLoad()\n let number: Int = 50\n var string = \"\\(number.numberString, withValue: false) lbs\"\n print(string)\n string = \"\\(number.numberString(withValue: false)) lbs\"\n print(string)\n }\n}\nextension Int {\n func numberString(withValue value: Bool) -&gt; String {\n if value == true {\n return \"value\"\n } else {\n return String(self)\n }\n }\n}\n\n\nthe printout is:\n\n((Function), withValue: false) lbs\n50 lbs\n\n\nIt is taking the first parameter as \"(Function)\", and reporting the rest of text inside the parenthesis as part of the text, but the editor doesn't show it as a text.\nIs there something I don't understand in the string interpolation syntax? or is this a complier issue/bug?\n\nThx" ]
[ "ios", "swift", "compiler-errors", "string-interpolation" ]
[ "How to ensure order of processing in java8 streams?", "I want to process lists inside an XML java object. I have to ensure processing all elements in order I received them.\n\nShould I therefore call sequential on each stream I use?\nlist.stream().sequential().filter().forEach()\n\nOr it it sufficient to just use the stream as long as I don't use parallelism?\nlist.stream().filter().forEach()" ]
[ "java", "java-8", "java-stream" ]
[ "Why add a \"_\" before parameter list", "When I read some code which run on linux and is compiled by gcc, I meet a declaration like that: \n\nvoid* (*func_name) _((void *buf, int size)) \n\n\nThe BGET source code is that: \n\nvoid bectl _((int (*compact)(bufsize sizereq , int sequence), \n void *(*acquire)(bufsize size),\n void *(*release)(void *buf),\n bufsize pool_incr));\nvoid bectl(compact, acquire, release, pool_incr)\n int(*compact) _((bufsize sizereq, int sequence));\n void *(*acquire) _((bufsize size));\n void (*release) _((void *buf));\n bufsize pool_incr;\n {\n\n }\n\n\nThe question is that I don't know why add \"_\" before parameter list." ]
[ "c", "gcc" ]
[ "Problem with IndexPath.row", "i have 60 rows in an table view.i have an array named as \"BundleImagesArray \" with 60 bundle images names.So i am retrieving the images from bundle and creating thumbnail to it.\nwhenever binding each cell at first time ,i am storing the Thumbnail images in to an array.because of enabling the fast scrolling after bind each cell.i am utilizing the images from the array(without creating the thumbnail again).however the imageCollection array(which will store thumbnail images) is disorder some times\n\nthe Index path.row is coming as 1,2.....33,34,50,51..etc\n\nits not an sequential order.so i am getting trouble with my imageCollection array which is used to store and retrieve images according to the index path.may i know what is the reason for that.can any one provide me a good solution for this.is there any way to get the indexpath.row as sequential order?\n\nmy cellForRowAtIndexPath code is:\n\n - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n { \n\n NSLog(@\"IndexPath Row%d\",indexPath.row);\n static NSString *CellIdentifier = @\"Cell\";\n\n UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];\n if (cell == nil)\n {\n\n cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];\n } \n\n\n if ([cell.contentView subviews])\n {\n for (UIView *subview in [cell.contentView subviews])\n {\n [subview removeFromSuperview];\n }\n }\n\n cell.selectionStyle = UITableViewCellSelectionStyleNone;\n [cell setAccessoryType:UITableViewCellAccessoryNone];\n\n Class *temp = [BundleImagesArray objectAtIndex:indexPath.row];\n\n UIImageView *importMediaSaveImage=[[[UIImageView alloc] init] autorelease];\n importMediaSaveImage.frame=CGRectMake(0, 0, 200,135 );\n importMediaSaveImage.tag=indexPath.row+1;\n [cell.contentView addSubview:importMediaSaveImage]; \n UILabel *sceneLabel=[[[UILabel alloc] initWithFrame:CGRectMake(220,0,200,135)] autorelease];\n\n sceneLabel.font = [UIFont boldSystemFontOfSize:16.0];\n sceneLabel.textColor=[UIColor blackColor];\n [cell.contentView addSubview:sceneLabel];\n\n\n //for fast scrolling\n if([imageCollectionArrays count] &gt;indexPath.row){\n\n\n importMediaSaveImage.image =[imageCollectionArrays ObjectAtIndex:indexPath,row];\n }\n else {\n\n//for start activity indicator \n [NSThread detachNewThreadSelector:@selector(showallstartActivityBundle) toTarget:self withObject:nil];\n NSData *datas = [self photolibImageThumbNailData:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:temp.fileName ofType:@\"png\" inDirectory:@\"Images\"]]];\n\n importMediaSaveImage.image =[UIImage imageWithData:datas]; \n\n [imageCollectionArrays addObject:importMediaSaveImage.image];\n\n\n\n//to stop activity indicator\n [NSThread detachNewThreadSelector:@selector(showallstopActivityBundle) toTarget:self withObject:nil];\n }\n\n\n\n\n\n sceneLabel.text = temp.sceneLabel;\n\n temp = nil;\n return cell;\n }" ]
[ "iphone", "objective-c", "xcode", "uitableview" ]
[ "JDBC: How do I delete a specific record from table using PreparedStatement?", "There's a table name \"Student\". The request is to write a function that tell user to input a student's ID. If such ID is found, delete that student record, otherwise print \"Record not found\".\n\nTable structure:\nid || fullName || gender || dob\n\nThis is my code. Whenever I try to run, it always show this error: The value is not set for the parameter number 1.\n\npublic void deleteStudent() {\n System.out.println(\"Enter the Student's ID you want to delete: \");\n Scanner sc = new Scanner(System.in);\n int id = sc.nextInt();\n\n try (\n Connection connect = DriverManager.getConnection(ConnectToProperties.getConnection());\n PreparedStatement ps = connect.prepareStatement(\"SELECT from Student WHERE id = ?\");\n ResultSet rs = ps.executeQuery();\n PreparedStatement psDel = connect.prepareStatement(\"DELETE from Student WHERE id = ?\");\n )\n\n { \n ps.setInt(1, id);\n if(rs.next()) {\n psDel.setInt(1, id);\n psDel.executeUpdate();\n System.out.println(\"Record deleted successfully.\");\n } else {\n System.out.println(\"Record not found.\");\n }\n } catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }" ]
[ "java", "sql", "sql-server", "jdbc", "mssql-jdbc" ]
[ "Explanation how should work the RPN calculator in the case of one argument and operand (divide or multiply)", "I'm trying to understand how the RPN calculator should work in the case of the one argument and one operand, for example. divide or multiply.\n\nI know how it should work in simple cases, eg.\n\n&gt; 1 \n1\n&gt; 3\n3\n&gt; +\nresult: 4 \n\nexplanation: 1 + 3 = 4\n\n\nIt's obvious how it works\n\nThe case 2 is harder but also pretty clear\n\n7 2 3 * −\nresult: 1 \nexplanation: 7 - (2 * 3) = 1\n\n\nSo I know how it works basically.\n\nI'm interested in these use cases.\n\n4 -\nresult: -4\n\n\nSo in the case of a single argument, it should transform a number into a negative form.\nIn the case of '+' we won't do anything\n\nBut how should it behave in these cases?\n\n4 /\n\n\nor \n\n4 * \n\n\nShould I directly do a math operation with the same number? eg:\n\n4 / === 4 / 4\n4 * === 4 * 4\n\n\nThanks for any help!\n\nP.S. Sorry for the stupid question but it's the first time when I faced this thing\n\nUPDATE:\nAlso, how about the use case when the user enters incorrect data. Eg. something like this?\n\n1 + 3 - 5 * 3 /\n\n\nBy default, it ends the process or doesn't allow the user to continue to enter the incorrect data until the correct and valid argument be entered?" ]
[ "javascript", "algorithm", "math", "rpn" ]
[ "Print on a single line not working Python 3", "I'm very new to programming and am working on some code to extract data from a bunch of text files. I've been able to do this however the data is not useful to me in Excel. Therefore, I would like to print it all on a single line and separate it by a special character, which I can then delimit in Excel.\n\nHere is my code:\n\nimport os\ndata=['Find me','find you', 'find us']\nwith open('C:\\\\Users\\\\Documents\\\\File.txt', 'r') as inF:\n for line in inF:\n\n for a in data:\n string=a\n\n if string in line:\n\n print (line,end='*') #print on same line\n\n inF.close()\n\n\nSo basically what I'm doing is finding if a keyword is on that line and then printing that line if it is.\n\nEven though I have print(,end='*'), I don't get the print on a single line. It outputs:\n\nFind me\n\n*find you\n\n*find us\n\n\nWhere is the problem? (I'm using Python 3.5.1)" ]
[ "python", "printing", "text-files", "readfile" ]
[ "Creating Stacked chart.js graph from array", "I would like to create a stacked graph of data.\nThe data is bottle feeds for each day.\n\nEg. I have this data\n\n0:{date: \"2017-12-19\", 2017-12-19 22:46:00: 341}\n1:{date: \"2017-12-30\", 2017-12-30 10:30:00: 199, 2017-12-30 14:00:00: 142, 2017-12-30 19:18:00: 199, 2017-12-30 17:00:00: 200}\n2:{date: \"2017-12-31\", 2017-12-31 15:43:00: 341, 2017-12-31 16:30:00: 199}\n3:{date: \"2018-01-01\", 2018-01-01 19:09:00: 199, 2018-01-01 06:00:00: 170, 2018-01-01 11:30:00: 170, 2018-01-01 09:00:00: 170}\n\n\nSo a json array. The first key value is the date of the feeds.\nThe rest are the time of day and the amount for that feed.\nI would like my chart js to to have 4 labels (each date value) \nand the stacked data to be the time of day and the amount for each day (date).\n\na: Do I have my data in the correct format?\nb: how do i dynamically add this data to chart.js?\nCan I loop over each one and push it in? As sometimes there may be data from 30 dates, for example..\n\nThanks." ]
[ "javascript", "php", "json", "chart.js" ]
[ "Rails has_many without a belongs_to", "I'm using Rails 4 and am trying to implement a Notif model which should have an array of users that have seen it. \n\nMy idea is to use a has_many relationship (notif has_many :users) where I add users which have seen the notif to the users. The current issue I'm experiencing is that I cannot call @notif.users because it states column users.notif_id does not exist since I'm not using a belongs_to. \n\nOne solution is to use a many-to-many relationship; however, I'd like to avoid having to create an individual association for each user that views a notification (trying to save database space).\n\nIs there a way to effectively have a users field without the has_many relationship? I guess I'm simply trying to store an array of user ids in my notif model." ]
[ "ruby-on-rails", "ruby", "activerecord", "has-many" ]
[ "500 error when custom controller method fires Action Mailer in Rails (on Heroku)", "My app sends an email when a button is clicked, this is working fine on development but has a 500 error when testing on Production (Heroku)\n\nThe logs point to something to do with the connection to a port or with allowing the custom POST method I've created to enable the trigger but I can't decipher it. Any pointers or help would be very appreciated.\n\nThe logs of the failed button click:\n\n\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] GifMailer#nearby_email: processed outbound mail in 0.7ms\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Delivered mail 5edfb32c2444b_41f5b823695@0f888f21-e8fa-493c-af7e-0e6fd5659d54.mail (2.8ms)\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Date: Tue, 09 Jun 2020 16:05:00 +0000\n - From: [email protected]\n - To: [email protected]\n - Message-ID: &lt;5edfb32c2444b_41f5b823695@0f888f21-e8fa-493c-af7e-0e6fd5659d54.mail&gt;\n - Subject: Hello in there\n - Mime-Version: 1.0\n - Content-Type: text/html;\n - charset=UTF-8\n - Content-Transfer-Encoding: 7bit\n -\n - Hello in there\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Completed 500 Internal Server Error in 13ms (ActiveRecord: 2.7ms | Allocations: 3021)\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95]\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Errno::ECONNREFUSED (Connection refused - connect(2) for \"localhost\" port 25):\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] app/controllers/gifs_controller.rb:12:in `email'\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Processing by ErrorsController#internal_server_error as HTML\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Parameters: {\"authenticity_token\"=&gt;\"ZTpQtYnCZwlx9Fy/PWwMES+6CT8kXFoQu8pDr4ok+L1bzbeXsL6ikj8Yof9VJzFUEeVO/84xl3Uc8SOFxjg5cQ==\", \"gif_email\"=&gt;\"[email protected]\"}\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Rendering errors/internal_server_error.html.erb within layouts/errors\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Rendered errors/internal_server_error.html.erb within layouts/errors (Duration: 11.9ms | Allocations: 154)\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Rendered shared/_favicons.html.erb (Duration: 0.1ms | Allocations: 6)\n [0f392bc6-e18e-4387-a3c1-043c58f6fa95] Completed 500 Internal Server Error in 28ms (Views: 27.5ms | ActiveRecord: 0.0ms | Allocations: 1742)\n\n\n\nThe controller:\n\n\n class GifsController &lt; ApplicationController\n protect_from_forgery except: [:email, :show], prepend: true\n skip_before_action :verify_authenticity_token\n before_action :set_gif, only: [:show, :edit, :update, :destroy]\n before_action :authenticate_user!, except: [:show]\n\n def email\n @gif_email = params[:gif_email]\n GifMailer.with(gif_email: @gif_email).nearby_email.deliver_now\n end\n helper_method :email\n ...\n\n end\n\n\n\nThe Mailer:\n\n\n class GifMailer &lt; ApplicationMailer\n default from: \"jack@xxxxxxxx\"\n\n def nearby_email\n @gif_email = params[:gif_email]\n mail(to: @gif_email, content_type: \"text/html\", subject: \"Hello in there\", body: \"Hello in there\", template_path: 'app/views/layouts/mailer.html.erb' )\n end\n\n end\n\n\n\nproduction.rb mail settings:\n\n\n config.action_mailer.perform_caching = false\n config.action_mailer.delivery_method = :smtp\n host = 'xxx.xxxxx'\n config.action_mailer.default_url_options = { host: host }\n config.action_mailer.smtp_settings = {\n address: 'smtp.gmail.com',\n port: 587,\n user_name: ENV['GMAIL_USERNAME'],\n password: ENV['GMAIL_PASSWORD'],\n authentication: 'plain',\n enable_starttls_auto: true,\n openssl_verify_mode: 'none'\n }\n\n\n\nRelevant routes:\n\n\n post '/email', to: \"gifs#email\", as: :hellointhere\n\n resources :gifs, path: ''" ]
[ "ruby-on-rails", "heroku", "gmail", "actionmailer" ]
[ "iOS - prevent duplicate add event to calendar", "I use this code below to add event , my code called many times so i have duplicate event , is there any idea to prevent duplicate \n\nThank You in advance \n\n EKEvent *event = [EKEvent eventWithEventStore:es];\n NSDateFormatter *dateFormats = [[NSDateFormatter alloc]init];\n [dateFormats setDateFormat:@\"yyy-MM-dd\"];\n\n NSDate *date1 = [[NSDate alloc] init];\n NSDate *date2 = [[NSDate alloc] init];\n date1 = nil;\n date2 = nil;\n date1 = [dateFormats dateFromString:event2.from_date];\n date2 = [dateFormats dateFromString:event2.to_date];\n\n\n event.title = event2.event_title;\n event.allDay = NO;\n event.startDate = date1;\n event.endDate = date2;\n\n [event addAlarm:[EKAlarm alarmWithRelativeOffset:60.0f *60.0f *24]];\n //put here if start and end dates are same\n [event setCalendar:[es defaultCalendarForNewEvents]];\n\n [es saveEvent:event span:EKSpanThisEvent commit:YES error:nil];" ]
[ "ios", "objective-c", "calendar", "ios8", "xcode6" ]
[ "Unable to connect to any of the specified MySQL hosts login form", "I am attempting to create a login page for my C# windows forms application.\nI am using a local database (.sdf file called LWADataBase) with a table (passwordTBL) with username and password columns.\n\nMy code is : \n\nprivate void loginBTN_Click(object sender, EventArgs e)\n{\n try\n {\n string myConnection = @\"Data Source=|DataDirectory|\\LWADataBase.sdf\";\n MySqlConnection myConn = new MySqlConnection(myConnection);\n MySqlCommand SelectCommand = new MySqlCommand(\"select * from LWADataBaseDataSet.passwordTBL where Username ='\" + this.usernameTxt.Text + \"' and Password ='\" + this.passwordTxt.Text + \"';\", myConn);\n MySqlDataReader myReader;\n myConn.Open();\n myReader = SelectCommand.ExecuteReader();\n int count = 0;\n while (myReader.Read())\n {\n count = count + 1;\n }\n if (count == 1)\n {\n MessageBox.Show(\"Login Sucessful\");\n }\n else if (count &gt; 1)\n {\n MessageBox.Show(\"Duplicate username or password. Access Denied\");\n }\n else\n MessageBox.Show(\"Username or password is incorrect. Access Denied\");\n }\n catch (Exception ex)\n {\n MessageBox.Show(ex.Message);\n }\n}\n\n\nWhen I debug and either enter or not enter anything into the textboxes diaplyed on the form, I get the error message \"Unable to connect to any of the specified MySQL hosts\"\n\nAm I using an incorrect connection string?\nWhen I configure the data source with the wizard I get this connection string :\nData Source=|DataDirectory|\\LWADataBase.sdf\n\nBut when I click Database Explorer >(Right click)Properties I get this connection string:\nData Source=C:\\Users\\Tom\\Desktop\\Lewis Warby Airbrushing\\Lewis Warby Airbrushing\\Lewis Warby Airbrushing\\LWADataBase.sdf\n\nAny suggestions?" ]
[ "c#", "mysql", "database", "winforms" ]
[ "find the number of comparisons in the execution of the loop for any n>0 in the given code", "Consider the following C code \n\nint j,n; //declaration\nj=1; //initialization\nwhile(j&lt;=n) //while loop\n j=j*2; //code ends here\n\n\nWhat is the number of comparisons made in the execution of the loop in the above code?\n\nI have tried the following: let increment of j is pow(2,0), pow(2,1), pow(2,2), etc. For some value of i so according to the question\n\npow(2,i)&lt;=n\ni&lt;=(log n/log2)\n\n\nWhat after this? The answer is floor(log n/log 2)+1 but how?" ]
[ "c" ]
[ "Show the data quarterly from the database in wordpress php", "How to show the data quarterly in a template of Wordpress \n\nLike:\n\nQuarter 1 \n\n\nJanuary Content \nFebruary Content \nMarch Content\n\n\nQuarter 2 \n\n\nApril Content \nMay Content\nJune Content\n\n\nQuarter 3 \n\n\nJuly Content\nAugsust Content\nSeptember Content\n\n\nHere is the Wp_query\nwhich will return all the result \n\n $args = array(\n 'post_type' =&gt; 'industry_data_report',\n 'paged' =&gt; get_query_var('paged'),\n 'posts_per_page' =&gt; 3,\n 'orderby' =&gt; 'Date',\n 'order' =&gt; 'ASC',\n 'post_status' =&gt; 'publish'\n\n );\n $nbemails = new WP_Query($args);" ]
[ "php", "wordpress" ]
[ "Java reduce CPU usage", "Greets- \n\nWe gots a few nutters in work who enjoy using \n\nwhile(true) { //Code } \n\n\nin their code. As you can imagine this maxes out the CPU. Does anyone know ways to reduce the CPU utilization so that other people can use the server as well. \n\nThe code itself is just constantly polling the internet for updates on sites. Therefore I'd imagine a little sleep method would greatly reduce the the CPU usage. \n\nAlso all manipulation is being done in String objects (Java) anyone know how much StringBuilders would reduce the over head by?\n\nThanks for any pointers" ]
[ "java", "performance", "cpu-usage" ]
[ "In angular, while adding child component, do we need to map all child Output variables?", "Example:\nParent -----\n\n@Component({\n selector: 'parent',\n template: `&lt;div&gt; Test\n &lt;child [modal] = \"parentModal\"\n (change) = \"onChange($event)\"&gt;\n &lt;/child&gt;\n &lt;/div&gt;`\n})\n\nexport class ParentComponent {\n parentModal;\n\n ngOnInit() {\n this.parentModal = \"I am Parent\";\n }\n\n onChange(event) {\n console.log(event);\n }\n\n}\n\n\nChild -----\n\n@Component({\n selector: 'child',\n template: `&lt;div&gt;\n {{modal}}\n &lt;a (click)=\"emitClick()\"&gt;&lt;/a&gt;\n &lt;/div&gt;`\n})\n\nexport class ChildComponent {\n @Input modal;\n @Output change;\n @Output open;\n\n\n emitClick() {\n this.change.emit();\n }\n}\n\n\nMy code might have wrong syntax. Please correct it if you find some.\n\nMy Question: \n\nAs you can see Parent is not passing Open Parameter to child. Will it result in error when emitClick function is called on click to A tag?" ]
[ "angular", "parent-child" ]
[ "Fullcalendar v4 resource timeline not taking full width when parent container resizes", "I'm using FullCalendar in a react project and have a side bar to the left; when I hide my sidebar the resource timeline expands, but it doesn't occupy its full width. See the image below, I get the blank space (B) on the right.\n\nI have added a click listener to the hamburger button, so that whenever it's clicked, it calls calendar.updateSize, but this doesn't seem to fix my issue.\nI tried instead of adding a click event listener to the hamburger, to add a mutation observer on the parent div for whenever its class that makes the side bar hide/show changes, and in the callback I call updateSize, this doesn't work, but if I open the devTools and set a debugger after updateSize, can click on the hamburger, the resizing occurs perfectly. I don't know why it works with the devtool opens and the debugger.\n\nSomething interesting that happens as well is that when I switch to a different view such as dayGridMonth and then switch back to resourceTimeline, the resourceTimeiline adjusts its width properly, and fits perfectly.\n\n\n\nAny ideas on how to I could fix this? \n\nThank you in advance!" ]
[ "html", "css", "reactjs", "fullcalendar", "fullcalendar-scheduler" ]
[ "import global vars stylus vue-cli", "Im using webpack, but now im trying to use vue-cli. And i have a problem.\nmodule.exports = {\n css: {\n extract: false,\n loaderOptions: {\n stylus: {\n use: [require(&quot;nib&quot;)()],\n import: [\n &quot;~nib/lib/nib/index.styl&quot;,\n path.resolve(__dirname, &quot;src/styl/_vars.styl&quot;),\n ],\n },\n },\n },\n};\n\n\nI have mixins styl fole _vars.styl, and try to import it global to all components. And thats work, but if im using scoped style, this import is not working and variables is not aviable. In webpack i have no this problem. How to chaneg settings vue.config.js, for import global variables (stylus mixins) to all vue-components, including scoped styles?" ]
[ "vue-cli" ]
[ "Health check response lacks .json extension", "I have implemented a health check with a ResponseWriter:\n\nservices.AddHealthChecks()\n .AddCheck(\"My Health Check\", new MyHealthCheck(aVariable));\n\napp.UseHealthChecks(\"/health\", new HealthCheckOptions()\n{\n ResponseWriter = WriteHealthCheckResponse\n});\n\nprivate static Task WriteHealthCheckResponse(HttpContext httpContext, HealthReport result){\nhttpContext.Response.ContentType = \"application/json\";\n\nvar json = new JObject(\n new JProperty(\"status\", result.Status.ToString()),\n new JProperty(\"results\", new JObject(result.Entries.Select(pair =&gt;\n new JProperty(pair.Key, new JObject(\n new JProperty(\"status\", pair.Value.Status.ToString()),\n new JProperty(\"description\", pair.Value.Description)))))));\nreturn httpContext.Response.WriteAsync(\n json.ToString(Formatting.Indented));}\n\n\nI was expecting it to return a health.json file, however it returns just health. The browser doesn't recognize the file without an extension and doesn't want to open it, therefor I want to control the filename.\n\nHow can I control the file name of the response?\n\nUpdate:\n\nWhen the health check passes, I now do get a health.json file (which can be opened).\nHowever, when the health check fails, I get a health file.\n\nTrying to download the fail health message (health without .json extension), I only get a partial download which can be opened, but stays empty.\n\nSo, what's wrong with the non happy flow in this code:\n\npublic Task&lt;HealthCheckResult&gt; CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default(CancellationToken)){\nvar isHealthy = false;\n\ntry\n{\n var executionResult = _service.ExecuteExample();\n isHealthy = executionResult != null;\n}\ncatch\n{\n //This should not throw an exception.\n}\n\nHealthCheckResult healthResult = isHealthy \n ? HealthCheckResult.Healthy(\"The service is responding as expected.\") \n : HealthCheckResult.Unhealthy(\"There is a problem with the service.\");\n\nreturn Task.FromResult(healthResult);}" ]
[ "c#", "asp.net-core", "health-monitoring" ]
[ "tf.train.Saver failing to restore checkpoint from path", "I'm having issues with the TensorFlow (v1.8) Saver. I'm specifying a path for the checkpoint files which works correctly for saving but raises an exception when restoring, even with the same name.\n\ncheckpoint_path = \"/some_dir_1/some_dir_2/my-checkpoint\"\nsaver = tf.train.Saver(save_relative_paths=True)\nsaver.save(sess, checkpoint_path) # This works correctly\nsaver.restore(sess, checkpoint_path) # This doesn't\n\n\nThe saver.save() method works correctly, creating the corresponding my-checkpoint.data, my-checkpoint.index and my-checkpoint.meta files in '/some_dir_1/some_dir_2'.\n\nThe restoring method does not work however for the same exact path as used in the save method. I get the following exception:\n\n\n NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /some_dir_1/some_dir_2/my-checkpoint\n [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_DOUBLE, DT_DOUBLE, DT_DOUBLE], _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]\n\n\nThe weird thing is that, if instead of specifying a nested path to the checkpoint you specify the checkpoint to be in the current working directory (e.g. saver.save(sess, './awesome-checkpoint') &amp; saver.restore(sess, './awesome-checkpoint')) it works correctly.\n\nHas anyone else experienced this? Is this a bug of am I doing something wrong?" ]
[ "python-3.x", "tensorflow" ]
[ "How to change time tracking unit from hours 'h' to days 'd' in sprint taskboard?", "Is there any way or workaround to change time tracking unit from hours 'h' to days 'd' in sprint taskboard in Azure Devops (ADO)? We've searched on Google and came across few articles. So sharing them here.\n\nhttps://developercommunity.visualstudio.com/content/problem/1095445/user-story-card-erroneously-displays-hours-when-ti.html\nhttps://developercommunity.visualstudio.com/content/problem/960792/capacity-planning-using-story-points.html\n\n\nWe want to change the highlighted unit 'h' to either 'd' or show nothing at all. Any extension or plugin for Azure Devops which can solve this problem would be really helpful. Or if there is any settings option (either Project settings or Organization settings) from where we can alter the taskboard's view would be helpful.\nThanks in advance." ]
[ "azure-devops" ]
[ "Nothing in my sql database table?", "This is my first asp.net web application that needs a sql database. I configured the database with the table and all of the columns that I need on my webserver.\n\nWhat i did so far is in web.config:\n\n&lt;connectionStrings&gt;\n &lt;add name=\"MyConnectionString\" connectionString=\"Data Source=; Initial Catalog=; User ID=; Password=;\"\n providerName=\"System.Data.SqlClient\" /&gt;\n &lt;/connectionStrings&gt;\n\nand in a simple application form:\n\nprotected void Button1_Click(object sender, EventArgs e)\n{\n SqlDataSource nexusdb = new SqlDataSource();\n nexusdb.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"MyConnectionString\"].ToString();\n\n nexusdb.InsertCommandType = SqlDataSourceCommandType.Text;\n nexusdb.InsertCommand = \"INSERT INTO Windows (Firstname, Lastname, Email, Phone, Company, Date, IPAddress) VALUES (@Firstname, @Lastname, @Email, @Phone, @Company, @Date, @IPAdress)\";\n\n nexusdb.InsertParameters.Add(\"Firstname\", FirstNametxtbox.Text);\n nexusdb.InsertParameters.Add(\"Lastname\", LastNametxtbox.Text);\n nexusdb.InsertParameters.Add(\"Email\", Emailtxtbox.Text);\n nexusdb.InsertParameters.Add(\"Phone\", Phonetxtbox.Text);\n nexusdb.InsertParameters.Add(\"Company\", Companytxtbox.Text);\n nexusdb.InsertParameters.Add(\"Date\", DateTime.Now.ToString());\n nexusdb.InsertParameters.Add(\"IPAddress\", Request.UserHostAddress.ToString());\n}\n\n\nHowever nothing in my table ?!" ]
[ "c#", "asp.net", "visual-studio-2010", "sql-server-2008" ]
[ "mySQL Efficiency Issue - How to find the right balance of normalization...?", "I'm fairly new to working with relational databases, but have read a few books and know the basics of good design.\n\nI'm facing a design decision, and I'm not sure how to continue. Here's a very over simplified version of what I'm building: People can rate photos 1-5, and I need to display the average votes on the picture while keeping track of the individual votes. For example, 12 people voted 1, 7 people voted 2, etc. etc.\n\nThe normalization freak of me initially designed the table structure like this:\n\nTable pictures\nid* | picture | userID | \n\nTable ratings\nid* | pictureID | userID | rating\n\n\nWith all the foreign key constraints and everything set as they shoudl be. Every time someone rates a picture, I just insert a new record into ratings and be done with it.\n\nTo find the average rating of a picture, I'd just run something like this:\n\nSELECT AVG(rating) FROM ratings WHERE pictureID = '5' GROUP by pictureID \n\n\nHaving it setup this way lets me run my fancy statistics to. I can easily find who rated a certain picture a 3, and what not. \n\nNow I'm thinking if there's a crapload of ratings (which is very possible in what I'm really designing), finding the average will became very expensive and painful.\n\nUsing a non-normalized version would seem to be more efficient. e.g.:\n\nTable picture\nid | picture | userID | ratingOne | ratingTwo | ratingThree | ratingFour | ratingFive\n\n\nTo calculate the average, I'd just have to select a single row. It seems so much more efficient, but so much more uglier.\n\nCan someone point me in the right direction of what to do? My initial research shows that I have to \"find the right balance\", but how do I go about finding that balance? Any articles or additional reading information would be appreciated as well.\n\nThanks." ]
[ "mysql", "performance", "normalization" ]
[ "MySQL merge results into table from count of 2 other tables, matching ids", "I've got 3 tables: model, model_views, and model_views2. In an effort to have one column per row to hold aggregated views, I've done a migration to make the model look something like this, with a new column for the views:\n\n+---------------+---------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+---------------+---------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| user_id | int(11) | NO | | NULL | |\n| [...] | | | | | |\n| views | int(20) | YES | | 0 | |\n+---------------+---------------+------+-----+---------+----------------+\n\n\nThis is what the columns for model_views and model_views2 look like:\n\n+------------+------------------+------+-----+---------+----------------+\n| Field | Type | Null | Key | Default | Extra |\n+------------+------------------+------+-----+---------+----------------+\n| id | int(11) | NO | PRI | NULL | auto_increment |\n| user_id | smallint(5) | NO | MUL | NULL | |\n| model_id | smallint(5) | NO | MUL | NULL | |\n| time | int(10) unsigned | NO | | NULL | |\n| ip_address | varchar(16) | NO | MUL | NULL | |\n+------------+------------------+------+-----+---------+----------------+\n\n\nmodel_views and model_views2 are gargantuan, both totalling in the tens of millions of rows each. Each row is representative of one view, and this is a terrible mess for performance. So far, I've got this MySQL command to fetch a count of all the rows representing single views in both of these tables, sorted by model_id added up:\n\nSELECT model_id, SUM(c) FROM (\n SELECT model_views.model_id, COUNT(*) AS c FROM model_views\n GROUP BY model_views.model_id\n UNION ALL\n SELECT model_views2.model_id, COUNT(*) AS c FROM model_views2\n GROUP BY model_views2.model_id)\nAS foo GROUP BY model_id\n\n\nSo that I get a nice big table with the following:\n\n+----------+--------+\n| model_id | SUM(c) |\n+----------+--------+\n| 1 | 1451 |\n| [...] | |\n+----------+--------+\n\n\nWhat would be the safest route for pulling off commands from here on in to merge the values of SUM(c) into the column model.views, matched by the model.id to model_ids that I get out of the above SQL query? I want to only fill the rows for models that still exist - There is probably model_views referring to rows in the model table which have been deleted." ]
[ "mysql", "sql" ]
[ "Can't print structure variable", "#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\ntypedef struct {\n char name[20];\n int age;\n} employee;\n\nint main(int argc, char** argv)\n{\n struct employee em1 = {\"Jack\", 19};\n printf(\"%s\", em1.name);\n return 0;\n}\n\n\nThis doesn't seem to work because, as the compiler says, the variable has incomplete type of 'struct employee'. What's wrong?" ]
[ "c", "struct", "printf" ]
[ "Sonata datepicker not working in other locale", "I have a strange issue here: my (French) website is using sonata-admin 2.3, and for the dates in my forms I am trying to use the datepicker:\n\n-&gt;add('birthDate', 'sonata_type_date_picker')\n\n\nDisplay is fine, but when I submit a date, i get a \"This value is not valid\" (in french..) for the date, while with the standard date widget everything works fine. I tried setting the locale at en instead of fr and everything went back to place, the datepicker worked just fine.\n\nThis is a pretty nasty bug for me as the date widget is not very user-friendly and my client asks for the datepicker...Does anyone have an idea ?" ]
[ "jquery", "datepicker", "momentjs", "symfony-sonata", "sonata" ]
[ "using regex to replace the value after =", "I have a string as given below\n\nabcdefg=12345\nabcdefg=551234\nabcdefg=111323\nabcdefg=567454\n\n\ni want to replace it using a regular expression so that the value becomes\n\nabcdefg=456789\n\n\ni used following code to do that\n\nstr1=string.split('=')\nline=str1[0]+'='+\"456789\"\n\n\nis there any better way using regular expresiion" ]
[ "python", "regex" ]
[ "How to style mathjax properly on this case?", "I can`t style the way I want to. \n\nThis is how I want it to look like:\n\n\n\nThis is what I have so far:\n\n\"Simplify $\\\\dfrac {{n^5} x {10n}} {2n^2}$\"\n\n\nThis is the output:\n\n\n\nThe problem is the \"x\"" ]
[ "html", "css", "mathjax" ]
[ "How to use Substring to find a character and update date format?", "I have a field in one table named SourceID. All records have a bunch of '|' characters, and after the last pipe is a date, in four different format. I am trying to update this date to be in one single format. The data looks like this.\n\nSourceID\nARS|1C47|13.2|2017-09-29\nmm|M8|160|030|ZX7|Sep 29 2017 12:00AM\nTMP_Schedule | Int | MG100 | 20370429\nTS|01|0|USD|I|S|ZDER|10/31/2017\n\n\nI tried to come up with code to update another field (SourceID_Revised), in the same table, with all data from SourceID and one standardized date format, such as DD/MM/YYYY. I tried some different ideas, and came up with this, which is think is close, but of course it doesn't work.\n\nUPDATE TBL_HIST\nSET SourceID_Revised = SourceID\nWHERE (SELECT CONVERT(VARCHAR(8), SUBSTRING([SourceID],select dbo.LastIndexOf('|', [SourceID]),99)) AS [DD/MM/YYYY]\nFROM [dbo].[TBL_HIST]\n\n\nUsing this to find the last pipe.\n\nFUNCTION [dbo].[LastIndexOf] (@stringToFind varchar(max), @stringToSearch varchar(max))\nRETURNS INT\nAS\nBEGIN\n RETURN (LEN(@stringToSearch) - CHARINDEX(@stringToFind,REVERSE(@stringToSearch))) + 1\nEND\n\n\nI'm on SQL Server 2008.\n\nUPDATE:\n\nJohn, I think this could work! It runs for about 5 seconds and then konks out. I get this message.\n\nMsg 241, Level 16, State 1, Line 1\nConversion failed when converting date and/or time from character string.\n\nI'm guessing, that because some records in that field have nothing at all like a date. So I have things like this:\n\n40285\n3467868\n\n\nI think that is causing an error. How can I skip those, or just do some kind of On Error Resume Next?\n\nOne more thing that I noticed is that several hundred records have this format.\n\n101.002.112020-06-30\n102.0012.102019-09-30\n125.02.022022-06-30\n\n\nFor these, I want to find the last dot, move to to the right, and get \n\nMM/DD/YYYY:\n06/30/2020\n09/30/2019\n06/30/2022\n\n\nNOT DD/MM/YY!" ]
[ "sql", "sql-server" ]
[ "When getPrincipal() return User object and when it return UserDetail object?", "My application uses J2eePreauth authentication provider and here is the common code to retrieve MyUser object:\n\nMyUser user = (MyUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();\n\n\nIt works all the time until most recently I may be upgrade Spring security or sth now it gives me \n\norg.springframework.security.core.userdetails.User cannot be cast to com.myapp.domain.MyUser\n\n\nAnd the class of MyUser is just implement interface UserDetails\n\nIt's very strange that the casting works all the time but regarding most recent update it fall apart.\n\nSo my question is when does SecurityContextHolder.getContext().getAuthentication().getPrincipal() return a UserDetail object and when does it return org.springframework.security.core.userdetails.User" ]
[ "spring", "spring-security" ]
[ "Abandoning overloads in favor of Extension methods", "Now that we have extension methods in C#, Is there any point left in keeping overloads in implementation of any class for passing default values?\nWhy pollute the class implementation when overloads can be made extension methods?\nAny advantage of overloads (for passing default values)?\n\nI'm counting out the option of default parameters because it forces specific ordering of parameters (i.e. default ones can come in end) and the fact that default value gets compiled in client code and a service pack could possibly break because of that." ]
[ "c#", "c#-4.0", "extension-methods", "api-design" ]
[ "search suggestion - PHP - MySQL", "I have a MySQL query as below;\n\n$query = \"SELECT * FROM dictionary WHERE word LIKE '%\".$word.\"%' ORDER BY word LIMIT 10\";\n\n\nThis will search for (and display) words in my dictionary db.\n\nthe search will return;\n\nDrunken for Drunk, etc, etc.. ,\nDrunken for Drunke, etc, etc..\nand Drunken for Drunken, etc, etc..\n\nBut it won't return Drunken for Drunkin. I would like to display this word as a suggestion word (like the one we see in google). How can I do this?\n\nbelow is my complete code for reference;\n\n$db = new pdo(\"mysql:host=localhost;dbname=dictionary\", \"root\", \"password\");\n$query = \"SELECT * FROM dictionary WHERE word LIKE '%\".$word.\"%' ORDER BY word LIMIT 10\";\n$result = $db-&gt;query($query);\n$end_result = '';\nif ($result) {\n while ( $r = $result-&gt;fetch(PDO::FETCH_ASSOC) ) {\n $end_result .= $r['word'].'&lt;br&gt;';\n }\n}\necho $end_result;" ]
[ "php", "mysql", "search", "pdo", "search-suggestion" ]
[ "Unable to get nginx-vod-module plugin to work", "My first time trying hands on nginx-vod-module or any video streaming for that matter.\nI just want to play static mp4 videos which I place on the server but via hls instead of direct mp4 access. No actual live streaming\nQ1. Am I right in understanding that a mp4 video which I place locally on my server, will automatically get broken down into segments for HLS?\nMy nginx installation is here: /opt/kaltura/nginx\nThe mp4 file is placed at /opt/kaltura/nginx/test/vid.mp4\nIn ../nginx/conf/server.conf, I have this:\nlocation /hls/ {\n alias test/;\n vod hls;\n vod_bootstrap_segment_durations 2000;\n vod_bootstrap_segment_durations 2000;\n vod_bootstrap_segment_durations 2000;\n vod_bootstrap_segment_durations 4000;\n\n include /opt/kaltura/nginx/conf/cors.conf;\n }\nlocation / {\n root html;\n }\n\nNow, I am able to access the m3u8 file:\ncurl http://104.167xxxxx/hls/vid.mp4/index.m3u8\nBut when I try to open this file via VLC, I see these errors in errors.log:\n*2020/10/31 15:00:08 [error] 12749#0: *60 mp4_parser_validate_stsc_atom: zero entries, client: 49.207 ..., server: ubuntu, request: &quot;GET /hls/vid.mp4/seg-1-v1.ts HTTP/1.1&quot;, host: &quot;104.167. ...&quot;\n2020/10/31 15:00:08 [error] 12752#0: *61 mp4_parser_validate_stsc_atom: zero entries, client: 49.207 ..., server: ubuntu, request: &quot;GET /hls/vid.mp4/seg-2-v1.ts HTTP/1.1&quot;, host: &quot;104.167. ...&quot;\n2020/10/31 15:00:09 [error] 12749#0: *62 mp4_parser_validate_stsc_atom: zero entries, client: 49.207 ..., server: ubuntu, request: &quot;GET /hls/vid.mp4/seg-3-v1.ts HTTP/1.1&quot;, host: &quot;104.167. ...&quot;\n2020/10/31 15:00:10 [error] 12751#0: *63 mp4_parser_validate_stsc_atom: zero entries, client: 49.207 ..., server: ubuntu, request: &quot;GET /hls/vid.mp4/seg-4-v1.ts HTTP/1.1&quot;, host: &quot;104.167. ...&quot;*\n\nQ2: Is https must for this to work?\nQ3: I dont see any /hls/vid.mp4 folder created anywhere on the server. Do I have to manually run ffmpeg separately to create the hls segments?\nWhat wrong am I doing?" ]
[ "nginx", "video", "ffmpeg" ]
[ "how to convert date passed in by user to the first of every month for the year that was passed in in SSRS?", "User inputs a date.\n\nBased on this date, I have to get the first day of each month of the year in this date.\n\nExample:\n\nUser input: 2/1/2014\n\nFrom that, I need an expression that will get me -\n\n1/1/2014\n3/1/2014\n4/1/2014\n\n\nand so on.\n\nI need the expression for each of the dates (not all together).\n\nBasically if someone can help me figure out how to get one of the dates, I can do the rest.\n\nEDIT - I got it guys. Sorry I wasn't clear enough.\n\n=CDate(\"1/1/\" + Year(Now).ToString)\n=CDate(\"2/1/\" + Year(Now).ToString)\n=CDate(\"3/1/\" + Year(Now).ToString)\n\n\nand so on." ]
[ "sql", "date", "reporting-services" ]
[ "Finding whether an activity is available on a certain date given a cycle of on/off periods", "This problem is killing me and I can't help but think there is an easy way to do this.\nI have some activities that can be performed for 'x' number of days, then held for 'x' number of days then performed again and again. The activities should start on a certain day and the cycles should repeat.\nSo for example, John must wash the car starting on 2020/4/15 and he must wash it for 3 days, then he is off for 7 days, then the cycle repeats on the following day.\nThe problem is that given a certain day (i.e. today), how can I calculate whether or not he is to wash the car? I have tried calculating the number of cycles since the start date, then multiplying that number times the cycle period (in this case the cycle would be 10 days) and trying to arrive at a new start date but that isnt working. Also tried subtracting the cycle total from todays date but something about this is really messing me up.\nAnyone have an idea that could point me in the right direction?" ]
[ "momentjs" ]
[ "How can template functions know size when size info is not explicitly stated?", "template&lt;size_t ROWS, size_t COLS&gt;\nvoid f(const array&lt;array&lt;int, COLS&gt;, ROWS&gt;&amp; arr)\n{\n for(size_t r=0; r&lt;ROWS; r++)\n for(size_t c=0; c&lt;COLS; c++)\n //stuff\n}\n\narray&lt;array&lt;int, 2&gt;, 3&gt; arr {{{1,2},{3,4},{5,6}}};\n\nf(arr);\n\n\nThis works but how? How does the template function figure out the row and col size? I'm not passing in size info during function call. I can see how template functions can figure out the type of the object being passed in, but in such a case I don't see how my ROWS and COLS are given values.\n\nThis question seeks understanding of this particular case with templates. The question isn't asking about vector or what other data structures exist." ]
[ "c++", "c++11", "c++14" ]
[ "Only return values found in all arrays", "Simple question, but i dont know how to solve it\n\nI have several arrays, but i only want the values that all arrays have in common\n\nIm using javascript." ]
[ "javascript", "arrays" ]
[ "Why does malloc_trim() only work with the main arena?", "glibc's malloc implementation supports 'malloc_trim()' call that lets an application program release unused(ie freed memory chunks) back to the system(implementation detail: the data segment of the program is reduced by calling sbrk() with a negative argument). However, this function only works with the main arena. In multithreaded programs, there are multiple arenas that hold freed chunks. Why does this call not release memory from the other arenas as well?" ]
[ "c++", "c", "glibc" ]
[ "Zend Framework create a sql function", "I would like to create a sql query in Zend Framework in the Abstract.php or in model? but I have a hard time figure out how to do it. I am new in zend framework.\n\nThe query that I want to create looks like that:\n\ndelete from users where id not in(select * from(select min(n.id)from users n group by n.email)x);\n\n\nBut in zend:\n\n$results = $db-&gt;query('delete\n from users\n where id not in(\n select * from(\n min(n.id)\n from users n\n group by n.email\n )x)');\n\n\nLook like the $db got a undefined variable, what kind of database function should the db call? My database is being call in the application.ini" ]
[ "mysql", "zend-framework", "zend-db", "zend-db-table" ]
[ "Why are the urls and headers of two requests seemingly the same but have different status codes (404 and 200, respectively)?", "I am trying to crawl pages like this http://cmispub.cicpa.org.cn/cicpa2_web/07/0000010F849E5F5C9F672D8232D275F4.shtml. Each of these pages contains certain information about an individual person.\n\nThere are two ways to get to these pages. \n\nOne is to coin their urls, which is what I used in my scrapy code. I had my scrapy post request bodies like ascGuid=&amp;isStock=00&amp;method=indexQuery&amp;offName=&amp;pageNum=&amp;pageSize=&amp;perCode=110001670258&amp;perName=&amp;queryType=2to http://cmispub.cicpa.org.cn/cicpa2_web/public/query0/2/00.shtml.\n\nThese posts would return response where I can use xpath and regex to find strings like'0000010F849E5F5C9F672D8232D275F4' to coin the urls I really wanted:\n\n next_url_part1 = 'http://cmispub.cicpa.org.cn/cicpa2_web/07/'\n next_url_part2 = some xptah and regex...\n next_url_part3 = '.shtml'\n next_url_list.append([''.join([next_url_part1, i, next_url_part3]))\n\n\nFinally, scrapy sent GET requests to these coined links and downloaded and crawled information I wanted.\nSince the pages I wanted are information about different individuals, I can change the perCode= part in those POST request bodies to coin corresponding urls of different persons.\n\nBut this way sometimes doesn't work out. I have sent GET requests to about 100,000 urls I coined and I got 5 404 responses. To figure out what's going on and get information I want, I firstly pasted these failed urls in a browser and not to my suprise I still got 404. So I tried the other way on these 404 urls. \n\nThe other way is to manually access these pages in a browser like a real person. Since the pages I wanted are information about different individuals, I can write their personal codes on the down-left blank on this page http://cmispub.cicpa.org.cn/cicpa2_web/public/query0/2/00.shtml( only works properly under IE), and click the orange search button down-right(which I think is exactly like scrapy sending POST requests). And then a table will be on screen, by clicking the right-most blue words(which are the person's name), I can finally access these pages.\n\nWhat confuses me is that after I practiced the 2nd way to those failed urls and got what I want, these previously 404 urls will return 200 when I retry them with the 1st way(To avoid influences of cookies I retry them with both scrapy shell and browser's inPrivate mode). I then compared the GET request headers of 200 and 404 responses, and they looks the same. I don't understand what's happening here. Could you please help me?\n\nHere is the rest failed urls that I haven't tried the 2nd way so they still returns 404(if you get 200, maybe some other people have tried the url the 2nd way):\n\nhttp://cmispub.cicpa.org.cn/cicpa2_web/07/7694866B620EB530144034FC5FE04783.shtml\nand the personal code of this person is\n110001670258\n\nhttp://cmispub.cicpa.org.cn/cicpa2_web/07/C003D8B431A5D6D353D8E7E231843868.shtml\nand the personal code of this person is\n110101301633\n\nhttp://cmispub.cicpa.org.cn/cicpa2_web/07/B8960E3C85AFCF79BF0823A9D8BCABCC.shtml\nand the personal code of this person is 110101480523\n\nhttp://cmispub.cicpa.org.cn/cicpa2_web/07/8B51A9A73684ADF200A38A5D492A1FEA.shtml\nand the personal code of this person is 110101500315" ]
[ "python", "http", "scrapy" ]