texts
list | tags
list |
---|---|
[
"extract image from image",
"Is it possible to extract an image from a jpeg, png or tiff file? NOT PDF! Suppose I have a file containing both text and images in jpeg format (so it's basically a picture); I want to be able to extract the image only programmatically (preferably using Java). If anyone knows useful libraries please let me know. I have already tried AspriseOCR and tesseract-ocr, they have been successful at extracting text only (obviously).\nThank you."
] | [
"java",
"jpeg",
"ocr",
"libraries"
] |
[
"NLP Named Entity Recognition",
"I am new to NLP. I want to use Named Entity Recognition algorithm for extract the names and locations from the text without using any libraries. \n\nExample: \n\n\n American Airlines said it would launch a direct flight to Bengaluru.\n\n\nAnswer: \n\nEntity: American Airlines\nLocation: Bengaluru\n\n\nWhat is the best practice of Named Entity? Is it like storing all the names and locations on CSV file and comparing with the sentence?"
] | [
"machine-learning",
"nlp",
"stanford-nlp",
"named-entity-recognition"
] |
[
"create php artisan migrate but not create new table in database",
"firstly I create a migration and in cmd, I run php artisan migrate but it didn't create a new table. it's showing this message. Do you have any answer, Senior Developers! please help me. Thanks a lot"
] | [
"laravel"
] |
[
"MobileIron custom configuration error : Plist not valid",
"I have a MobileIron cloud instance, i want to add a custom configuration for my in house app.\nI create my plist file with xCode. it has only one key value.\nBut when i try to add the custom configuration using my plist i get : \n\n\n configData: the suggested configuration is not valid.\n\n\nAny idea where this issue may come from ?"
] | [
"ios",
"mobile",
"mobileiron"
] |
[
"Insert an array to MySQL database using PHP's prepared statements",
"I have an input array that I want to insert to database. I don't want to have 1 row in database for each item in the array. I want them all to go on same row. So this is my code:\n\n<?php\nsession_start();\ninclude('../../config/dbconf.php');\n\nmysqli_select_db($conn, $webdb);\n\n$stmt = $conn->prepare(\"INSERT INTO changelog (title, type, content, author, post_date) VALUES (?, ?, ?, ?, ?)\");\n\n$title = $_POST['title'];\n$type = $_POST['type'];\n$change = $_POST['change'];\n$author = $_SESSION['waradmin'];\n$date = time();\n\nforeach($_POST['change'] as $key => $value) {\n $changes = \"<li>\" . $change[$key] . \"</li>\";\n}\n\n$stmt->bind_param(\"sissi\", $title, $type, $changes, $author, $date);\nif($stmt->execute()) {\n header('location: ../?p=dashboard');\n}else{\n echo \"Error: \" . $stmt->error;\n}\n\n$stmt->close();\n?>\n\n\nThe query runs in database but only the first list item from the array... Do I need to use the implode function? I have never used it so if that is the only solution can someone show me how i use that in this query?"
] | [
"php",
"mysql",
"arrays"
] |
[
"How to programmatically select multiple options with Chosen.JS multiple select",
"I'm having trouble figuring out how to select multiple values in a multiple select programmatically, with chosenJS/chosen.js and still have the values binded to my ng-model (angularJS).\n\nCase: I have a list of users from which some are already saved on the current project. I want to show these users as selected (but i have no idea how). \n\nI have tried finding the indexs of the users that i want pre-selected and make them \"selected\" like this:\n\n$('.chzn-container-multi').val(0).trigger('liszt:updated');\n$('.chzn-container-multi').val(1).trigger('liszt:updated');\n$('.chzn-container-multi').val(2).trigger('liszt:updated');\n\n\nbut this only selects the last one.\n\nAny help would be much appreciated !\n\nEDIT\n\nWith help from #Marek Kowalski i was able to select the values in my list, but it wasn't applied to the ng-model connected with my dropdown, anyone have a solution to this?"
] | [
"javascript",
"jquery",
"angularjs",
"jquery-chosen"
] |
[
"SCCM 2012 Application Deployment scripting issues, any ideas?",
"I had no problems with SCCM 2007 scripting application deployments, but SCCM 2012 has me pulling my hair out and I have very little left.\nWe tend to have heavily scripted installs and most of the time the installs fail in SCCM 2012, the latest failure is symantec enterprise vault, I wrote a script that would check the main DLL plugin version and use the correct uninstall string to remove the previous version, before installing the latest version.\n\nmy script is very simple and works fine outside of SCCM, but inside SCCM it fails.\n\nIf I recreate the application as a MSI deployment and use the MSI file then it installs fine, so SCCM is working correctly to the client. The uninstall that SCCM puts in from the MSI failed, but that is covered below in the example. I have checked all the client side log files and can not find any issue.\n\nI even return the successfull install return code 1707 and 0 at the end of the script to try and get SCCM to make it a success.\nI have written the script first in VB.net as a console service app and then rewrote it in vb script. both scripts fail. I used to use AutoIT to write scripts in the past, but that too was failing, so I thought I would switch to something more microsoft.\n\nFor detection I use the windows installer selection and point to the msi file where it picks up the product code.\n\ndeployment type is script.\n\nThe only thing I can think of is SCCM 2012 does not like the sleeps that are in the scripts.\n\nor it just does not like scripts. :-(\n\nThe MSI uninstall failed, because it needed to run as administrator, as you can see from the script below, I run as administrator and this works outside SCCM, but not in SCCM. the install uses pretty much the same code but more logic and many more uninstall strings.\n\neven the uninstall fails and here is how simple the uninstall script is;\n\nSet WshShell = WScript.CreateObject(\"WScript.Shell\")\nIf WScript.Arguments.length = 0 Then\n Set ObjShell = CreateObject(\"Shell.Application\")\n ObjShell.ShellExecute \"wscript.exe\", \"\"\"\" & \n WScript.ScriptFullName & \"\"\"\" & \"RunAsAdministrator\", , \"runas\", 1\n Else\nend if\n\nSet objShell = CreateObject(\"WScript.Shell\")\nSet objExec = objShell.Exec(\"MsiExec.exe /x{ADEBB592-4986-4FD1-868C-D59DB32F0BC2} /q\")\n\nWScript.Sleep 8000\nreturnValue = 1707\nWScript.Quit(returnValue)"
] | [
"sccm"
] |
[
"primary key duplicate record bypass to next insert",
"weird question. i am inserting 10,000 records or so in a table and the primary key is not an Identity field. so when inserting all 10,000 if some are duplicate, is there a way to skip to next record in sql server insert and make sure the non-duplicates go in? i really dont care bout the duplicates not getting inserted."
] | [
"sql-server",
"primary-key"
] |
[
"How get char keycode when user start typing on keyboard?",
"Swift, Swift2 iOS\nI have simple project for test only. In this project i have a input text as UITextField and UILabel. If i write code like below:\n\n@IBAction func textChange(sender: UITextField) {\n textPreview.text = textEdit.text\n}\n\n\nso it is simple i see on Label what someone type on keyboard. But i would like get char as key code e.g. a=65 and when i start write something i need to see key code in Label. \n\nIs any way to capture pressed key and put this info to label?"
] | [
"ios",
"iphone",
"swift",
"swift2"
] |
[
"jQuery target and change array key based on input value",
"I have a multi dimensional array. I want to draw out one of the arrays, by changing its key. How can I target its key and change its value?\nThis is my array:\n$myarray=\narray(2) {\n ["KeyOne"]=>\n array(6) {\n ["firstvalue"]=>\n string(1) "1"\n }\n ["KeyTwo"]=>\n array(6) {\n ["firstvalue"]=>\n string(1) "6"\n }\n}\n\nI then place this array in a drop down select of a form:\n<select name="selectYourKey" id="key">\n <option value="keyOne">keyOne</option>\n <option value="keyTwo">keyTwo</option>\n</select>\n\n<select name="myarray" >\n <?php\n foreach ($values = $myarray[$arraykey] as $value) {\n var_dump($value);\n } ?>\n</select>\n\nWhen a user selects a key from the first input I want it to change the input in the second drop down.\nI know how to capture the first select. But I am not sure how to change the key.\nThis is my jQuery capture:\n$("select[name='selectYourKey']").on('change', function() {\n var arrayKey = $("select[name='selectYourKey']").find(":selected").text();\n});\n\nI now want to change the array key in the foreach loop with the arrayKey in the jQuery."
] | [
"jquery"
] |
[
"\"No Windows Console found. Are you running cmd.exe?\"",
"All I did was copy and pasted some example code from PyInquirer into my IDE and it doesn't work and I am confused as to why.\nTHE CODE:\n from __future__ import print_function, unicode_literals\nfrom PyInquirer import prompt\nfrom pprint import pprint\nquestions = [\n {\n 'type': 'input',\n 'name': 'first_name',\n 'message': 'What\\'s your first name',\n }\n]\nanswers = prompt(questions)\npprint(answers)\n\nTHE ERROR:\nC:\\Users\\minch\\AppData\\Local\\Microsoft\\WindowsApps\\python.exe C:\\Users\\minch\\PycharmProjects\\Unicorn\\Transformations.py\nTraceback (most recent call last):\n File "C:\\Users\\minch\\PycharmProjects\\Unicorn\\Transformations.py", line 11, in <module>\n answers = prompt(questions)\n File "C:\\Users\\minch\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\PyInquirer\\prompt.py", line 69, in prompt\n answer = run_application(\n File "C:\\Users\\minch\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\prompt_toolkit\\shortcuts.py", line 576, in run_application\n output=create_output(true_color=true_color))\n File "C:\\Users\\minch\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\prompt_toolkit\\shortcuts.py", line 118, in create_output\n return Win32Output(stdout)\n File "C:\\Users\\minch\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\prompt_toolkit\\terminal\\win32_output.py", line 80, in __init__\n info = self.get_win32_screen_buffer_info()\n File "C:\\Users\\minch\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\prompt_toolkit\\terminal\\win32_output.py", line 172, in get_win32_screen_buffer_info\n raise NoConsoleScreenBufferError\nprompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?\n\nProcess finished with exit code 1\n\nI have no idea why this is happening. Why is this happening?"
] | [
"python"
] |
[
"Accessing an integer within a structure which has Pointer to structure",
"I am new to pointers and trying to use a pointer to the structure.I need to access the structure parameter using pointer. Kindly assist me.\n\nHere is the program:\n\n#include<stdio.h>\n\ntypedef struct{\nint a;\nint b;\nint c;\n}time;\n\ntypedef struct{\nint a;\nint b;\ntime record;\n}myarray;\n\ntypedef struct{\n myarray *ptrtoarray\n}access;\n\nmyarray n_my_array_first[2] =\n{\n\n {1 ,2 , {1 , 2 ,2}},\n {100 ,121 , {123,322,65535}}\n\n};\n\nmyarray n_my_array_third[2] =\n{\n {23,44,{1,43,22}},\n {23,48,{455,666,999}}\n};\n\naccess n_access[5] =\n{\n {&n_myarray_first},\n {((void *)0)},\n {((void *)0)},\n {&n_myarray_third},\n {((void *)0)}\n};\n\nint main()\n{\n\n /* access the record.c parameter of second element of n_my_array_third array.\n whose value is 999 \n\n I have tried it as : \n time v = n_access[3].(n_myarray_third + 1) -> record.c ; \n But I am getting an error */\n\n\n return 0;\n}\n\n\nQ 1 )Explain what could possibly be done to access the fields .\n\nQ 2 )Present any simpler ways to achieve the same thing (by using structure within structure)\nif possible.Thanks"
] | [
"c",
"pointers",
"struct"
] |
[
"how to display middle name as middle initial if middle name have two words",
"so i created a form which have middle name field and display the middle name as initial. \n\npreg_split(\"/[\\s,_-]+/\",$data[\"s_mname\"])\n\nthis code works IF the middle name is only one word.. like Snow it will display as S but my problem is if the middle name is 2 words like De Leon, Delos Santos the initial that will be displayed is DL,DS.. but it should display as D... any idea how to do this..\n\nSUBSTR($data[\"s_mname\"],strrchr($data[\"s_mname\"], ' '), 1)\n\ni tried this code but nothing works i just got this from other site.."
] | [
"php",
"substr"
] |
[
"Create a Flash Fonts from different sources",
"In Actionscript/Flash it is possible to create a swf which contains font data for emedding like this:\n\npackage {\n import flash.display.Sprite;\n public class Font_times_new_roman extends Sprite {\n [Embed(\n systemFont='times new roman',\n mimeType='application/x-font',\n fontName='times new roman',\n fontWeight='normal',\n fontStyle='regular',\n unicodeRange='U+0020-U+007E,U+00A0-U+00AC,U+00AE-U+00FF,U+0100-U+017F,U+037E-U+037E,U+0384-U+038A,U+038C-U+038C,U+038E-U+03A1,U+03A3-U+03CE,U+0400-U+045F,U+20AC-U+20AC')]\n public static var FontClass:Class;\n }\n} \n\n\nnow what i would like is, to create something like this with glyphs from different source fonts.\n\nfor example unicode character x should be taken from Arial, while character y should be from times new roman.\n\nis that possible? if yes, how?"
] | [
"flash",
"actionscript",
"fonts"
] |
[
"Pasting Text From Excel to Word in Specific Locations VBA",
"I am trying to place variables that I have already established (In this case the variable is QN_number) into a word document in specific locations, I have done this in the past except I placed an entire table into word so the code was different. I have not been able to find a way to past using the variable names directly which would be preferred instead having to reference a range each time. Also the method I am using now is not working well as it does paste in the proper location, but it pastes the words associated with the variable as a selection box that can be moved and resized. I would like is pasted just like any other text in the document. Here is the code that I am using right now. Does anyone have any suggestions?\n\nSub Export_Excel_To_Word()\n\n'Connect to M-Word\nDim wordApp As Word.Application\nSet wordApp = New Word.Application\nwordApp.Visible = True\nDim wordDoc As Word.Document\n\ni = 0\n\n'Exits loop when QN#s are finished\nDo\nIf Cells(i + 2, 2) = \"\" Then\nExit Do\nElse: End If\n\n\n'Opens the Template Word Document For Discus Complaints\nSet wordDoc = wordApp.Documents.Open(File_Name)\n\n\n 'Places the QN# in the Word Document\n With Worksheets(\"Data\").Cells(i + 2, 2)\n .Copy\nwordDoc.Application.Selection.Find.Execute \"Complaint Description:\" '***Places after a specfic word\nwordApp.Selection.MoveDown Unit:=wdLine, Count:=-1, Extend:=wdMove '***Moves the placement up a line\nwordApp.Selection.TypeParagraph\n'wordDoc.Paragraphs.Add\nwordApp.Selection.Paste\nEnd With\nend sub"
] | [
"excel",
"vba"
] |
[
"mvn dependency:tree return nothing but build success",
"I am looking for any dependency conflict in aspectjrt however when I run mvn dependency:tree command it shows nothing but Build Success, but I can clearly see the dependency declared in the pom.xml\n\nmvn dependency:tree -Dverbose -Dincludes=aspectjrt > maven.tree.txt\n\n\npom.xml\n\n <dependency>\n <groupId>org.aspectj</groupId>\n <artifactId>aspectjrt</artifactId>\n <version>1.7.3</version>\n </dependency>\n\n\nresult\n\n[INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building MySmallApplication-1.10.war\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ MySmallApplication ---\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 4.912 s\n[INFO] Finished at: 2017-07-13T11:21:43-04:00\n[INFO] Final Memory: 20M/436M\n[INFO] ------------------------------------------------------------------------\n\n\nis there anything I can do to fix this?"
] | [
"java",
"spring",
"maven"
] |
[
"Given a text representation of a MIME message, how can I recreate the message?",
"I have a GDB core dump that contains the header and body of a MIME mutlipart/form-data request message. I need to somehow recreate the message exactly and send it to my server so that I can debug why my code is crashing.\n\nThe message is from a fairly standard form-data page. All of the Content-Types are text/plain, except for one that is image/jpeg.\n\nThe problem is that the binary part of the body has boundaries already, so I can't just extract the binary portion and generate the header automatically via built-in Python MIME code.\n\nAgain, I need to recreate the initial message exactly how it was. What is the simplest way to do this?"
] | [
"python",
"tcp",
"mime-types",
"mime"
] |
[
"Padding is invalid and cannot be removed?",
"I have looked online for what this exception means in relation to my program but can't seem to find a solution or the reason why it's happening to my specific program. I have been using the example provided my msdn for encrypting and decrypting an XmlDocument using the Rijndael algorithm. The encryption works fine but when I try to decrypt, I get the following exception: \n\n\n Padding is invalid and cannot be removed\n\n\nCan anyone tell me what I can do to solve this issue? My code below is where I get the key and other data. If the cryptoMode is false, it will call the decrypt method, which is where the exception occurs:\n\npublic void Cryptography(XmlDocument doc, bool cryptographyMode)\n{\n RijndaelManaged key = null;\n try\n {\n // Create a new Rijndael key.\n key = new RijndaelManaged();\n const string passwordBytes = \"Password1234\"; //password here \n\n byte[] saltBytes = Encoding.UTF8.GetBytes(\"SaltBytes\");\n Rfc2898DeriveBytes p = new Rfc2898DeriveBytes(passwordBytes, saltBytes);\n // sizes are devided by 8 because [ 1 byte = 8 bits ] \n key.IV = p.GetBytes(key.BlockSize/8);\n key.Key = p.GetBytes(key.KeySize/8);\n\n if (cryptographyMode)\n {\n Ecrypt(doc, \"Content\", key);\n }\n else\n {\n Decrypt(doc, key);\n }\n\n }\n catch (Exception ex)\n {\n MessageBox.Show(ex.Message);\n }\n finally\n {\n // Clear the key.\n if (key != null)\n {\n key.Clear();\n }\n }\n\n}\n\nprivate void Decrypt(XmlDocument doc, SymmetricAlgorithm alg)\n{\n // Check the arguments. \n if (doc == null)\n throw new ArgumentNullException(\"Doc\");\n if (alg == null)\n throw new ArgumentNullException(\"alg\");\n\n // Find the EncryptedData element in the XmlDocument.\n XmlElement encryptedElement = doc.GetElementsByTagName(\"EncryptedData\")[0] as XmlElement;\n\n // If the EncryptedData element was not found, throw an exception.\n if (encryptedElement == null)\n {\n throw new XmlException(\"The EncryptedData element was not found.\");\n }\n\n\n // Create an EncryptedData object and populate it.\n EncryptedData edElement = new EncryptedData();\n edElement.LoadXml(encryptedElement);\n\n // Create a new EncryptedXml object.\n EncryptedXml exml = new EncryptedXml();\n\n\n // Decrypt the element using the symmetric key.\n byte[] rgbOutput = exml.DecryptData(edElement, alg); <---- I GET THE EXCEPTION HERE\n // Replace the encryptedData element with the plaintext XML element.\n exml.ReplaceData(encryptedElement, rgbOutput);\n\n}"
] | [
"c#",
"cryptography"
] |
[
"Maven modules via setting paths, not copying folders",
"Maven's multi-modules plugin doc states clearly:\n\n\n Modules are regular Maven projects which must be located under a subdirectory so the parent project can retrieve them easily. \n\n\nThe thing is I don't want to locate them under a subdirectory. I just want to point to some file path which can be used in order to compile dependencies. (Highlighted, since this is the question actually). \n\nThe reason I want it is simple: I just don't want to mess two completely different paradigms - maven modules and git submodules - in one folder. Moreover, I don't want to have any kind of git dependencies in the project. \n\nSolution number 0, i.e. to create simlinks and to put them to .gitignore does not count ;)"
] | [
"maven"
] |
[
"How to get the count of deleted entities",
"I use the following method to delete a set of objects based on a certain where condition, but in reality the number of removed objects could be lesser than the passed collection. How do I get the actual count of deleted entities\n\nhttp://docs.spring.io/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/HibernateTemplate.html#deleteAll(java.util.Collection)"
] | [
"java",
"spring",
"hibernate"
] |
[
"Apache-Cayenne Custom Query Results",
"To preface my question, I'm in school working on a project that has been previously worked on in past semesters. So the choices made in the design and development were something I am not 100% sure on and so I cannot comment on the reasoning behind why things are set up how they are. I also looked through all of the questions on Apache-Cayenne tag and could not find something that addresses this. Please inform me if I'm mistaken on that and I'll gladly check it out.\n\nEssentially, we have a table that has a plethora of columns and I only want a few of those columns to be loaded (otherwise there is way too much unnecessary data being queried and it takes the page a lot longer to load).\n\nAs an example to keep it generic, let's say I have a table with object that have 10 columns. I want only 3 of the columns. So in my code I would have this:\n\npublic List<objectToQuery> getSpecificColumns() {\n\nObjectContext context = getNewContext();\n\nSQLTemplate select = new SQLTemplate(objectToQuery.class, \"select column1, column2, column3 from table\");\n\nList<objectToQuery> results = context.performQuery(select);\n\nreturn results;\n}\n\n\nAnd when I run this, it works and returns the proper amount of rows. However, when I try to interact with and retrieve data, it will run individual queries on every row that includes all columns anyways.\n\nSo for examle if on the page that gets the results I would have:\n\nobject.getColumn1();\n\n\nIt will run a query on the object for all of the columns... Why does this happen and is there any way to accomplish what I'm trying to do?\n\nMany thanks,\n-R"
] | [
"apache-cayenne"
] |
[
"Python DateTime Format Error",
"I am new at Python. I was trying to play with time and date objects. I wrote a simple test program to parse a string into a specific time format. But its throwing a ValueError. Can you please help me out here?\n\nHere is the code:\n\nimport time\ntestDate = \"Tuesday, Febuary 23 2011 12:00:00 UTC\"\ntoday = time.strptime(testDate,\"%A, %B %d %Y %H:%M:%S %Z\")\nprint today\n\n\nand the error:\n\nTraceback (most recent call last):\n File \"D:\\Python\\PythonTest\\src\\helloWorld.py\", line 3, in <module>\n today = time.strptime(testDate,\"%A, %B %d %Y %H:%M:%S %Z\")\n File \"C:\\Python27\\Lib\\_strptime.py\", line 467, in _strptime_time\n return _strptime(data_string, format)[0]\n File \"C:\\Python27\\Lib\\_strptime.py\", line 325, in _strptime\n (data_string, format))\nValueError: time data 'Tuesday, Febuary 23 2011 12:00:00 UTC' does not match format '%A, %B %d %Y %H:%M:%S %Z'"
] | [
"python",
"django",
"python-2.7"
] |
[
"ProgressBar for Zip arhive in powershell",
"I have a piece of code that works just fine in powershell.\nHowever I want to visualize the amount of work (zipping process).\n\n Write-Host \"Started zipping files and folders...\" -ForegroundColor Yellow\n\n Add-Type -Assembly System.IO.Compression.FileSystem\n $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal\n $zip = [System.IO.Compression.ZipFile]::CreateFromDirectory(\"$Destination\\$folderName\\\",\n \"$Destination\\$folderName.zip\", $compressionLevel, $false)\n if ($?) {\n Write-Host \"Zip process success. Exiting...\" -ForegroundColor Yellow\n Invoke-Item \"$Destination\"\n sleep -Seconds 2\n }\n else {\n Write-Host \"Zip process failed.\" -ForegroundColor Red\n }\n\n\nI assume that what I need to put is something like:\n\nWrite-Progress -Activity \"Zipping files and folders...\" -Status \"Progress:\" -PercentComplete ($zip/something?)}\n\n\nI am using Powershell v 5.1\n\nUPDATE:\nI will probably change and use incorporated cmdlet Compress-Archive"
] | [
"powershell"
] |
[
"Javascript image on hover with",
"my menu consists of different names, and I'm trying to fade in/out a different image every time user hovers over one of the <li> elements. Each <li> element is connected to different id, so that a correct image fades in for the specific person.\nThe problem is that the fade in and fade out works on all of the <ul> elements under the specific <li> element. Would you know how I can fix this?\n\n\r\n\r\n$(document).ready(function() {\r\n $(\"#pau\").mouseover(function() {\r\n $(\"#paup\").fadeIn(600);\r\n });\r\n $(\"#pau\").mouseout(function() {\r\n $(\"#paup\").fadeOut(600);\r\n });\r\n $(\"#red\").mouseover(function() {\r\n $(\"#redp\").fadeIn(600);\r\n });\r\n $(\"#red\").mouseout(function() {\r\n $(\"#redp\").fadeOut(600);\r\n });\r\n});\r\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n<div class='people'>\r\n <nav>\r\n <ul>\r\n <li>\r\n <div id=\"red\">Redpoppy Stories</div>\r\n <ul>\r\n <li><a href=\"http://www.redpoppystories.com\" target=\"_blank\">Blog</a></li>\r\n <li><a href=\"https://www.facebook.com/redpoppystories\" target=\"_blank\">Facebook</a></li>\r\n <li><a href=\"https://instagram.com/redpoppyzuz/\" target=\"_blank\">Instagram</a></li>\r\n <li><a href=\"#\">Vimeo</a></li>\r\n </ul>\r\n </li>\r\n </ul>\r\n <ul>\r\n <li id=\"pau\">\r\n <div>Paulinemma</div>\r\n <ul>\r\n <li><a href=\"http://www.diamondandunicorn.com\" target=\"_blank\">Blog</a></li>\r\n <li><a href=\"https://www.facebook.com/paulinemma\" target=\"_blank\">Facebook</a></li>\r\n <li><a href=\"https://instagram.com/paulinemma/\" target=\"_blank\">Instagram</a></li>\r\n <li><a href=\"#\">Vimeo</a></li>\r\n </ul>\r\n </li>\r\n </ul>\r\n </nav>\r\n</div>\r\n\r\n\r\n\n\nThank you very much for your comments."
] | [
"javascript",
"jquery",
"html",
"css",
"fadein"
] |
[
"Using ajax and jQuery to execute some PHP code",
"EDIT: solved. Was a simple mistake. The PHP file needed one of those \"?field=value\" things in the URL, and that's what needed to be in the data section. I needed to feed through the value of the input field to the PHP file, since when using Ajax, the URL does not change. \n\n\n\nThree files:\n test.html\n test.php\n test.js\n\nSo when a user clicks a button in test.html, it will execute the php code in test.php\n\n<form method=\"GET\" action=\"test.php\" id=\"addData\">\n\n\nThat works fine. The PHP retireves some information from another website and stores them in variables and then sends them to my database. Everything works fine. What I want to do now is make this process occur in the background.\nI have been researching the jQuery ajax call, and there is a 'data' field where you need to enter data to 'send'. This is where I got confused. My data is all handled in the PHP file and my javascript file has no access to that data. So...what goes in the data field?\n\n $(document).ready(function(){\n $(\"#addData\").submit(function(e){\n e.preventDefault();\n $.ajax\n ({\n type: 'POST',\n url: 'test.php',\n data: ?????????????????????????????\n success.........\n })\n });\n });\n\n\nSo when they submit the form, I want the PHP to execute and the data sent to the database. All the 'data' is taken care of in the PHP file and the 'sending to the database' is also handled in the PHP file. So what do I put in the ajax 'data' field ??"
] | [
"javascript",
"php",
"jquery",
"css",
"ajax"
] |
[
"Select nth record from a SQL result set in php",
"I run a query and get a result set. I need to get the nth record from this result set. Any ideas how I can do this?\n\nI cannot select the nth record from the database directly coz I need to filter it and don't know how many records there are in the result set. So I cannot be certain which number to pass to the mysql_result method i.e.\n\n\nBased on certain conditions, get a few rows from a table\nFrom these rows, select the nth row (the number n is not fixed. It depends on the number of records returned)\n\n\nThe basic idea is to get all results based on a set condition and get a random result from these.\n\nAny ideas? Thanks."
] | [
"php",
"mysql"
] |
[
"Python function returns non-type in AWS Glue even the same function working in local machine",
"i am new to AWS glue. I have a created job that would modify phone number's from a column and update the data frame.\nBelow script working fine in my local machine where i running with pyspark,\nThis basically add '+00' against those phone numbers which are not starting with '0'\n\n## Phonenubercolum\n6-451-512-3627\n0-512-582-3548\n1-043-733-0050\n\ndef addCountry_code(phoneNo):\n countryCode= '+00'+phoneNo\n if phoneNo[:1] !='0':\n return str(countryCode)\n else:\n return str(phoneNo)\n\nphone_replace_udf=udf(lambda x: addCountry_code(x), StringType())\n\nphoneNo_rep_DF= concatDF.withColumn(\"phoneNumber\", phone_replace_udf(sf.col('phoneNumber')))#.drop('phoneNumber')\n##output\n+006-451-512-3627\n0-512-582-3548\n+001-043-733-0050\n\n\n\nBut when i ran the same code in the glue context, it throws following error\n\naddCountry_code countryCode= '+00'+phoneNo **TypeError: must be str, not NoneType**\n\n\nI am wondering how this function fails in glue?\n\nAppreciate if anyone can help on this?"
] | [
"python-3.x",
"pyspark",
"aws-glue"
] |
[
"Can't create a variable in a while loop in VBScript?",
"This code causes an error for me:\n\ni = 0\nSet colors = CreateObject(\"Scripting.Dictionary\")\nDo While i < 7\n If True Then\n Dim a(1)\n a(0) = \"go\"\n a(1) = \"tRY\"\n colors.Add \"space\", a\n End If\n i = i + 2\nLoop\n\n\nI'm not too sure why. I need to do something similar, where I initialize a dictionary with one array for each key, but the while loop seems to be messing it up. Any suggestions? Thanks!"
] | [
"arrays",
"vbscript"
] |
[
"Save message properties only locally (Outlook)",
"How can an Outlook add-in set a MAPI property (for example, the body content) on a message, but only have it saved in the local cache (and not sent back to the exchange server)? I've seen this done with a few encryption add-ins. \n\nI'm open to using pretty much any API that could do the trick.\n\nThanks!"
] | [
"outlook",
"vsto",
"add-in",
"exchange-server",
"mapi"
] |
[
"Google Sheets Script - Copying data range from one sheet to another - whole range not copying",
"Bit of a rookie at this and learning atm. I am using the following script to copy data from one sheet to another in the same Google spreadsheet:\n\nfunction recordHistory() {\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = ss.getSheetByName(\"Cover\");\n var source = sheet.getRange(\"a1:c21\");\n var values = source.getValues();\n var sheet2 = ss.getSheetByName(\"January 2020\")\n values [0] [0] = new Date();\n sheet2.appendRow(values [0])\n}\n\n\nWhich works fine to copy a single row but does not copy the entire range listed (a1:c21). Now I imagine the problem lies around Row 8 but I am not sure. \n\nHere is the link to the spreadsheet I am using for trying this out:\n\nhttps://docs.google.com/spreadsheets/d/15pEbNy-PmrGeAmpASRUK2iXIyJPfg43Mm2r6bbiTBuM/edit#gid=1296663899"
] | [
"google-apps-script",
"google-sheets"
] |
[
"PostgreSQL: FATAL: XX000: could not write init file",
"I got this error when I tried to access DB from the live instance Server.\nAnyone knows the reason ?"
] | [
"postgresql"
] |
[
"Is there a more concise way to realize the internationalization by using different variables in javascript?",
"I can use ternary operator to implement my display variable internationalization. \n\n<span v-text=\"$store.getters.get_locale=='en-US' ? image_data.name_en : image_data.name \"></span>\n\n\nBut whether there is a more concise way to do this? \nour variable characteristic is xxx and xxx_en."
] | [
"javascript",
"vue.js"
] |
[
"jQuery: how to compare multiple inputs",
"How can you compare multiple input in the same form if they ALL have the same value? I need to check if they all have the same value or not.\n\n<input type=\"text\" class=\"inputclass\"/>\n<input type=\"text\" class=\"inputclass\"/>\n<input type=\"text\" class=\"inputclass\"/>\n<input type=\"text\" class=\"inputclass\"/>\n<input type=\"text\" class=\"inputclass\"/>\n...."
] | [
"jquery",
"input"
] |
[
"VB.NET TryParse returns False although a valid date passed",
"I created a function in VB.NET that checks for valid dates. The function is below:\n\nPublic Shared Function IsDate(obj As [Object]) As Boolean\n Dim strDate As String = obj.ToString()\n Dim dt As DateTime = DateTime.MinValue\n\n If DateTime.TryParse(strDate, dt) AndAlso dt <> DateTime.MinValue AndAlso dt <> DateTime.MaxValue Then\n Return True\n Else\n Return False\n End If\n End Function\n\n\nI pass a value to that function that I think is a valid date. My test value is 49278 that should correspond to a date of 30th Nov 2034.\n\nMy function however tells this is NOT a valid date. I cannot get why.\n\n\n\nWhat is happening here?"
] | [
".net",
"vb.net",
"excel",
"parsing",
"date"
] |
[
"checkbox in paginated datatable",
"I have a datatable and buttons for delete and update. And these button are disabled. I also have some checkbox in the first column of every row. Whenever I click the checkbox, the edit and delete button will be enabled. It is working on the first page of my datatable but when I click a row from other pages of the datatable, it doesn't enabling the buttons. What is the problem with it? I have this code:\n\nHTML Table:\n\n<table class=\"table table-bordered table-hover table-striped\" id=\"account_data\" width=\"100%\" style=\"margin-top: 0px\"> <thead class=\"header\">\n\n <tr class=\"well\"><th colspan=\"3\" style=\"text-align:center\">LIST OF USERS</th></tr>\n <tr class=\"well\"> \n <th style=\"width: 5px\"><input type=\"checkbox\" class=\"check\"/></th>\n <th style=\"font-size: 14px;padding-left: 20px;\"> ID#</th>\n <th style=\"font-size: 14px;padding-left: 20px;\"> Name</th> \n\n </tr>\n </thead>\n\n <tbody>\n <?php if($users != NULL){?>\n <?php foreach($users as $row){ ?>\n\n <tr> \n <td align=\"center\"><input type=\"checkbox\" class=\"accounts\" name=\"accounts[]\" value=\"<?php echo $row->user_id;?>\"/></td>\n <td style=\"font-size: 15px;padding-left: 20px;\"><?php echo $row->user_id;?></td>\n <td style=\"font-size: 15px;padding-left: 20px;\"><?php echo $row->user_name;?></td>\n\n </tr>\n <?php }?>\n <?php }?>\n </tbody>\n </table>\n\n\nJQUERY:\n\n<script>\n$(document).ready(function(){\n var count=0;\n var chkId=new Array();\n var checkedValue ='';\n $('.check').click(function() {\n $(\" .check\").each(function () {\n if($(this).is(\":checked\"))\n {\n $(\" .accounts\").prop('checked',true);\n // $('#edit_acc').prop('disabled',false);\n var n = $( \" .accounts:checked\" ).length;\n\n if(n==1){\n $('#edit_acc').prop('disabled',false);\n }\n if(n>1){\n $('#edit_acc').prop('disabled',true);\n }\n $('#delete_acc').prop('disabled',false);\n return\n }\n $(\" .accounts\").prop('checked',false);\n $('#edit_acc').prop('disabled',true);\n $('#delete_acc').prop('disabled',true);\n });\n\n });\n});\n</script>"
] | [
"javascript",
"jquery",
"html",
"checkbox",
"jquery-datatables"
] |
[
"Saving scatter graph as image in C#",
"I'm plotting some scatter graphs from SQL data in a c# program. I would like automatically save these graphs as they populate. I have the following code which saves the Jpeg files, but when I open them, they are empty. I'm plotting multiple graphs at once.\n\nAny help is appreciated.\n\npublic partial class XYplotForm : Form\n {\n public XYplotForm()\n {\n InitializeComponent();\n\n }\n public void Plot(Double[] freq, Double[] amp, Double[] bw, string name)\n {\n scatterGraph1.PlotXY(freq, amp);\n tbName.Text = name;\n\n Bitmap image = new Bitmap(scatterGraph1.Width, scatterGraph1.Height);\n Rectangle target_bounds = default(Rectangle);\n target_bounds.Width = scatterGraph1.Width;\n target_bounds.Height = scatterGraph1.Height;\n target_bounds.X = 0;\n target_bounds.Y = 0;\n scatterGraph1.DrawToBitmap(image, target_bounds);\n string filename = \"C:\\\\Graph\\\\\" + name + \".Jpeg\";\n image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);\n\n\n\n }\n\n\n }\n\n\n }"
] | [
"c#",
"image",
"graph",
"bitmap",
"scatter"
] |
[
"How to split values inside python dictionary?",
"I have values of dict stored in the form of list.\nHere it is what it looks like:\n\nd = [\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=prince,initial=p'},\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=steven,initial=s'}\n]\n\n\nIn here, in the key Length, i have two values. first=steven,initial=s\nI want to split those values and create two new fields and store it in the dictionary in the updated form.\n\nRequired Output:\n\nd = [\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=prince,initial=p','first':'prince','initial':'p'},\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=steven,initial=s','first':'steven','initial':'s'}\n]\n\n\nHere's the program i tried:\n\nd = [\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=prince,initial=p'},\n{'Driveline': 'Rear-wheel drive', 'Hybrid': 'False', 'Classification': 'Automatic,Transmission', 'Number_of_Forward_Gears': 6, 'Fuel_Type': 'Gasoline', 'Length': 'first=steven,initial=s'}\n]\nfield_to_split = \"Length\"\nsplit_using1 = ','\nsplit_using2 = '='\nb =[]\nfor i in d:\n s = i[field_to_split].split(split_using1)\n print(s)\n b.append(s)\n #print(s)\nprint(b)\n\n\nHow can i make this possible..."
] | [
"python",
"python-3.x",
"list",
"dictionary",
"for-loop"
] |
[
"Safe string copying over DLL boundaries",
"I am trying to make a DLL that exposes a certain API and thus wanted to implement a safe way to copy strings over the DLL boundaries. The DLL implementation is very straight forward - all the functions that return string values take two arguments - char* and size_t&. If the size is big enough I memcpy the contents of the string from within the DLL to the given pointer, set the size to the actual one and return a successful return code. If it is not I set the size to what it should be and return an error code. The DLL side is very straightforward.\n\nNow what is more complicated - how to make a nice template function which given a pointer to some function from the DLL would do all the correct manipulations to fill out an instance of std::string. This is what I came down to:\n\ntemplate<typename I>\nCErrorCode GetStringValue(const I& Instance, CErrorCode(I::*pMethod)(char*, size_t&) const, std::string& sValue)\n{\n std::string sTemporaryValue;\n size_t nValueLength = sTemporaryValue.capacity();\n sTemporaryValue.resize(nValueLength);\n do\n {\n auto eErrorCode = (Instance.*pMethod)(const_cast<char*>(sTemporaryValue.c_str()), nValueLength);\n if (eErrorCode == CErrorCode::BufferTooSmall)\n {\n sTemporaryValue.resize(nValueLength);\n }\n else\n {\n if (eErrorCode == CErrorCode::NoError)\n {\n sTemporaryValue.resize(nValueLength);\n sValue = std::move(sTemporaryValue);\n }\n return eErrorCode;\n }\n } \n while (true);\n}\n\n\nSo I did the initial resize because I can't do that after the first call (since then it would erase the content, since the string is initially empty). But resize fills the string with zero characters, which kind of upsets me (I mean I know I am going to be doing the filling myself anyway). And then I need the resize even after a successful run since if the length was actually smaller I need to resize down. Any suggestions if this can be done I a nicer way?"
] | [
"c++",
"dll",
"stdstring"
] |
[
"Netbeans - Library build with running Glassfish",
"I'm using a jar lib, my own develop, to share code between different netbeans project. When I'm going to build lib and glassfish/payara is running i get the following error:\n\n\n C:\\Users\\developer\\Documents\\NetBeansProjects\\redevoserver-git\\redevodblib\\nbproject\\build-impl.xml:1419: Unable to delete file C:\\Users\\developer\\Documents\\NetBeansProjects\\redevoserver-git\\redevodblib\\dist\\redevolib.jar\n BUILD FAILED (total time: 2 seconds)\n\n\nThe annoing procedure now foresee:\n\n\nStop server;\nBuild lib;\nRestart server.\n\n\nThis is a great time issue because stop and start glassfish (and redeploy all projects needed) get 60-120 seconds.\n\nIs there a way to manage libraries to avoid server stop need?"
] | [
"java",
"netbeans",
"jar",
"glassfish"
] |
[
"Rake task selectivly ignoring new code",
"In a rake task I'm writing some puts statements show changes while others don't. For instance changing\n\nputs model+\" | \"+id\n\n\ninto\n\nputs model+\" * \"+id\n\n\ndoesn't change in the output of the script. However in some places changing\n\nputs \"Connecting to \"+site\n\n\ninto\n\nputs \"Connecting to ----\"+site\n\n\nshows the changes that where made.\n\nIn the places where any changes to the line doesn't change the output, adding a new puts statement before or after don't show up when the task is run. Commenting out lines of code around the unchanging puts statements that do the actual work cause the script to not execute those lines, just as it should, but changing or adding puts statements there do not change the output of the script.\n\nRemoving all other tasks and emacs backup files from the lib/tasks folder doesn't help. I've been bitten before by having a backup copy of a task with the same namespace and task name running instead of the one I was working on.\n\nThis is being run with Ruby 2.4.3 on OpenBSD 6.3-stable on a fx-8350. I would post the whole script but the company I'm working for won't allow it."
] | [
"ruby",
"debugging",
"rake",
"rake-task",
"openbsd"
] |
[
"why position:fixed is not working in Chrome version 59?",
"position:fixed is not working in Chrome version 59..\nI've a toolbar in my application it is fixed below the menubar in the app. It's working fine in all other browser including Chrome with this below CSS rule, except Chrome version 59. Is there any way to fix this issue with CSS or jQuery ?\n\n#toolBar {\n background: #f7f7f7;\n height: 29px;\n border-bottom: 1px solid #3d5fa3;\n left: 19.4%;\n position: fixed;\n right: 0;\n z-index: 99999999999999999;\n -webkit-transition: all .2s ease-in-out;\n transition: all .2s ease-in-out;\n -webkit-transform: translateZ(0);\n}\n\n\nChrome version 59 alone misbehaves whit this.\nanother question regarding the same : Is there any way to apply CSS for specific chrome version?"
] | [
"jquery",
"css",
"google-chrome",
"browser",
"compatibility"
] |
[
"Endpoint which returns send_file not called again",
"I am writing a Flask app in which I have an HTTP endpoint which returns a send_file of an image I create in the function. Unfortunately, it seems the browser caches that image and doesn't even call the endpoint again, loading the original image on subsequent reloads.\n\nAny idea why this is happening and what the fix might be?"
] | [
"python",
"http",
"flask"
] |
[
"Handling regression for large unsorted datasets",
"I am tackling a way to solve this problem. Two data sets (CSVs) as of different times or from different environments are to be compared, and their difference is to be calculated and reported.\n\nThere is an identifying key-column for these data sets, which should ideally matching columns on that key. These sets may not necessarily have the same number of records, in which case missing data would not have a reported difference. The data types are all either strings or floating point numbers.\n\nFor two files of size 300MB, with approximately 500,000 records each, what data structure or method of reading in data would be ideal without depleting heap memory? This is given that the records will not come in sorted order by the identifying key. Storing a map of \n\n\n {key->Map{attribute->[valFile1,valFile2]}} was my first instinct, but this proved largely inefficient."
] | [
"java",
"csv",
"data-structures",
"data-storage"
] |
[
"vba excel If condition error on final iteration",
"I'm having the code takes the input from my checkboxes and grab data from the related worksheet. I ran it line by line and found out that it always gets a runtime error at the If statement on the final loop. Is there something wrong in my code?\n\nOption Explicit\n\nPrivate Sub UserForm_Initialize()\n Dim counter As Long\n Dim chkBox As MSForms.CheckBox\n\n ''''Add checkboxes based on total sheet count\n For counter = 1 To Sheets.count - 2\n Set chkBox = Me.Frame1.Controls.Add(\"Forms.CheckBox.1\", \"CheckBox\" & counter)\n chkBox.Caption = Sheets(counter + 2).Name\n chkBox.Left = 10\n chkBox.Top = 5 + ((counter - 1) * 20)\n Next\n\nEnd Sub\n\nPrivate Sub cmdContinue_Click()\n\n Dim Series As Object\n Dim counter As Long\n\n '''Clear old series\n For Each Series In Sheets(2).SeriesCollection\n Sheets(2).SeriesCollection(1).Delete\n Next\n\n\n ''Cycle through checkboxes\n For counter = 1 To Sheets.count - 2\n ''If the box is checked then\n If Me.Frame1.Controls(counter).Value = True Then ''Error here on 4th iteration\n ''Add new series\n With Sheets(2).SeriesCollection.NewSeries\n .Name = Sheets(counter + 2).Range(\"$A$1\")\n .XValues = Sheets(counter + 2).Range(\"$A$12:$A$25\")\n .Values = Sheets(counter + 2).Range(\"$B$12:$B$25\")\n End With\n\n End If\n\n Next counter\n\n Me.Hide\n\nEnd Sub\n\n\nAlso, a second problem is it always run on the wrong loop. If i check box 2 it'll run data for the box 1 sheet, 3 run for 2, 4 run for 3, and 1 run for 4. Can anyone explain the reason behind this? \n\nEDIT: So as VincentG point out below, adding an explicit name \"checkbox\" in there did the trick (i didn't know you could do that). Index 1 was probably taken by one of the buttons or the frame in the user form, causing it to get off set."
] | [
"vba",
"excel",
"if-statement"
] |
[
"Mixing sed backreferences with bash variables",
"I am running an old version of git and I am writing a script that updates the host name configuration. \n\nMy problem is that I can't figure out the right escape character combinations so that a variable is not mixed with the back-reference used in my regex. \n\nHere is my best effort\n\n#!/bin/bash\n#code\nfoo=`ec2-describe-instances i-f95e4b82 | grep amazon | awk '{print $4}'`\nsed -i \"s/\\(ec2-user@\\)\\(.*\\)\\(:repo\\.git\\)/\\\\1 $foo \\\\3/\" /var/www/.git/config\n\n\nThis puts a space between the first back-reference and the variable foo. The hope is to not have that space between the first back reference and $foo. I suspect I could use a literal instead of the backreference, but the user names and repos may change.\n\nAny ideas?\n\nEdit\n\n\"s/\\(ec2-user@\\)\\(.*\\)\\(:repo\\.git\\)/\\\\1$foo\\\\3/\"\n\n\nDoes not produce the right answer because foo is amalgamated with the 1, producing the wrong back reference. I can't figure out how to escape $foo."
] | [
"bash",
"sed",
"escaping"
] |
[
"Is it ok to wrap my web site in Flutter web view",
"I have a website and now I need to have mobile app in order to be able to send push notifications to my users and provide limited scope of functionalities of my web application.\nSince this will be simplified version of my website’s functionality, my plan is to first check if my web is responsive and looks OK on mobile browsers, and modify it if needed.\nThen I plan to create simple mobile app in Flutter with webview component that will just load my website inside app.\nThe motive is to have one simple code base for both platforms That’s easy to maintain.\nWill Flutter’s webview be suitable for this kind of use-case?\nOther options are to use PWA and browser push/notification messages, or to learn React Native, Xamarin or something similar. My preference is the first aproach, but only if it looks suitable for my use-case."
] | [
"android",
"ios",
"flutter",
"mobile",
"progressive-web-apps"
] |
[
"jQuery select various information from different",
"I'm working with the following HTML:\n\n<tr class=\"oddrow\">\n <td>row1</td>\n <td style=\"text-align:center;\">\n <table>\n <tbody>\n <tr>\n <td width=\"50%\">-1<br>+1</td>\n <td width=\"50%\">WSH: -110<br>SAC: -110</td>\n </tr>\n </tbody>\n </table>\n </td>\n <td style=\"text-align:center;\">\n <table>\n <tbody>\n <tr>\n <td width=\"50%\">202.5</td>\n <td width=\"50%\">o: -110<br>u: -110</td>\n </tr>\n </tbody>\n </table>\n </td>\n <td style=\"text-align:center;\">WSH: 0<br>SAC: 0</td>\n</tr>\n<tr class=\"evenrow\">\n <td>row2</td>\n <td style=\"text-align:center;\">\n <table>\n <tbody>\n <tr>\n <td width=\"50%\">-1<br>+1</td>\n <td width=\"50%\">WSH: -110<br>SAC: -110</td>\n </tr>\n </tbody>\n </table>\n </td>\n <td style=\"text-align:center;\">\n <table>\n <tbody>\n <tr>\n <td width=\"50%\">202.5</td>\n <td width=\"50%\">o: -110<br>u: -110</td>\n </tr>\n </tbody>\n </table>\n </td>\n <td style=\"text-align:center;\">WSH: 0<br>SAC: 0</td>\n <!-- The above line is the one I need. --!>\n</tr>\n\n\nThere are 2 such rows (row1 and row2), alternating as an oddrow then evenrow. I have the entire HTML as a string in my JavaScript/jQuery code. I also have the information of the two three-letter abbreviations: in this example, WSH and SAC. What I need is the third <td style=\"text-align:center;\"> of the row2 row. I should point out that there are several tables of row1 and row2 on the page, so I need a general selector. What I have been doing is just grabbing all the data in all the rows then parsing it from there, but the inconsistency of the data is making that more difficult. Is there a quick and dirty jQuery that will point me to the data I need? \n\nI was thinking something like $(\"tr td:contains(\" + abbrev + \") td:contains('row2')\").text();, but that doesn't get it.\n\nCan anyone help?"
] | [
"javascript",
"jquery",
"html"
] |
[
"Get a column to represent data from another table",
"Sorry if my question wasn't clear before, i updated it hope it makes more sense now.\n\nI have 2 tables:\n\nServers (Server,IP,OS)\nIPs (IP,Ping,Server)\n\n\nI have configured a foreign key so that any ip inserted to \"Servers\" will have to exist on \"IPs\".\n\nNow, i would like that every time i insert a record to the \"Servers\" table, the Server will automatically be created in the \"IPs\" table in corresponding IP (the IPs table already contains all of the possible ip addresses with NULL in the Server column). for example:\n\n\nIPs table looks like this:\n\nIP Ping Server\n\n1.1.1.1 True Null\n1.1.1.2 True Null\n1.1.1.3 True Null\ninsert into Servers table: Server=srv1 IP=1.1.1.1 OS=Win2008R2\nIPs table is automatically updated and now looks like this:\n\nIP Ping Server \n\n1.1.1.1 True Srv1\n1.1.1.2 True Null\n1.1.1.3 True Null \n\n\nIs there a way to achieve that?\n\nThanks."
] | [
"sql",
"sql-server"
] |
[
"In file editing, how to replace all the string words with incremental integers?",
"I have a file containing a lot of string words, severed by pipes. I would like to have a script (written in bash or in any other programming language) that is able to replace every word with an incremental unique integer (something like an ID).\n\nFrom an input like this:\n\naaa|ccccc|ffffff|iii|j\naaa|ddd|ffffff|iii|j\nbb|eeee|hhhhhh|iii|k\n\n\nI'd like to have something like this\n\n1|3|6|8|9\n1|4|6|8|9\n2|5|7|8|10\n\n\nThat is: aaa has been replaced by 1, bb has been replaced by 2, and so on.\n\nHow to do this? Thanks!"
] | [
"string",
"bash",
"file",
"edit"
] |
[
"Babel: The CLI has been moved into the package `babel-cli`",
"I was working on a JS file at work where I had babel installed, running babel file.js | node\nI sent the file home to work in the evening, installed babel at home and I got the following error when I run the above command:\n\nThe CLI has been moved into the package 'babel-cli'\n\n\nAny ideas? Thank you in advance :)\n\nIf I install the CLI - the following code fails to compile:\n\nfunction sumArrayIndex(array, i, separator) {\n return array\n .map(x => x.split(separator)\n .map(c => { return parseInt(c) })\n )\n .map(x => { return x[i]; })\n .reduce((x, y) => { return x += y }, 0);\n}\n\nfunction minToSec(m) {\n return m * 60\n}\n\nfunction secondsToMinutesAndSeconds(s) {\n var min = s / 60;\n var sec = s % 60;\n\n minutes += Math.floor(min);\n seconds += sec;\n}\n\nfunction outputTime() {\n return hours + ':' + minutes + ':' + seconds;\n}"
] | [
"javascript",
"ecmascript-6",
"babeljs"
] |
[
"Could not push image: denied: requested access to the resource is denied",
"I'm using docker-java to create an image on a docker host which is running on a Ubuntu 16.04 VM. The image creation works just fine and I can list the image created via docker-java. But when I try to push the image to a private registry(Harbor) I get\n\ncom.github.dockerjava.api.exception.DockerClientException: Could not push image: denied: requested access to the resource is denied\n\n\nI have added my current user to the usergroup docker and can manually push the image with the following command from the terminal(note no sudo).\n\ndocker login\ndocker push some_ip/app/test:test\n\n\nBut when I make the following call from my java code I get the above mentioned error.\n\ndockerClient.pushImageCmd(\"10.107.173.190/container-apps/test:testapp\") \n .exec(pushImageResultCallback).awaitSuccess();\n\n\nPossible cues:\n\n\nWhich profile does docker daemon use when being invoked by the API? How can I make sure it has sufficient access?"
] | [
"docker",
"docker-api",
"docker-java"
] |
[
"Determining the type from a smart pointer",
"I have a function that currently takes in two template parameters. One is expected to be the smart pointer, and the other is expected to be the object type. For example, SmartPtr<MyObject> as the first template parameter and MyObject as the second template parameter.\n\ntemplate <typename T, typename TObject>\n\n\nI would like to know whether I can determine the second parameter, MyObject, automatically from the first parameter SmartPtr<MyObject> or not so that my template function is written like this:\n\ntemplate <typename T>\n\n\nAnd the type TObject in the original template function is automatically determined from T which is expected to be a smart pointer.\n\nAs requested, here is the function declaration and its use:\n\ntemplate <typename T, typename TObject>\nT* CreateOrModifyDoc(T* doc, MyHashTable& table)\n{\n T* ptr = NULL;\n\n if (!table.FindElement(doc->id, ptr))\n {\n table.AddElement(doc->id, new TObject());\n table.FindElement(doc->id, ptr);\n } \n\n return ptr;\n}"
] | [
"c++",
"templates"
] |
[
"position of span text inside parent div",
"I am working on a CSS issue. I have a parent div and there are some child spans in it which getting generated dynamically as block element...\n\nI need to have the text of span in the right hand side of div but if the text is more than parent div then it should not be wrapped to right align. it should be align left..\n\nI used text-align:right.. but the first text in my span wrapping to right which i dont want. I tried float - right, position - fixed etc.. but couldnt fix it.\n\nHere is my code ..\n\n\r\n\r\n.parent {\r\n display: inline-block;\r\n width: 20%;\r\n margin-top: 10px;\r\n margin-right: 15px;\r\n border: 1px solid red;\r\n}\r\n.spanLabel {\r\n display: block;\r\n margin-bottom: 2.2em;\r\n word-wrap: break-word;\r\n text-align: right;\r\n}\r\n<div class=\"parent\">\r\n <span class=\"spanLabel\">\r\n ExcellentExcellentAAExcellentExcellentAAExcellentE\r\n </span>\r\n <span class=\"spanLabel\">\r\n Good\r\n </span>\r\n</div>\r\n\r\n\r\n\n\nI need something like the text of span should be right side of parent div but if text grows then next line should be left align.. I need to have same css for span as it is getting generated dynamically in a loop..\n\nAny help would be much appreciated.."
] | [
"html",
"css"
] |
[
"Trigger multi domain redirects (to set cookies) without changing the current page url/view",
"Currently working on changes to handle third-party cookie block by browsers in the future.\nI have three domains but the same code base (Domain X, Domain Y, Domain Z) and Accounts website A.\nA user comes to accounts A from domain X and on successful login, I wanted to make three redirects (trigger redirects internally) without changing the actual accounts URL/view and on successful three redirects, I wanted to domain redirect to Domain X.\nReason for choosing redirects:\n\nFollowing the same approach as Google (SetSSID redirect to google, youtube)\n\nTried XHR instead of redirect but the created cookie is not accessible by the domains. See below example:\nI made an XHR post request to domain X (with Set-Cookie), the cookie is created as per the network request. But when I navigate to domainx.com, couldn't see the cookie.\n\n\nNote: Scenario: Third-party cookie is always blocked"
] | [
"google-chrome",
"redirect",
"single-sign-on"
] |
[
"PanResponder could not detect touch if i touch on Touchables(TouchableHighlight, TouchableOpacity, TouchableWithoutFeedback)",
"I have implemented PanResponder in my project but it only works when I touch non touchable elements . When I touch touchable elements like TouchableOpacity, PanReponder does not responds.But when I move my finger on TouchableOpacity PanResponder responds.\n\n\n Same thing happening for Button also\n\n\nPlease tell me what might be the problem.\n\nExpo Link : https://snack.expo.io/SyYrtq87W\n\nimport React, { Component } from 'react';\nimport { Button, PanResponder, View, StyleSheet,TouchableOpacity } from 'react-native';\nimport { Constants } from 'expo';\n\nexport default class App extends Component {\n state = {\n show : false\n };\n _panResponder = {};\n\n componentWillMount() {\n this._panResponder = PanResponder.create({\n\n onStartShouldSetPanResponder: () => {\n alert('clicked')\n console.log('clicked')\n return true\n },\n onMoveShouldSetPanResponder: () => {\n alert('moved')\n console.log('moved')\n return true\n },\n onStartShouldSetPanResponderCapture: () => false,\n onMoveShouldSetPanResponderCapture: () => false,\n onPanResponderTerminationRequest: () => true,\n onShouldBlockNativeResponder: () => false,\n });\n }\n\n render() {\n return (\n <View\n style={styles.container}\n collapsable={false}\n {...this._panResponder.panHandlers}>\n\n {/*********************PanResponder does not respond***************************/} \n\n <TouchableOpacity>\n <View style={{width:200, height:200,backgroundColor:'red'}}>\n </View>\n </TouchableOpacity>\n\n\n\n <Button\n title=\"Here is a button for some reason\"\n onPress={() => {}} \n />\n\n {/*****************************************************************************/}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n paddingTop: Constants.statusBarHeight,\n backgroundColor: '#ecf0f1',\n }\n});"
] | [
"react-native"
] |
[
"Reading another device's file structure via Bluetooth",
"Is it possible to read another mobile device's file structure if my device is connected to that device via Bluetooth?\n\nIt's not how to send files, but to see the file structure of another device in Android devices.\n\nThe mobile is Android platform and the other device can be any Bluetooth device.\n\nSo from my mobile device I want to read Bluetooth device's file structure."
] | [
"android",
"bluetooth"
] |
[
"regex to match strings not ending with a pattern?",
"I am trying to form a regular expression that will match strings that do NOT end a with a DOT FOLLOWED BY NUMBER. \n\neg.\n\nabcd1\nabcdf12\nabcdf124\nabcd1.0\nabcd1.134\nabcdf12.13\nabcdf124.2\nabcdf124.21\n\n\nI want to match first three.\nI tried modifying this post but it didn't work for me as the number may have variable length.\n\nCan someone help?"
] | [
"regex",
"regex-negation",
"lookahead",
"negative-lookahead",
"negative-lookbehind"
] |
[
"Web scraping with beautiful soup multiple files having each file as a column name",
"Python newbie here. I am trying to to get data from multiple page each page representing a column, for example see below\ndf = {\n'country': [],\n'values':[],\n'units':[]\n}\nfilesss = ['GDP.html', 'GDP per capita.html']\nfor filename in filesss:\nif filename.endswith(".html"):\n variableName = filename.replace('.html', "")\n\n with open('indicators/'+filename, encoding='utf8') as filee:\n sou = bs(filee, 'lxml')\n if(sou is not None):\n table = sou.find('table', class_='table')\n if(table is not None):\n rows = table.find_all('tr', {'class': re.compile('^datatable-row')})\n if(rows is not None):\n for i in range(len(rows)):\n a = rows[i].find_all('td')[0].find('a')\n if(a is not None):\n \n countryName = a.text.strip()\n variableValue = rows[i].find_all('td')[1].text.strip()\n unit = rows[i].find_all('td')[4].text.strip()\n \n df['units'].append(unit)\n df['values'].append(variableValue)\n \n if(countryName not in df['country']):\n df['country'].append(countryName)\n\nRequired result is somewhat like this\n\n\n\n\nCountry\nGDP\nUNIT\nGDP per capita\nUNIT\n\n\n\n\nUK\n2312\nUSD BILLION\n2360\nUSD\n\n\nUS\n2312\nUSD BILLION\n2360\nUSD\n\n\nKENYA\n2312\nUSD BILLION\n2360\nUSD"
] | [
"python",
"beautifulsoup"
] |
[
"Recursively call api (axios / javascript)",
"I'm trying to fill an array with the result of multiple API calls using recursion. I'm pretty over my head here with ES6 and the recursion stuff and could need some help.\n\nHere is my current code, which only returns \"promise\" :\n\ngetAllEmployees: function() {\n let allEmployees = []; // this array will contain all employees\n let pageNumber = 1; // start with page 1\n const getThoseEmployees = function(pageNumber) {\n return axios.get(rest_url + 'users/?per_page=50&page=' + pageNumber, {\n headers: {\n 'X-WP-Nonce': WPsettings.nonce\n },\n }).then(response => {\n // add the employees of this response to the array\n allEmployees = allEmployees.concat(response.data);\n pageNumber++;\n if (response.headers['x-wp-total'] > allEmployees.length) {\n // do me again...\n return getThoseEmployees(pageNumber);\n } else {\n // this was the last page, return the collected contacts\n return allEmployees;\n }\n });\n }\n return getThoseEmployees();\n},\n\n\n// after \"created\" in vue\nthis.allEmployees = this.getAllEmployees(); // returns \"promise\""
] | [
"javascript",
"recursion",
"ecmascript-6",
"es6-promise",
"axios"
] |
[
"Tomcat7 MySQL Connection Error",
"I'm facing a perplexing problem. I've completed a jsf web app that utlizes hibernate and infinispan with Tomcat7 and tomcat-jdbc-pool as the connection pool provider. \n\nIt is being deployed to a Linode cluster w/ 2 nodes -- one database server and one production server. \n\nI can run the app on my local environment using the exact same copy of Tomcat7 (I literally tarred the tomcat directory and promoted it to the server to debug this error) -- even when connected to the live database instance. Everything runs fine.\n\nWhen I attempt to run the application from the production server I get a MySQLIO error:\n\n\n Caused by: java.net.ConnectException:\n Connection refused\n\n\nLooking further up in the logs i see:\n\n\n The last packet sent successfully to\n the server was 1 milliseconds ago. The\n driver has not received any packets\n from the server.\n com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:\n Communications link failure\n\n\nI can connect from the command line on the prodapp server just fine -- even using tcp:\n\nmysql -h db01 -u user -p --protocol=tcp\n\n\nBut it just won't work running inside the Tomcat container. I've tried all kinds of things but I'm really stumped. It just seems strange that I can connect to the database server using the same copy of Tomcat7 locally but when deployed to production the same copy of tomcat7 can't connect -- even though I can connect from the command line on that production server ... I'm stumped.\n\nAny help is greatly appreciated.\n\nEDIT: Solved my problem after wasting too much good life on it. The answer was I'm stupid. Thanks to everyone who tried to help. I have the app moded w/ a dev and live mode and the connection pool was reading the dev mode this whole time. What really made it confusing is that the sessionfactory was moded to live so it would actually reach the live database and initialize a connection when it started up so i could see it connecting (and running meta data queries in the mysql log), but when it actually went to grab a connection from infinispan it blew up. Oh well -- at least it's working now. Thanks again."
] | [
"mysql",
"tomcat",
"connection"
] |
[
"Location Settings Dialog caused the current activity to go back in android?",
"I am using Location Setting Dialog in my Application. I am using the below code:\n\nprivate void enableLoc() {\n\n if (googleApiClient == null) {\n googleApiClient = new GoogleApiClient.Builder(getApplicationContext())\n .addApi(LocationServices.API)\n .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {\n @Override\n public void onConnected(Bundle bundle) {\n\n }\n\n @Override\n public void onConnectionSuspended(int i) {\n googleApiClient.connect();\n }\n })\n .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {\n\n @Override\n public void onConnectionFailed(ConnectionResult connectionResult) {\n\n Log.d(\"Location error\",\"Location error \" + connectionResult.getErrorCode());\n }\n }).build();\n googleApiClient.connect();\n\n LocationRequest locationRequest = LocationRequest.create();\n locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);\n locationRequest.setInterval(30 * 1000);\n locationRequest.setFastestInterval(5 * 1000);\n LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()\n .addLocationRequest(locationRequest);\n\n builder.setAlwaysShow(true);\n\n PendingResult<LocationSettingsResult> result =\n LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build());\n result.setResultCallback(new ResultCallback<LocationSettingsResult>() {\n @Override\n public void onResult(LocationSettingsResult result) {\n final Status status = result.getStatus();\n switch (status.getStatusCode()) {\n case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:\n try {\n // Show the dialog by calling startResolutionForResult(),\n // and check the result in onActivityResult().\n status.startResolutionForResult(AboutUsActivity.this, REQUEST_LOCATION);\n\n finish();\n } catch (IntentSender.SendIntentException e) {\n // Ignore the error.\n }\n break;\n }\n }\n });\n }\n }\n\n\nWhen I call this method the dialog appears if my location setting is off.\nNow as soon as the dialog appears my activity goes to the back and the previous activity is showing.\n\nWhy this is happening? How to ask user for location setting updating?"
] | [
"android",
"sdk",
"location"
] |
[
"How to execute XSLT 2.0 with ant?",
"I'm trying to run an XSLT transformation from an ant file.\n\nI'm using a XSLT 2.0 stylesheet with a saxon 9 parser (supporting XSLT 2.0).\n\nThe problem is that it seems that ant is always calling an XSLT 1.0 parser.\n\nHere's my ant file :\n\n<xslt style=\"stylesheet.xslt\"\n basedir=\"core/\" \n extension=\".xml\"\n destdir=\"core/\"\n classpath=\"D:\\\\DevTools\\\\saxon\\\\bin\\\\saxon9.jar\">\n</xslt>\n\n\nIf I call it directly (without ant), it's working.\n\nAny idea ?"
] | [
"xslt",
"ant",
"saxon"
] |
[
"retrieving user input from a text field",
"What is the best way to retrieve user-input text from a text field on Submit button press? I am having issues with the listener, because it doesn't return anything (located in my gui class). I need to somehow retrieve what the user inputs, then return to the main class, and decide from there what to do with the user input. an example code would be nice!"
] | [
"input"
] |
[
"Vb visual basics console mode is flickering too much. Any way to stop it?",
"I have been programming for just over half a year now, so sorry for how bad this code is. But i am making pong in vb console mode in 2008. I am doing it for a project at my 6th form that why its in 2008. But when the ball is moving along it i causing the whole thing to flicker. I am using a 2D array with a ticker to move the ball. The code is pretty long and in separate classes so i will put the bit which i think is causing the problem. There is a lot of subs below the last which just move the paddles down and up \n\nModule Module1\nPublic arrfield(79, 11), readkey, secounds, key, score1, score2 As String\nPublic milliSecond As Integer = 0\nPublic secound As Integer = 0\nPrivate Tick As New Timers.Timer(1)\nPublic h As Integer = 39\nPublic g As Integer = 6\n<MTAThread()> _\nSub Main()\n AddHandler Tick.Elapsed, AddressOf ticker\n score1 = 0\n score2 = 0\n Console.WriteLine(\"Hello and welcome to Russell's pong program!\")\n Console.WriteLine(\"This is a two player game, one person on WSAD and the other person on the arrow keys\")\n Console.WriteLine(\"Press ENTER to start\")\n Console.ReadLine()\n fireldsetup()\n field()\n ball1()\n win_lose()\n Paddle1_middle_Paddle2_middle()\nEnd Sub\n<MTAThread()> _\nSub ball1()\n Dim run As New ballphysics()\n Dim ballphysics As New Thread(AddressOf run.ball)\n ballphysics.Name = \"ballphysics\"\n ballphysics.IsBackground = True\n ballphysics.Start()\nEnd Sub\n<MTAThread()> _\nSub win_lose()\n Dim run As New win_lose()\n Dim win_lose As New Thread(AddressOf run.win)\n win_lose.Name = \"win_lose\"\n win_lose.IsBackground = True\n win_lose.Start()\nEnd Sub\nSub fireldsetup()\n For i = 0 To 79\n For j = 0 To 11\n arrfield(i, j) = \" \"\n Next\n Next\n For i = 0 To 79\n arrfield(i, 1) = \"_\"\n Next\n For i = 0 To 79\n arrfield(i, 11) = \"_\"\n Next\n Tick.Enabled = True\nEnd Sub\nSub field()\n Console.Clear()\n Console.WriteLine()\n Console.WriteLine(\" \" & \"Player1\" & \" \" & \"Player2\")\n Console.ForegroundColor = ConsoleColor.Green\n Console.WriteLine(\" \" & score1 & \" !PONG! \" & score2)\n Console.ForegroundColor = ConsoleColor.White\n Console.WriteLine()\n Console.WriteLine()\n For i = 0 To 79\n Console.Write(arrfield(i, 1))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 2))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 3))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 4))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 5))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 6))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 7))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 8))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 9))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 10))\n Next\n For i = 0 To 79\n Console.Write(arrfield(i, 11))\n Next\nEnd Sub\nPrivate Sub LookForKeyPress()\n Dim k As ConsoleKeyInfo = Console.ReadKey()\n readkey = k.Key.ToString\nEnd Sub\nSub ticker()\n milliSecond += 1\n secound = milliSecond\nEnd Sub\nSub Paddle1_middle_Paddle2_middle()\n fireldsetup()\n arrfield(2, 7) = \"│\"\n arrfield(2, 6) = \"│\"\n arrfield(2, 5) = \"│\"\n arrfield(76, 7) = \"│\"\n arrfield(76, 6) = \"│\"\n arrfield(76, 5) = \"│\"\n field()\n LookForKeyPress()\n If readkey = \"S\" Then\n readkey = \"\"\n Paddle1_up1_Paddle2_middle()\n ElseIf readkey = \"W\" Then\n readkey = \"\"\n Paddle1_down1_Paddle2_middle()\n ElseIf readkey = \"DownArrow\" Then\n readkey = \"\"\n Paddle1_middle_Paddle2_up1()\n ElseIf readkey = \"UpArrow\" Then\n readkey = \"\"\n Paddle1_middle_Paddle2_down1()\n Else\n Paddle1_middle_Paddle2_middle()\n End If\nEnd Sub"
] | [
"vb.net",
"visual-studio-2008"
] |
[
"Can Multiple BackgroundWorkers use the same Function / end Variable?",
"Is that okay if let's say I have\n\nBackgroundWoker1\nBackgroundWoker2\n\n\nBoth of them are having :\n\nAddHandler BackgroundWoker1.DoWork, AddressOf requestDataTravelPackagesName\nAddHandler BackgroundWoker1.ProgressChanged, AddressOf showLoadingAnim\n\n\nand in the other line (with different time usage)\n\nAddHandler BackgroundWoker2.DoWork, AddressOf requestDataTravelPackagesName\nAddHandler BackgroundWoker2.ProgressChanged, AddressOf showLoadingAnim\n\n\nIs this allowed? Because I tried the similar thing, and it appeared that my Form malfunctions.\nBut it doesn't gives me any error / message. the Frame (GUI) just vanished.\n\nI'm thinking perhaps this is because of the multiple background workers that I have. Probably they are accessing the same variable (at the completed function) or in the similar function / etc."
] | [
"vb.net",
"thread-safety",
"backgroundworker"
] |
[
"Is it possible to pass pipes as parameters to a component and execute the transform from within the component?",
"I need to do some tasks inside a component which require non-transformed text. Yet I want to be able to pass pipes alongside the text. I would like to either pass the pipes as parameters for the component and call them later - or if that is not possible, delay the execution of the transformations and inject my own before that. I can not use my own pipe since it \n\n\nwould require all other pipes to be called afterwards and \nis a stateful transformation (I need to know if the text is currently collapsed or not)\n\n\nI tried simply passing the pipes in an array to an @Input field in the component, and I tried to pass them as strings and then resolve the pipe-names to retrieve the pipe-instances, both unsuccessfully. My first approach was to create a pipe of my own, but since I need to store the state of the text I can't really use pipes.\n\nThis was how I would like to set up my component (which does not work obviously)\n\n<collapsible-content [text]=\"item.data.message\" \n [pipes]=\"[markdown, hashtags, mention]\">\n</collapsible-content>"
] | [
"angular",
"input",
"parameters",
"pipe"
] |
[
"transitionend event fires twice",
"I have the following code and my problem is that the transitionend event is fired twice. I don't know what's causing this. I suspected the vendor prefixes caused it, but they don't. Even if I only leave transitionend and transition it will still fire twice.\n\nCSS\n\ntransition: 1s ease-out;\n\n\nJS\n\ndocument.addEventListener('click', function (e) {\n var submarine = document.querySelector('.submarine');\n var submarineX = e.clientX - submarine.offsetWidth / 2;\n var submarineY = e.clientY - submarine.offsetHeight / 2;\n\n submarine.style.left = submarineX + \"px\";\n submarine.style.top = submarineY + \"px\";\n});\n\ndocument.addEventListener('transitionend', function (event) {\n console.log(event.type + \" \" + new Date().getTime());\n});\n\n\nFiddle\n\n\r\n\r\ndocument.addEventListener('transitionend', function (event) {\r\n console.log(event.type + \" \" + new Date().getTime());\r\n});\r\n\r\ndocument.addEventListener('click', function (e) {\r\n var submarine = document.querySelector('.submarine');\r\n var submarineX = e.clientX - submarine.offsetWidth / 2;\r\n var submarineY = e.clientY - submarine.offsetHeight / 2;\r\n\r\n submarine.style.left = submarineX + \"px\";\r\n submarine.style.top = submarineY + \"px\";\r\n});\r\n.submarine {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 20px;\r\n height: 20px;\r\n background-color: red;\r\n border-radius: 50%;\r\n transition: 1s ease-out;\r\n}\r\n<div class=\"submarine\"></div>"
] | [
"javascript",
"css"
] |
[
"Django/Heroku hide heroku url by subdomains name",
"I'm currently deploying some django app on Heroku.\nI bought a domain name on Gandi, and made a subdomain redirecting (temporary redirection) on my heroku server. Currently, the subdomain is redirecting to the machine, this is working.\n\nmysubdomain.mydomain.com --> something.heroku.com \n\nHowever, when I navigate throught my website, I still have on my address bar the heroku domain name in front of my page (something.heroku.com/detailpage/slugforexample) \nI would like to hide the heroku domain name by my subdomain name (to have something like subdomain.domain.com/detailpage/slugforexample)\n\nI set the Gandi configuration (temporary redirection to heroku server)\nI set on heroku domains:add with my subdomain. \n\nWhere do I have to configure the redirection ? Is it in heroku, wsgi, django conf ?"
] | [
"django",
"heroku",
"configuration",
"url-redirection"
] |
[
"Catch (date) change event of ios5 native datepicker per javascript",
"I try to catch a date change event per javascript of the native ios5 datepicker.\n\nExample:\n\n<input type=\"date\" onclick=\"alert('click')\" onchange=\"alert('change')\" onselect=\"alert('select')\" onfocus=\"alert('focus')\" />\n\n\nThe 'onfocus' & 'onclick' events are fired correctly (Tested on iPad with iOS 5.0.1) but\nnot the 'onchange' or 'onselect' events (not while you turn at the wheel, either if the control lost the focus).\n\nAnybody has idea, how to catch these events?\nThanks!\n\nEdit:\n\nI tried also the 'onblur' event to catch the lost of the focus:\n\n<input type=\"date\" onblur=\"alert('blur')\" />\n\n\nBut that crashes safari."
] | [
"javascript-events",
"ios5"
] |
[
"Eloquent Javascript LifeLikeTerrarium clone",
"I am going through Marijn Haverbeke's Eloquent Javascript and am having some trouble understanding a section of the LifeLikeTerrarium example. Specifically the code below:\n\nfunction clone(object){\n function OneShotConstructor(){}\n OneShotConstructor.prototype = object;\n return new OneShotConstructor(); \n}\n\n\nWhich is called by the constructor for LifeLikeTerrarium:\n\nfunction LifeLikeTerrarium(plan){\n Terrarium.call(this, plan);\n} \nLifeLikeTerrarium.prototype = clone(Terrarium.prototype);\nLifeLikeTerrarium.prototype.constructor = LifeLikeTerrarium;\n\n\nMy understandig is that LifeLikeTerrarium should inherit from Terrarium and this code is trying to make that happen. My uncertainty is about how it achieves this. \n\n\nDoes doing the 'Terrarium.call(this, plan) pass the data to the Terrarium constructor as if you had called Terrarium(plan) within the context of the inheritence?\nWhat is the purpose of calling clone(object)? How is this different from saying \"LifeLikeTerrarium.prototype = Terrarium.prototype?\nWhat is the purpose of assigning LifeLikeTerrarium's constructor to itself?\n\n\nI feel like I understand the rest of the code but this seems like a pretty crucial section. Would really appreciate anyone who is willing to break it down for me. \n\nThanks!"
] | [
"javascript",
"inheritance",
"clone"
] |
[
"jquery show and hide functionality not worked",
"I have a set of records with an \"edit\" button next to them.\nI also have a div that has a form inside of it. \n\nwhen I click on \"edit\" I show the div. Inside the div, I have a \"close\" button which simply closes the div via jquery.hide(). when I then click the \"edit\" button for another record, the div does not get displayed at all.\n\nI use other shows and hide within my code for other elements and they work quite fine. Only this one I can't get working.\n\nIs there a specific usage of the show() and hide() methods in my case?\n\n$('.edit').live('click', function () {\n var theid = $(this).attr('id');\n $('#' + theid).empty().append($('.rec_edit').show());\n\n if ($('#txt_nowediting_id').val() > 0) {\n load_single_rec($('#txt_nowediting_id').val());\n };\n\n $('#txt_nowediting_id').val(theid);\n return false;\n});\n\n$('#btnCancelEdit').click(function () {\n $('.rec_edit').hide();\n load_single_rec($('#txt_nowediting_id').val());\n return false;\n});\n\n\nhere .rec_edit is the div that gets hidden and shown..."
] | [
"jquery"
] |
[
"How to send object to class parameter javascript?",
"I have a problem sending a parameter to the class. I want to do a class that supports error in AJAX. The working function looks like this:\n\nfunction GetLastChangePass(UserId) {\n var field =\n {\n id: UserId,\n }\n var fieldStringified = JSON.stringify(field)\n $.ajax({\n url: \"/Users/LastChangePass\",\n method: 'PUT',\n data: fieldStringified,\n contentType: 'application/json; charset=utf-8',\n success: (result) => {\n if (result.includes('12.12.2000')) {\n document.querySelector('#user-tslog').append('')\n } else if (result == 'Not_tslog') {\n document.querySelector('#user-tslog').append('')\n }\n else {\n document.querySelector('#user-tslog').append(result)\n }\n },\n error: (result) => {\n addNewMessage(\"error\", \"Error\")\n console.error(\"fail responseText: \" + result.responseText)\n console.error(\"fail contentstatusText : \" + result.statusText)\n console.error(\"fail status TEST: \" + result.status)\n }\n });\n}\n\n\nI made a class that looks like this:\n\nclass ErrorConsole {\n constructor(result) {\n this.result = result\n}\n\n error() {\n console.error(\"fail responseText: \" + this.result.responseText)\n console.error(\"fail contentstatusText : \" + this.result.statusText)\n console.error(\"fail status : \" + this.result.status)\n }\n}\n\n\nWhy is the parameter undefined after converting the function to what is below?\n\n error: (result) => {\n console.log(result) //===> there is object\n\n addNewMessage(\"error\", \"Error\");\n err.error(result) //===> there is indefined\n\n console.error(\"fail responseText: \" + result.responseText)\n console.error(\"fail contentstatusText : \" + result.statusText)\n console.error(\"fail status TEST: \" + result.status)\n }"
] | [
"javascript",
"ajax"
] |
[
"SQL query to determine that this is mssql DB and not other DB's",
"How to write a query to just determine that it is mssql ?\nand fail on other db's \n\nHow can i verify for example something like this :\n\nSELECT @@VERSION AS 'SQL_Server_Version' where 'SQL_Server_Version' like '%Microsft%'; \n\n\nThis donst work"
] | [
"sql-server"
] |
[
"ggplot2: Divide Legend into Two Columns, Each with Its Own Title",
"I have these factors\nrequire(ggplot2)\nnames(table(diamonds$cut))\n# [1] "Fair" "Good" "Very Good" "Premium" "Ideal" \n\nwhich I want to visually divide into two groups in the legend (indicating also the group name):\n"First group" -> "Fair", "Good"\n\nand\n"Second group" -> "Very Good", "Premium", "Ideal"\n\nStarting with this plot\nggplot(diamonds, aes(color, fill=cut)) + geom_bar() + \n guides(fill=guide_legend(ncol=2)) +\n theme(legend.position="bottom")\n\nI want to get\n\n(note that "Very Good" slipped in the second column/group)"
] | [
"r",
"ggplot2",
"legend"
] |
[
"Gulp disappearing everytime new modules installed",
"Gulp installed locally (picture 1, 2). Everything working fine. After installing new modules (picture 3) Gulp disappears (picture 4). Starting Gulp with \"npm run gulp\".\n\nScript from package.json:\n\n\"gulp\": \"./node_modules/.bin/gulp\"\n\n\nI have to reinstall Gulp everytime when I install more modules. Problem appears only with Gulp module.\n\nQuestions:\n\n\nWhy Gulp disappear everytime?\nIs there any solution for this problem?\n\n\n1. Installing Gulp.\n\n\n\n2. node_modules/.bin/gulp.\n\n\n\n3. Installing new module.\n\n\n\n4. Gulp disappears from node_modules/.bin/."
] | [
"node.js",
"npm",
"gulp"
] |
[
"How many blocks and nodes can i run on a local Hyperledger fabric network?",
"I am using Hyperledger explorer for checking the fabric blocks, transactions, Chaincodes and nodes.\n\nMy System configuration is :\nRAM: 12GB, \nProcessor: i5-7th gen\nMemory: 1TB"
] | [
"hyperledger-fabric",
"hyperledger"
] |
[
"What is the benefit of passing a callback to ob_start compared to just processing the result of ob_get_clean()?",
"I am wondering if there is any real benefit to using this...\n\nfunction getSomeContent() {\n ob_start(function($content) {\n // ... modify content ...\n return $content;\n }\n // ... output stuff ...\n return ob_get_clean();\n}\n\n\n...as opposed to this...\n\nfunction getSomeContent() {\n ob_start();\n // ... output stuff ...\n $result = ob_get_clean();\n // ... modify content ...\n return $result;\n}\n\n\n...?\n\nAssume the \"output stuff\" and \"modify content\" parts are the same in each case. The key point is that the \"modify content\" has changed its location, being in a callback in the first case, and being \"inline\" in the second case.\n\nIs there a performance benefit of one over the other? For example, does the second form make two copies of the buffer contents when the first uses only one? Or is it purely a coding style decision? Why would you choose one form over the other?\n\nI can see there are differences in scope access, because any variables in the enclosing scope will be available in the \"modify content\" part of the second example, where they would have to be \"passed in\" with a use clause in the first example. In fact this is exactly why I would normally choose the second form."
] | [
"php",
"performance",
"coding-style",
"output-buffering"
] |
[
"Wrong result in DetachedCriteria",
"I have some entities as below\n\n@Entity\npublic class Contact {\n @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = \"contact\")\n private Set<ContactDetails> details = new HashSet<>();\n}\n\n@Entity\npublic class ContactDetails {\n @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = false)\n private Contact contact;\n\n @ElementCollection(fetch = FetchType.EAGER)\n @CollectionTable(name = \"contact_details_values\", joinColumn = @JoinColumn(name = \"contact_detail_id\"))\n @Column(name = \"value\")\n private Set<String> values = new HashSet<String>();\n}\n\n\nand I have a method that selects range of Contacts with DetachedCriteria as below:\n\npublic List<Contact> getContactsByRange(int start, int length) {\n DetachedCriteria criteria = DetachedCriteria.forClass(Contact.class);\n criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);\n Criteria executableCriteria = criteria.getExecutableCriteria(currentSession);\n executableCriteria.setFirstResult(start);\n executableCriteria.setMaxResults(length);\n return executableCriteria.list();\n}\n\n\nThe problem is when I call method with 0 and 10 it will return all contacts in the database, but when I call it with 0 and 1 it will return first contact in database with its first detail value and if I call it with 1 and 1 it will return first contact in database with its second detail value."
] | [
"java",
"hibernate",
"detachedcriteria"
] |
[
"My callback is not being called",
"Here I'm trying to test my api but the callback function is not being called during the execution and return with no failures all the time.\n\nconst express = require('express')\nconst app = express();\nconst nconf = require('nconf');\nconst request = require('request');\nvar index = require('../index')\nvar querystring = require('querystring');\n\n\ndescribe(\"Auth\", function () {\nconsole.log(\"Auth\");\n\nvar form = {\n \"email\":\"[email protected]\",\n \"password\":\"123456\",\n \"name\":\"aleem\",\n \"mobile\":\"12345678903\",\n \"country\":\"india\",\n \"state\":\"telangana\",\n \"city\":\"hyderabad\"\n}\n\n\nvar formData = querystring.stringify(form);\n\n// Creating account with existing user data\nit (\"Returns statusText false\", function (done) {\n var url = 'http://http://localhost:5000/api/auth/signup/';\n var headers = {\n 'Content-Type' : 'application/x-www-form-urlencoded'\n };\n request.post({ url: url, form: formData, headers: headers }, function (e, r, body) {\n // callback body\n console.log(r.statusCode+'ka');\n expect(r.statusText).toBe('false');\n done() ;\n });\n});\n});\n\n\nDuring execution the callback function is not being called."
] | [
"javascript",
"node.js",
"jasmine-node"
] |
[
"How to deserialize dynamic field using Jackson?",
"I have the following Json:\n\n{\n \"id\": \"id1\",\n \"version\": \"id1\",\n \"license\": { \"type\": \"MIT\" }\n}\n\n\nWhich can also be in the form of:\n\n{\n \"id\": \"id1\",\n \"version\": \"id1\",\n \"license\": \"MIT\"\n}\n\n\nAnd sometimes it can be:\n\n{\n \"id\": \"id1\",\n \"version\": \"id1\",\n \"licenses\": [\n { \"type\": \"MIT\", \"url: \"path/to/mit\" },\n { \"type\": \"Apache2\", \"url: \"path/to/apache\" }]\n}\n\n\nAll of the above are essentially the same, I'm looking for a way to combine them with a single field and deserialize it using Jackson. Any Ideas?"
] | [
"java",
"json",
"jackson"
] |
[
"Scripted method to find and kill process using a specific dll",
"I need your help to make a script to be used to alleviate symptoms of an issue while we dig into it and find the cause.\n\nDescription of issue: We have a problem where a dll gets locked and this stops IIS from handling requests. There are a couple of dll's that could be the issue. We mapped them as exceptions for Windows Defender but still the issue occurs.\n\nWe can detect the issue by writing a script to periodically access the website which will stall if the issue is happening.\n\nThis is on Windows 2016 Server.\n\nRequirement: Clearly a long term fix is needed and we are working on this. Whilst we find that fix, we are seeking a way to find the process that is using a dll and kill that process. \n\nSysInternals ProcessExplorer can identify the process that is accessing a dll file (this is the binoculars feature). And once we know which process then we can also kill that process in ProcessExplorer. \n\nThe ideal solution would be a script that searches for processes using a specified dll name and then kills them. I guess we can use command line utilities of sysinternals but don't know where to start.\n\nNotes: Ideally we will fix the issue but it is ongoing so we want to alleviate the symptoms. Some of you are going to maybe suggest fixing the issue and if you have a solution then send it in. In the mean time here are some questions that may get asked... What causes the issue - if we knew that...! The issue seems to occur after the Windows Defender signature update runs. It 'feels' like when Windows Defender restarts to load the new threat signatures, the dll that is in memory is somehow seen as a threat. Could it be a bone fide threat - no because we scanned it manually and it comes up clean."
] | [
"windows",
"sysinternals"
] |
[
"Generate report of all the information in a Web Application",
"I am working on a Web Application that sells a Product to users. I would like to create a count of all the times a user buys a product or when the user clicks on a product and doesn't buy it. I want to generate daily, monthly and annual report of this data so that I could eventually analyze this data. How should i approach this problem?. Are there any tools or third party applications that i can use to generate these reports?"
] | [
"java",
"web"
] |
[
"MYSQL get multiple fields count using Group by multiple fields by date",
"I want count by using group two columns. I have data like this:\n\nid sectionid date\n\n1 1 2015-09-16\n2 1 2015-09-16\n3 2 2015-09-16\n4 2 2015-09-16\n5 3 2015-09-16\n6 1 2015-09-17\n7 2 2015-09-18\n8 2 2015-09-18\n\n\nResult will be:\n\n Date section1count section2count section3count\n\n 2015-09-16 2 2 1\n 2015-09-17 1 0 0\n 2015-09-18 0 2 0\n\n\nThanks in advance."
] | [
"mysql"
] |
[
"c++ convex hull in recursion method",
"I'm trying to debug the \"convex hull\" jarvis's algorithm. The \"convex hull\" problem is, given a collection P of n points in a plane, to find a subset CH(P) that forms the vertices of a convex polygon containing all the other points. \nwrite this function recursively but stick in a loop for ever and return segmentation fault\n\n int main()\n{\n vector<Point> hull(20);\n int n,x,y;\n cin >> n;\n vector<Point> ps;\n Point p;\n// Point p1,p2,q1,q2;\n\n while(cin >> x >> y)\n { \n p.x = x;\n p.y = y;\n ps.push_back(p);\n }\n int base = find_leftmost_point(ps, n);\n hull.push_back(ps[base]);\n vector<Point> po = convexHull(ps, base, hull);\n cout << perimeter(po) << endl;\n return 0;\n}\n\nvector<Point> convexHull(vector<Point> points, int base, vector<Point> &hull)\n{\n\n int p, q;\n\n p = base; \n q = (p+1) % points.size();\n if (points.size() <= 3) \n {\n\n return hull;\n }\n if(q == base)\n {\n return hull;\n }\n else\n { \n for (int i = 0; i < points.size(); i++)\n { \n if (orientation(points[p], points[i], points[q]) == 2)\n {\n q = i;\n }\n\n }\n cout<<points[q].x<<points[q].y<<endl;\n hull.push_back(points[q]);\n return convexHull(points, q, hull);\n }\n}\n\ndouble perimeter(vector<Point> P)\n{\n double r = 0;\n for(int i = 1;i < P.size(); i++)\n r += sqrt(pow(P[i].x - P[i-1].x, 2) + pow(P[i].y - P[i-1].y, 2));\n return r;\n}\nint orientation(Point p, Point q, Point r)\n{\n int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\n if (val == 0) \n return 0;\n return (val > 0) ? 1 : 2;\n}\n\nint find_leftmost_point(vector<Point> points, int n)\n{\n int l = 0;\n for (int i = 1; i < n; i++)\n if (points[i].x < points[l].x)\n l = i;\n return l;\n\n}"
] | [
"c++",
"recursion",
"vector",
"convex-hull"
] |
[
"Combine two Linq lambda expressions",
"Expression<Func<MyObject, string>> fn1 = x => x.PossibleSubPath.MyStringProperty;\n\nExpression<Func<string, bool>> fn2 = x => x.Contains(\"some literal\");\n\n\nIs there a way to create a new lambda expression which basically uses the output of fn1 and uses it as input for fn2?\n\nExpression<Func<MyObject, bool>> fnCombined = ...\n\n\nI know that I can create the function at once, but the problem is that I'm making some generic code and therefore really need to be able to create these two functions separately, then combine them in such a way that Linq can use them on my database objects (Entity Framework)."
] | [
"c#",
"linq",
"expression"
] |
[
"is there a method to check if a QJsonObject object contains specific attribute?",
"there is a QJsonObject\n\n {\n \"a\":\"...\",\n \"b\":\"...\",\n \"c\":\"...\"\n }\n\n\nis there a method to check if this object contains \"a\"?"
] | [
"c++",
"json",
"qt",
"qtcore",
"qjsonobject"
] |
[
"get request have no responses in expressjs",
"Im trying to get a response from a simple route to check if a client exist in my database... is really simple but when the GET request is fired, it's not resolved and never show any response.\n\nThis is the code for the route: \n\nrouter.get('/clientes/:client_id', function (req, res) {\n Cliente.find({ _id: req.params.client_id }, function(err, cliente) {\n if(!cliente) {\n res.status(404).json({ statusMsg: 'El cliente no existe' });\n } else if(err) {\n res.json({ error: err });\n } else {\n res.status(200).json({ cliente: cliente, statusMsg: 'Ok' });\n }\n });\n}); // end: router.get clientes\n\n\nPretty simple, but when i run curl http://localhost:8080/omi/v1/clientes/2345 (the id is arbitrary, is just one test to get a 404 response) for a simple get request, i get this in my server logger (morgan): GET /omi/v1/clientes/10 - - ms - -, Because i need to cancel the job.\n\nSo i read one, two, three times the code, searched on google and don't get the problem. Anyway my english is not really good too, so maybe i dont make a complete search."
] | [
"node.js",
"get",
"mongoose",
"request"
] |
[
"What Datatype is created?",
"What data type does \"two_days_in_a_row\" create in Python? Does it create a list or a tuple, or any other datatype\n\nIn my Advanced Data Science with Python on Coursera Course 1, Week 4, Distributions lecture, prof said that two_days_in_a_row = 0 will create a list. I am still figuring why will be the case, why a list will be created. Help me know the answer. Thanks in advance!!! \n\ntwo_days_in_a_row = 0 \n#creates a list"
] | [
"python",
"python-3.x"
] |
[
"Multiple simultanous animations, simulation of 'animate' easing and one 'step' call for a jQuery collection",
"Here is the problem, I've got a tree structure of html blocks, global container is of a fixed width(X) and height(Y). When i click one of the blocks on a level, all other blocks shrink to some size, while the clicked one gets enlarged to the leftover space, and the sublevels show up on it's place.\n\nFor all the shrinking i'm using default animate function with easing effect, when shrinking 1 level, to avoid enlargement bugs i have to do something like this:\n\n$tabs.not($obj).animate({height:32<<$obj.getVerUp().length+\"px\"},{duration:300,\n step:function() {\n $obj.height(function(){\n var sum = 0;\n $tabs.not($obj).each(function(){\n sum += $(this).height();\n });\n return $obj.getCont().height()-sum+\"px\";\n });\n }\n});\n\n\n$tabs are all the tabs of current level, $obj - is the one tab that i want to enlarge\n\nThe main problem is:\nWhen i open up a tab that is on a deep level, i have to animate all the tabs of higher levels to shrink a little bit more, thus the $obj X and Y would change, so the current animation has to use new values, but if i call 3 different animations on different levels i'm bound to get a bug, when one of the animations on a deeper level finishes 1 step earlier, while the one on the level above, would enlarge the object by 5-10 more pixels and that space wouldn't be used up.\n\nThe second problem is that there has to be about 50 object animating with easing at the same time, which is a little bit overkill.\n\nAnd the last problem is when i call step callback on animation as shown above, i have a strange feeling that it calls the step separately for each animation of the $tabs collection, while i need 1 step for all the tabs in the list (to avoid unnecessary scripts)\n\nThere might be some other way to fix all that, but i have yet to discover all jQuery functions, so from what i see the only way is to simulate easing, and do everything in one single animation.\n\nI don't really want to use setInterval and determining when do i need to clear it plus calculating each of the easing values, if there is a simple way doing it.\n\nDoes jQuery has some sort of empty animation easing, e.g. \n\n$().css(\"height\":starth+\"px\").animate({height:endh},{duration:300,\n step:function(fn) {\n\n // all the animation actions here via fn end value\n }\n});\n\n\nThanks in advance.\n\n\n\nWhat I need - is not a completely working solution in code, just some enlightenment in those subjects:\n\n\nIs there a legal way to call one step function for a collection of animated elements, or, maybe, it does call step once when I use one .animate on collection.\nI'd be really appreciated if someone would shed some light over how does jquery handle multiple .animate, would they be used in one global function that works on .setInterval? or would they be having massive number of those .setIntervals that are equivalent to setTimeout (which most browsers can't handle in large amounts);\nIs there a way to simulate 'animate' easing, some function name maybe, or a special trick to achieve that (the only thing I see is a hidden element or 'window' property to change maybe)\n\n\nOr some directed pushes with functions I should study, that could help me achieve my goals"
] | [
"javascript",
"jquery"
] |
[
"Parsing IBM server error message in Java",
"I have an error message that I need to parse. \n\nDSNL027I AGENTNAME SERVER DISTRIBUTED AGENT WITH\n LUWID=XX00000.X000.XX0000000X00=00000\n THREAD-INFO=XXXX00:255.255.255.255:XXXX00:application_name:*:*:*:*\n RECEIVED ABEND=00X\n FOR REASON=00000000\n\n\nThere are thousands of these messages that I need to parse. They all follow a similar pattern like the one below.\n\nDSNL027I agent-type DISTRIBUTED AGENT WITH \n LUWID luw-id=token \n THREAD-INFO thread-information \n RECEIVED ABEND=abend-code \n FOR REASON=reason-code\n\n\nAdditionally, these patterns are all available on the IBM documentation site.\n\nhttp://www-01.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.msgs/src/msgs/db2z_msgs.dita\n\nI need to capture all of the fields in this message and create an XML object, an example from the given error message is below.\n\n <agent-type>AGENTNAME</agent-type>\n <luwid>XX00000.X000.XX0000000X00</luwid>\n <token>00000</token>\n <thread-information>XXXX00:255.255.255.255:XXXX00:application_name:*:*:*:*</thread-information>\n <abend-code>00X</abend-code>\n <reason-code>00000000</reason-code>\n\n\nUsing regular expressions to match the messages is easy and makes sense. \n\nIs there a simple programmatic method that can take a pattern (lowercase characters) and pull out the corresponding values in the actual message?"
] | [
"java",
"regex"
] |
[
"How do I include an SDK routine in VB6?",
"I am modifying some old VB6 code and there are a number of calls to a subroutine called SDKPress(Index as integer, PressStatus as Integer, PressX as double, PressY as double, PressDataX as double, PressDataY as double).\n(This routine returns the position of the mouse click and Index returns which graph on a form the mouse is in.)\nSince there is no code for this in the project, I assume it is from some Windows software development kit. However, there is no trace of it on the development PC. just an SDK directory in the VisualBasic directory containing winsdk_web.exe.\nI cannot call that subroutine from another project. Where does the subroutine live? Where can I find documentation on it? How can I get it in a form where I can use it on another project?"
] | [
"windows",
"sdk",
"vb6",
"windows-xp"
] |
[
"How do I set alerts based on events in my Dataflow pipelines?",
"I'd like to be able to take events like errors in my logs and set threshold-based alerts to notify me when anomalous behavior occurs."
] | [
"google-cloud-dataflow"
] |
[
"gPRC how to send array data from the server to the client [gPRC + Node.js]",
"I m trying to send an array data object from the server.js to the client.js but I get undefined.\n\nWhat is the correct way to send this data types\n\n- string\n- number\n- Object\n- array\n\n\nI m trying to send a simple array data from the master to the client. I dont want to even imagine to send a more complex data like Object\n\nCan someone show me, a simple working example where I can send from the server.js this data\n\n[\n { id: '1', title: 'Note 1', content: 'Content 1'},\n { id: '2', title: 'Note 2', content: 'Content 2'},\n { id: '3', title: 'Note 3', content: 'Content 3'}\n]\n\n\nand on the client, I want to see this response if I run \n\n\n node .\\client.js\n\n\n[\n { id: '1', title: 'Note 1', content: 'Content 1'},\n { id: '2', title: 'Note 2', content: 'Content 2'},\n { id: '3', title: 'Note 3', content: 'Content 3'}\n]\n\n\nnotes.proto\n\nsyntax = \"proto3\";\n\npackage notes;\n\nservice NoteService {\n rpc GetNoteList (Empty) returns (NoteList) {} <--- this not workig\n rpc GetNoteItem (Empty) returns (Note) {} <--- this works\n}\nmessage Empty {}\n\nmessage Note {\n string id = 1;\n string title = 2;\n string content = 3;\n}\n\nmessage NoteList {\n repeated Note notes = 1;\n}\n\n\nserver.js\n\nconst grpc = require('grpc');\nconst protoLoader = require('@grpc/proto-loader');\n\nconst PROTO_PATH = __dirname + '/../../protos/notes.proto';\n// const notesProto = grpc.load('notes.proto')\n\nconst packageDefinition = protoLoader.loadSync(\n PROTO_PATH,\n { \n keepCase: true,\n longs: String,\n enums: String,\n defaults: true,\n oneofs: true\n }\n);\n\nconst notesProto = grpc.loadPackageDefinition(packageDefinition).notes;\n\n\n\n// returns a list of notes.\nconst getNoteList = (call, callback) => {\n // mock data\n const notes = [\n { id: '1', title: 'Note 1', content: 'Content 1'},\n { id: '2', title: 'Note 2', content: 'Content 2'},\n { id: '3', title: 'Note 3', content: 'Content 3'},\n ];\n callback(null, { message: notes });\n}\n\n\nfunction getNoteItem(call, callback) {\n const data = { id: '1', title: 'Note 1', content: 'Content 1'};\n return callback(null, data)\n}\n\n/**\n * Starts an RPC server that receives requests for the Greeter service at the\n * sample server port\n */\nfunction main() {\n var server = new grpc.Server();\n server.addService(notesProto.NoteService.service, {\n GetNoteList: getNoteList,\n GetNoteItem: getNoteItem\n });\n server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());\n console.log('Server running at http://127.0.0.1:50051')\n server.start();\n}\n\nmain();\n\n\nclient.js\n\n// var PROTO_PATH = __dirname + '/../../protos/model.proto';\nvar PROTO_PATH = __dirname + '/../../protos/notes.proto';\n\n\nvar grpc = require('grpc');\nvar protoLoader = require('@grpc/proto-loader');\nvar packageDefinition = protoLoader.loadSync(\n PROTO_PATH,\n {\n keepCase: true,\n longs: String,\n enums: String,\n defaults: true,\n oneofs: true\n }\n);\nconst notesProto = grpc.loadPackageDefinition(packageDefinition).notes;\n\nfunction main() {\n const client = new notesProto.NoteService('localhost:50051', grpc.credentials.createInsecure());\n var user;\n\n if (process.argv.length >= 3) {\n user = process.argv[2];\n } else {\n user = 'world';\n }\n\n // console.log({user : user});\n\n // expected to return array of objects\n client.getNoteList('test', (err, res) => {\n if (!err) {\n console.log('list1: ', res);\n console.log('list2: ', res.message);\n } else {\n console.error(err);\n }\n });\n\n\n // get a single item\n client.getNoteItem('test', (err, res) => {\n if (!err) {\n console.log('getNoteItem res: ', res);\n } else {\n console.error(err);\n }\n });\n\n\n}\n\nmain();\n\n\noutput\n\nPS C:\\dev\\george\\tests\\GRPC\\grpc-test\\server\\node> node .\\client.js\ngetNoteItem res: { id: '1', title: 'Note 1', content: 'Content 1' }\nlist1: { notes: [] }\nlist2: undefined"
] | [
"grpc",
"grpc-node"
] |
[
"How can I find last row in multiple group by WITHOUT window functions over?",
"I have a query that returns a result fairly quickly:\n\nSELECT [Date],[AccountCode],[ModelCode],[Generic],SUM([MTMusd]) AS 'MTMusd'\nFROM [dbo].[MTM]\nWHERE [AccountCode] = 'XXX'\nAND [ModelCode] = '1'\nGROUP BY [Date],[AccountCode],[ModelCode],[Generic]\nORDER BY [Date]\n\n\nCREATE TABLE [dbo].[MTM](\n [AccountCode] [nvarchar](50) NULL,\n [ModelCode] [nvarchar](50) NULL,\n [Date] [date] NULL,\n [TIMESTAMP] [time](7) NOT NULL,\n [Generic] [nvarchar](50) NULL,\n [MTMUsd] [float] NOT NULL\n) ON [PRIMARY]\n\n\nHowever, I don't want SUM() I want LAST(). \n\nIn the GROUP BY I have missed out [TIMESTAMP] which is the time of day. I want my query to return the record with the LAST TIMESTAMP for each GROUP { [Date],[AccountCode],[ModelCode],[Generic] }\n\nHow can I achieve this efficiently? I have approx 5 millions rows.\n\nI tried ROW_NUMBER() OVER () based example I found, but processing took an order of minutes."
] | [
"sql-server",
"group-by",
"aggregate-functions",
"row-number"
] |
[
"Recall window load event - javascript",
"I am going to do my best here to distinctly explain what my issue is without the use of jsfiddle because $(window).on(\"load\") does not fire within their IDE.\n\nI have a html 'wrapper' which dynamically loads (ajax) html into div.content. \n\n<body>\n<div class=\"header\"></div>\n<div class=\"overlay\"></div>\n\n\n<div class=\"loader hidden\" align=\"center\">\n <img src=\"images/loading.gif\" />\n</div>\n\n<!-- Container for the content -->\n<div class=\"content\">\n <!-- dynamic content appears here -->\n</div>\n\n\n\n<div class=\"footer\"></div>\n</body>\n\n\nAt the start of a new piece of content being loaded, I toggle the visibility between the loading gif and the content div.\n\n$(\".content\").toggleClass(\"hidden\", true);\n$(\".loader\").toggleClass(\"hidden\", false);\n\n\nAt the end of the loading /ajax process I have the following code:\n\n$(\".content\").load(\"screens/\"+this.currentScreen+\"/\"+this.currentScreen + \".html .screen\", function( response, status, xhr ) \n{\n //other code \n //\n //\n $(window).on(\"load\", function() {\n $(\".content\").toggleClass(\"hidden\", false);\n $(\".loader\").toggleClass(\"hidden\", true);\n });\n });\n\n\nI chose $(window).on(\"load\") because I only want div.content to be visible again once all the images have finished loading, as opposed to $(document).ready().\n\nFor the first piece of content to be loaded, this works perfectly. However for the second piece of content, the $(window).on(\"load\") event never fires.\n\nI have a hunch that this event is not allowed to be invoked a second time, or maybe it is unbound after being called?\n\nI tried triggering / invoking the method but to no avail.\n\nif((window.onload) === null)\n{\n $(window).on(\"load\", function() {\n console.log(\"$(window).on('load') called\");\n $(\".content\").toggleClass(\"hidden\", false);\n $(\".loader\").toggleClass(\"hidden\", true);\n });\n}\nelse\n{\n $(window).trigger(\"load\");\n}\n\n\nAlso, I assure everyone that it isn't the content being loaded, because if I replace $(window).on(\"load\") with $(document).ready() it works fine. I just desperately want to wait for the new images to have loaded.\n\nHow can I achieve this?"
] | [
"javascript",
"jquery",
"html",
"ajax"
] |
[
"Postgres query dramatically slow on prod, but very fast on local laptop",
"I have this query http://pastebin.com/R1iLL5tn when it is run on my prod server, it takes more than a whopping 160000 ms! But when I back up the database and restore in my laptop, the same query takes just 300 ms.\n\nExplain in local laptop: https://explain.depesz.com/s/2NmY\nExplain in prod server: https://explain.depesz.com/s/hMk8\n\nAll significant settings like work_mem, cpu_tuple_cost, effective_cache_size are the same default settings in both environments..\n\nI have tried to vacuum analyze on my prod, but it doesn't help much.\n\nAny pointers?"
] | [
"performance",
"postgresql",
"explain"
] |
[
"How to write data in specified format into a binary file with Perl?",
"this might be quite a newbie question, but i need to process a certain text file and dump its content into a binary file and i do not know how - i decided to use perl, but my perl skills are quite low. I probably should have written this in C++, but this seem like a nice and easy task for perl, so why not learn something new? ;) The text file has thousands of lines in this format:\n\n2A02FC42 4\n\nYou can look at it as a hexadecimal number (the length is ALWAYS 8) and a regular number. Now i need to dump all the lines into a binary file in this format (it should look like this when viewed with a hex editor):\n\n42FC022A00000004\n\nMore examples so it is clear:\n\n70726F67 36 -> 676F727000000024 \n6A656374 471 -> 7463656A000001D7 \n\nThe part of parsing the input file is easy, but i'm stuck on the second part, where i should write this into a binary file. I have no idea how to format the data in this way or even how to output things in binary mode. Can someone help me out here?\n\nThanks.\n\nEDIT: updated the examples, forgot about endiannes - im on a LE system."
] | [
"perl",
"file-io",
"binary",
"hex"
] |
[
"Image Gallery w/ Light Box - Image Links Not Swapping with others correctly",
"I'm trying to create an Ecommerce Item gallery. I'd like it to be able to show the image that's selected to appear within the lightbox. Everything is working fine, except when the user selects the second thumbnail it does not show in the lightbox. The lightbox only shows the first images href. It seems that the 'href' is not swapping correctly after you select another thumbnail. This is also happening with the caption being passed through the \"alt\" attribute. \n\nHere is my code.\n\n $(function() {\n $(\".image\").click(function() {\n var image = $(this).attr(\"rel\");\n $('#image img').fadeOut(\"slow\", function(){\n $('#image a').html('<img src=\"' + image + '\"/>');\n $('#image a').fadeIn('slow');\n });\n return false;\n });\n});\n\nvar $overlay = $('<div id=\"overlay\"></div>'); //Stores Jquery Handler within a Variable.\nvar $image = $(\"<img>\"); \nvar $caption = $(\"<p></p>\");\n\n// Add Image to overlay\n$overlay.append($image);\n// Add Caption\n$overlay.append($caption);\n// Add overlay\n $(\"body\").append($overlay); \n\n\n// Capture the click event on a link to an image.\n$(\"#image a\").click(function(event){\n event.preventDefault(); //Prevents the browser from loading the link in a new page!\n var imageLocation = $(this).attr(\"href\");\n // Update overlay with the image linked in the link.\n $image.attr(\"src\", imageLocation);\n\n // Show the overlay. \n //console.log(href);\n $overlay.show();\n\n\n // Get Childs Alt attribute and set caption. (Childs Image Alt Attribute)\n var captionText = $(this).children(\"img\").attr(\"alt\"); \n $caption.text(captionText);\n});\n\n//3. When overlay is clicked\n\n$overlay.click(function(){\n//3.1 Hide the overlay \n$overlay.hide();\n\n\n});\n\n\nHere is a Demo"
] | [
"javascript",
"jquery",
"html",
"css",
"image"
] |
[
"I restored my WordPress website but now when I login as admin I don't get my admin panel. Any solutions?",
"I just restored my WordPress website, but somehow I am not able to get into admin panel even after using correct credentials.\nIt shows me as logged in, but do not allow me to go into admin panel. Neither it shows me options on the top of the website.\n\nHere is the screenshot\nhttps://gyazo.com/0497b96e2aa8d1b857569091d4850e6a\n\nAny solutions will be greatly appreciated."
] | [
"wordpress",
"custom-wordpress-pages"
] |
[
"winforms listbox and search users input",
"Inside windows form there are textbox 'txtSearch' and button 'btnOk'. \n\nBelow is listbox which is populated with articles from database.\nI have following code which takes user input and based on that string put selection on matched row inside listbox. Problem is that it matches only exact string using FindStringExact method.\n\nHow to implement to match part of name article not whole name listed?\n\nint index = listBoxArticles.FindStringExact(txtSearch.Text) + 0; \n string str = Convert.ToString(txtSearch.Text);\n listBoxArticles.SelectedIndex = index;"
] | [
".net",
"winforms"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.