texts
sequence
tags
sequence
[ "Animations in AngularJS 1.2 - How To", "I tried to use animations within my app but unfortunately to no avail. I checked lots of examples, blog, downloaded animate.css etc etc. \n\nI injected animation module, tried basic examples, tried following tutorials for instance, but it seems I miss something every time.\n\nCan someone please provide exact instructions for AngularJS v1.2 animations to work, with injections, inclusions and everything you need to do to get them working? Maybe a step-by-step instructions on how you usually do your animations.\n\nA basic fadein/fadeout example on ng-show/hide would suffice.\n\nThank you very much" ]
[ "javascript", "css", "angularjs", "animation" ]
[ "Find the same numbers from two array", "Hello to everyone please help me get the same numbers from two array with function.\n\nfunction getIntersect(arrF, arrS){\n\n\n var arrF = [ 3, 5, 8];\n var arrS = [1, 2, 3, 5, 8];\n var nums = [];\n\n for ( var i = 0; i < arrF.length; i++ ){\n for ( var j = 0; j < arrS.length; j++ ){\n if ( i == j ){\n nums.push(i);\n nums.push(j);\n return nums;\n }\n }\n }\n}\n\ndocument.write(getIntersect());" ]
[ "javascript" ]
[ "Image to PDF in Android using iTEXTG", "I am making a module that needs to scan from an image taken by the camera. so basically, it converts jpeg into a PDF. \n\nI am done accessing the camera and retrieving the bitmap too. my problem is how to get the URI and pass it to the class that converts it to the pdf. It does not give any errors in android monitor so i don't know what i'm doing wrong.\n\nbelow is my code:\n\n public void selectImages() {\n Intent intent = new Intent(\"android.media.action.IMAGE_CAPTURE\");\n startActivityForResult(intent, CAMERA_REQUEST);\n}\n\n@Override\npublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n super.onActivityResult(requestCode, resultCode, data);\n if (requestCode == INTENT_REQUEST_GET_IMAGES && resultCode == Activity.RESULT_OK)\n {\n photo = (Bitmap) data.getExtras().get(\"data\");\n uri = data.getData();\n\n if(uri.equals(\"\"))\n {\n Toast.makeText(AddUtility.this, \"empty\", Toast.LENGTH_SHORT).show();\n } else {\n CreatePDF();\n }\n }\n}\n\npublic void CreatePDF()\n{\n Document document = new Document(PageSize.A4, 38, 38, 50, 38);\n try{\n PdfWriter.getInstance(document,new FileOutputStream(\"Sample.pdf\"));\n document.open();\n Image image = Image.getInstance (uri.getPath());\n document.add(new Paragraph(\"Heading\"));\n document.add(image);\n document.close();\n } catch (Exception e)\n {\n e.printStackTrace();\n Toast.makeText(AddUtility.this, e.toString(), Toast.LENGTH_SHORT).show();\n }\n}" ]
[ "android", "pdf", "itextg" ]
[ "VBA Command Button array", "I'm currently working on a project where I'll be selecting up to 5 items to compare to each other, with the results being displayed in up to a 5x5 dynamic grid. My objective is to have this grid be composed of command buttons such that the caption of each button is the percent similarity between the row and column items, and on clicking the button, the units that are common between the row and column items will be displayed in a message box. \n\nI more or less know how to generate the actual array of buttons. However, everything I've read suggests that I need to create a class to handle the button clicks, since I don't feel like making 20 subroutines that all have the same code in them. I have not been able to get this class to work properly, and I could use some tips. Here's what I have so far. \n\nIn a class module named DynButton:\n\nPublic Withevents CBevents as MSForms.CommandButton\nPrivate Sub CBevents_Click()\n DisplayOverlappedUnits 'Sub that will display the units that are the same\n 'between items i and j- may use Application.Caller\nEnd Sub\n\n\nAnd in the userform itself:\n\n Private Sub Userform_Initialize()\n Dim NumItems as integer\n Dim ComparisonArray() as DynButton\n Dim ctlButton as MSForms.CommandButton\n 'QuestionList() is a public type that stores various attributes of the \n 'items I'm comparing.\n\n 'This code determines how many items were selected for comparison\n 'and resets the item array accordingly.\n NumItems=0\n For i=1 to 5 \n If QuestionList(i).Length>0 Then\n NumItems=Numitems+1\n QuestionList(NumItems)=QuestionList(i)\n End If\n Next\n\nRedim ComparisonArray(1 to NumItems, 1 to NumItems)\nFor i = 1 to NumItems\n For j=1 to NumItems\n Set ctlButton=Me.Controls.Add(\"Forms.CommandButton.1\", Cstr(i) & Cstr(j) & cb)\n With ctlButton\n .Height= CB_HEIGHT 'These are public constants defined elsewhere.\n .Width= CB_WIDTH\n .Top= TOP_OFFSET + (i * (CB_HEIGHT+ V_PADDING))\n If i = j Then .visible = False\n .Caption= CalculateOverlap(i,j) 'Runs a sub that calculates the overlap between items i and j\n End With\n Set ComparisonArray(i,j).CBevents = ctlButton\n Next\n Next\nEnd Sub\n\n\nCurrently, I get a \"Object with or Block variable not set\" when I hit the Set ComparisonArray line, and I'm stymied. Am I just missing something in the class module? Thanks in advance for the help. \n\nEdited to add: I tried to model the class code in part off of this article, but again I haven't got it to work yet. http://www.siddharthrout.com/index.php/2018/01/15/vba-control-arrays/" ]
[ "vba", "class", "dynamic", "control-array" ]
[ "Extracting only black text from a pdf", "I have a bunch of pdf files containing song lyrics (in black font) and chords (in blue font) right in between the letters. \n\nIs it possible to extract only the text in black font and omit all the text in other colors?" ]
[ "pdf", "ghostscript", "text-extraction" ]
[ "take string with multiple elements as an input and converting to vector c++", "I am trying to build a simple reference generator and am requiring the user to enter author names, which then become attributed to an object. However, I have tried dynamically allocating a string, and feeding to the function which sets the object's authors, but keep receiving these error messages:\n\n\nno viable conversion from 'vector<std::__1::string>' (aka\n 'vector<basic_string<char, char_traits<char>, allocator<char> > >') to 'const\n\n\nMain code:\n\nint authors;\nint aYear;\nstring aName = \"?\";\nstring aDate = \"?\";\nstring Org = \"?\";\nstring www = \"?\";\nHarvard *refer;\n\nrefer = new Harvard();\n\ncout << \"Please enter as many details as you know. Type '0' if data is unknown.\" << endl;\ncout << \"Number of authors: \" << endl;\ncin >> authors;\n\nif (authors != 0)\n{\n string ss[authors];\n vector<char> writers = {};\n\n cout << \"Enter the author names, pressing return when finished: \" << endl;\n for(int a = 0; a < authors; a++)\n {\n getline(cin.ss[s]);\n writers.push_back(ss[a]);\n }\n refer->setAuthor(authors,&writers);\n}\n\n\nFunction code:\n\n// sets the authors of the source\nvoid Harvard::setAuthor(int num, vector<char>* writers)\n{\n for(int i = 0; i < writers->size(); i++)\n {\n authors.push_back(writers[i]);\n }\n return;\n}\n\n\nIs there any way I can take the authors first name and last name, and separate them inside the vector?" ]
[ "c++" ]
[ "Cassandra integration with hadoop for read performance", "I am using Apache Cassandra for storing around 100 million records. There is one single node with the following specifications-\n\nRAM-32GB, HDD-2TB, Intel quad core processor.\n\n\nWith cassandra there is a read performance problem. For some queries it takes around 40mins for giving the output. After searching for how to improve the read performance i came to know about the following factors-\n\nCompaction strategy,compression techniques, key cache, increase the heap space, turning off the swap space for cassandra.\n\n\nAfter doing these optimizations, the performance remains the same. After seraching, I came around for integrating Hadoop with cassandra.Is it the correct way to do the queries in cassandra or any other factors I am missing here??\nThanks." ]
[ "hadoop", "cassandra" ]
[ "How to create tabs within pagination like the cricbuzz site?", "I am trying to create a page for cricket Rankings for Test, ODI and t20 like cricbuzz in ASP.Net MVC. I need to create pagination and tabs combined such that the first one must consist of Test, ODI and t20 whereas the second must consist of Batsmen, Bowlers and Team Rankings and I have to link the tabs and pagination accordingly.\n\n\n\nThe code is\n\n <h2><b><i>Ranking</i></b></h2>\n<br>\n\n<div>\n <ul class=\"nav nav-tabs\">\n <li class=\"active\"><a data-toggle=\"tab\" href=\"#teams\">Teams</a></li>\n <li><a data-toggle=\"tab\" href=\"#batsmen\">Batsmen</a></li>\n <li><a data-toggle=\"tab\" href=\"#bowlers\">Bowlers</a></li>\n <li><a data-toggle=\"tab\" href=\"#allrounders\">All rounders</a></li>\n </ul>\n</div>\n\n<ul id=\"paginationId\" class=\"pagination\">\n <li class=\"active\"><a data-toggle=\"tab\" href=\"#test\">Test</a></li>\n <li><a data-toggle=\"tab\" href=\"#odi\">ODI</a></li>\n <li><a data-toggle=\"tab\" href=\"#t20\">T20</a></li>\n</ul>\n\n<div class=\"tab-content\">\n <div id=\"test\" class=\"tab-pane fade in active\">@Html.Action(\"TeamTestRanking\")</div>\n <div id=\"odi\" class=\"tab-pane fade in\">@Html.Action(\"TeamODIRanking\")</div>\n <div id=\"t20\" class=\"tab-pane fade in\">@Html.Action(\"Teamt20Ranking\")</div>\n</div>" ]
[ "javascript", "html", "css", "asp.net" ]
[ "Request Deferrer with Service Worker in PWA", "I am making a PWA where users can answer the forms. I want it to make also offline, so when a user fills out a form and does not have the internet connection, the reply will be uploaded when he is back online. For this, I want to catch the requests and send them when online. I wanted to base it on the following tutorial:\n\nhttps://serviceworke.rs/request-deferrer_service-worker_doc.html\n\nI have managed to implement the localStorage and ServiceWorker, but it seems the post messages are not caught correctly.\n\nHere is the core function:\n\nfunction tryOrFallback(fakeResponse) {\n // Return a handler that...\n return function(req, res) {\n // If offline, enqueue and answer with the fake response.\n\n if (!navigator.onLine) {\n console.log('No network availability, enqueuing');\n return;\n // return enqueue(req).then(function() {\n // // As the fake response will be reused but Response objects\n // // are one use only, we need to clone it each time we use it.\n // return fakeResponse.clone();\n // });\n }\n console.log(\"LET'S FLUSH\");\n // If online, flush the queue and answer from network.\n console.log('Network available! Flushing queue.');\n return flushQueue().then(function() {\n return fetch(req);\n });\n };\n}\n\n\nI use it with:\n\nworker.post(\"mypath/add\", tryOrFallback(new Response(null, {\n status: 212,\n body: JSON.stringify({\n message: \"HELLO\"\n }),\n})));\n\n\nThe path is correct. It detects when the actual post event happens. However, I can't access the actual request (the one displayed in try or fallback \"req\" is basically empty) and the response, when displayed, has the custom status, but does not contain the message (the body is empty). So somehow I can detect when the POST is happening, but I can't get the actual message. \n\nHow to fix it?\n\nThank you in advance,\n\nGrzegorz" ]
[ "reactjs", "caching", "service-worker", "progressive-web-apps" ]
[ "jQuery: How to check a DOM element has inline style", "I want to remove unwanted nesting.\n\nHow can I select from DOM, elements with this form:\n\n<div style=\"display: block;\">\n..\n</div>\n\n\nIt seems like a tight filtering like:\n\nvar unwanted_nest = $('.webform-client-form').find('div:not([id])').filter('div:not([class])');\n\n\nwill only display forms like: .." ]
[ "jquery", "dom" ]
[ "How to \"Hlookup an array\" with a formula", "I'm trying to perform a sumproduct function on two arrays. I'd like to find a way of asking excel to select the first array if the column match a certain value.\n\nIn my simplified case if the value is \"1\" pick the first array and perform sumproduct with the array below A ...something that prevent me from spending the day nesting if (obviously a formula like =SUMPRODUCT(IF(O4=1;F4:F8;IF(O4=2;G4:G8;IF(O4=3;H4:H8;IF(O4=4;I4:I8))));L4:L8) works but in my real case is no use)" ]
[ "arrays", "excel", "excel-formula" ]
[ "PHP fopen incoming email .txt attachment", "What I'd like to do is send an email or text from a phone to an email address that forwards/pipes the email to a PHP script. The to, from, subject and body of the message is parsed and is compared to an SQL database where the body of the email is compared to previous entries and addition information is sent back to the original sender.\nThe code starts like this...\n\n#!/usr/bin/php -q\n<?php \n//Listen to incoming e-mails\n$sock = fopen (\"php://stdin\", 'r');\n\n$email = '';\n//Read e-mail into buffer\nwhile (!feof($sock))\n{\n $email .= fread($sock, 1024);\n}\n\n//Close socket\nfclose($sock);\n\n\nThis script works fine for regular email to email correspondence. However when a text message is executed the content/body of the email is within a .txt attachment. I have no clue what to put for the filename in order to open the .txt file using the fopen command. The .txt attachment is always \"slide1.txt\" I've tried fopen(\"slide1.txt\", \"r\"); fopen(\"/slide1.txt\", \"r\"); fopen(\"php://stdin/slide1.txt\", 'r'); and a few others with no luck. Nothing is returned.\n\nAny ideas?" ]
[ "php", "email", "fopen", "email-attachments", "incoming-mail" ]
[ "Twitter Bootstrap 2 drop down menu is not work", "Good day!\nI'm trying to implement drop down menu from examples on my site. But it is not work (drop down menu is not showing at all). I included all necessary js and css files, markup is the same as in the docs.\n\nCan you see what I'm doing wrong?\n\n<link type=\"text/css\" href=\"{{ STATIC_URL }}css/bootstrap.css\" rel=\"stylesheet\">\n\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/jquery-1.7.1.min.js\"></script>\n\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/bootstrap.js\"></script>\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/bootstrap-dropdown.js\"></script>\n\n...\n\n<body>\n<div class=\"navbar .navbar-fixed-top\">\n <div class=\"navbar-inner\">\n <div class=\"container\">\n <a class=\"brand\" href=\"/\">\n Brand\n </a>\n\n <ul class=\"nav\">\n <li class=\"dropdown\">\n <a href=\"#fat-menu\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n Аккаунт\n <b class=\"caret\"></b>\n </a>\n <ul class=\"dropdown-menu\" id=\"fat-menu\">\n <li><a>SubLink</a></li>\n <li class=\"divider\"></li>\n <li><a>SubLink</a></li>\n </ul>\n </li>\n </ul>\n\n...\n\n\n </div>\n </div>\n</div>\n\n\nMany thanks." ]
[ "css", "django", "twitter-bootstrap" ]
[ "Is change of intel_idle.max_cstate kernel parameter possible even after boot?", "Due to some bug in intel driver I need to use kernel parameter "intel_idle.max_cstate=4" - otherwise the screen flickers after suspend/resume.\nBut of course, this is a drawback in power consumption. So simple question is: Can I boot without and apply this param at any time after boot?" ]
[ "linux", "kernel", "cpu", "intel" ]
[ "Python dict: the size affects timing?", "Let' say you have one key in dictionary A vs 1 billion keys in dictionary B\n\nAlgorithmically a lookup op is O(1)\n\nHowever, the actual time (program execution time) to look up different based on the size of the dict?\n\nonekey_stime = time.time()\nprint one_key_dict.get('firstkey')\nonekey_dur = time.time() - onekey_stime\n\nmanykeys_stime = time.time()\nprint manykeys_dict.get('randomkey')\nmanykeys_dur = time.time() - manykey_stime\n\n\nWould i see any time difference between onekey_dur and manykeys_dur?" ]
[ "python", "performance", "dictionary" ]
[ "Oracle SQLDeveloper on MacOS won't open after installation of correct Java", "I downloaded the Oracle SQLDeveloper, but when I opened it, it said that it requires a minimum of Java 8 and gave me the website for the download. I went on and downloaded Java 10.0.1, but when I went back on to open SQL, it continued saying it required a minimum of Java 8.\n\nI checked that the Java 10.0.1 had installed correctly, and I'm pretty sure it has. It shows up in System Preferences and when clicked, it opens the Java Control Panel fine.\n\nI had also found someone recommending trying this command:\n\nc:\\Program Files\\Oracle\\sqlcl\\17.3\\sqlcl\\bin>java -version\n\n\nAfter trying this in the Terminal, I ended up with command not found.\n\nI'm on a MacOS X El Captain 10.11.6." ]
[ "java", "oracle", "macos", "java-8", "oracle-sqldeveloper" ]
[ "Create auto increment field in Spark SQL temporary table", "I'm new to the Spark environment. I use Spark SQL in my project. I want to create auto increment field in a Spark SQL temporary table. I created UDF, but it didn't work properly. I tried various examples on the internet. This is my Java POJO class:\n\npublic class AutoIcrementId {\n int lastValue;\n public int evaluate() {\n lastValue++;\n return lastValue;\n }\n}" ]
[ "java", "apache-spark", "hive", "apache-spark-sql", "auto-increment" ]
[ "Uncaught SyntaxError: Unexpected token ILLEGAL Wordpress", "This code is working fine outside wordpress but Wordpress shows follwing error and does nothing. Can anyone tell the reason?\nThanks\n\n\n Uncaught SyntaxError: Unexpected token ILLEGAL\n custom_params.js:2Uncaught TypeError: Object # has no method\n 'prettyPhoto'\n chrome-extension://mpcddcfoblbgmnaklcpkbfajnfikinhn/videodownload.js:5Uncaught\n TypeError: Cannot read property '0' of null\n 3/wordpress/?page_id=458:169Uncaught ReferenceError: addInput is not\n defined\n\n\n<script type=\"text/javascript\">\nvar counter = 1;\nvar limit = 3;\nfunction addInput(divName){\n if (counter == limit) {\n alert(\"You have reached the limit of adding \" + counter + \" inputs\");\n }\n else {\n var newdiv = document.createElement('div');\n newdiv.innerHTML = \"Entry \" + (counter + 1) + \" <br><input type='text' name='myInputs[]'>\";\n document.getElementById(divName).appendChild(newdiv);\n counter++;\n }\n}\n</script>\n<form method=\"POST\">\n <div id=\"dynamicInput\">\n Entry 1<br><input type='text' name='myInputs[]'>\n </div>\n <input type='button' value='Add another text input' onClick='addInput(\"dynamicInput\")'>\n</form>" ]
[ "wordpress" ]
[ "How to compile and run any file at any location in C,java and C++?", "I am creating a editor kind of application where I want to compile and run (of course create, edit, open also) C,C++ and Java files;\nI am creating it in Java.\n\nNow for compilation and running I am taking the whole path of file\nand compiling & running via this full path.\n\nfor eg.\n\n compileFileCommand = javac /media/disk/eclipse/\\/UniversalIDE/Java/FirstJava.java\n\ntry\n{\n System.out.println(\"Compiling Java File\");\n Process compileProcess = Runtime.getRuntime().exec(compileFileCommand);\n compileProcess.waitFor();\n String line = \"\";\n BufferedReader bri = new BufferedReader(new InputStreamReader(compileProcess.getInputStream()));\n BufferedReader bre = new BufferedReader(new InputStreamReader(compileProcess.getErrorStream()));\n while ((line = bri.readLine()) != null)\n {\n System.out.println(line);\n }\n bri.close();\n while ((line = bre.readLine()) != null)\n {\n System.out.println(line);\n }\n bre.close();\n compileProcess.waitFor();\n System.out.println(\"Done Java Compile.\");\n} catch (Exception e)\n{\n // TODO: handle exception\n System.out.println(\"Exception in Java Compile. \");\n System.out.println(e.getMessage());\n}\n\n\nAbove code works fine and create a class file at location of java file.But bri.readLine() always contains null.\n\nFor running Java file\n\nrunFileCommand = java /media/disk/eclipse/\\/UniversalIDE/Java/FirstJava\n\n\nAnd for running C & CPP files the same procedure\n\nFor C compilation\n\nString compileFileCommand = \"gcc \" + fileNameWithFullPath; \n\n\nFor C Running\n\nString runFileCommand = \"./\" + fileNameWithFullPath.split(\".c\")[0];\n\n\nFor CPP compilation\n\nString compileFileCommand = \"g++ \" + fileNameWithFullPath;\n\n\nFor CPP Running \n\nString runFileCommand = \"./\" + fileNameWithFullPath.split(\".cpp\")[0];\n\n\nI use the same code as used for compiling java file but it does not give anything as result and bri.readLine() gives null all the time.\n\nPlease help me to solve this problem and please give me any suggestion on my application." ]
[ "java", "compilation" ]
[ "How does Postgres' built-in PGLZ compression compare to GZIP?", "From reading some stuff about TOAST I've learned Postgres uses an LZ-family compression algorithm, which it calls PGLZ. And it kicks in automatically for values larger than 2KB.\n\nHow does PGLZ compare to GZIP in terms of speed and compression ratio?\n\nI'm curious to know if PGLZ and GZIP have similar speeds and compression rates such that doing an extra GZIP step before inserting large JSON strings as data into Postgres would be unnecessary or harmful." ]
[ "postgresql", "compression", "gzip" ]
[ "Get the mouse coordinates in Firefox 18, IE 9, Chrome 24", "I try to obtain the mouse coordinates, for an event (for example document.onmousemove), but, i get different values for IE9. I use this function.\n\nfunction mouseCoords(event){\nif(event.pageX || event.pageY){\n return {x:event.pageX, y:evevent.pageY};\n}\nreturn { //IE\n x:event.clientX + document.body.scrollLeft - document.body.clientLeft,\n y:event.clientY + document.body.scrollTop - document.body.clientTop\n};}\n\n\n¿Exists a solution for these three browsers?" ]
[ "javascript", "internet-explorer", "google-chrome", "firefox" ]
[ "MongoDB prototypal inheritance between persisted objects", "I curious if MongoDB has the option to save a object with another object (in the same schema) as its 'prototype'. For example:\n\nSay we have an object in the db like so\n\n{\n name : 'foo',\n lastName : 'bar',\n email : '[email protected]'\n}\n\n\nWhat i would like to do is get this object and update the email (for example) \n\nso the new object would become this:\n\n{\n name: 'foo',\n lastName : 'bar',\n email : '[email protected]'\n}\n\n\nAs you can see there's a duplicated data here (namely the name and lastName properties).\n\nWhat i would like to do is save only the diffs so then the object would be on the email prop and a reft the original object like so\n\n{\n email : '[email protected]',\n __proto__ : originalObjectId //or whatever\n}\n\n\nI know I can just update the object directly or save a new copy of the object but i would like to have immutability and not save the whole object every time, i would like to only save the diff from the original.\n\nIs such a thing possible out of the box (by this i mean does mongo support and optimize such a this)? (or via some lib like mongoose or something)\n\nOr would i have to implement it myself?\n\nCheers,\nBoogie" ]
[ "javascript", "node.js", "mongodb", "mongodb-query" ]
[ "How do you remove a value that has an empty key from an associative array in PHP?", "I have a key that appears to be an empty string, however using unset($array[\"\"]); does not remove the key/value pair. I don't see another function that does what I want, so I'm guessing it's more complicated that just calling a function.\n\nThe line for the element on a print_r is [] => 1, which indicates to me that the key is the empty string.\n\nUsing var_export, the element is listed as '' => 1.\n\nUsing var_dump, the element is listed as [\"\"]=>int(1).\n\nSo far, I have tried all of the suggested methods of removal, but none have removed the element. I have tried unset($array[\"\"]);, unset($array['']);, and unset($array[null]); with no luck." ]
[ "php", "arrays", "associative-array" ]
[ "How to make cxf consumer wait indefenity till it get response from JMS", "Design: The servicemix cxf consumer target service is jms and the jms target service is cxf provider.\n\nProblem: The consumer doesn't wait till the response is received from provider even though http-conduit is implemented for consumer and provider.\nOnce jms is removed and if provider is made as target for consumer , the consumer waits indefinitely .\n\nKindly suggest the configurations required to make the consumer wait even with JMS" ]
[ "jms", "cxf", "apache-servicemix" ]
[ "Does someone know to fix this error? I don't know its for a note on school", "For school I need to write a code that will play Hangman with you but, there is a error which I can't fix. The error is in the part of the print, I think it has something to do with the import but I am not sure (the error is a invalid syntax)\n\nI tried to put the print and the message on different lines but I didn't work, I also tried a colon behind the print but also that didn't solve the problem (I am in Python 3.6.1 on repl.it)\n\nhttps://repl.it/@Informatica132/Galgje\n\nIt has to print: \"Your right\" Character \"is in the chosen word\", or \"Your wrong\" Character \"is not in the chosen word\" but it prints a syntaxerror invalid syntax." ]
[ "python-3.x", "repl.it" ]
[ "Serializable Dynamic Objects created in C# ( WCF ) not accessible in VB.NET", "In my solution I have the webservice (backend) written in C# and served via WCF to the client which is the MVC3 web front-end with VB.NET. For one web service I need to send to the client a list of dynamic objects List<SerializableDynamicObject>. \n\nI implemented solution described here: WCF Serializaiont of DLR , Example code.\nIn my test console application written in C# I can easily read dynamic properties served by WCF. Unfortunately in the VB.NET console application when I try to call one of the property I receive error message for first property \"Public member 'TRIP_ID' on type 'SerializableDynamicObject' not found\". The interesting thing is that I can see in the \"Watch\" and \"Locals\" windows dynamic properties for served objects in both C# and VB.NET. \n\nCan anyone explain to me what is the problem and how to solve this ? Thanks...\n\nThe webservice code:\n\npublic class Service1 : IService1\n{ \n public object Process(object value)\n {\n dynamic d = new SerializableDynamicObject();\n d.TRIP_ID = Convert.ToInt64(1);\n d.TRIP_NAM = \"TRIP NAM\";\n d.TRIP_USR_CRE_DTE = DateTime.Now;\n d.TripValue = new SerializableDynamicObject();\n d.TripValue.TPVL_TRIP_ID = Convert.ToInt64(1);\n d.TripValue.TPVL_VAL = \"TPVL VAL\";\n return d;\n }\n\n}\n\n\nThe C# version to read WCF dynamic objects (works), the dynamic properties are visible and can be called:\n\n class Program\n{\n static void Main(string[] args)\n {\n dynamic d = new SerializableDynamicObject();\n d.Testing = \"this is a test.\";\n DynService.Service1Client client = new DynService.Service1Client();\n dynamic res = client.Process(d);\n Int64 TRIP_ID = res.TRIP_ID; \n string TRIP_NAM = res.TRIP_NAM;\n DateTime TRIP_USR_CRE_DTE = res.TRIP_USR_CRE_DTE;\n Int64 TPVL_TRIP_ID = res.TripValue.TPVL_TRIP_ID;\n string TPVL_VAL = res.TripValue.TPVL_VAL; \n }\n}\n\n\nThe VB.NET version to read WCF dynamic objects (not working)\n\nOption Strict Off\nOption Infer On\nImports System.Linq\nImports DynSrv\nModule Module1\n Sub Main()\n Dim d As Object = New SerializableDynamicObject()\n d.Testing = \"this is a test.\"\n Dim client As New ServiceReference1.Service1Client()\n Dim res As Object = client.Process(d)\n Dim TRIP_ID As Int64 = res.TRIP_ID\n Dim TRIP_NAM As String = res.TRIP_NAM\n Dim TRIP_USR_CRE_DTE As Date = res.TRIP_USR_CRE_DTE\n Dim TPVL_TRIP_ID As Int64 = res.TripValue.TPVL_TRIP_ID\n Dim TPVL_VAL As String = res.TripValue.TPVL_VAL\n\n End Sub\nEnd Module" ]
[ "c#", "vb.net", "wcf", "dynamicobject" ]
[ "Looping through composer require with ansible task", "I feel like this should be really straight-forward, but I've been pouring over the ansible docs and other answers here, and I'm stuck.\n\nWhat I want to do is to set up an array or list of composer packages to be used in a composer require statement using the ansible composer object.\n\nSo, I've got a set fact like so to define the modules:\n\n- name: Define modules to be required\n set_fact:\n modules:\n - vendor1/package1\n - vendor2/package2\n - vendorN/packageN\n\n\nI've put this in the top of my ansible project so it's easily accessible and editable (It'd be sweet to figure out how to simply define the packages in a yaml file as vars, and then use set_fact in the playbook, but I'll stick to scope here)\n\nWith this in mind, I then have a role in the project with a composer task where I want to require each of these:\n\n- name: \"Require packages\"\n composer:\n command: require\n arguments: {{ modules_to_be_required }}\n working_dir: \"{{ app['directory'] }}\"\n\n\nOriginally, I did this using with_items like so:\n\n- name: \"Require packages\"\n composer:\n command: require\n arguments: \"{{ item }}\"\n working_dir: \"{{ app['directory'] }}\"\n with_items\n - vendor1/package1\n - vendor2/package2\n - vendorN/packageN\n\n\nThis does work; however, it causes a composer update to run with each iteration of with_items which takes far too long. To me, it makes more sense to take the list of packages to be required, convert them to a string separated by spaces, and then pass that as an argument.\n\nIn my research I found that I could convert a list to a string with the join filter, so I tried this:\n\n- name: \"Require packages\"\n composer:\n command: require\n arguments: {{ modules | join(\" \" ) }}\n working_dir: \"{{ app['directory'] }}\"\n\n\nBut, this gives me a YAML syntax error:\n\nThe offending line appears to be:\ncommand: require\narguments: {{ modules | join(\" \") }}\n ^ here\n\n\nI've tried wrapping \"{{ modules | join(\" \") }}\" but I get yelled at for the quotes in the parenthesis. \n\nAm I approaching this idea in the right way, or what questions do I need to ask to get to the answer? Any guidance is appreciated." ]
[ "ansible" ]
[ "Put text description adjacent to kable", "Following this example, here's what I have\n\n# iris\nThis section is about the iris dataset\n```{r, echo=FALSE, message=FALSE, warning=FALSE}\nkable(head(iris[, 1:2]), format = \"html\") %>%\n kable_styling(bootstrap_options = c(\"striped\", \"hover\"), full_width = FALSE, position = \"float_right\")\n```\n\n# mtcars\nThis section is about the mtcars dataset\n```{r, echo=FALSE, message=FALSE, warning=FALSE}\nkable(head(mtcars[, 1:2]), format = \"html\") %>%\n kable_styling(bootstrap_options = c(\"striped\", \"hover\"), full_width = FALSE, position = \"float_right\")\n```\n\n\nBut the output looks like this:\n\n\n\nHow do make the mtcars section appear below the iris section?" ]
[ "r", "r-markdown", "knitr", "kable", "kableextra" ]
[ "regex for ------/------ or 123456/123456 optional character", "The below regex works perfectly \n\n[\\s\\S]*[0RECALL]?[\\s\\S]\\d(?P<fpName>[R|U|J|L|I|N]\\d\\d\\d\\d),(?P<fpReceivedTimestamp>\\d\\d\\/\\d\\d\\/\\d\\d,\\d\\d\\d\\d)Z,[^,]*,(?P<basic_weight>\\d\\d\\d\\d\\d\\d)\\/(?P<payload>\\d\\d\\d\\d\\d[\\d]?),\n\n\nfor \n\n0RECALL,J2516\\n1J2516,04/20/16,1336Z,N103XA /CL30 ,123456/123456,\n\n\nBut I need a regex in which \nThe last digits are optional 123456/123456 or ------/------\n\nso the text can be either \n\n0RECALL,J2516\\n1J2516,04/20/16,1336Z,N103XA /CL30 ,123456/123456,\n\nor \n\n0RECALL,J2516\\n1J2516,04/20/16,1336Z,N103XA /CL30 ,------/------,\n\n\nWhat changes should I do to my regex . Presently I am Using the below online tool for help\n\nDEMO LINK" ]
[ "python", "regex" ]
[ "Is it possible to set the content source of a post with Tumblr's API?", "I find it strange that you can set nearly every property of a given post through Tumblr's API, however, I cannot seem to find how one would go about setting the content source of a post when posting through Tumblr's API.\n\nAny thoughts? By the way, not the source of the quote post type, but rather the content source that you would if you used their GUI." ]
[ "api", "tumblr" ]
[ "Excel VBA - Take only the numeric value in a cell", "I have an IF function in VBA that has a mathematical formula in it:- (Cells(i3, 10).Value > 30)\n\nThe issue i'm having is that the values in column 10 are all alphanumeric. For example they're all \" 1 - Hard\", \"2 - Moderate\", \"3 - Easy\". \n\nIs there anyway to make VBA only look at the number so when it's testing if the value is more than 30, it actually works?\n\nThanks" ]
[ "excel", "vba", "if-statement" ]
[ "How to get use GSON.fromJson with type provided in a variable?", "I wanted to use GSON.fromJSON in the following way:\n\nClass<?> type = Abc.class;\nClass<?> parametersObject = GSON.fromJson(parameters, type);\n\n\nBut I am getting compilation error on 2nd line. How do I infer the return type of the following line? I know it would be of Abc type in the above case. But I want to make this dynamic based on what is specified in type variable. How can I do that?" ]
[ "java", "generics", "gson" ]
[ "Keep x number of directories and delete all others, need to exclude one directory and its contents every time", "I am trying to delete all but the 10 most recent directories, always excluding the java directory. Unfortunately it is deleting all but the last 10 the contents of the \"java\" directory too.\n\nI've been trying to modify the solution from the following link to get my situation to work properly:\nKeep x number of files and delete all others - PART TWO\n\nThe directory structure is as follows:\n\ndev_app_backup\\java\ndev_app_backup\\2012-05-09_01-00-05_commnXsl (contains Xsl files)\ndev_app_backup\\2012-05-09_01-00-05_published (contains zip files)\ndev_app_backup\\various-dates-time_commonXsl\ndev_app_backup\\various-dates-time_published\n\n\nMy plan is to run a second script to clean out the java subdirectories.\n\n#----- define folder where files are located ----#\n$TargetFolder = \"\\\\test\\TestShare\\dev_app_backup\\*\"\n\n#----- number of directories to keep ----#\n$keep = 10\n\n#----- get zip files based on lastwrite filter ---#\n$files = Get-Childitem $TargetFolder -recurse -exclude java\n\nif ($files.Count -gt $keep) \n{\n$files | Sort-Object -property $_.LastWriteTime | Select-Object -First ($files.Count - $keep) | Remove-Item -Force\n}" ]
[ "powershell" ]
[ "How to apply multithreading to Bio::SeqIO translate code (Bioperl)?", "I am translating a fasta nucleotide file into protein sequences by this code \n\nuse Bio::SeqIO;\nuse Getopt::Long;\n\nmy ($format,$outfile) = 'fasta';\n\nGetOptions(\n 'f|format:s' => \\$format,\n 'o|out|outfile:s' => \\$outfile,\n );\n\nmy $oformat = 'fasta';\n$file=$ARGV[0];\nchomp $file;\n\n# this implicity uses the <> file stream\nmy $seqin = Bio::SeqIO->new( -format => $format, -fh => \\*ARGV);\nmy $seqout;\nif( $outfile ) {\n $seqout = Bio::SeqIO->new( -format => $oformat, -file => \">$outfile\" );\n} else {\n# defaults to writing to STDOUT\n $seqout = Bio::SeqIO->new( -format => $oformat );\n}\n\n while( (my $seq = $seqin->next_seq()) ) {\n my $pseq = $seq->translate();\n $seqout->write_seq($pseq);\n }\n\n\nI implement \nthreads and threads::shared perl modules to achieve in other cases but I want to apply following code into previous task \n\nuse threads;\nuse threads::shared;\nuse List::Util qw( sum );\nuse YAML;\nuse constant NUM_THREADS =>100;\n\nmy @output :shared;\n\nmy $chunk_size = @data / NUM_THREADS;\n\nmy @threads;\nfor my $chunk ( 1 .. NUM_THREADS ) {\n my $start = ($chunk - 1) * $chunk_size;\n push @threads, threads->create(\n \\&doOperation,\n \\@data,\n $start,\n ($start + $chunk_size - 1),\n \\@output,\n );\n}\n$_->join for @threads;\n\nsub doOperation{\n my ($data, $start, $end, $output) = @_;\n\n my $id = threads->tid;\n\n print \"$id \";\n\n for my $i ($start .. $end) {\n print \"Thread [$id] processing row $i\\n\";\n\n\n#THIS WHILE SHOULD BE MULTITHREADED\n\n while( (my $seq = $seqin->next_seq()) ) {\n my $pseq = $seq->translate();\n $seqout->write_seq($pseq);\n }\n\n\n#THIS WHILE SHOULD BE MULTITHREADED\n\n sleep 1 if 0.2 > rand;\n }\n print \"Thread done.\\n\";\n return;\n}\nprint \"\\n$time\\n\";\nmy $time = localtime;\nprint \"$time\\n\";\n\n\nThreads are being created but somehow it can not process the fasta file.\nThe fisrt code works fine without multi threading." ]
[ "multithreading", "perl", "bioperl" ]
[ "Css transform in jQuery", "I have img and I need to rotate it 90 degree when I click on it. \n\n<img src=\"img/right-arrow.png\" alt=\"\" class=\"show\">\n\n\nwhen I use \n\n.show {\ntransform: rotate(90deg); \n}\n\n\nin Css file it works. \nbut when I do it in jQuery it doesn't work. \nhere is my code in jQuery \n\n$('.show').click(function(){\n $(this).css(\"-webkit-transform\" : \"rotate(90deg)\");\n}\n);" ]
[ "jquery", "css" ]
[ "Constructor in an abstract class use in a derived class", "Let's say that I have the following abstract class:\nclass Animal\n{\nprivate:\n string _name;\n int _age;\npublic:\n Animal(const string name, const int age);\n virtual void eat() = 0;\n};\n\nIf I want to create a new derived class, for example, a Dog class. How do I call Animal's constructor, as Animal is an abstract class?\nMore than this, if I'd have 2 more classes under Dog: Pug and Poodle (I know that the example isn't that good but let's ignore that). How will those two classes use Animal c'tor?" ]
[ "c++", "oop", "c++11", "inheritance", "abstract-class" ]
[ "mouse hover on anchor tag does not display pointer cursor. Behavior observed on Chrome, works fine on IE 9?", "I have a code in my razor view as below. The pointer cursor is not displaying while mouse hover on any of the anchor tag. The same code works fine on IE 9. This issue is observed on Chrome browser. Any guess why the below code failed on Chrome Version 25.0.1364.172 m?\n\n <ul id=\"menu\" class=\"menu\">\n <li><a href=\"#\" style=\"cursor: pointer;\">Top 10 Headlines</a>\n </li>\n <li><a href=\"#\">Related Content</a>\n </li>\n </ul>" ]
[ "google-chrome", "cursor", "anchor" ]
[ "SQLalchemy: iterate through raw SQL query in template", "Have a code in function, which renders ResultProxy (as I understand), to template, like this:\n\nquery = db_session.execute(serious_business_query) #raw sql\nreturn render_template('result.html', query=query)\n\n\nI want to iterate through it in my template, but see nothing. How can I iterate through ResultProxy object? Or what should I pass to template to simply iterate through it?\n\nLinks to docs are OK, cant find what I need." ]
[ "flask", "sqlalchemy", "jinja2" ]
[ "PHP Error Form - Leave Contents of Form on Redirect", "I have a simple login form in which if an error occurs such as wrong password, I need it to be able to remember the username which was entered. Would I Go about doing this PHP or Javascript as I am not allowed to use JQuery. \n\nMy current PHP - (Not Including the HTML Form)\n\n<?php\n//MySQl Connection\n mysql_connect(\"localhost\", \"root\", \"\") or die(mysql_error()); \n mysql_select_db(\"clubresults\") or die(mysql_error()); \n\n//Initiates New Session - Cookie\nsession_start(); // Start a new session\n\n// Get the data passed from the form\n$username = $_POST['username'];\n$password = md5($_POST['pass']);\n\n// Do some basic sanitizing\n$username = mysql_real_escape_string($username);\n$password = mysql_real_escape_string($password);\n\n//Performs SQL Query to retrieve Login Details from DB\n$sql = \"select * from admin_passwords where username = '$username' and password = '$password'\";\n$result = mysql_query($sql) or die ( mysql_error() );\n\n//Assigns a Variable Count to 0\n$count = 0;\n\n//Exectues a loop to increment on Successful Login\nwhile ($line = mysql_fetch_assoc($result)) {\n $count++;\n}\n//If count is equal to 1 Redirect user to the Members Page and Set Cookie\nif ($count == 1) {\n $_SESSION['loggedIn'] = \"true\";\n header(\"Location: members.php\"); // This is wherever you want to redirect the user to\n} else {\n\n//Else Echo that login was a failure.\ndie('Login Failed. <a href=login.php>Click Here to Try Again</a>');\n\n}\n\n?>\n\n\nAny help would be appreciated. Cheers" ]
[ "php", "mysql" ]
[ "Why can 2 spark structured streaming instances read the same messages from Azure EventHub even if they are using the same consumer group", "What I understand from the official document is that, when using a same consumer group, 2 consumers can not read the same message. If I still want to process a same message, I must use a different consumer group.\n\nI try to test if this is true with 2 simple Spark structured streaming app. It just reads all the messages from the hub and write them to a table in memory. Here is my code for the 2 apps:\n\nehConf = {\n 'eventhubs.connectionString' : connectionString,\n 'eventhubs.consumerGroup': \"group1\"\n}\n\ndf = spark.readStream.format(\"eventhubs\").options(**ehConf).load()\ndf.writeStream.format(\"memory\").queryName(\"sink\").outputMode(\"append\").start()\n\n\nThen I tried to send some messages to the hub, using this\n\ndfnum = spark.range(1, 8)\ndfnum = dfnum.select(col('id').cast('string')).withColumnRenamed('id', 'body')\n# dfnum.show()\n\nehWriteConf = {\n 'eventhubs.connectionString' : connectionString\n}\n\nds = dfnum.select(\"body\").write.format(\"eventhubs\").options(**ehWriteConf).option(\"checkpointLocation\", \"tmp/checkpoint\").save()\n\n\nThe problem is that all the Spark Structured Streaming apps can still read all the message from the Eventhub, which is not like what the official document says.\n\nHere is the result from spark application 1:\n\n+----+------+---------+--------------------+---------+------------+\n|body|offset|partition| enqueuedTime|publisher|partitionKey|\n+----+------+---------+--------------------+---------+------------+\n| 4| 1248| 0|2020-05-31 14:00:...| null| null|\n| 1| 1296| 0|2020-05-31 14:00:...| null| null|\n| 3| 1152| 1|2020-05-31 14:00:...| null| null|\n| 2| 1200| 1|2020-05-31 14:00:...| null| null|\n| 5| 1344| 0|2020-05-31 14:01:...| null| null|\n| 6| 1248| 1|2020-05-31 14:01:...| null| null|\n| 7| 1296| 1|2020-05-31 14:01:...| null| null|\n+----+------+---------+--------------------+---------+------------+\n\n\nAnd here is the result from the spark application 2:\n\n+----+------+---------+--------------------+---------+------------+\n|body|offset|partition| enqueuedTime|publisher|partitionKey|\n+----+------+---------+--------------------+---------+------------+\n| 4| 1248| 0|2020-05-31 14:00:...| null| null|\n| 3| 1152| 1|2020-05-31 14:00:...| null| null|\n| 1| 1296| 0|2020-05-31 14:00:...| null| null|\n| 2| 1200| 1|2020-05-31 14:00:...| null| null|\n| 5| 1344| 0|2020-05-31 14:01:...| null| null|\n| 6| 1248| 1|2020-05-31 14:01:...| null| null|\n| 7| 1296| 1|2020-05-31 14:01:...| null| null|\n+----+------+---------+--------------------+---------+------------+\n\n\nThe order is a bit different, but the content is all the same.\n\nDo I misunderstand something here?" ]
[ "apache-spark", "spark-structured-streaming", "azure-eventhub" ]
[ "Regular expression causing my failing unit tests. Why?", "I am having a really tough time with regular expressions. Mine is causing my unit test to fail. I have tried it a couple of different ways without success. Maybe I am going about it wrong. I need it to either use one word (Trumpet) or two words with a space (French Horn). \n\nProperty that I am having an issue with.\n\npublic string Name\n {\n get { return _name; }\n set\n {\n string source = propTI.ToTitleCase(value.Trim());\n string pattern = \"^[A-Z][a-z]*\\\\s[A-Z][a-z]*$\";\n if (Regex.IsMatch(source, pattern))\n _name = source;\n else\n {\n throw new ArgumentException(\"Name must have proper case!\");\n }\n }\n }\n\n\nI have also tried \"^([A-Z][a-z]\\s)$\" as a pattern.\n\nConstructor:\n\npublic Instrument() : this(DefaultName, DefaultCategory) { }\n\n\nUnit Test:\n\n [TestMethod] \n public void Instrument_Name_IsValid()\n {\n var na = \"french\";\n var goodna = \"French\";\n var inst = new Instrument();\n inst.Name = na;\n Assert.AreEqual(goodna, inst.Name);\n }\n\n\nWhat should I use for a regular expression? Since these are clearly not working?" ]
[ "c#", "regex", "unit-testing" ]
[ "Is there a way to make an object from an ArrayList that is independent of the ArrayList?", "For example:\n\nArrayList<SomeObj> list = new ArrayList<SomeObj>();\nSomeObj temp = list.get(0); // this points to the first object and \n//any modification to it will be reflected in the ArrayList as well.(I think)\n\n\nMy question is there a way of making a 'new' object that has the same value as the one in the ArrayList but not modified if I change the 'temp' one.\nNote: I can only use ArrayLists." ]
[ "java", "arraylist" ]
[ "Can you distinguish between the left CTRL key and right CTRL key using keycodes in .keypress()?", "This code will fire an alert if I hit either Ctrl key:\n\n$('#text').bind('keypress', function(e) {\n if(e.keyCode==17)\n {\n alert(\"Boo ya\");\n }\n});\n\n\nAny way to only fire the alert if only the left Ctrl key is pressed?" ]
[ "javascript", "jquery", "keypress" ]
[ "Can't seem to match elements of WHERE clause of SQL statement using RegEx", "I have this \"WHERE\" clause:\n\nWHERE 1 = 0 AND 0 = 1 AND A = B\n\n\nI created the following regular expression:\n\n\\s*(?<SearchCondition>[^,]+?)\\s*(?<Connector>(AND|OR|$))\n\n\nwhich will create the groups properly when the input string is: \n\n1 = 0 AND 0 = 1 AND A = B\n\n\nbut how would I adapt it to give the same result when given the string:\n\nSELECT * FROM SOMETABLE WHERE 1 = 0 AND 0 = 1 AND A = B\n\n\nI was trying to stick \"WHERE\" in front of my regex but I can't figure out how to get it right. I was trying this out in regexhero: \nhttp://regexhero.net/tester/\n\nCan someone point me in the right direction?" ]
[ "c#", ".net", "regex", "perl" ]
[ "In jsf how integer properties get value 0 in client page without process validation phase for first time request", "I have a bean as shown \n\n@ManagedBean\n@RequestScoped\npublic class Demo {\nprivate int value1;\nprivate String value2;\n\n..getter and setter..\n\n\nthis is my xhtml page demo.xhtml\n\n<h:form>\n <p:panelGrid columns=\"2\">\n <p:outputLabel value=\"id\"></p:outputLabel>\n <p:inputText value=\"#{demo.value1}\"></p:inputText>\n <p:outputLabel value=\"name\"></p:outputLabel>\n <p:inputText value=\"#{demo.value2}\"></p:inputText>\n </p:panelGrid>\n </h:form>\n\n\nhow the integer value get 0 value in the client page\n\n\ni have read that in request processing lifecycle, for first time request, jsf runtime will create new view and directly goes to render phase. how values are set to client page without process validation phase.\n\ni read these lines from jsf 2.0 complete reference\n\n*Initial request to view the register.xhtml page\n\nSince this\nis an initial request (also referred to as a “non-postback” request) to view the\nregistration page, the Restore View phase creates an empty View (UIViewRoot)\ncomponent tree and stores it in the FacesContext instance.\n\n\nAfter the View is created, the lifecycle immediately proceeds directly to the Render\nResponse phase\n, since there was no incoming field data in the request to validate or\n process (also referred to as a “non-postback” request).*\n\ni think this sentence help to understand my question. expect answer in lifecycle point of view" ]
[ "jsf", "jsf-2", "primefaces" ]
[ "How to get the data from linked servers using queries", "I have created a linkedserver as ravikiran-vm which is the virtual machine in my desktop.\n\nNow I have a database called kiran which contains an employ table.\nTo retrieve employ data, I do the following:\n\nselect * from ravikiran-vm.kiran.employ\n\n\nbut it shows the error \"Incorrect syntax near '-'.\"\n\nCan anyone help me, please?\n\nThanks in advance.\n\nThanks guys with ur support it working fine...\nNow i hav to schedule this as a new job.when i execute it as normal it shows o/p.\nbut when i cinfigure the same query as sqlserver agent job it gives error and query not executing...Plz help me in this regard\n\nThanks in advance" ]
[ "sql-server", "sql-server-2005" ]
[ "Basic Authentication with Spring boot for Rest services", "I am trying to implementing the basic authentication with spring boot for Rest Service endpoints.Below is my sample code.I don't have Database to store the username and passwords and using a application.properties to store the passwords.My rest services will be used by fron end system and it is not recommended to share the plain passwords to frond systems ,Can anyone suggest how to generate the passwords which is secure .Can we generate the random number ?\nCan we use BCryptPasswordEncoder for random number password ?\n @Configuration\n public class SecurityConfig extends WebSecurityConfigurerAdapter {\n\n private static final Logger log = LogManager.getLogger();\n\n @Override\n protected void configure(HttpSecurity http) throws Exception {\n http\n .authorizeRequests()\n .antMatchers("/**").authenticated() \n .and()\n .httpBasic();\n http.csrf().disable();\n }\n\n @Bean\n public UserDetailsService userDetailsService() {\n \n String username = "username";\n String password = "password";\n InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();\n String encodedPassword = passwordEncoder().encode(password);\n manager.createUser(User.withUsername(username).password(encodedPassword).roles("USER").build());\n return manager;\n }\n\n @Bean\n public PasswordEncoder passwordEncoder() {\n return new BCryptPasswordEncoder();\n }\n }" ]
[ "java", "spring-boot" ]
[ "Does $.ajax automatically execute script, if the data returned is javascript?", "I use a single JS file to post all my data back to my server, using:\n\n$.ajax({\n url: \"/backend/post.php\", // Url to which the request is send\n type: \"POST\", // Type of request to be send, called as method\n data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)\n contentType: false, // The content type used when sending data to the server.\n cache: false, // To unable request pages to be cached\n processData:false, // To send DOMDocument or non processed data file it is set to false\n success: function(response, status, xhr) // A function to be called if request succeeds\n {\n var ct = xhr.getResponseHeader(\"content-type\") || \"\";\n if(ct.indexOf(\"text/plain\") > -1){\n alert(response);\n console.log('text - response');\n }\n if(ct.indexOf(\"text/javascript\") > -1){\n //eval(response);\n console.log('javascript - response');\n }\n }\n });\n\n\nIt goes through a whole load of functions on the server side but eventually gets to this one: output_javascript(\"alert('item added');\");\n\nfunction output_javascript($script)\n{\n header(\"content-type:text/javascript\");\n echo $script;\n}\n\n\nThe idea was to have the $.ajax function display text or execute script from the server.\n\nWhen $.ajax gets the response from output_javascript(\"alert('item added');\"); then it executes the code twice. When I comment out the code to execute in the success function:\n\n$.ajax({\n url: \"/backend/post.php\", // Url to which the request is send\n type: \"POST\", // Type of request to be send, called as method\n data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)\n contentType: false, // The content type used when sending data to the server.\n cache: false, // To unable request pages to be cached\n processData:false, // To send DOMDocument or non processed data file it is set to false\n success: function(response, status, xhr) // A function to be called if request succeeds\n {\n\n }\n });\n\n\nThen it only executes the response once. Making me believe that $.ajax executes the code before returning the script in the response variable.\n\nIs this true, or am I not understanding $.ajax correctly ? If I am misunderstanding the $.ajax function, could someone please tell me how to resolve this problem?" ]
[ "javascript", "php", "jquery", "ajax" ]
[ "What makes a web site 'finished' for delivery to a client?", "Sorry if this question has already been answered, and sorry if it's too subjective to make sense, or for StackOverflow.\n\nI'm delivering a site to a client and I want to send them high-quality HTML/CSS/JS, fully validated, accessible etc. \n\nSo I'm compiling a list of things to check, and useful tools for doing so, before I hand the code over. Here's a partial list, but what am I missing?\n\n\nLink checking for any broken links I might have missed - W3C link checker \nHTML validation for accessibility and broken-ness - W3C HTML validator\nCSS validation - W3C CSS validator\nCheck for slow-loading page elements - Firebug and YSlow plugin\n\n\nWhat's missing - if you were a client, what else would you want to be sure has been checked?\n\nI'm wondering about the etiquette of things like comments, indentation, and minification; is it good practice to sort out all these? And what else have I missed?\n\nThanks :)" ]
[ "html", "w3c-validation" ]
[ "Is prepared statements on trusted data from another query really neccessary?", "Is prepared statement necessary when dealing with trusted data fetched from another query? \n\nFor example.\nWhen a user is navigating throughout the site, they click named links like this: /?category=health where health is the value that is sent to the database.\nIn this scenario I of course use prepared statement like this: \n\n$qry = $dbh->prepare('SELECT category_id, and, other, columns FROM categories WHERE query_value = ?');\n$qry->execute([$_GET['category']]);\n$get = $qry->fetch();\n$qry = null;\n\n\nBut further down the script, I would display content associated with the selected category based on the categories.category_id fetched from the last query. \n\n$Banners = $dbh->query('SELECT image FROM Banners WHERE category_id = '.$get['category_id'])->fetchAll();\n\n\nI would like to think that this is a secure query.\nThat the value could be no other than a trusted value since it has to be a result from the previous query?\nAnd this query won't be executed if the previous query doesn't return true.\n\nHere's how I've done it so far:\nIt's a 3-liner. But it would speed up the coding part a bit if I was certain that the 1-liner above is fine too.\n\n$qry = $dbh->prepare('SELECT image FROM Banners WHERE category_id = ?');\n$qry->execute([$get['category_id']]);\n$Banners = $qry->fetchAll();" ]
[ "php", "pdo", "prepared-statement" ]
[ "Running cron python jobs within docker", "I would like to run a python cron job inside of a docker container in detached mode. My set-up is below:\nMy python script is test.py\n#!/usr/bin/env python\nimport datetime\nprint "Cron job has run at %s" %datetime.datetime.now()\n\nMy cron file is my-crontab\n* * * * * /test.py > /dev/console\n\nand my Dockerfile is\nFROM ubuntu:latest\nRUN apt-get update && apt-get install -y software-properties-common python-software-properties && apt-get update\n\nRUN apt-get install -y python cron\nADD my-crontab /\nADD test.py /\nRUN chmod a+x test.py\n\nRUN crontab /my-crontab\nENTRYPOINT cron -f\n\nWhat are the potential problems with this approach? Are there other approaches and what are their pros and cons?" ]
[ "python", "cron", "docker" ]
[ "Is there a defined product support lifecycle for Wildfly / JBoss AS?", "I'm looking for dates until when patches for known vulnerabilities will be delivered for the products mentioned above. I found the same for RedHat's JBoss Enterprise Application Platform, but not for JBoss AS or Wildfly.\n\nHere's an example." ]
[ "jboss", "wildfly" ]
[ "Django: TypeError preventing attaching a bytes-like object to email", "I am trying to use xlsxwriter to generate a xlsx file and then send it as an attachment in email. Here is what I have now:\n\ndef WriteToExcel(project):\n output = BytesIO()\n workbook = xlsxwriter.Workbook(output)\n\n #putting in data\n\n workbook.close()\n xlsx_data = output.getvalue()\n # xlsx_data contains the Excel file\n return xlsx_data\n\ndef project_email (request, project_id):\n project = Project.objects.get(id = project_id)\n xlsx_data = WriteToExcel(project)\n\n message = EmailMessage(\"Heading\", 'Here is the message.', 'HOST', ['[email protected]'])\n\n message.attach_file(xlsx_data)\n message.send()\n\n\nAnd when I tried to send the email, I have the following error:\n\n\n TypeError at /projstatus/1/email\n \n cannot use a string pattern on a bytes-like object\n\n\nIs there any way that I could go around it? Like, make the xlsx file non-binary or if there is a function in email to attach binary file?" ]
[ "django", "email", "django-email" ]
[ "What is the page size for 32 and 64 bit versions of windows Os?", "I want to know the default page size for virtual memory in windows Os for both 32 and 64 bit versions. For ex: the page size of Linux (x86) is 4 Kb." ]
[ "windows", "memory-management", "virtual-memory" ]
[ "Swift - Add N month to date", "I have used the following code to generate dates between two dates. It works in all cases where the day of the month is less than 28.\nextension Date {\n public func addMonth(n: Int) -> Date {\n let calendar = Calendar.current\n return calendar.date(byAdding: .month, value: n, to: self)!\n }\n public func addYear(n: Int) -> Date {\n let calendar = Calendar.current\n return calendar.date(byAdding: .year, value: n, to: self)!\n }\n\n public var monthName: String {\n let calendar = Calendar.current\n let monthInt = calendar.component(.month, from: self)\n return calendar.monthSymbols[monthInt-1]\n }\n}\n\nvar date = Date()\n\nrepeat {\n date = date.addMonth(n: 1)\n print("\\(date) \\(date.monthName) ")\n} while date <= Date().addYear(n: 2)\n\nResult\n2020-07-30 13:31:14 +0000 July \n2020-08-30 13:31:14 +0000 August \n2020-09-30 13:31:14 +0000 September \n2020-10-30 14:31:14 +0000 October \n2020-11-30 14:31:14 +0000 November \n2020-12-30 14:31:14 +0000 December \n2021-01-30 14:31:14 +0000 January \n2021-02-28 14:31:14 +0000 February \n2021-03-28 13:31:14 +0000 March \n2021-04-28 13:31:14 +0000 April \n2021-05-28 13:31:14 +0000 May \n2021-06-28 13:31:14 +0000 June \n2021-07-28 13:31:14 +0000 July \n2021-08-28 13:31:14 +0000 August \n2021-09-28 13:31:14 +0000 September \n2021-10-28 13:31:14 +0000 October \n2021-11-28 14:31:14 +0000 November \n2021-12-28 14:31:14 +0000 December \n2022-01-28 14:31:14 +0000 January \n2022-02-28 14:31:14 +0000 February \n2022-03-28 13:31:14 +0000 March \n2022-04-28 13:31:14 +0000 April \n2022-05-28 13:31:14 +0000 May \n2022-06-28 13:31:14 +0000 June \n2022-07-28 13:31:14 +0000 July \n\nExpected result\nI expect the result to be either 28 or 30.\n 2020-07-30 13:31:14 +0000 July\n 2020-08-30 13:31:14 +0000 August\n 2020-09-30 13:31:14 +0000 September\n 2020-10-30 14:31:14 +0000 October\n 2020-11-30 14:31:14 +0000 November\n 2020-12-30 14:31:14 +0000 December\n 2021-01-30 14:31:14 +0000 January\n 2021-02-28 14:31:14 +0000 February\n 2021-03-30 13:31:14 +0000 March\n 2021-04-30 13:31:14 +0000 April\n 2021-05-30 13:31:14 +0000 May\n 2021-06-30 13:31:14 +0000 June\n 2021-07-30 13:31:14 +0000 July\n 2021-08-30 13:31:14 +0000 August\n 2021-09-30 13:31:14 +0000 September\n 2021-10-30 13:31:14 +0000 October\n 2021-11-30 14:31:14 +0000 November\n 2021-12-30 14:31:14 +0000 December\n 2022-01-30 14:31:14 +0000 January\n 2022-02-28 14:31:14 +0000 February\n 2022-03-30 13:31:14 +0000 March\n 2022-04-30 13:31:14 +0000 April\n 2022-05-30 13:31:14 +0000 May\n 2022-06-30 13:31:14 +0000 June\n 2022-07-30 13:31:14 +0000 July\n\nDoes Calendar has built-in functionality to achieve this?" ]
[ "ios", "swift", "date" ]
[ "How to find difference between two dates in years months and days in Java?", "Suppose I have :\nEmployee model which has startDate as its property variable and Promotion model has promotionDate. \nI want to find out for how long employee has worked until his promotion for which I have to find difference between promotionDate and startDate.\nIf I get startDate as employee.getStartDate() and promotionDate as promotion.getPromotionDate, how can I find difference in years months and days for any dates,\n\nAny help would be really appreciated.\n\nUPDATE : I SOLVED PROBLEM AS BELOW\n\nString startDate = \"2018-01-01\";\nString promotionDate = \"2019-11-08\";\n\nLocalDate sdate = LocalDate.parse(startDate);\nLocalDate pdate = LocalDate.parse(promotionDate);\n\nLocalDate ssdate = LocalDate.of(sdate.getYear(), sdate.getMonth(), sdate.getDayOfMonth());\nLocalDate ppdate = LocalDate.of(pdate.getYear(), pdate.getMonth(), pdate.getDayOfMonth());\n\nPeriod period = Period.between(ssdate, ppdate);\nSystem.out.println(\"Difference: \" + period.getYears() + \" years \" \n + period.getMonths() + \" months \"\n + period.getDays() + \" days \");\n\n\nThank you." ]
[ "java", "date-difference", "date" ]
[ "Is there a size limit to a Android Gradle build?", "I have an Android project with 3000 photo's that needs to be available offline. When I include all the photo's in the build, the build fails. When I remove some of them, the build succeeds.\nI have put the photo's in two dynamic modules that download at install time.\nHere is the gradle scan for reference: https://scans.gradle.com/s/nn6eo527qvge6\nIs this purely a size issue and if so, how do I get around that?" ]
[ "android", "gradle", "android-gradle-plugin", "build.gradle", "gradlew" ]
[ "Calculation with seconds vba", "I have a column in excel that stores the difference between and end date and start date in seconds. \n\nTime window seconds\n2580 (0:43)\n16200\n\n\nI would like to sum these seconds and store this information in an array. This array should then contain the totalnumber of seconds. However if I specify this array as: \n\nDim totalnumber(7) as Date\n\n\nI get weird values in Date format, instead of seconds. The next step is to do a simple calculation with each number stored in the array. How should I define this array so that it contains seconds and that I can do a calculation with it?" ]
[ "vba", "excel" ]
[ "Toggle the next row in a table", "I have 3 rows in a table, a header row, an view row, and an edit row. I'm trying to hide the \"viewrow\" and show the \"editrow\" from a link in the viewrow. The viewrow toggles, but the editrow does not.\n\n<table width=400 cellpadding=3 cellspacing=2 border=0 align=center>\n<tr class=\"headerrow\">\n <td><strong>Field One</strong></td>\n <td><strong>Field Two</strong></td>\n <td> </td>\n</tr>\n<tr class=\"viewrow\">\n <td>Item One-One</td>\n <td>Item One-Two</td>\n <td><a href=\"#\" class=\"edit\">Edit</a></td>\n</tr>\n<form>\n<tr class=\"editrow\">\n <td><input type=\"hidden\" name=\"id\" value=\"1\" /><input type=\"text\" name=\"fieldone\" value=\"Item Two-Two\" style=\"width: 300px;\" /></td>\n <td><input type=\"text\" name=\"fieldtwo\" value=\"Item One-Two\" /></td>\n <td><input type=\"submit\" value=\"update\" name=\"submit\" /></td>\n</tr>\n</form>\n\n\n\n\nAnd here's the jquery:\n\njQuery(function($) {\n$('.edit').click(\nfunction() {\n //hide the view row, and show the edit row\n $(this).closest('tr').toggle();\n $(this).closest('tr').next('.editrow').toggle();\n});\n});\n\n\nAnd the CSS:\n\n.editrow {\ndisplay: none;\n}\n\n\nAny thoughts on what I might be doing wrong?" ]
[ "jquery", "toggle", "tablerow" ]
[ "serial port ttyUSB0 read block when use libev", "I have a serial port ttyUSB0, and open it with NONBLOCK.\n\nfd = open(args_info.dev_arg, O_RDWR | O_NONBLOCK);\n\nuse read will immediate return, everything is ok. But when use libev \n\nev_io_init(&serial->recv_ctx->io, serial_recv_cb, fd, EV_READ);\n\nserial_recv_cb will block until 100bytes. if data length less than 100bytes, serial_recv_cb will never be called.\n\n[root@jane client]# ./tcptrans --dev /dev/ttyUSB0 -d 7 --nic wlp2s0\nserial.c +163 serial_recv_cb(): DEBUG: fd: 5, size: 100\nserial.c +163 serial_recv_cb(): DEBUG: fd: 5, size: 100\n\n\nI think serial_recv_cb will be called immediate. Why libev will block ?" ]
[ "c", "linux", "libev" ]
[ "Java SpringBoot method still @Scheduled under wrong @Profile?", "My application.properties file defines the default profile as spring.profiles.active=test and I have a method that I schedule like so:\n\n @Scheduled(initialDelay = 2500, fixedRate = 60 * 1000 * minutesRecheckRate)\n @Profile(\"loop\")\n public void processingLoop() {\n System.out.println(Arrays.toString(env.getActiveProfiles()));\n //.. the rest is omitted for brevity.\n\n\nTo my understanding, under these circumstances I should never see this get called while running my unit-tests because I do not change the default profile. This turns out not to be the case, as this is still getting scheduled and I see the output \n\n[test]\n\n\nin my console despite my best efforts to prevent it. What is happening? Why is this still running even with a different active profile?\n\nUPDATE:\nI can't give much more due to the fact this is a work-relevant application, but I'll give what I can.\n\nThe class is configured like so:\n\n@Configuration\n@EnableScheduling\npublic class BatchConfiguration {\n\n\nThe unit tests are all annotated like this:\n\n@SpringApplicationConfiguration(classes = SpringBatchJsontestApplication.class)\npublic class SpringBatchJsontestApplicationTests extends AbstractTestNGSpringContextTests {\n\n\nThe main application class is this:\n\n@SpringBootApplication\npublic class SpringBatchJsontestApplication {\n\n\nNone of them change anything else. There is no context.xml file, this is a SpringBoot application so everything is annotations only.\n\n\n\nThis is the end result that works very well for me\n\n @Profile(\"test\")\n @Bean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)\n @Role(BeanDefinition.ROLE_INFRASTRUCTURE)\n public ScheduledAnnotationBeanPostProcessor scheduleBeanProcessorOverride() {\n logger.info(\"Test Profile is active, overriding ScheduledAnnotationBeanPostProcessor to prevent annotations from running during tests.\");\n return new ScheduledAnnotationBeanPostProcessor() {\n @Override\n protected void processScheduled(Scheduled scheduled, Method method, Object bean) {\n logger.info(String.format(\"Preventing scheduling for %s, %s, %s\", scheduled, method, bean.getClass().getCanonicalName()));\n }\n };\n }\n\n\nHere is the POM configuration to trigger the testing profile, so I no longer have to do so explicitly in my application.properties.\n\n <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-surefire-plugin</artifactId>\n <version>2.19</version>\n <configuration>\n <systemPropertyVariables>\n <spring.profiles.active>test</spring.profiles.active>\n </systemPropertyVariables>\n </configuration>\n </plugin>" ]
[ "java", "spring", "spring-boot" ]
[ "Slack connection error. Failed to establish a new connection: [Errno -2] Name or service not known", "I have facing connection issue in slack api. I ran this code inside the vagrant Ubuntu 14.04.4 virtual machine. \n\nsc = SlackClient(token)\nprint sc.api_call(\"api.test\")\n\n\nI tried above example code from slackclient library and getting following error. \n\n\n requests.exceptions.ConnectionError:\n HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded\n with url: /api/api.test (Caused by\n NewConnectionError(': Failed to establish a new connection:\n [Errno -2] Name or service not known',))\n\n\nHow do I resolve this error?" ]
[ "python", "ubuntu-14.04", "python-requests", "slack-api", "urllib3" ]
[ "Decimal format mask in Drupal 7", "In Drupal 7 is it possible to specify an input mask for a decimal so that the value is right justified and comma separated after input has been done?" ]
[ "drupal-7", "format", "decimal" ]
[ "angular.js Assert error throw async", "I'm testing an angular.js app using karma with sinon-chai. I need to test a code like this:\n\nvar sync = function() {\n async.then(function() {\n // success\n }, function() {\n throw Error('foo');\n });\n}\n\n\nsync is the function I want to test. async is a function returning a $q promise I want to test it fails throwing an error.\n\nMy ideal test suit:\n\ndescribe('unit', function() {\n it('should throw an error', function() {\n expect(function() {\n return sync();\n }).to.throw(Error, 'foo');\n })\n});\n\n\nBut, it fails at afterEach() because the error is thrown on $digest.\n\nHow can I achieve this test?\n\nThank you very much!" ]
[ "javascript", "angularjs", "asynchronous", "assert", "throw" ]
[ "How to set document title by React Native Web with react-navigation?", "My web application is created by React Native Web with react-navigator.\nreact-navigator sets RouteName as document.title in default.\nex.\n<Stack.Navigator screenOptions={{ headerShown: false }}>\n <Stack.Screen name="root" component={RootScreen} />\n <Stack.Screen name="search" component={SearchScreen} />\n</Stack.Navigator>\n\ngenerates\n...\n<head>\n <title>root</title>\n ...\n\nWhat I want\nChanging document.title on demand.\nWhat I tried but not works\ntry to access document object directly, but below code does not works.\nexport default function RootScreen({ navigation }) {\n useEffect(() => {\n document.title = `My Web App | ${someMessage}`\n })" ]
[ "react-native", "react-navigation", "react-native-web" ]
[ "Generating a subroutine reference from a string", "I'm creating a dispatch table: \n\n my $dispatch = { \n 'do_this' => \\&do_this,\n 'do_that' => \\&do_that,\n 'do_something' => \\&do_something,\n 'do_something_else' => \\&do_something_else,\n };\n\n\nInstead of typing in the same string of chars for the key and the value, I'd like to do this:\n\nmy $dispatch_values = ['do_this', 'do_that', 'do_something', 'do_something_else'];\nmy $dispatch = generate_dispatch_table($dispatch_values);\n\nsub generate_dispatch_table {\n my $values = shift;\n my $table = {};\n foreach $value (@$values) {\n $table{$value} = #WHAT GOES HERE?\n }\n return $table; \n}\n\n\nI don't know how to generate a subroutine reference from a string, though." ]
[ "perl" ]
[ "How to use or access newly created pipeline variable inside a exe of C# so that i can assign value inside program in azure dev-ops build pipeline?", "How to use or access newly created custom pipeline variable inside a executable created through C# so that I can assign value inside program in Azure DevOps build pipeline?\n\nLet me explain my query in detail:\n\nI have a build pipeline created in Azure DevOps for my project. If I select EDIT option on this Pipeline I see a tab or section at top with title as Variables, here selected Pipeline Variables and Clicked on ADD to create my own custom variable lets say VersionNumber and checked the settable at queue time option.\n\nOn the side I also have a C# based Console Application which accepts command line arguments and does some process. \n\nI created an additional task in the build pipeline of Command Line where i have given my Executable file path such that it can pick and execute it.\n\nNow, here's is my query or issue:\n\n\nHow to pass the custom variable created above as a command line argument to my exe such that i can assign the value inside my program to be used in further tasks in the pipeline?\n\n\nIf this is not possible then:\n\n\nHow can i return values from my exe such that when executed as part of pipeline the values can be used in next tasks of the build pipeline?\n\n\nPlease note that the logic in the exe is written using C# and inside main method itself as there are only few lines of code which gets executed and gets the value.\n\nHow to achieve or tackle the above issue/query?\n\nCan you please help me on this? and please try to explain in a detailed step by step guide manner as I am bit new to coding, C# and Azure DevOps?\n\nTried to pass the command line arguments as $VersionNumber but was not useful apart from this did not get anything to process." ]
[ "c#", "azure", "azure-devops", "azure-pipelines" ]
[ "Jquery Datatable default sorting not working", "I have a table containing 3 columns A, B and C. Now By default I want to sort it on base of C at start. But I don't know why It's not working. It's shows the down arrow on columns C, but data are not sorted.\n\n\n\n{\n \"processing\": true,\n \"scrollX\": true,\n \"columns\": [\n {\n bSortable: true\n bVisible: true\n data: \"A\"\n filtering: true\n label: \"A\"\n mData: \"A\"\n mRender: (data, type, row)\n orderable: true\n render: (data, type, row)\n total: false\n visible: true\n },\n {\n bSortable: true\n bVisible: true\n data: \"B\"\n filtering: true\n label: \"B\"\n mData: \"B\"\n mRender: (data, type, row)\n orderable: true\n render: (data, type, row)\n total: false\n visible: true\n },\n {\n bSortable: true\n bVisible: true\n data: \"C\"\n filtering: true\n label: \"C\"\n mData: \"C\"\n mRender: (data, type, row)\n orderable: true\n render: (data, type, row)\n total: false\n visible: true\n },\n ],\n \"pageLength\": 10,\n \"paging\": true,\n \"pagingType\": \"simple_numbers\",\n \"lengthChange\": false,\n \"bPaginate\": false,\n \"bDeferRender\": true,\n \"bSortable\": true,\n \"columnDefs\": [],\n \"searching\": false,\n \"oScroll\": {\n \"iBarWidth\": 7\n },\n \"dom\": \"frtlS\",\n \"aaSorting\": [ [ 2, \"desc\" ] ],\n \"aoColumnDefs\": [\n {\n \"aTargets\": [ 0 ], \"bSortable\": true\n },\n {\n \"aTargets\": [ 1 ], \"bSortable\": true\n },\n {\n \"aTargets\": [ 2 ], \"bSortable\": true\n }\n ]\n}\n\n\nAny type of help would be highly appreciated." ]
[ "javascript", "jquery", "datatables" ]
[ "How to debug Django commands in PyCharm", "I know how to run commands with PyCharm (Tools -> Run manage.py Task), but I would like to debug them also, including my commands and third party app's commands." ]
[ "django", "pycharm" ]
[ "Speed test of a web page : how to get the theoretical loading speed", "There are many tools online to measure the speed of a web page.\nThey provide data such as the loading time of a page.\nThis loading time depends on the number of files downloaded at the same time and the connection speed (and many other things such as the network state, the content providers, so on).\n\nHowever, because it is based on the speed of the connection, we don't have the theoretical loading time.\nA browser downloads many resources at the same time within a certain limit (5 resource at the same time). So it is optimized to load the resources faster.\nIf we could set the speed connection to a fixed amount, the loading page of a page would \"never\" change.\n\nSo does anyone know a tool which computes this theoretical loading time of a web page ?\n\nI'd like to get this kind of results :\nTheoretical loading time : 56 * t\nWith t equals the amount of time to download 1kb of data." ]
[ "performance", "browser", "webpage", "theory", "pagespeed" ]
[ "Create an extended class in PHP using instance of the base class?", "In Wordpress, I would like to add some functionality to the 'wpdb'(database) class, and extend it. The 'wpdb' instance is created by Wordpress at startup, so I can not get it to use my derived class. Can I some how instantiate my derived class with the 'wpdb' instance? Something like:\nclass MyWPDB extends wpdb\n{\n /**\n * Constructor using an instance of base class 'wpdb'\n * @param wpdbInstance A 'wpdb' instance\n */\n public function __construct(wpdbInstance) {\n // Use 'wpdbInstance' to instantiate this object\n }\n}" ]
[ "php", "class", "inheritance" ]
[ "addition of values in node.js", "above is result of below snippet of code\n\n var total_points = 0\nfor(var i = 0; i < req.body.requisites.length; i++){\n\n total_points = total_points + req.body.requisites[i].points\n console.log(req.body.requisites[i].points , total_points)\n}\nconsole.log('total points :' + total_points)\nreq.body.points = total_points\n\n\nI am not getting why one time it is concatenating the results (see the last values before 'total points') and next time it calculates correctly.\n\nAppreciated if you can help.\n\nThanks in advance!" ]
[ "node.js", "express" ]
[ "Amazon Textract skip some form fields when doing analysis", "I am calling Amazon Textract api for analyze pdf scanned image and it skipped some fields as key value pair. Is there any way to train or specifically point to map key value pair properly?" ]
[ "amazon-web-services", "aws-textract" ]
[ "Grails Tomcat Render GSP template", "In a controller i have ,, \n\nrender(template: 'bookingHeader', model: [memberInstance:memberInstance,bookingInstance: bookingInstance, eventInstance: eventInstance])\n\nrender(template: 'bookingAccounts', model: [memberAccountInstanceList:memberInstance.memberAccounts])\n\n\nwhich correctly renders info to the screen .. \n\nIn a gsp I have\n g:render template=\"bookingheader\" model=\"'booking':bookingInstance,'member':memberInstance]\"/>\n\nBoth work fine in my test environment (Intellij ) but the gsp tag fails when\ndeployed in a war to tomcat .. So i moved t template to a common directory and\nput an\n\nexplicit reference in ..\n\ng:render template=\"/common/bookingheader\" model=\"['booking': bookingInstance,\n\n\n'member': memberInstance]\"/>\n\nit still failed with .. \n\nError 500: Error processing GroovyPageView: Template not found for name\n[/common/bookingheader] and path [/common/_bookingheader.gsp] at \n/WEB-INF/grails-app/views/booking/details.gsp:33\nServlet: grails\nURI: /apollo/grails/booking/details.dispatch\nException Message: Template not found for name [/common/bookingheader] and path\n[/common/_bookingheader.gsp] at \n/WEB-INF/grails-app/views/booking/details.gsp:33\n\nCaused by: Error processing GroovyPageView: Template not found for name\n[/common/bookingheader] and path [/common/_bookingheader.gsp] at \n/WEB-INF/grails-app/views/booking/details.gsp:33\n\nClass: gsp_apollo_bookingdetails_gsp\nAt Line: [33]\nCode Snippet:\n\nMy environment is Grails 1.2.2 deploying to Tomcat 6 .. This is really causing\nme some grief ..\n\nI checked the web app directories and as far as i can see the GSP'S are where\nthey should be .. in Tomcat 6.0\\webapps\\apollo\\WEB-INF\\grails-app\\views\\common\n\nCan anyone shed any light ???" ]
[ "templates", "grails" ]
[ "How can I have one item of menu rtl and another one ltr?", "I have this menu:\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item\n android:id=\"@+id/choosemap\"\n android:title=\"اولین آیتم\"/>\n <item\n android:id=\"@+id/choosespinner\"\n android:title=\"abc\" />\n</menu>\n\n\nAnd this is output:\n\n\n\nI want to have Persian title rtl and English title ltr (now both of them are ltr), how can I do this?" ]
[ "android", "menu", "menuitem" ]
[ "Packing ext type in C++ with Msgpack", "I am looking for a sample how to pack ext types with msgpack in C++ as I am not sure about how to do this.\n\nThe only information I found is located in this section https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_packer#pack-manually.\n\nAssumed I want to pack an object of type Foo as a msgpack ext type with an adaptor class template. How to use pack_ext and pack_ext_body? Do I have to create a \"sub packer\" within the template, pack my Foo data manually and then pass size of the binary data and the data itself to pack_extand pack_ext_body? It would be create if some C++ expert could give me a minimal example.\n\nMSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {\n namespace adaptor {\n template<>\n struct pack<Foo> {\n template <typename Stream>\n packer<Stream>& operator()(msgpack::packer<Stream>& o, Foo const& v) const {\n // how to use ?\n o.pack_ext(size_t l, int8_t type);\n o.pack_ext_body(const char* b, size_t l);\n }\n }\n }\n\n\n}\n\nThanks in advance!" ]
[ "c++", "msgpack" ]
[ "How to integration test Spring Boot application with multiple configurations", "We currently have a integration test base class\n\n@SpringApplicationConfiguration(classes = { MyApp.class, TestConfig.class })\n@IntegrationTest({\n \"foo:bar\",\n \"baz:qux\"\n})\n@WebAppConfiguration\n@RunWith(SpringJUnit4ClassRunner.class)\npublic abstract class BaseIntegrationTest {\n ...\n}\n\n\nWhat we'd like to do is add a parameter to @IntegrationTest for a single test class. This works quite well when running the tests in separately, but when running all tests, the parameter is not added.\n\nIs there a way around this? E.g., starting a new app for the single test class? \n\nBasically, what I'd like to do is:\n\npublic class TestOne extends BaseIntegrationTest { ... }\n\n@IntegrationTest({\n \"foo:zorblax\"\n})\npublic class TestTwo extends BaseIntegrationTest { ... }" ]
[ "spring-boot", "integration-testing", "spring-test" ]
[ "Restore style class after restart", "I want to save and restore the style class after restarting the application:\n\nif(answered)\n{\nthis.getStyleClass().add(\"GREEN\");\n}\n\n\nSo how can I save the style for the next start?" ]
[ "java", "javafx", "styles", "restore" ]
[ "Is there a TSO command written in REXX or CLIST that can determine WHO has enqueued a dataset?", "I need to write a REXX Exec or Clist to identify WHO has enqueued a Dataset and display a user friendly message on an ISPF dialog application. Due to system configuration issues, the %WHOHAS command is not available. However I also know that ISPF itself (Option 3.4) has proprietary hooks into the zos mainframe to display the enqueued resource information I need - so the infomation can be obtained. Unfortunately I don't know how to access this data from outside ISPF 3.4 using a REXX Exec or CLIST. Any suggestions?" ]
[ "mainframe", "zos", "rexx", "tso", "clist" ]
[ "jQuery - Logging order of checkbox clicks", "I have a system that is tracking volunteers for a performing arts center. When they sign up to work a shift they can also sign up a buddy (or buddies). There's also a waiting list if we have too many sign-ups. The form looks like so for selecting buddies:\n\n\n\nIf the waiting list only has one position left on it I need to turn the next person's name red if they are selected (so John is selected, but when Jane is checked she turns red to serve as a warning). \n\nMy problem is that the user might decide to check them both, then uncheck John instead of Jane, which should then make Jane turn black again.\n\nIs there an easy way to track clicks using something like:\n\n$(\"input:checkbox\").change(function(){\n\n $(\"input:checked\").each(function(i){\n\n //object/array manipulation?\n\n });\n\n});\n\n\nI had it working okay using the index of the element but realized that wouldn't work since it would keep track of the order in which the checkboxes were checked in the first place.\n\nEven a point in the right direction would be amazing. I realize I haven't given much to go on.\n\nThanks,\n\nJason" ]
[ "jquery", "arrays", "object", "checkbox" ]
[ "Bring bluetooth pairing dialogue to the front", "I've a simple service to pair bluetooth devices and it look like this: \n\nprotected void onHandleIntent(Intent intent) {\n Bundle extras = intent.getExtras();\n if(!extras.containsKey(\"bluetoothAddress\"))\n return;\n String bluetoothAddress = extras.getString(\"bluetoothAddress\");\n BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();\n if(!adapter.isEnabled()) {\n adapter.enable();\n }\n BluetoothDevice device = adapter.getRemoteDevice(bluetoothAddress);\n device.createBond();\n}\n\n\nIt works perfectly fine except that sometimes the pair dialogue pop up and sometimes it show up in my notifications bar and I have to open it manually. Is there any way to make sure that it always pop up to the front? \n\nI've tried to google on it and only thing I can find is that if you stay in bluetooth settings it always pop up, but that seems like a ugly solution. The reason for all of this is that I'm working with automation and want to make sure that when I run my service I get the pair dialogue can just click \"Pair\"." ]
[ "android", "bluetooth" ]
[ "How do I add an object to a binary tree based on the value of a member variable?", "How can I get a specific value from an object?\nI'm trying to get a value of an instance\nfor eg. \n\nListOfPpl newListOfPpl = new ListOfPpl(id, name, age);\nObject item = newListOfPpl;\n\n\nHow can I get a value of name from an Object item??\nEven if it is easy or does not interest you can anyone help me??\n\nEdited: I was trying to build a binary tree contains the node of ListOfPpl, and need to sort it in the lexicographic. Here's my code for insertion on the node. Any clue??\n\n public void insert(Object item){\n Node current = root;\n Node follow = null;\n if(!isEmpty()){\n root = new Node(item, null, null);\n return;\n }boolean left = false, right = false;\n while(current != null){\n follow = current;\n left = false;\n right = false;\n //I need to compare and sort it\n if(item.compareTo(current.getFighter()) < 0){\n current = current.getLeft();\n left = true;\n }else {\n current = current.getRight();\n right = true;\n }\n }if(left)\n follow.setLeft(new Node(item, null, null));\n else\n follow.setRight(new Node(item, null, null));\n }" ]
[ "java", "variables", "object", "binary-tree" ]
[ "raise ConnectionError in python2.7", "i want to raise ConnectionError (a python 3 subclass) when my program fails to connect to a local service. i'm using python2.7. testing this out though, it looks like i have to import a module to get this working:\n\n>>> raise ConnectionError(\"test\")\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nNameError: name 'ConnectionError' is not defined\n\n\nhow can i raise this type of exception?" ]
[ "python", "python-2.7" ]
[ "SELECT WHERE IN (subquery) slow", "I've tried the solution here, but it doesn't work.\n\nMy table is like this:\n\n `Index` uid dept\n...........................\n 1 001 dept1\n 2 001 dept2\n 3 001 dept3\n 4 002 dept2\n 5 002 dept3\n 6 002 dept4\n 7 003 dept1\n 8 003 dept5\n 9 004 dept1\n 10 004 dept6\n\n\nI want to retrieve all the rows with a particular dept. That is, If I want to retrieve dept1, I want to retrieve all rows except uid=002, since there's no dept1 for uid=002.\n\nThe query string is slow even when using index:\n\nSELECT id FROM table WHERE uid IN\n(SELECT uid WHERE dept='dept1')\n\n\nMy previous version without using WHERE IN is as following:\n\n\n Retrieves all the uid with dept=dept1 first.\n Then use a for-loop for all uid retrieved in the first query.\n\n\nThis method is very fast for a small amount(100) of rows retrieved in the first query. However, it seems that it's not a good solution because it creates a lot of queries(each of them is extremely fast)." ]
[ "mysql", "performance", "select", "subquery", "where-clause" ]
[ "passing parameters to get function within FOSRestBundle", "To be short, when accessing a GET action something like offset/limit will also need to be concluded. I'm wandering how to set parameters for this?\n\nLike this:\n\npublic function getThreadsAction($userKey, $offset, $limit)\n{ #logic here\n ......\n}\n\n\nOr using ParameterFetcherInterface:\n\npublic function getThreadsAction($userKey, ParameterFetcherInterface $fetcher)\n{ #logic here\n $offset = $fetcher->get('offset');\n ......\n}\n\n\nOr using Request directly:\n\npublic function getThreadsAction($userKey, Request $request)\n{ #logic here\n $offset = $request->get('offset');\n ......\n}\n\n\nTemporarily if it's like the first one, the route looks like /api/threads/{userKey}.{_format}.\n Do I need to set a @GET()annotation? Otherwise if it goes in the other ways is it necessary to set a @QueryParam for limit & offset?\n\nThanks in advance." ]
[ "rest", "symfony", "fosrestbundle" ]
[ "What's wrong with my PHP for loop?", "What's wrong with my PHP loop?\nIt just loops until it eventually times out.\n\n$max = 7;\n$derp = $a / 5;\nfor($i = 1; $i < $max; $i++){\nif($i = $derp){\necho\"<option value='$derp' selected='selected'>$derp</option>\";\n}else{\necho\"<option value='$i'>$i</option>\";\n}\n}" ]
[ "php", "html" ]
[ "Sending a javascript XML dom to server to save to local file", "I've been trying to figure this out for several hours now to no avail. In javascript, I have string of XML that I've created:\n\nvar txt=\"<bookstore><book type='cooking'>\";\ntxt+=\"<title>Everyday Italian</title>\";\ntxt+=\"<author>Giada De Laurentiis</author>\";\ntxt+=\"<year>2005</year>\";\ntxt+=\"</book>\";\n\n\nI've then used this to create the XML dom:\n\nif (window.DOMParser) {\n var parser=new DOMParser();\n var xmlDoc=parser.parseFromString(txt,\"text/xml\");\n}\nelse{ // Internet Explorer\n var xmlDoc=new ActiveXObject(\"Microsoft.XMLDOM\");\n xmlDoc.async=false;\n xmlDoc.loadXML(txt);\n}\n\n\nI need to send the xmlDoc to a server page (an asp page I think) where the server will prompt me to save the xml file to my local drive. I don't have too much experience with this, and have hit a road block. I know that I need to create an XMLHttpRequest and post my xmlDoc to an asp page:\n\nvar xmlhttp = new XMLHttpRequest();\nxmlhttp.open(\"POST\", \"http://MYSERVERURL/xml.ASP\", false); \nxmlhttp.send(xmlDoc); \n\n\nMy problem is that I have no idea what should go into my xml.ASP page to receive the xmlDoc and prompt me to save to an xml file.\n\nI have this so far, but really don't know where to go from here:\n\n<%\nresponse.ContentType=\"text/xml\"\nset xmldoc = Server.CreateObject(\"Microsoft.XMLDOM\")\nxmldoc.async=false\nxmldoc.load(request)\n%> \n\n\nAny help is greatly appreciated.\n\nThanks." ]
[ "javascript", "xml", "dom", "asp-classic" ]
[ "Java mySQL with 000webhost", "I created a mySQL database on 000webhost and I wanted to connect it into my Java program but somehow driver aren't receiving sockets. Here is my code:\n\nClass.forName(\"com.mysql.jdbc.Driver\");\nConnection conn = DriverManager.getConnection(\"jdbc:mysql://mysql2.000webhost.com/a4931569_users/Users\", username, pass);\n\n\nwhere a4931569_users is database, Users is table. Please help me." ]
[ "java", "mysql" ]
[ "Sinatra test with sessions and concurrent access", "I wanted to write a little tests that concurrently accesses my little sinatra app.\n\nThe problem here is, that I use sessions (via Rack::Session::Pool). I could not figure out how to let rack-test spawn a new session. Whe I inject session data in my request, I always end up with one session. So I can basically have only 1 session at a time.\n\nIn my test I tried the following:\n\nthreads = []\n2.times do |index|\n threads << Thread.new do\n get \"/controller/something\", {}, \"rack.session\" => {:id => \"Thread#{index}\"}\n post \"/do_action\"\n end\nend\nthrads.each{|t| t.join}\n\n\nIs there some kind of \"Browser-Layer where I can have multiple instances\"?\n\nEDIT: I am sorry I have to clarify: The threading example was just a wild guess to get a new session. It didn't work. So I'm just looking for a way to open multiple sessions on a runnin (test)server. In development mode I can just open a new browser session to achieve such a thing. In test mode I'm currently lost." ]
[ "ruby", "session", "sinatra", "rack" ]
[ "How to use combinations of sets as test data", "I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns true whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is more, main aim is to generate combinations of these values, with or without repetition, in order to get a set of test data.\n\n(inf,0,-1), (5,10,1000), (10,5,5), (0,-1,5), (1000,inf,inf),\n...\n\n\n\n As a note: I actually know the answer to this, but it might be helpful for others, and a challenge for people here! --will post my answer later on." ]
[ "unit-testing", "language-agnostic", "testing" ]
[ "What is the correct way to clear a class instance of its recursive pointers to a same class instance", "I'm building a reset function to a very simple octree class which goal is to reset all of the octree instances created by this same octree.\n\nThe octree.h class defines a public array of pointers like this\n\nOctree *children[8];\nbool subdivided; // true if has children\n\n\nand this is the reset function in octree.cpp\n\nvoid Octree::reset()\n{\n if(subdivided)\n {\n for (int i = 0; i < 8; ++i)\n {\n children[i]->reset();\n children[i] = NULL;\n }\n }\n}\n\n\ninstances of the octree class are initiated using new in a class subdivision() function.\n\nEverytime I run this code I get a exception thrown\n\n\n Access violation reading location 0x0000000000000000\n\n\nWhich according to the call stack, comes from an insert() function called after the reset(), which should repopulate the tree.\n\nWhat I understand is that the function that is causing the exception is trying to read the pointer (which is now NULL). I think this means my object is still there, but my pointer isn't. How do I recursively access and delete all my children ?\n\nedit : \n\nI solved it, the error was coming from the fact that I wasn't updating the isSubdivided variable and was only resetting the pointers not deleting the objects.\n\nvoid Octree::reset()\n{\n if(subdivided)\n {\n for (int i = 0; i < 8; ++i)\n {\n children[i]->reset();\n delete children[i];\n }\n subdivided = false;\n }\n}\n\n\nThe memory doesn't seem to leak anymore and there are no more thrown exceptions, thanks everyone :)" ]
[ "c++", "class", "oop" ]
[ "Android: Looking for different TimePicker Style", "Hello everyone a brief question - I have been hunting for this style of TimePicker to no avail so far(as shown on DroidDraw):\n\n\n\nI start doubting the existence of that style ... :P Anyone who's got a clue on how to get my hands on it - thanks in advance.\n\nCheers,\nReady4Android" ]
[ "android", "android-widget", "widget", "timepicker" ]
[ "Octave: How to turn a vector of integers into a cell array of strings?", "In Octave:\nGiven a vector\na = 1:3\n\nHow to turn vector "a" into a cell array of strings\n{'1','2','3'}\n\n(Output of this:)\nans =\n{\n [1,1] = 1\n [1,2] = 2\n [1,3] = 3\n}\n\n(question end)\n\nFurther information: my aim is to use a as the input of strcat('x',a) to get\nans =\n{\n [1,1] = x1\n [1,2] = x2\n [1,3] = x3\n}\n\nOther solutions how to reach this aim are welcome, but the main question is about getting an array of strings directly from a vector.\nThis question is a follow-up from cell array, add suffix to every string which could not help me, since strcat('x',{'1','2','3'}) works, but strcat('x', num2cell(1:3)) does not:\n>> strcat('x', num2cell(1:3))\nwarning: implicit conversion from numeric to char\nwarning: called from\n strcat at line 121 column 8\n C:/Users/USERNAME/AppData/Local/Temp/octave/octave_ENarag.m at line 1 column 1\n\nwarning: implicit conversion from numeric to char\nwarning: called from\n strcat at line 121 column 8\n C:/Users/USERNAME/AppData/Local/Temp/octave/octave_ENarag.m at line 1 column 1\n\nwarning: implicit conversion from numeric to char\nwarning: called from\n strcat at line 121 column 8\n C:/Users/USERNAME/AppData/Local/Temp/octave/octave_ENarag.m at line 1 column 1\n\nans =\n{\n [1,1] = x[special sign "square"]\n [1,2] = x[special sign "square"]\n [1,3] = x[special sign "square"]\n}\n\nAlso, the Matlab function string(a) according to Matlab: How to convert cell array to string array?, is not yet implemented:\n\n"The 'string' function is not yet implemented in Octave.`" ]
[ "string", "vector", "type-conversion", "octave" ]
[ "how to mark and reuse reports and avoid deleting these marks", "i have several reports in jasper, and i want to mark these reports by type so i can search these mark to find and reuse my reports\n\nto do this i open the jrxml and add a comment in the header of the xml, with the mark @REPORTE and type name, for example:\n\n@REPORTE informe con detalle de cobranza\n\nthe problem occurs when i compile the project, netbeans remove all my marks.\nis there anyway to configure the netbeans avoid delete these marks\n\ni using netbeans 7.2 the the ireport plugin\n\nthanks" ]
[ "java", "netbeans", "jasper-reports" ]
[ "logdna only stream logs from a specific route via elastic beanstalk logdna agent", "I am integrating LogDNA with Elastic beanstalk. I have already added the config file as follows:\nfiles:\n "/home/ec2-user/logdna.sh" :\n mode: "000777"\n owner: root\n group: root\n content: |\n #!/bin/sh\n rpm --import https://repo.logdna.com/logdna.gpg\n echo "[logdna]\n name=LogDNA packages\n baseurl=https://repo.logdna.com/el6/\n enabled=1\n gpgcheck=1\n gpgkey=https://repo.logdna.com/logdna.gpg" | sudo tee /etc/yum.repos.d/logdna.repo\n yum -y install logdna-agent\n logdna-agent -k <INGESTION_KEY> # this is your unique Ingestion Key\n # /var/log is monitored/added by default (recursively), optionally add more dirs here\n logdna-agent -d /var/path/log\n # logdna-agent --hostname allows you to pass your AWS env metadata to LogDNA (remove # to uncomment the line below)\n # logdna-agent --hostname `{"Ref": "AWSEBEnvironmentName" }`\n # logdna -t option allows you to tag the host with tags (remove # to uncomment the line below)\n #logdna-agent -t `{"Ref": "AWSEBEnvironmentName" }`\n chkconfig logdna-agent on\n service logdna-agent start\ncommands:\n 01_install_logdna:\n command: "/home/ec2-user/logdna.sh"\n 02_restart_logdna:\n command: "service logdna-agent restart"\n\nI know that i can add specific files to be monitored by doing `logdna-agent -d /path/log-to-be-monitored\nBut in my own scenario, i dont want to stream or monitor logs from all sources. I only want to capture / monitor logs from a specific route `/api.\nI want to only monitor/ capture logs or data from this route. How do i do that using LogDNA agent?" ]
[ "amazon-web-services", "amazon-elastic-beanstalk", "logdna" ]
[ "Perform a Union as well as a NOT IN/NOT EXISTS", "I am trying to return all info for products that the current user has purchased as long as those products are not in the product review table. \n\nRight now, there is an Orders table, which holds all orders and contains the UserId. \n\nThere is an OrderItems table which contains all items ordered for each order (based on the OrderId) as well as the ProductId for each item. \n\nHowever, there is also another table to check for orders that may have been made outside the store website (this table is called ApprovedProductReviews and contains a User Id field and a Product Id field)\n\nFinally, there is the ProductReviews table which contains all submitted reviews for all products (and it contains the ReviewerProfileId (which is the same as the UserId) and the ProductId).\n\nSo far, I have been able to check to see if the current user has purchased a particular product with success:\n\nSELECT [ProductId], [UserId] \nFROM [Orders] \nINNER JOIN [OrderItems] ON UserId= [current user id] \n WHERE [ProductId] = [whatever the current product id is])\n OR [ProductId] IN \n (SELECT [uidProduct] \n FROM [ApprovedProductReviews] \n WHERE [uidProduct]= [current user id])\n\n\nBut I am not sure how to alter this code to get check if a ProductId exists in the ProductReviews table. I suspect I may have to do a UNION but I am not sure...Any help would be appreciated!\n\nTo clarify some more, what I need to look at in the ProductReviews table is the ProductId and ReviewerProfileId (which is the same thing as the UserId. So, basically, ReviewerProfileId = UserId). I need to check to see if the ReviewerProfileId matches the current user's id, then I need to go through the Orders table to get the UserId, as well as the OrderItems table to get the ProductId, and I need to check in the ApprovedProductReviews table for the UserId and ProductId as well (this ApprovedProductReviews table may contain orders for a user that were placed outside of the site, hence, they will not appear in the Orders table but still count as valid orders).\n\nSo, I need to combine 3 tables just to get the proper UserId and ProductId information, and then I need to take the ProductId and see if it is in the ProductReviews table where UserId = ReviewerProfileId. \n\nHopefully, that all makes sense." ]
[ "sql", "join", "union" ]
[ "Replacing variables names dynamically like string parts", "I'd like to optimise my code using a single function to process multiple possibilities depending on the situation: here it is different currencies.\n\nI know how to do it when I use strings with the \\(something) syntax and I'd like something similar for variables.\n\nHere is my current situation for USD:\n\nif WalletViewController.currencyUSD == true {\n if CurrentDifferenceFunctions.buyOrSellBitcoinUSD == 1 {\n if let lastBitcoinBuyPrice = UserDefaults.standard.object(forKey: \"lastBitcoinBuyPrice\\(currentCurrency)\") as? Double {\n CurrentDifferenceFunctions.savedBitcoinPrice = lastBitcoinBuyPrice\n }\n } else if CurrentDifferenceFunctions.buyOrSellBitcoinUSD == 2 {\n if let lastBitcoinSellPrice = UserDefaults.standard.object(forKey: \"lastBitcoinSellPrice\\(currentCurrency)\") as? Double {\n CurrentDifferenceFunctions.savedBitcoinPrice = lastBitcoinSellPrice\n }\n }\n}\n\n\nHow can I replace USD everytime it appears by another currency when needed and then be able to use the same function for different currencies? Would using arrays help here?\n\nI have a few dozens cryptos and as many currencies to process, any help would be gold!\n\nPS: I'm sorry about the redundant WalletViewController.currencyUSD == true but I like to keep my work literal until I fully understand the logic." ]
[ "arrays", "swift", "string", "variables" ]
[ "how to search particular data in file and replace the string next to it in batch file", "Hello I am trying to search particular string in file and want to replace that string with other string in batch file. \n\nFor example, I am having a.txt containing following data:\n\nline 1: Name: abc\nline 2: Some words then age: 24 something\nline 3: country:xyz\n\n\nNow i want to find with \"age:\" and want to replace to \n\nline 2: Some words then age: 30 something\n\n\nand save in same a.txt. \n\nthanks for help" ]
[ "batch-file" ]
[ "Castle 3.0 ILogger breaks the NVelocityTemplateEngine wrapper?", "It appears that the the ILogger interface in 3.x is missing a method for .Info that the TemplateEngineNeeds. I'm getting the following error...\n\nMethod not found: 'Void Castle.Core.Logging.ILogger.Info(System.String, System.Object[])'.\n\n\nI'm using version 1.1.1.0 Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine. Perhaps this isn't the correct version so any help in pointing out the correct version would be greatly appreciated." ]
[ "castle-windsor", "nvelocity" ]
[ "How to add UserControl to a Panel on a WPF Window", "I think I'm missing something that should be obvious here, but I'm drawing a blank on this one.\n\nI've built a very primitive UserControl containing nothing more than a TextBox to use as a log window:\n\n<UserControl x:Class=\"My.LoggerControl\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n x:Name=\"LoggerView\">\n <Grid x:Name=\"LayoutRoot\">\n <TextBox x:Name=\"LogWindow\" AcceptsReturn=\"True\"/>\n </Grid>\n</UserControl>\n\n\nI don't expect that to be the best way to do it, but it should be good enough for a prototype.\n\nThe code-behind is similarly simple:\n\npublic partial class LoggerControl : UserControl, ILogger\n{\n public LoggerControl()\n {\n InitializeComponent();\n }\n\n private LogLevel level = LogLevel.Warning;\n\n #region ILogger\n\n public LogLevel Level\n {\n get { return level; }\n set { level = value; }\n }\n\n public void OnError(string s)\n {\n if (level >= LogLevel.Error)\n LogWindow.AppendText(\"ERROR:::\" + s + \"\\n\");\n }\n\n // ...\n #endregion\n}\n\n\nThe thing I can't figure out is how to add this control to my MainWindow.xaml. Simplifying, lets say my window looks like this:\n\n<Window x:Class=\"My.MainWindow\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:local=\"clr-namespace:My\"\n Title=\"Test\" Height=\"350\" Width=\"525\">\n <Grid>\n <local:LoggerControl x:Name=\"LogView\" />\n </Grid>\n</Window>\n\n\nEven with something so simple, the Designer in Visual Studio 2010 can't load the main window. The error given is:\n\n\n A value of type 'LoggerControl' cannot be added to a collectionor dictionary of type 'UIElementCollection'.\n\n\nThis error message has only one unrelated hit in the major search engines (plus duplicates) so I haven't found any useful help. Microsoft's own documentation seems to imply that this should work.\n\nAny idea how to solve this?" ]
[ "wpf", "xaml", "user-controls" ]