texts
sequence | tags
sequence |
---|---|
[
"MySQL: SUM function applied to a formula contained in field selected by another query",
"I'm in the need to perform a select SUM() where that is a formula contained into a field selected by another query.\nExample:\n\ntable_A (the \"formula\" field contains, in each cell, an arithmetic expression involving columns from table B):\n\n+------------+--------------+------------+\n| Product_id | related_prod | formula |\n+------------+--------------+------------+\n| U1 | C2 | col2-col1 |\n| U2 | C3 | col3-col2 |\n| U3 | C4 | col3-col1 |\n+------------+--------------+------------+\n\n\ntable_B:\n\n+------------+---------+------------+----------+------+------+------+\n| Product_id | year_id | company_id | month_id | col1 | col2 | col3 |\n+------------+---------+------------+----------+------+------+------+\n| C2 | 2017 | 1 | 2 | 100 | 200 | 300 |\n| C3 | 2017 | 1 | 2 | 400 | 500 | 600 |\n| C4 | 2017 | 1 | 2 | 700 | 800 | 900 |\n+------------+---------+------------+----------+------+------+------+\n\n\nI do, then, the following query:\n\nSELECT \nSUM(totals.relaz) as final_sum, \ntotals.relaz as 'col', \ntotals.prod as 'prod', \ntotals.cons as 'cons', \nm.company_id, m.month_id, m.year_id, FROM `table_B` m, \n ( SELECT formula as relaz, \n related_prod as prod,\n p.product_id as cons FROM table_A p ) \n AS totals \nWHERE m.product_id=totals.prod \nGROUP BY m.company_id, m.year_id, m.month_id, m.product_id, totals.cons\n\n\nAfter the select I'd do expect that, considering for example the only product 'U1', the corresponding row would be\n\n+-----------+-----------+------+------+------------+----------+---------+\n| final_sum | col | prod | cons | company_id | month_id | year_id |\n+-----------+-----------+------+------+------------+----------+---------+\n| 100 | col2-col1 | C2 | U1 | 1 | 2 | 2017 |\n+-----------+-----------+------+------+------------+----------+---------+\n\n\nInstead, what I get is\n\n+-----------+-----------+------+------+------------+----------+---------+\n| final_sum | col | prod | cons | company_id | month_id | year_id |\n+-----------+-----------+------+------+------------+----------+---------+\n| 0 | col2-col1 | C2 | U1 | 1 | 2 | 2017 |\n+-----------+-----------+------+------+------------+----------+---------+\n\n\ni.e. the final_sum field is always set to 0, despite the 'col' field contains the correct equation.\n\nWhat am I doing wrong?\n\nThank you in advance\nAlex"
] | [
"mysql",
"mariadb"
] |
[
"What is the difference between signed and unsigned addition in vhdl?",
"If I add two signed numbers like -1 and -1 the result should be -2. If I add the same values but as unsigned the output will be the same.\n\nSo what's the difference between signed and unsigned?"
] | [
"vhdl"
] |
[
"Empty iterator range in vector constructor",
"Is it valid to pass empty iterator range in vector constructor?\nI.e. would it be undefined behaviour in the following code?\n\nstd::set<int> empty_set;\nstd::vector<int> target_vector(empty_set.begin(), empty_set.end());\n\n\nAccording to cppreference explanation, this constructor:\n\n\n Constructs the container with the contents of the range [first, last).\n\n\nDoest it mean first must be dereferenceable?"
] | [
"c++",
"stl"
] |
[
"SAS SQL: Merge consecutive rows with blank date if the next row is different",
"I have a table t1 with fields activity_name (integer) and status_change_dttm (date):\n\nactivity_name status_change_dttm\n------1------ -------null------- \n------1------ -------null------- \n------1------ 18FEB2019:19:16:13 \n------2------ -------null------- \n------3------ -------null------- \n------3------ -------null------- \n------3------ -------null------- \n------4------ -------null------- \n------5------ 03FEB2019:14:38:52 \n------5------ 04FEB2019:18:30:52\n------5------ 14FEB2019:12:00:12\n\n\nThe result should look like this: \n\nactivity_name status_change_dttm \n------1------ 18FEB2019:19:16:13 \n------2------ -------null------- \n------3------ -------null------- \n------4------ -------null------- \n------5------ 03FEB2019:14:38:52 \n------5------ 04FEB2019:18:30:52 \n------5------ 14FEB2019:12:00:12\n\n\nSo if I have rows with the same activity_name and null values in status_change_dttm and the next activity doesn't equal to the previous one, I need to merge these rows in one row. If I have rows with null values in status_change_dttm and the next row is with the same activity_name and status_change_dttm is not null, I need to drop only rows with nulls.\nTo conclude: \n\n1) IF NULL - NULL - DATE - next activity -> drop nulls \n2) IF NULL - NULL - NULL - next activity -> merge into one row \n3) IF DATE - DATE - DATE - next activity -> no changes \n4) IF one NULL - next activity -> no changes \n5) IF one DATE - next activity -> no changes \n\n\nI guess the key is lag/lead functions, but I don't understand the overall concept. Thanks."
] | [
"sql",
"sas",
"proc-sql"
] |
[
"Padding does not work with div",
"I am not a front-end developer so I suspect I might be missing something really basic. Nevertheless I cannot figure out a solution.\nI have a div element and I simply want to apply some padding at the top so that it does't interfere with the heading. I have looked around and I have seen similar problems with margin collapsing but I don't think it's the case since here I am dealing with two separate div not enclosing each other (tot-header and content).This is what I have written so far.\n\n<!DOCTYPE html>\n<html>\n <head>\n <title>Blogologo</title>\n <link rel=\"stylesheet\" href=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">\n <link href=\"css/head.css\" type=\"text/css\" rel=\"stylesheet\" />\n </head>\n <body>\n <div class=\"tot-header\">\n <div class=\"page-header\">\n <h1>Blogologo</h1>\n </div>\n <nav class=\"navbar navbar-default\">\n <div class=\"container-fluid\">\n <ul class=\"nav navbar-nav\">\n <li class=\"active\"><a href=\"#\">Home</a></li>\n <li><a href=\"#\">Racconti</a></li>\n <li><a href=\"#\">Rubriche</a></li> \n <li><a href=\"#\">Pesce fritto e baccal&#224;</a></li> \n </ul>\n </div>\n </nav>\n </div>\n <div class=\"content\">\n <div class=\"container\">\n <div class=\"row\"> \n <div id=\"central\" class=\"col-md-8\">\n Preview\n </div>\n <div id=\"side\" class=\"col-md-4\">\n <ul class=\"side-menu\">\n <li><a href=\"#\">Home</a></li>\n <li><a href=\"#\">Racconti</a></li>\n <li><a href=\"#\">Rubriche</a></li> \n <li><a href=\"#\">Pesce fritto e baccal&#224;</a></li> \n </ul>\n </div>\n </div>\n </div>\n </div>\n </body>\n</html>\n\n\nand the css\n\n.tot-header {\n position: fixed;\n top: 0px;\n width: 100%;\n text-align: center;\n}\n\n.navbar .navbar-nav {\n display: inline-block;\n float: none;\n vertical-align: top;\n}\n\n.content {\n padding-top: 10cm;\n}\n\n\nHowever the padding seems not to work. Any ideas?"
] | [
"html",
"css",
"twitter-bootstrap"
] |
[
"I hear always to use prepared statements, but in what about wordpress?",
"Question 1. I know I don't need to do them for wbdb->insert or wbpdb->delete, but people say do it anyway even though the class will do it for you. \n\n// I've got a select count query function and should use it here.\n\nglobal $wpdb;\n$entries = $wpdb->prefix . 'simpledir_entries';\n$count = $wpdb->get_var(\"SELECT COUNT(*) FROM $entries WHERE rel = $id;\");\n\nif($count <= 0){\n return false;\n}else{\n return true;\n} \n\n\nQuestion 2. I'm not sure how to formulate this into the proper prepared statement which is completely secured. Does $entries and $id both need it?\n\nThanks"
] | [
"php",
"mysql",
"wordpress"
] |
[
"Cannot convert lambda expression to type 'string' because it is not a delegate type",
"I am using a LINQ lambda expression like so: \n\nint Value = 1;\nqryContent objContentLine;\n\nusing (Entities db = new Entities())\n{\n objContentLine = (from q in db.qryContents\n where q.LineID == Value\n orderby q.RowID descending\n select q).FirstOrDefault();\n}\n\n\nHowever, I am getting the following error:\n\n\n Cannot convert lambda expression to type 'string' because it is not a delegate type"
] | [
"c#",
"asp.net",
"linq",
"lambda"
] |
[
"Jcombobox and switch case",
"I want to link my combobox selected item with switch case which result in different result depend on option chosen. But return in this error :Exception in thread \"AWT-EventQueue-0\" java.lang.ClassCastException: javax.swing.JComboBox cannot be cast to java.awt.event.ItemListener. Can only one help me, thanks you so much! \n\n private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { \n jComboBox1.addItemListener((ItemListener) jComboBox1);\n int usertype = (int) jComboBox1.getSelectedIndex();\n\nswitch (usertype) {\n case '1':\n new ResidentView().setVisible(true);\n this.dispose();\n break;\n case '2':\n new OfficeClerkView().setVisible(true);\n this.dispose();\n break;\n case '3':\n new OfficeManagerView().setVisible(true);\n this.dispose();\n break;\n}"
] | [
"switch-statement",
"jcombobox"
] |
[
"How to inherit build chain in Maven POM?",
"Seems like you can only inherit plugin configurations. Can I inherit the full tag?\n\nI want all my projects to use the same build chain. I was hoping to create a single parent pom w/ such a build chain. Sounds like a rather logical (and necessary) request, doesn't it?"
] | [
"maven",
"inheritance",
"plugins",
"build",
"pom.xml"
] |
[
"Failable Initializer for Decodable Classes",
"I would like the initialization to return nil in case title is missing. \n\n\nAdding a ? to init produces the following error:\n\n\n\n Non-failable initializer requirement 'init(from:)' cannot be satisfied by a failable initializer ('init?') \n\n\n\nAdding a if title == nil { return nil} produces the following error:\n\n\n\n Only a failable initializer can return 'nil'\n\n\nclass ClassA: Decodable {\n\n let title: String\n let subtitle: String?\n\n private enum CodingKeys: String, CodingKey {\n case title\n case subtitle\n }\n\n required init(from decoder: Decoder) throws {\n\n// changing the signature to:\n// required init?(from decoder: Decoder) throws\n// produced: \n// Non-failable initializer requirement 'init(from:)' cannot be satisfied by a failable initializer ('init?')\n\n let container = try decoder.container(keyedBy: CodingKeys.self)\n\n guard let theTitle = try container.decode(String.self, forKey: .title) else {\n\n return nil // Only a failable initializer can return 'nil'\n\n\n }\n\n title = theTitle\n subtitle = try? container.decode(String.self, forKey: .subtitle)\n }\n}"
] | [
"ios",
"swift",
"codable",
"decodable"
] |
[
"Not able to fetch all the columns while using groupby in pyspark",
"columnList = [item[0] for item in df1.dtypes if item[1].startswith('string')]\n\ndf2 = df1.groupBy(\"TCID\",columnList).agg(mean(\"Runtime\").alias(\"Runtime\"))\n\n\nWhile using like this I am getting the following error :\n\npy4j.protocol.Py4JError: An error occurred while calling z:org.apache.spark.sql.functions.col. Trace:\npy4j.Py4JException: Method col([class java.util.ArrayList]) does not exist\nat py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)\nat py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:339)\nat py4j.Gateway.invoke(Gateway.java:274)\nat py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)\nat py4j.commands.CallCommand.execute(CallCommand.java:79)\nat py4j.GatewayConnection.run(GatewayConnection.java:214)\nat java.lang.Thread.run(Thread.java:748)"
] | [
"pyspark",
"pyspark-sql"
] |
[
"Wait until process exit that run by Runtime.exec(\"wmic process call create notepad.exe\")",
"I am working on an application which is able to run programs, monitoring them to reopen in case the user closes them accidentally and close programs on log out.\n\nI am able to get process id of program by parsing the input stream of wmic process call create <program>.\n\nI use this code snippet to run programs and detect when program is closed by user. My problem is the command i use(wmic) to run programs exit immediately after running them. \n\nHow can i achieve detection of program exit?\n\nMy code: \n\npublic static void main(String[] args) {\n Process process = null;\n try {\n process = Runtime.getRuntime()\n .exec(\"wmic process call create \\\"notepad.exe\\\"\");\n BufferedReader stdin = new BufferedReader(\n new InputStreamReader(process.getInputStream()));\n String processIdLine = \"\";\n String line;\n while ((line = stdin.readLine()) != null) {\n if (line.contains(\"ProcessId\")) {\n processIdLine = line;\n break;\n }\n System.out.println(line);\n }\n stdin.close();\n String[] param = processIdLine.split(\"=\");\n if (param.length > 1) {\n String pId = param[1];\n pId = pId.replaceAll(\";\", \" \");\n pId = pId.replaceAll(\" \", \"\");\n System.out.println(\"ID : \" + pId);\n }\n try {\n process.waitFor();\n // I want it to hang here till notepad closed.\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n System.out.println(\"PROCESSE EXIT\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n}\n\n\nNOTE: i dont want to use tasklist command and compare whether process has exited"
] | [
"java",
"windows",
"bash"
] |
[
"AssertAlmostEqual for a value in a dict",
"I have the following code:\n\ndef test_transformation_last_price(self):\n data_set = etl.fromdicts([{'MTDReturn': 4, 'EffectiveDate': '1992-06-30'},\n {'MTDReturn': 3.2, 'EffectiveDate': '1992-07-31'}])\n last_price_dataset = self.parser.last_price_dataset(data_set)\n first_row = list(etl.dicts(last_price_dataset))[0]\n expected_row = {'TimeSeriesValue': 121.20923188958272,\n 'EffectiveDate': datetime.date(1992, 6, 30),\n 'FundID': self.parser.FUND_ID,\n 'TimeSeriesTypeID': self.parser.LAST_PRICE_ID}\n self.assertEqual(first_row, expected_row)\n\n\nMy method: last_price_dataset runs a few other methods that essentially grab a value from a database and produces some calculations based on it. At the moment this passes, and it's correct. However, that value might change by a few decimal points here and there. \n\nIs there a unittest I can use that checks if the TimeSeriesValue is close that number in the dict?\n\nAssertAlmostEqual doesn't work with dicts like that. Any suggestions?"
] | [
"python",
"unit-testing"
] |
[
"How to implement invite codes in Amplify?",
"I need to enable a user A to provide a user B's phone number so my app can text/msm user B\n\nInstructions text\nAn invite code.\n\nDoes Cognito already have a built in method for this that would let me\n\nGenerate a code on the client.\nStore it on Amplify servers\nSend a text to the number with the content and the client generated code\n\nOR\n\nCognito manages the whole process and has an interface that would let user A provide the user B phone number on one end, then enable user B to accept the invite code triggered by user A on the other end"
] | [
"amazon-web-services",
"amazon-cognito"
] |
[
"Intellij cursor keeps following mouse and highlight",
"For some reason Intellijs text cursor keeps following my mouse and highlighting everything. Is there some setting that can do that? I can't seem to find it from searching the settings. Where else could it be?"
] | [
"intellij-idea"
] |
[
"How can I block all ports except 443 on MacOS Catalina",
"For test reasons I want to temporarily block all ports on MacOS Catalina except 443. How can I do / undo this?"
] | [
"macos",
"macos-catalina"
] |
[
"can't fetch data from eloquent relationships",
"I try to fetch specific users who sent to the auth a message using the eloquent relationships\nthis is the message modal\n<?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass Message extends Model\n{\n \n protected $guarded = [];\n public function fromContact()\n {\n return $this->hasOne(User::class, 'id', 'from');\n }\n}\n\nand this is the message Migration\n<?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass CreateMessagesTable extends Migration\n{\n /**\n * Run the migrations.\n *\n * @return void\n */\n public function up()\n {\n Schema::create('messages', function (Blueprint $table) {\n $table->bigIncrements('id');\n $table->integer('from')->unsigned();\n $table->integer('to')->unsigned();\n $table->text('text');\n $table->text('img')->nullable();\n $table->timestamps();\n });\n }\n\n /**\n * Reverse the migrations.\n *\n * @return void\n */\n public function down()\n {\n Schema::dropIfExists('messages');\n }\n}\n\nand I don't change the User modal\nI try to use the where() function but didn't work"
] | [
"laravel",
"eloquent-relationship"
] |
[
"SECURITY Flaws in this design for User authentication",
"SECURITY Flaws in this design for User authentication.\n\nFrom: http://wiki.pylonshq.com/display/pylonscookbook/Simple+Homegrown+Authentication\n\nNote:\n a. Project follows the MVC pattern.\n b. Only a user with a valid username and password is allowed submit something.\n\nDesign:\n a. Have a base controller from which all controllers are derived from.\n b. Before any of the actions in the derived controllers are called the system calls a before action in the base controller.\n c. In each controller user hardcodes the actions that need to be verified in an array.\n d. The before action first looks in the array that has the actions that are protected and sees if a user is logged in or not by peaking into the session. If a user is present then user is allowed to submit otherwise user is redirected to login page.\n\nWhat do you think?"
] | [
"python",
"authentication",
"pylons"
] |
[
"Setting document library permissions in WSS 2.0",
"I am using WSS2.0. Am trying to set some permissions to a document library but not getting the desired behavior. I have created a sharepoint user and assigned it to 'Reader' group. I just want this user to view document library content but not make any changes like check out or upload new document or delete etc. Hence I assign the Reader group. But when I login to the site as this user I am able to delete documents and perform other changes. I checked the document library permissions and it contains Reader, Contributor, Administrator groups and also the permissions are not inherited from the parent.\n\nIs there any other settings I need to check. Have I missed or misunderstood anything?\n\nPlease advise.\n\nThanks,\nJagannath"
] | [
"sharepoint",
"wss"
] |
[
"Push Notification Ionic 3 - Angular 4 redirect",
"I'm developing an app with Angular 4 and Ionic 3. The app sends a notification between users of the app when either of them are close to each other.\nThis is similar to what happens with the Facebook feature that shows you which of your friends are close to your location.\nCurrently, I can send and receive the notifications but I need the notification to take me to a specific rout of the app when the user click on it and not to just open the app.\nHow could I do that? Has anyone tried this before?"
] | [
"angular",
"push-notification",
"ionic3"
] |
[
"How can we optimize Google's Autocomplete?",
"Yesterday I was interviewed by XYZ Company, They gave me following real time problem to work on. \n\nAs we all know how google autocomplete works. It sends an AJAX call for each character you type in. So even when I haven't yet finished typing it sends all requests to server for each character I have pressed. (e.g I want to search who is the biggest fool on the internet then for each character it makes an AJAX call).\n\nQuestion was \"How can we optimize this ?\" \n\nI gave him solution to abort the previous ajax request if key is pressed again. But it seemed that interviewer was not convinced with this. So please suggest what could be the best solution for this ?\n\nThanks in advance,"
] | [
"javascript",
"algorithm"
] |
[
"HTTP 504 error AWS ElasticBeanstalk for a Python application",
"I use AWS Elastic Beanstalk for a Python application.\n\nIn this application I have some long requests (requests that take more than 1 minute to respond). When I deployed the application on AWS Elastic Beanstalk I received, for these requests, 504 HTTP status code.\n\nAs a first step I changed the idle timeout value in LoadBalancer settings (classic LoadBalancer).\nI solved my problem but now I see some confusion about the status of my associated EC2 instances (for example these often go down and I see in the Apache logs many 408 status codes from internal AWS network... I think from my load balancer).\n\nIn this article (or here), I reed that, probably, I have to change the Apache keep-alive timeout (inside my Elastic Beanstalk instances) also but I'm not sure what to add to my .ebextensions configuration files\nI don't found specific indications in the documentation. Some idea?"
] | [
"apache",
"amazon-web-services",
"timeout",
"amazon-elastic-beanstalk",
"amazon-elb"
] |
[
"Moving shell code to a function causes it to stop functioning: \"no such file or directory\"",
"I'm writing one of my first bash scripts that analyses a text document with different regex expressions. The following command does exactly what it's supposed to do:\n\negrep \"\\\\i(\\[.*\\])?\" \"$1\" | cut -d \"{\" -f2 | cut -d \"}\" -f1\n\n\nI decided to move this command to a function, because i need to execute it several times. Problem is: I get a \"egrep : no such file or directory\"-Error when it's inside a function. Here's the code:\n\nfunction printThis() {\n egrep \"\\\\i(\\[.*\\])?\" \"$1\" | cut -d \"{\" -f2 | cut -d \"}\" -f1\n}\n...\nprintThis\n\n\nI'm sure I made a complete beginner's mistake, but I just can't seem to find it. I also alternated my code so it starts with a cat command. in that case i get the same error starting with \"cat : ...\"\n\nThank you for your time."
] | [
"bash",
"shell",
"parameter-passing"
] |
[
"Can't load OpenCV on Linux - undefined symbol error",
"So I would like to play with OpenCV little bit. My test project is in Java (OS is Debian Linux 8.4), and I have followed this tutorial to build OpenCV: https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html\n\nAfter fixing few issues, I was able to successfully build OpenCV jar and so file. There were no errors or warnings during the build. I have put opencv-400.jar and libopencv_java400.so into lib subfolder of my project. Added the jar file to build path in Eclipse, and put correct path to so file in Eclipse's Build Configurations.\n\nMy project has just a Main class which is a sample I found in OpenCV's sources, so nothing complicated:\n\nimport org.opencv.core.Core;\nimport org.opencv.core.CvType;\nimport org.opencv.core.Mat;\n\npublic class Main {\n\n public static void main(String[] args) {\n System.out.println(\"Welcome to OpenCV \" + Core.VERSION);\n System.loadLibrary(Core.NATIVE_LIBRARY_NAME);\n Mat m = Mat.eye(3, 3, CvType.CV_8UC1);\n System.out.println(\"m = \" + m.dump());\n }\n}\n\n\nIt all looks that it should be working fine, but when I run the project, I see this exception:\n\nException in thread \"main\" java.lang.UnsatisfiedLinkError: /home/firzen/ownCloud/develop/java/workspace/CVExperiments/lib/libopencv_java400.so: /home/firzen/ownCloud/develop/java/workspace/CVExperiments/lib/libopencv_java400.so: undefined symbol: _ZNK6google8protobuf8internal12MapFieldBase28SpaceUsedExcludingSelfNoLockEv\nat java.lang.ClassLoader$NativeLibrary.load(Native Method)\nat java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)\nat java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)\nat java.lang.Runtime.loadLibrary0(Runtime.java:870)\nat java.lang.System.loadLibrary(System.java:1122)\nat Main.main(Main.java:9)\n\n\nAnd this part of exception is really making me worried:\n\n/home/firzen/ownCloud/develop/java/workspace/CVExperiments/lib/libopencv_java400.so: undefined symbol: _ZNK6google8protobuf8internal12MapFieldBase28SpaceUsedExcludingSelfNoLockEv\n\n\nIt almost seems to me that there is something wrong with that libopencv_java400.so file. Am I right? Or do I need some another files to make it work? I have build OpenCV as Debug, so that so file has 135 MiB, but that shouldn't be a problem I think.\n\nI will be thankful for any ideas!"
] | [
"java",
"linux",
"opencv",
"debian"
] |
[
"My HTML5 button keeps refreshing the browser",
"I have a simple button that has a click event binded to its ID. This button retrieves a value from a slider that is then outputted to a <span> nested within a paragraph. The problem is that when the button is pressed, the page refreshed so I see the value for a split second then it dissapears. In the real world I will want this to happen when all values are submitted to a server, but for now I just need the page not to refresh when I click my button:\n\n// Output to the value of slider one\n$(\"#slider01\").on('mousemove', function(evt) {\n var sliderValue = $(this).val();\n $(\"#value\").text(sliderVal);\n});\n\n// Retrieve the value from slider one\n$(\"#submit\").on(\"click\", function(evt) {\n var sliderValue = $('#slider01').val();\n $(\"#output > p\").append(sliderValue);\n //alert(\"The value of slider 1 is: \" + sliderValue);\n});\n\n\nHeres my two main functions."
] | [
"jquery",
"html"
] |
[
"Remove unpushed commit without removing local changes",
"I was writing some computational codes locally and sync them with Github. I recently wrote some new code and tested it with some large size data file inside the folder. I did not pay attention to the size of the file, until I add and commit the whole folder and try to push it. However errors indicating file size is too big to push. \n\nI am quite new to git, so I figured just to remove the generated data file from the folder, but only realized the commit has already log the oversized data file. I look around and found options like git revert command. But it seems like once I git revert, all the code I've updated with go back to the previous commit. I just wanna recommit without the oversized data file included so that I can make a successful push. Is there any one can help me with that?"
] | [
"git",
"github"
] |
[
"Can Python or R join local dataframes with database tables like Proc SQL in SAS?",
"PROC SQL can join a local table to one from a database. For example, joining db.sales and work.customer_info. To my knowledge, there aren't any packages in R or Python that can do this; either the local table must be uploaded to the database and the join done there, or the table (entire or subset) must be queried into local memory as a dataframe and then joined with the flat file.\n\nIs there actually a way to do this in Python or R? Or is SAS superior for querying like this?"
] | [
"python",
"sql",
"r",
"sas"
] |
[
"Prolog Compare elements of list",
"When given some input list, I want to build a new list and it should:\n\n\nAlways add h in front of the new list\nCompare every two consecutive elements of the input list, and, if they are\nequal, append y to the new list, if not, append x.\n\n\nExample:\n\n?- control([a,a,b,b],R).\nR = [h,y,x,y].\n\n\nHere is my code so far:\n\ncontrol([H,H|T],K,[K,0|T2]):- control([H|T],[K,0],T2).\ncontrol([H,J|T],K,[K,1|T2]):- control([J|T],[K,1],T2).\ncontrol([H],G,G).\n\n\nBut it is not working correctly.\n\n?- control([a,a,b,b],[h],L).\nL = [[h], 0, [[h], 0], 1, [[[h], 0], 1], 0, [[[...]|...], 1], 0] ;\nL = [[h], 0, [[h], 0], 1, [[[h], 0], 1], 1, [[[...]|...], 1], 1] ;\nL = [[h], 1, [[h], 1], 1, [[[h], 1], 1], 0, [[[...]|...], 1], 0] ;\nL = [[h], 1, [[h], 1], 1, [[[h], 1], 1], 1, [[[...]|...], 1], 1] ;\nfalse.\n\n\nHow can I make it correct?"
] | [
"list",
"prolog",
"prolog-dif"
] |
[
"Python string to datetime-date",
"I've got lots of dates that look like this: 16.8.18 (American: 8/16/18) of type string. Now, I need to check if a date is in the past or future but, datetime doesn't support the German format.\n\nHow can I accomplish this?"
] | [
"python-3.x",
"datetime"
] |
[
"What does the reduced palette option in Eclipse offer to user",
"I would like to know what does the reduced palette option in Eclipse offer to user.\n\n(In Windows) Window > Peferences > Appearance - Color and Font Theme\n\nWhat are the settings that it changes etc."
] | [
"eclipse",
"settings",
"color-scheme"
] |
[
"Issue with Forest in MarkLogic after MarkLogic downgrade",
"Recently we updated from ML-7.03 to ML - 8.07, but ran into some issues and had to revert back to ML-7. Unfortunately when we took the backup of the entire ML directory which had ML-7, we didn't realize that the forest data was not part of the installation directory. As such when we have reverted back to ML-7, we are seeing the following error.\n\n\n XDMP-FORESTERR: Error in startup of forest \"ABC-DE-001\": XDMP-CORRUPT: read D:\\Forest\\Forests\\ABC-DE-001\\00003980: File corrupt, bad triple value index version, version=1\n\n\nPlease suggest what could have gone wrong, and how to fix this issue, as we don't have the backup of ML-7 with us to fall back to. \n\nRegards\nAmit"
] | [
"marklogic",
"database-backups",
"marklogic-8",
"marklogic-7"
] |
[
"How to prevent ggmap (with Stamen maps) from misaligning points and features latitudes at low zoom?",
"When using ggmap, Stamen maps and continental-level zooms (zoom=3), the point-latitudes do not align with the map. For example:\n\nlibrary(ggmap)\ngc <- geocode('the white house')\n\nqmap('the white house', zoom = 3) + # looks good\n geom_point(aes(x = lon, y = lat), data = gc, colour = 'red')\n\nqmap('the white house', zoom = 3, source = 'stamen', maptype=\"toner\") + # not so good\n geom_point(aes(x = lon, y = lat), data = gc, colour = 'red')\n\n\nThis seems to have been and addressed defect for googlemaps and osm maps - what strategies can I employ to work-around for Stamen?"
] | [
"r",
"ggplot2",
"ggmap"
] |
[
"Different sized vectors according to user's input",
"int main() {\n int k=0;\n string s;\n cout<<\"string \";\n getline(cin,s);\n float n=s.size();\n\n\n vector< vector<string> > vec(n>8?floor((sqrt(n))):3, vector<string>(n>8?ceil((sqrt(n))):3));\n\n\n\n for(int i=0;n>8?i<floor((sqrt(n))):i<3;i++)\n {\n for(int j=0;n>8?j<ceil((sqrt(n))):j<3;j++)\n {\n if(k<s.size())\n {\n vec[i][j]=s[k];\n k++;\n }\n }\n }\n\n\n\n for(int j=0;n>8?j<ceil((sqrt(n))):j<3;j++) \n {\n\n {\n for(int i=0;n>8?i<floor((sqrt(n))):i<3;i++)\n\n cout<<vec[i][j];\n\n }cout<<\" \";\n }\n\n\nI am working on an encryption program and I want to make a a vector(using it for the first time) whose size should be influenced by the user's input.How can I implement it?"
] | [
"c++",
"vector"
] |
[
"Lightweight portable cross-platform client-server database",
"Is there a lightweight (in size and memory usage), portable (that i can copy and paste it to another computer without reconfiguration, or rsync it with ease), cross-platform (that runs on windows and linux, at least at data level), client-server (because there would be more than one user write at the same time, so i wont use sqlite or any other embedded database) database?\n\nwhat are my options?\n\ni don't care if it's sql or nosql, i don't care about the security too.."
] | [
"database",
"cross-platform",
"portable-database"
] |
[
"Porting wxPython to SWT/JFace",
"I use some nice controls/widgets in a simple wxPython app I developed taking inspiration from the sample demo. Call it my prototype.\n\nI am now ready to migrate my prototype to Java/SWT.\n\nSome controls are just not there.. or.. at least.. I could not find them.\n\nIs there anything else in the FOSS world of SWT apart from the usual:\n\n\nSWT/JFace\nNebula\nOpal\n\n\nFor a while I did not know about Nebula nor Opal at all. Now I do. At least you know I have done some legwork before coming here. Could it be that I am still oblivious to some fundamental set of extensions to the core SWT?\n\nWhat I am doing right now is building a table, on the left - controls I use from wxPython, on the right - equivalent controls I'll use in Java/SWT.\n\nThe right column still has some gaping blanks.."
] | [
"swt",
"eclipse-rcp",
"jface",
"nebula",
"opal"
] |
[
"Download a page doesn't return a status code",
"I have found a page I need to download that doesn't include an http status code in the returned headers. I get the error: ParseError: ('non-integer status code', b'Tag: "14cc1-5a76434e32f9e"') which is obviously accurate. But otherwise the returned data is complete.\nI'm just trying to save the page content manually in a call back: afilehandle.write(response.body) sort of thing. It's a pdf. Is there a way I can bypass this and still get the contents of the page?\nThe returned example that also crashed fiddler. The first thing in the header is Tag.\nTag: "14cc1-5a76434e32f9\ne"..Accept-Ranges: bytes\n..Content-Length: 85185.\n.Keep-Alive: timeout=15,\n max=100..Connection: Ke\nep-Alive..Content-Type: \napplication/pdf....%PDF-\n1.4.%ÓôÌá.1 0 obj.<<./Cr\neationDate(D:20200606000\n828-06'00')./Creator(PDF\nsharp 1.50.4740 \\(www.pd\nfsharp.com\\))./Producer(\nPDFsharp 1.50.4740 \\(www\n.pdfsharp.com\\)).>>.endo\nbj.2 0 obj.<<./Type/Cata\nlog./Pages 3 0 R.>>.endo\nbj.3 0 obj.<<./Type/Page\ns./Count 2./Kids[4 0 R 8\n 0 R].>>.endobj.4 0 obj.\n<<./Type/Page./MediaBox[\n0 0 612 792]./Parent 3 0\n R./Contents 5 0 R./Reso\nurces.<<./ProcSet [/PDF/\nText/Ima.... etc\n\nNote: For any not familiar with PDF file structure %PDF-1.4 and everything after is the correct format for a PDF document. Chrome downloads the PDF just fine even with the bad headers."
] | [
"scrapy",
"http-headers"
] |
[
"searching products like (hats). but I have products name with (hat) in product's table in mysql. I wanted similar result with hat or hats",
"I have three tables and I am using inner join to get data from these tables. \n\n SELECT u.user_id, u.user_full_name, u.user_picture, \n s.shop_id, s.user_id, s.shop_name,\n p.product_id, p.product_name, p.product_description, \n p.product_image, p.product_price, p.user_id \n FROM products AS p \n INNER JOIN shops AS s \n ON p.user_id = s.user_id \n INNER JOIN users AS u \n ON s.user_id = u.user_id \n //this function is used to add two or more strings\n WHERE lower(p.product_name) \n LIKE '%hats%'\n GROUP BY s.user_id\n /* query end*/"
] | [
"mysql"
] |
[
"Wordpress loggout link redirect to homepage",
"I am using worpress and have added a loggout link in the nav:\n\necho '<a href=\"http://mydomain.com/wp-login.php?action=logout&redirect_to=%252Flogin%252F&_wpnonce=a2b834fa87\">Logout</a>';\n\n\nI need it to redirect to the homepage instead of going to the login page.\n\nIf possible I would like to do this by modifying the link about.\n\nI tried changing %252Flogin%252F to the url but that didn't work."
] | [
"php",
"wordpress"
] |
[
"Setting up batch file to run on command line, setting up shop",
"I just installed the into the defaulta location C:\\Program Files and wanted a batch file to start when I start a new cmd in Windows XP. My batch file is:\n\n@echo off\nSET TOOLS_HOME=%ProgramFiles%\\Java\nSET JAVA_HOME=%TOOLS_HOME%\\jdk1.6.0_21\nSET PATH=%JAVA_HOME%\\BIN;%PATH%\nSET CLASSPATH=.;\n\n\nThis file is in Program Files\\Java\\jdk1.6.0_21\\bin\n\nFrom there, I created a shortcut for my cmd-line, and I used the /k in target so that looks like:\n\n%SystemRoot%\\system32\\cmd.exe /k %ProgramFiles%\\Java\\jdk1.6.0_21\\bin\\setenv.bat\n\n\nAnd my Start in: is %HOMEDRIVE%\n\nWhen I then start my command prompt, I get 'c:\\Program\\ is not recognized as an internal or external command, operable program or batch file. Is my batch file correct? Or is my Target/Start in incorrect? Thanks."
] | [
"java"
] |
[
"In node.js, how can I auto input the password with sudo command in exec?",
"I'm developing a Node.js program and encounter a problem.\n\nI try to use stdin.write to auto input the password of sudo in exec, but it seems not works.\n\nI don't want run my program as root.\n\nHere is my code:\n\nvar SUDO_PASSWORD = '123456';\nvar command = 'sudo echo \"1\" > test.txt';\nvar child = require('child_process').exec(command);\nchild.on('exit', function() {\n console.log('in exit');\n return 'OK';\n});\nchild.stdin.write(SUDO_PASSWORD);\n\n\nHow to modify it? Thank everybody."
] | [
"node.js",
"exec",
"stdin",
"child-process"
] |
[
"How to calculate the slope between touch point and UIImageView center",
"How to calculate the slope between touch point and UIImageView center?\n\nI tried a lot of codes, one of them is this:\n\nCGPoint translation = [gesture translationInView:[myImage superview]];\ndouble tx = myImage.center.x - translation.x;\ndouble ty = myImage.center.y - translation.y;\ndouble t_length = sqrt((tx*tx) + (ty*ty));\ndouble a = cos(ty / t_length);\n\n\nIt is not giving a right angle, so please help me"
] | [
"iphone",
"ios",
"objective-c"
] |
[
"C++ Populating a vector of objects with user input",
"I am new to vectors and new to classes.That being said, I have found some posts about how to create a vector of objects. I want to know how would one go about creating a vector of objects from user input? Say the program asks the user to give the number of employees(class) he/she wants to create. The user wants to add 5 employees. So user must input the employee's last name and first name. I have a for loop in mind but I am not sure how to go about grabbing the user input (Maybe using getline and push_back?) and storing it in the vector. \n\n//Lets say class.h looks like this\nclass Employee\n{\nprivate:\n string lastName;\n string firstName;\npublic:\n void setLastname(string);\n void setFirstname(string);\n string getLastname() const;\n string getFirstname() const;\n}"
] | [
"c++",
"vector"
] |
[
"Panel is flickering when switching from one winform to another",
"I render my image on the panel. \n\nusing Microsoft.DirectX.Direct3D;\n\nDevice device;\n\nthis.device = new Device(0, DeviceType.Hardware, this.panel2,\n CreateFlags.HardwareVertexProcessing, presentationParameters);\n\n\nAs a result, the panel is flickering when I try to switch the winform from one to another.\n\nI know it is hard to describe the scenario. Hence I hereby upload a video clip (.swf) to my google drive, you guys may download it and open it with window media player to watch the video.\n\nBelow is the shared link:\nhttps://drive.google.com/file/d/0B6wTfkJvzke_aVJwanVkaU1iSVU/edit?usp=sharing\n\nInside the video, I am running my application at debug mode, then I click on the 'chrome browser' tab in task bar to access the 'chrome browser', when the minimized 'chrome browser' pop out, the panel will be flickered. Then when I minimize the 'chrome browser' again, the panel flickered again.\n\nThe problem occur when there is some other winform being placed above the panel on screen.\n\nAny comment on the above matter? Help is needed."
] | [
"c#",
"winforms",
"panel",
"flicker",
"doublebuffered"
] |
[
"Append character to a JSON generated in MS SQL 2017",
"I am able to get a proper output in a JSON format with the following query. However I need to have a CR+LF character at the end of this string appended. So it detects end of line.\n\nSELECT top 1 * FROM customers FOR JSON auto, Root('Customers')\n\n\nSo the output should be something like <JSON>CRLF"
] | [
"json",
"sql-server"
] |
[
"Changing grouping separator, currency symbol and position of currency symbol for multiple currencies in Swift",
"My app uses multiple currencies, and these currencies uses different formats, for example:\n\nPrice for Ruble shows as: 1,101 Руб.\n\nSame amount for US Dollar shows as: US $1 101\n\nHow would I change the grouping separator, currency symbol and position of currency symbol, by defining a set of different formats for different currencies.\n\nThis is how my short code stands\n\nvar formatter = NSNumberFormatter()\nformatter.numberStyle = .CurrencyStyle\nformatter.locale = NSLocale.currentLocale()\nformatter.stringFromNumber(4500000)\n//Output : $4,500,000.00\n//Expected : 4,500,000 Руб."
] | [
"ios",
"swift",
"nsnumberformatter"
] |
[
"Check if a relation already exist between two entities/models having 2 lists/querysets of them",
"I have 3 models: A, B and C.\n\n\nA has a type that defines if B or C can connect to it\nB has a OnetoOneRelation to A\nC has a OnetoOne relation to A\n\n\n\n\nclass A(models.Model):\n type = models.SmallIntegerField(\n choices=A_TYPE_CHOICES, default=ACCOUNT_TYPE_B\n )\n\nclass B(models.Model):\n a = models.OneToOneField(A, related_name='b', on_delete=models.CASCADE)\n\nclass C(models.Model):\n a = models.OneToOneField(A, related_name='c', on_delete=models.CASCADE)\n\n\nWhat I need:\n\n\nget all accounts that are type B but a B Objects is not related\nsame as 1 for C\n\n\nSo, I have:\n\na_type_b = Account.objects.filter(type=ACCOUNT_TYPE_B)\n\n\nThere are any was to check if B model/object is already attached/related instead of looping thru all accounts and check ?, because this can take a lot of time and queries and is not efficient\n\n\nDo no let C connect to a type_B account and vice-versa on model create/update."
] | [
"django",
"django-models",
"django-queryset"
] |
[
"Need help pulling spotify id from uri",
"I'm trying to pull the spotify id from a spotify uri (e.g. spotify:track:5xioIP2HexKl3QsI8JDlG8) I know this should be quite easy, but I can't seem to get anything to validate on http://regexpal.com/.\n\nWhat I have so far is:\n\nspotify:track:[a-zA-Z0-9]{22}\n\n\nBut it pulls the whole string, how can I make it only pull after the colon?"
] | [
"php",
"regex"
] |
[
"Python unable to decode byte string",
"I am having problem with decoding byte string that I have to send from one computer to another. File is format PDF. I get error that goes:\nfileStrings[i] = fileStrings[i].decode()\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 648: invalid continuation byte\n\nAny ideas of how to remove b' ' marking? I need to compile file back up, but i also need to know its size in bytes before sending it and I figured I will know it by decoding each byte string (Works for txt files but not for pdf ones..)\nCode is:\n with open(inputne, "rb") as file:\n while 1:\n readBytes= file.read(dataMaxSize)\n fileStrings.append(readBytes)\n if not readBytes:\n break\n readBytes= ''\n \n filesize=0\n for i in range(0, len(fileStrings)):\n fileStrings[i] = fileStrings[i].decode()\n filesize += len(fileStrings[i])\n\nEdit: For anyone having same issue, parameter len() will give you size without b''."
] | [
"python",
"encoding",
"decode"
] |
[
"Cakephp 3 find all and only max date of each",
"I have this table:\n\nGroup workers\n\n\nid (int)\nworker_id (int)\ngroup_id (int)\ndate_created (datetime)\n\n\nI need all where worker_id = 3 (for example) and only max recent date_created."
] | [
"php",
"mysql",
"cakephp-3.0"
] |
[
"Can I target in CSS a single line element?",
"I need to be able to differentiate within the css between an element with a single line and one with multiple lines - can it be done? \n\n(I cannot break the lines into different DOM elements, it's always one element with 1 or more lines)"
] | [
"css"
] |
[
"Alexa Reminders API 401 response",
"So, I am using Amazon Alexa Reminders API as shown here.\nHere is my method for sending requests to API:\n\npublic static void sendReminder(String accessToken, String reminderText, long offsetInSec) {\n CloseableHttpClient client = HttpClients.createDefault();\n HttpPost post = new HttpPost(\"https://api.amazonalexa.com/v1/alerts/reminders\");\n post.addHeader(\"Authorization\", \"Bearer \" + accessToken);\n post.addHeader(\"Content-Type\", \"application/json\");\n TimeZone tz = TimeZone.getTimeZone(\"UTC\");\n DateFormat df = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm'Z'\");\n df.setTimeZone(tz);\n String nowAsISO = df.format(new Date());\n String jsonContent = \"{ \\\"requestTime\\\" : \\\"\" + nowAsISO + \"\\\", \\\"trigger\\\": { \\\"type\\\" : \\\"SCHEDULED_RELATIVE\\\", \\\"offsetInSeconds\\\" : \\\"\" + offsetInSec + \"\\\" }, \\\"alertInfo\\\": { \\\"spokenInfo\\\": { \\\"content\\\": [{ \\\"locale\\\": \\\"en-US\\\", \\\"text\\\": \\\"\" + reminderText + \"\\\" }] } }, \\\"pushNotification\\\" : { \\\"status\\\" : \\\"ENABLED\\\" } }\";\n HttpEntity entity = null;\n try {\n byte[] bytes = jsonContent.getBytes(\"UTF-8\");\n entity = new ByteArrayEntity(bytes);\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n post.setEntity(entity);\n try {\n CloseableHttpResponse response = client.execute(post);\n System.out.println(response);\n } catch (IOException e) {\n e.printStackTrace();\n }\n}\n\n\nAnd I execute it like this:\n\nRemindersToolkit.sendReminder(session.getUser().getAccessToken(), \"text\", 1);\n\n\nSkill also has permission for reminders:\n\n\nBut when the method is executed, I get the following response:\n\nHttpResponseProxy{HTTP/1.1 401 Unauthorized [Content-Type: application/json, Connection: keep-alive, Server: Server, Date: Tue, 22 Jan 2019 00:21:21 GMT, Vary: Accept-Encoding,User-Agent, x-amz-rid: 8YMCM10GKVGTT71JQH3N, X-Cache: Error from cloudfront, Via: 1.1 05a90e634e0872685ad69ee9a4e0eba5.cloudfront.net (CloudFront), X-Amz-Cf-Id: J5CtMnkUTv1hd6p-7-tob7mCb-4DM7y_LxhEiMLt5x3qEqmzhwbx_Q==] org.apache.http.client.entity.DecompressingEntity@6df97b55}\n\n\nAccording to Amazon on this page, 401 UNAUTHORIZED means Token is valid but does not have appropriate permissions.\n\nMaybe some of you guys had the same problem or could help me figure out how to solve mine?\nThanks"
] | [
"amazon",
"alexa"
] |
[
"What is the function parameter equivalent of constexpr?",
"We are trying to speedup some code under Clang and Visual C++ (GCC and ICC is OK). We thought we could use constexpr to tell Clang a value is a compile time constant but its causing a compile error:\n\n$ clang++ -g2 -O3 -std=c++11 test.cxx -o test.exe\ntest.cxx:11:46: error: function parameter cannot be constexpr\nunsigned int RightRotate(unsigned int value, constexpr unsigned int rotate)\n ^\n1 error generated.\n\n\nHere is the reduced case:\n\n$ cat test.cxx\n#include <iostream>\n\nunsigned int RightRotate(unsigned int value, constexpr unsigned int rotate);\n\nint main(int argc, char* argv[])\n{\n std::cout << \"Rotated: \" << RightRotate(argc, 2) << std::endl;\n return 0;\n}\n\nunsigned int RightRotate(unsigned int value, constexpr unsigned int rotate)\n{\n // x = value; y = rotate\n __asm__ (\"rorl %1, %0\" : \"+mq\" (value) : \"I\" ((unsigned char)rotate));\n return value;\n}\n\n\nGCC and ICC will do the right thing. They recognize a value like 2 in the expression RightRotate(argc, 2) cannot change under the laws of the physical universe as we know them, and it will treat 2 as a compile time constant and propagate it into the assembly code.\n\nIf we remove the constexpr, then Clang and VC++ aseembles the function into a rotate REGISTER, which is up to 3x slower than a rotate IMMEDIATE.\n\nHow do we tell Clang the function parameter rotate is a compile time constant, and it should be assembled into a rotate IMMEDIATE rather than a rotate REGISTER?"
] | [
"c++11",
"clang",
"constexpr"
] |
[
"Handling OnSize function or resizable dialog in MFC",
"In one MFC application there is a paned window. \nOn that window,\n\nI have added a menu-bar and a toolbar and lots of other controls. \nThe paned window is re-sizable.\n\nNow for the re-sizable window, I have override the function OnSize(). There I have retrieved the top window size and then below it and so on...\nThen for every control I have retrieved it's window and called MoveWindow().\n\nI just wants to be assured is it the correct way for handling resizable window/ dialog in MFC or there is some other ways available.\n\nThanks"
] | [
"visual-c++",
"mfc",
"visual-c++-2005"
] |
[
"WinForms: Is there a solution to display important Usercontrol properties at first place?",
"I have developped a UserControl that is very complicated and that contains too much properties.\nAfter draggin this control from ToolBox to Form, when I want to assign more important properties, I lost too much time to scroll to important properties est Text or Name.\nSo I have decided to 'shadow' the more important properties like this\n <Category("@First")>\n <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>\n Public Property A_4_Text() _\n As String\n\n Get\n Return Me.Text\n End Get\n\n Set(ByVal value As String)\n Me.Text = value\n End Set\n End Property\n\nIn properties box, I have following result\n\nAll important properties are now in first group named @First and are order as I want.\nThis is a little tricky and this is not beautiful !\nIs there another more elegant solution to put important properties in first place ?"
] | [
"vb.net",
"visual-studio",
"winforms",
"properties",
"user-controls"
] |
[
"Disabling edit on a JTextPane when click on a button (Java)",
"Okay, so I am making a simple program that sets the ability to edit a JTextPane to true or false, according to which corresponding button is clicked.But, I can't figure out how to disable and re-able the edit-ability of the pane. JTextPane Here is the code I am struggling with:\n\n`JTextPane Pad1 = new JTextPane();\n Pad1.setText(\"Edit Me...\");\n Pad1.setBounds(10, 45, 188, 160);\n frmDuvalStudiosOffscreen.getContentPane().add(Pad1);\n\n\n JButton button = new JButton(\"Save\");\n button.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent arg0) {\n //I want to make it when this button is clicked, it sets the ability to edit Pad1 to false.\n }\n });\n button.setBounds(10, 239, 89, 23);\n frmDuvalStudiosOffscreen.getContentPane().add(button);\n\n JButton button_1 = new JButton(\"Edit\");\n button_1.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent arg0) {\n //I want to make it when this button is clicked, it sets the ability to edit Pad1 to true.\n }\n });'\n\n\nPlease provide code and text. Thank You!"
] | [
"java",
"swing",
"jtextpane"
] |
[
"hex char to decimal and store output as char",
"I am writing a hex to dec conversion function. The input is a single character which is converted to hex and returned back as a char.\nHere is the function\n\nchar hex2dec(char inp)\n{\n char out;\n cout << \"inp:\" << inp;\n\n if(inp >= '0' && inp <='9')\n {\n out = (inp - '0');\n cout << \" out \" << out;\n }\n else \n {\n out = (toupper(inp) - 'A' + 10);\n cout << \" out \" << out;\n }\n\n return out;\n}\n\n\nWhen i pass '0' and 'A' to the function, the print i get is\ninp:0 out \ninp:A out \ni.e nothing is printed in out.\n\nI am not able to find the issue..Can anyone help?"
] | [
"c++",
"hex",
"decimal"
] |
[
"Variable interpolation in expect",
"This expect script cannot interpolate or assign the /bin/date to ydate. \nkeeps on throwing errors. I tried the backticks and that did not work. \n\n#!/usr/bin/expect\n ydate=$(date -d 'yesterday' \"+%Y.%m.%d\")\n file=\"casper_${ydate}.csv\"\n spawn scp -o StrictHostKeyChecking=no -oport=666 $file casper@casper-server:/spooky/outgoing\n set pass \"foofoofoo\"\n expect {\n password: {send \"$pass\\r\"; exp_continue}\n }"
] | [
"bash",
"expect"
] |
[
"Razor page does not work after adding MVC to WebForms project",
"I added MVC to my existing Web Forms project, but then when I try to add MVC razor page I got this rutime error:\n\nThere is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.\n\n\nAnswer to similar question Razor Compiler Warning/Errors - ASP.NET MVC 4 gave me a hint, so I fixed that run-time crash by modifying root Web.Config.\nI added to element this code:\n\n<assemblies>\n <add assembly=\"System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\n</assemblies>\n\n\nThat helped.\n\nThen I removed that \"assemblies\" configuration, but my web project kept working.\n\nWhy razor crashed initially and why does it work now?\n\nUpdate:\nI noticed that this error happened on Windows 7 computers, but did not happen on Windows 8 computers."
] | [
"asp.net-mvc",
"razor",
"webforms"
] |
[
"How do I post 3 values from a form into 1?",
"I have the following date picker with 3 different select ids\n\n<form id=\"testform\" method=\"get\" action=\"../Untitled-1.html\">\n <select id=\"date-sel-dd\" name=\"date-sel-dd\">\n <option value=\"-1\">Day</option>\n\n <option value=\"1\">1st</option>\n <option value=\"2\">2nd</option>\n <option value=\"3\">3rd</option>\n <option value=\"4\">4th</option>\n <option value=\"5\">5th</option>\n <option value=\"6\">6th</option>\n\n <option value=\"7\">7th</option>\n <option value=\"8\">8th</option>\n <option value=\"9\">9th</option>\n <option value=\"10\">10th</option>\n <option value=\"11\">11th</option>\n <option value=\"12\">12th</option>\n\n <option value=\"13\">13th</option>\n <option value=\"14\">14th</option>\n <option value=\"15\">15th</option>\n <option value=\"16\">16th</option>\n <option value=\"17\">17th</option>\n <option value=\"18\">18th</option>\n\n <option value=\"19\">19th</option>\n <option value=\"20\">20th</option>\n <option value=\"21\">21st</option>\n <option value=\"22\">22nd</option>\n <option value=\"23\">23rd</option>\n <option value=\"24\">24th</option>\n\n <option value=\"25\">25th</option>\n <option value=\"26\">26th</option>\n <option value=\"27\">27th</option>\n <option value=\"28\">28th</option>\n <option value=\"29\">29th</option>\n <option value=\"30\">30th</option>\n\n <option value=\"31\">31st</option>\n </select>\n <select id=\"date-sel-mm\" name=\"date-sel-mm\">\n <option value=\"-1\">Month</option>\n <option value=\"1\">January</option>\n <option value=\"2\">February</option>\n <option value=\"3\">March</option>\n\n <option value=\"4\">April</option>\n <option value=\"5\">May</option>\n <option value=\"6\">June</option>\n <option value=\"7\">July</option>\n <option value=\"8\">August</option>\n <option value=\"9\">September</option>\n\n <option value=\"10\">October</option>\n <option value=\"11\">November</option>\n <option value=\"12\">December</option>\n </select>\n <select id=\"date-sel\" name=\"date-sel\">\n <option value=\"-1\">Year</option>\n <option value=\"2012\">2012</option>\n <option value=\"2013\">2013</option>\n <option value=\"2014\">2014</option>\n </select>\n\n <input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Submit\" />\n\n\n\n\nI need to get the values from these 3 differnt select fields and post it with the form to a new named: 'arrival'.\nWhen I submit to the page I want my url to look like:\n\nmydomain.php?arrival=date-sel-dd/date-sel-mm/date-sel"
] | [
"php",
"post",
"get"
] |
[
"Android Firebase password reset error",
"I am getting an error whenever I try to enter an email into an alertdialog. I am trying to get it to send a recovery password to the email entered. Here is my code and error message I am getting\n\nCode:\n\npublic void PassResetViaEmail(View view)\n{\n AlertDialog.Builder alertdialog = new AlertDialog.Builder(Settings.this);\n alertdialog.setTitle(\"Reset password\");\n alertdialog.setMessage(\"Enter email below\");\n\n EditText input = new EditText(this);\n email = input.getText().toString().trim();\n alertdialog.setView(input);\n\n alertdialog.setPositiveButton(\"Send\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n ResetEmailSender();\n }\n });\n\n alertdialog.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n }\n });\n\n alertdialog.show();\n}\n\npublic void ResetEmailSender()\n{\n auth.sendPasswordResetEmail(email).addOnCompleteListener(\n new OnCompleteListener<Void>() {\n @Override\n public void onComplete(@NonNull Task<Void> task) {\n if (task.isSuccessful()) {\n Toast.makeText(Settings.this, \"We have sent you instructions to reset your password!\", Toast.LENGTH_SHORT).show();\n } else {\n Toast.makeText(Settings.this, \"Failed to send reset email!\", Toast.LENGTH_SHORT).show();\n }\n }\n });\n}\n\n\nError:\n\n04-14 02:25:40.842 20031-20031/com.safariagaming.flix E/AndroidRuntime: FATAL EXCEPTION: main\nProcess: com.safariagaming.flix, PID: 20031\njava.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.auth.FirebaseAuth.sendPasswordResetEmail(java.lang.String)' on a null object reference\n at com.safariagaming.flix.Settings.ResetEmailSender(Settings.java:105)\n at com.safariagaming.flix.Settings$2.onClick(Settings.java:91)\n at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:161)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:154)\n at android.app.ActivityThread.main(ActivityThread.java:6119)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)"
] | [
"java",
"android",
"firebase",
"firebase-authentication"
] |
[
"require(): using module.exports vs assigning to \"this\" directly",
"I'm wondering if there are any pros or cons when using the two approaches against each other:\n\nfirst.js:\n\nthis.myFunction = function() {\n return 'herro first';\n}\n\n\nsecond.js:\n\nmodule.exports = obj = {};\nobj.myFunction = function() {\n return 'herro second';\n}\n\n\nThe two above would then be included and used as so:\n\napp.js:\n\nvar first = require('./first.js');\nconsole.log(first.myFunction());\n\nvar second = require('./second');\nconsole.log(second.myFunction());"
] | [
"javascript",
"node.js"
] |
[
"RabbitMQ/Celery/Django Memory Leak?",
"I recently took over another part of the project that my company is working on and have discovered what seems to be a memory leak in our RabbitMQ/Celery setup.\n\nOur system has 2Gb of memory, with roughly 1.8Gb free at any given time. We have multiple tasks that crunch large amounts of data and add them to our database.\n\nWhen these tasks run, they consume a rather large amount of memory, quickly plummeting our available memory to anywhere between 16Mb and 300Mb. The problem is, after these tasks finish, the memory does not come back.\n\nWe're using:\n\n\nRabbitMQ v2.7.1 \nAMQP 0-9-1 / 0-9 / 0-8 (got this line from the\nRabbitMQ startup_log)\nCelery 2.4.6\nDjango 1.3.1\namqplib 1.0.2\ndjango-celery 2.4.2\nkombu 2.1.0\nPython 2.6.6\nerlang 5.8\n\n\nOur server is running Debian 6.0.4.\n\nI am new to this setup, so if there is any other information you need that could help me determine where this problem is coming from, please let me know.\n\nAll tasks have return values, all tasks have ignore_result=True, CELERY_IGNORE_RESULT is set to True.\n\nThank you very much for your time.\n\nMy current config file is:\n\nCELERY_TASK_RESULT_EXPIRES = 30\nCELERY_MAX_CACHED_RESULTS = 1\nCELERY_RESULT_BACKEND = False\nCELERY_IGNORE_RESULT = True\nBROKER_HOST = 'localhost'\nBROKER_PORT = 5672\nBROKER_USER = c.celery.u\nBROKER_PASSWORD = c.celery.p\nBROKER_VHOST = c.celery.vhost"
] | [
"django",
"rabbitmq",
"celery",
"amqp",
"django-celery"
] |
[
"Trouble deploying Django app to Heroku \"no Cedar-supported app detected\"",
"I've been struggling to deploy a small Django web app following the instructions given here. I've only been using sqlite3 to build my app in my development and everything works fine on the Django development server. When I try to deploy to Heroku, I get the error \"Push rejected, no Cedar-supported app detected\", but I think I have all the files required to get my app up and running. Been at it for days now with no success so I'll take any suggestions and help. Below is a sketch of my app, but feel free to sift the whole thing at my github repo.\n\nlandcrab/\n landcrab/ <----- main project\n settings/\n __init__.py\n base.py\n local.py\n production.py\n __init__.py\n urls.py\n db.sqlite3\n wsgi.py\n vcrental/ <----- my app\n admin.py\n ....\n static/\n ....\n .gitignore\n db.sqlite3\n manage.py\n Procfile\n requirements.txt\n runtime.txt\n\n\nIn manage.py and wsgi.py I've set os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"landcrab.settings.production\")\n\nProcfile\n\nweb: gunicorn landcrab.wsgi --log-file -\n\n\nrequirements.txt (used pip freeze)\n\nDjango==1.7.1\ndj-database-url==0.3.0\ndj-static==0.0.6\ndjango-toolbelt==0.0.1\ngunicorn==19.1.1\njsmin==2.0.11\nnose==1.3.4\npsycopg2==2.5.4\npyparsing==2.0.3\npython-dateutil==2.2\npytz==2014.9\nsix==1.8.0\nstatic3==0.5.1\n\n\nruntime.txt\n\npython-3.4.2\n\n\nFor my settings file, I attempted to follow this structure\n\nProduction.py\n\nfrom landcrab.settings.base import *\nimport dj_database_url\n\nDEBUG = False\nTEMPLATE_DEBUG = False\n\n# Parse database configuration from $DATABASE_URL\nDATABASES['default'] = dj_database_url.config()\n# DATABASES['default'] = dj_database_url.config(default='postgres://user:pass@localhost/dbname')\n# DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'\n# DATABASES = {'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))}\n# DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}\n\n# Honor the 'X-Forwarded-Proto' header for request.is_secure()\nSECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')\n\n# Allow all host headers\nALLOWED_HOSTS = ['*']\n\n\nand finally wsgi.py\n\nimport os\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"landcrab.settings.production\") #Edited by me\n\nfrom django.core.wsgi import get_wsgi_application\n\n#Added by me for Heroku\ntry:\n from dj_static import Cling\n application = Cling(get_wsgi_application())\nexcept:\n application = get_wsgi_application()"
] | [
"python",
"django",
"heroku"
] |
[
"Slider scrolls based on the slider item class name",
"How its should be,\n\nGray color is the screen\nWhen I hit next the 1st item on the category(red) should be the 1st position on the slider,\nNow its r1, then I hit next again its y1, then p1, etc...\nThe same case happen when I hit prev\nSlider : Slick slider\nI believe a few lines jQuery will helps me, but I am poor in jQuery.\nThanks in advance"
] | [
"jquery",
"slick.js"
] |
[
"balancing reluctant and greedy matching",
"I am trying to match the two address lines below (mostly fictional addresses):\n\n\n2320 ZINER CIR East 43123\n1111 ZINER CIR East Bernstadt 43123\n\n\nMy regular expression is built using names of cities, and East Bernstadt is a city name. However, streets can also end in \"East\". My predicament then is that if I greedy match \"East\", as in:\n\n\\d+ [^ ]+ CIR( East)?( East Bernstadt)?(?: \\d+)?\n\n\n...then only the fist line is matched (the other is a partial match). If I use a reluctant match, as in:\n\n\\d+ [^ ]+ CIR( East)??( East Bernstadt)?(?: \\d+)?\n\n\n...the second line matches but not the first.\n\nHow can I change the regular expression so that both lines are matched completely? \"East\" and \"East Bernstadt\" must remain in separate parts of the expression.\n\nEDIT: I cannot treat \"East\" and \"East Bernstadt\" with one parenthesis group; both expressions above must match, but also \"1234 Ziner CIR East East Bernstadt\" must match as well (some streets have cardinal directions on them)."
] | [
"java",
"regex",
"regex-greedy",
"non-greedy"
] |
[
"why does my records got zero object id in mongodb upsert scenario?",
"I write an extension method to implement the upsert(update if exists else insert) scenario but every time I use it, my records save with "0" object id in my mongodb document.\nhere is my code:\npublic static async Task<ReplaceOneResult> UpsertAsync<T>\n (this IMongoCollection<T> collection, T entity) where T : IEntity\n {\n return await collection.ReplaceOneAsync(i => i.Id == entity.Id,\n entity,\n new ReplaceOptions { IsUpsert = true });\n }\n\nand my model:\npublic class User : IEntity\n{\n [BsonId]\n public ObjectId Id { get; set; }\n public int TelegramUserId { get; set; }\n public bool IsBot { get; set; }\n public string FirstName { get; set; }\n public string LastName { get; set; }\n public string Username { get; set; }\n public string ActivityPath { get; set; }\n public string Number { get; set; }\n public string Location { get; set; }\n public ObjectId [] Playlists { get; set; }\n}\n\nand my saved record looks like this:\n{\n"_id": {\n "$oid": "000000000000000000000000"\n},\n"TelegramUserId": 515151,\n"IsBot": false,\n"FirstName": "Test user",\n"LastName": null,\n"Username": "Test",\n"ActivityPath": null,\n"Number": null,\n"Location": null,\n"Playlists": null}\n\nthe problem is "000000000000000000000000" value for id, why id don't init correctly, I expect a valid guid value for that, not just zeros.\nthanks for your help."
] | [
"c#",
"mongodb"
] |
[
"Google Analytics ecommerce does not fire from local file",
"I am trying to set ecommerce tag firing from the local file. At the moment I am using hardcoded data. \nThe GA file itself is working and sending page view. However, the bit with ecommerce doesn't work. No information in the console, no errors like it doesn't exist. \n\nThe code is below:\n\n\r\n\r\n<script>\r\n(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\r\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\r\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\r\n})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\r\n\r\nga('create', 'UA-17316967-1', 'auto');\r\nga('set', 'checkProtocolTask', null); // Disable file protocol checking.\r\nga('set', 'checkStorageTask', null); // Disable cookie storage checking.\r\nga('set', 'historyImportTask', null); // Disable history checking (requires reading from cookies).\r\nga('send', 'pageview');\r\n\r\n\r\n</script>\r\n\r\n<script>\r\n ga('require', 'ecommerce'); \r\n ga('ecommerce:addTransaction', {\r\n 'id' : '298',\r\n 'affiliation' : 'Tax',\r\n 'revenue' : '0.0',\r\n 'shipping' : '0.0',\r\n 'tax' : '0.0'\r\n });\r\n ga('ecommerce:addItem', {\r\n 'id' : '227',\r\n 'sku' : '227',\r\n 'name' : 'Alpha 0 featured listing',\r\n 'category': 'Appliances',\r\n 'price' : '23.34',\r\n 'quantity': 1\r\n });\r\n ga('ecommerce:send');\r\n\r\n</script>"
] | [
"google-analytics"
] |
[
"Fullcalendar start end time from json feed",
"I'm feeding fullcalendar from my custom php script via build in json feed functionality. But its little bit unclear for me, how i should prepare start and end times so it will display time in calendar.\nCurrently json feed responds following json data:\n\n[{\"id\":46,\"title\":\"Some Event\",\"start\":\"2013-12-16 06:00:00\"},\n{\"id\":47,\"title\":\"Some Event 2\",\"start\":\"2013-12-23 06:00:00\"},\n{\"id\":48,\"title\":\"Some Event3\",\"start\":\"2013-12-30 06:00:00\"}]\n\n\nBut fullcalendar does not understand time part from this start field.\nfullcalendar documentation says taht time can be also in format (ex: \"2009-11-05T13:15:30Z\")\n\nSo i prepared my json data like this:\n\n[{\"id\":46,\"title\":\"Some event\",\"start\":\"2013-12-16T06:00:00Z\"},\n{\"id\":47,\"title\":\"Some event 2\",\"start\":\"2013-12-23T06:00:00Z\"},\n{\"id\":48,\"title\":\"Some event 3\",\"start\":\"2013-12-30T06:00:00Z\"}]\n\n\nIt didn't make any changes.\nAny more ideas ?"
] | [
"php",
"jquery",
"fullcalendar"
] |
[
"How to remove strings from a text file using batch script?",
"I am trying to create a batch script that can remove a certain string from a text file. Eg. Here's what is looks like in text_file.txt:\n\ntest_time 1.4567s\n\ntest_time 2.1456s\n\ntest_time 1.45267s\n\n\nI would like to remove \"test_time\" and the new_text_file.txt would look like this:\n\n1.4567s\n2.1456s\n1.45267s\n\n\nAny help would be appreciated."
] | [
"batch-file"
] |
[
"Docker run copies to filesystem?",
"I am trying to understand how Docker manages the filesystem. When start a new container, does it create a new \"filesystem\" and copy files into it and when I stop/kill it, does it clean it up?\n\nAre there any links that describe how Docker manages files?\nThanks in advance!"
] | [
"docker"
] |
[
"Importing Sharepoint pages in QnA Maker knowledge base not working",
"I'm trying to import Sharepoint pages in a QnA Maker knowledge base as URL but without success. Every time obtaining a:\nBad Argument\nUnsupported/Invalid URLs: "https://myapp.sharepoint.com/sites/AllKeyServices"\n\nI've read the documentation here but it was not helpful.\n\nThe Sharepoint is not public\nThe account I'm usig when adding the URL is enabled to access sharepoint\nWhen clicking on "Save and train" the authentication popup appears (really fast indeed, I cannot see what's inside, but I think it is the token request successfully execute. So I think it should not be the same case of this)\nIf I save the page as PDF and import it as file, it works.\nIt's not some file on SharePoint I want to import, I need to import the page itself.\n\nAny idea on how to understand what's wrong?\nPage formatting? Should not, due to 4)\nPermission? Should not, due to 3)\nWhat else?"
] | [
"sharepoint",
"qnamaker",
"knowledge-base-population"
] |
[
"allocate more memory to a process - Windows 7",
"I am running a simulation and it takes long time to be finished. My RAM is 64 Gb. But even when I set the priority to high or even real time the process has max. 31 Gb memory allocated. How can I increase it? Thanks."
] | [
"performance",
"memory"
] |
[
"TS2739 - Type missing in following properties",
"So i connect Typescript with hooks.\nWhen i try to render Register User in parent component i getting error:\n\n\n\n interface IRegisterUser {\n mail: string;\n password: string;\n };\n\n let RegisterUser: React.FC<IRegisterUser> = (props) => {\n\n const InitialUserState = {mail: \"\", password: \"\"}\n const [user, setUser] = useState(InitialUserState)\n\n useEffect(() => {\n\n }, []);\n\n return (\n <div>\n <input type=\"text\" className=\"text\" name=\"username\" value={user.mail} placeholder=\"\" required/>\n <input type=\"text\" className=\"text\" name=\"userpassword\" value={user.password} placeholder=\"\" required/>\n </div>\n );\n }"
] | [
"reactjs",
"typescript",
"interface"
] |
[
"Difference between pg-promise 'duration' and execution time in EXPLAIN ANALYSE of postgres?",
"I am using 'duration' property from data object of 'result' function to measure the duration of execution of my query.\n\nI tried the same query in pgAdmin with \"EXPLAIN ANALYSE\".\n\nBoth have a big difference.\n\ncan anyone say why is this?\n\nwhich is the right approach to measure the execution duration of my query."
] | [
"postgresql",
"pgadmin",
"pg-promise"
] |
[
"LINQ TO XML attribute tag give no object reference error",
"Hi i am doing as follow \n\n XDocument xmlDoc = XDocument.Load(@\"F:\\test2.xml\");\n var q = from c in xmlDoc.Descendants(\"autoivr.ok\")\n where c.Element(\"LS_CZIP4\").Value == \"1234\"\n select new\n {\n name = c.Element(\"LS_LIN\").Value,\n state = c.Element(\"LS_STATE\").Value \n };\n\n\nWhen i use \n where c.attribute(\"LS_CZIP4\").Value == \"1234\"\ni get error of object reference not set but when i use c.element there is no such error.\n\nFollowing is the xml i made which is actually a table in sql converted to xml file\n\n<?xml version=\"1.0\" standalone=\"yes\"?>\n<DocumentElement>\n <autoivr.ok>\n <LS_LIN>abc</LS_LIN>\n <LS_STATE>def</LS_STATE>\n <LS_TYPE>5</LS_TYPE>\n <LS_CZIP4>1234</LS_CZIP4>\n <priority>0</priority>\n </autoivr.ok>\n\n\nCan someone let me know the problem and how can i resolve and can i work with element tag only instead of attribute . Thank You"
] | [
"c#",
"xml",
"linq-to-xml"
] |
[
"Prestashop - blockuserinfo position & translation",
"I have an issue with blockuserinfo module. It displays in place which is not the best according to the layout. So i wanted to move it to different place. SO i did following thing - from blockuserinfo.tpl I copied element:\n\n{if $logged}\n<a href=\"{$link->getPageLink('my-account', true)}\" title=\"{l s='View my customer account' mod='blockuserinfo'}\" class=\"account\" rel=\"nofollow\"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>\n<a href=\"{$link->getPageLink('index', true, NULL, \"mylogout\")}\" title=\"{l s='Log me out' mod='blockuserinfo'}\" title=\"{l s='Log out' mod='blockuserinfo'}\" class=\"logout\" rel=\"nofollow\">{l s='Log out' mod='blockuserinfo'}</a>\n {else}\n<a href=\"{$link->getPageLink('my-account', true)}\" title=\"{l s='Login to your customer account' mod='blockuserinfo'}\" class=\"login\" rel=\"nofollow\">{l s='Log in' mod='blockuserinfo'}</a>\n {/if}\n\n\nand pasted into header.tpl to the place I wanted to have it. It appears and works BUT there is huge problem with translation - after pasting it into header.tpl data from blockuserinfo changed into english and I cannot change the language of those texts (even after switching the lang). In admin panel > module translation there is MISSING variable for login and logout under blockuserinfo.\n\nHow to repare it?"
] | [
"smarty",
"prestashop"
] |
[
"Creating a crosstab for product rankings across regions in r",
"The data is as follows:\nRegion <- c("XX","XX","XX", "YY","YY","YY","ZZ","ZZ")\n Product <- c("A","B","C","A","B","C","B","C")\n Ranks <- c(1,2,3,3,2,1,5,6)\n data <- data.table(Region,Product,Ranks)\n\nI want to create a crosstab like this :\n\nThere will be some products that are don't have any rank for a region"
] | [
"r"
] |
[
"Why is fprintf not printing anything in the file?",
"Why is it not printing anything in the file. I tested with fputs and it's also not working.\nIt is bugging me, because I'm just using scanf to get a string and passing it to the function fprintf.\n#include <stdio.h>\n#include <string.h>\n#define SIZEBUFFER 401\n\nint main(){\n FILE *arq;\n char file_name[44], text_buffer[SIZEBUFFER];\n char action, action2;\n int again = 1;\n while(1){\n printf("What do you want? ");\n scanf(" %c", &action);\n switch(action){\n case 'N': case 'n':\n printf("Type the file name: ");\n scanf(" %[^\\n]s", file_name);\n strcat(file_name, ".txt");\n arq = fopen(file_name, "a+");\n rewind(arq);\n do{\n printf("What do you want now? ");\n scanf(" %c", &action2);\n switch(action2){\n case 'W': case 'w':\n printf("Type the paragraph: \\n\\n");\n scanf( " %[^\\n]s", text_buffer);\n fprintf(arq, "%s\\n", text_buffer);\n break;\n case '0':\n again = 0;\n break;\n }\n putchar('\\n');\n }while(again);\n again = 1;\n break;\n }\n }\n\n return 0;\n}"
] | [
"c",
"printf"
] |
[
"Comparing performance - htc vs jQuery",
"I have a (IE only) web app which now uses htc to render html widgets.\n\nI am considering migrating the app to jQuery. How does the performance compare between\nhtc and jQuery."
] | [
"jquery",
"performance",
"internet-explorer",
"html-components"
] |
[
"How can I read CSV with strange quoting in ruby?",
"I have CSV file with some line like:\n\ncol1,col \"two\",col3\n\n\nso i get Illegal quoting error and fix that by setting :quote_char => \"\\x00\"\n\n[\"col1\", \"col\\\"two\\\"\", \"col3\"]\n\n\nbut there is a line like\n\ncol1,col2,\"col,3\"\n\n\nlater in that file\n\n[\"col1\", \"col2\", \"\\\"col\", \"3\\\"\"]\n\n\nthen i read file line by line and call parse_csv wrapped in block. Set :quote_char => \"\\\"\", rescue CSV::MalformedCSVError exceptions and for that particular lines set :quote_char => \"\\x00\" and retry\n\nAll works perfectly until we get line\n\ncol1,col \"two\",\"col,3\"\n\n\nin this case it rescues from exception, set :quote_char => \"\\x00\" and result is\n\n[\"col1\", \"col\\\"two\\\"\", \"\\\"col\", \"3\\\"\"]\n\n\nApple Numbers is able to openn that file absolutely correctly.\n\nIs there are any setting for parse_csv to handle this without preprocess string in some way?\n\nUPD i show CSV lines as it is in file and results (arrays) as it was printed by p. there are no actual \\\" in my strings."
] | [
"ruby",
"csv"
] |
[
"Laravel submit button does not go to the next page and previous page",
"I have created a form page . When a user fills up all the input fields, then the form page goes to the preview page with the data. Preview page has 2 buttons. One is back and the other is next. If the user presses the back \n button, then user can edit his/her information. If the user press the next, the the data is stored in the database before going to the done page. But in the preview, the back and next button do not go the next or previous pages. \n\nThis is the first form page:\n\n\nThis is the 2nd preview page after submit the first page:\n\n\nThis is after click the next or back button in preview:\n\n\nThis is the controller\n\n public function preview(PERequest $request) {\n\n $pE = new PE($request->all());\n $cIs = $request->c;\n\n return view('kakaku.package_estimates.preview', compact('pE', 'cIs'));\n\n }\n public function done(PERequest $request)\n {\n $input= $request->except('action');\n if ($request->action === 'back') {\n return redirect()->back()->withInput($input);\n }\n $pE = new PE();\n $pE->fill($request->all())->save();\n $pEC = [];\n foreach ($request->c as $cI) {\n $pEC = [\n 'p' => $pE->id,\n 'c' => $cI\n ];\n $pE->pEC()->createMany([$pEC]);\n }\n\n return view('k.p_e.done');\n\n }\n\n\nThis is the route\n\nRoute::post('p/preview','K\\Controller@preview')->name('k.p.preview');\nRoute::post('ps/done','K\\Controller@done')->name('k.p.done');\n\n\nThis are the preview page submit buttons\n\n{!! Form::submit('abc',['name' => 'server_back_button','class'=>'btn reediting_btn']) !!}\n{!! Form::submit ('acb',['name'=>'commit','class'=>'btn estimate_done_btn_top','data-disable-with'=>'bcd']) !!}"
] | [
"php",
"laravel"
] |
[
"Why getLocationOnScreen(location) method gives the same result Altough the place of the image changes in Android?",
"I want to drag the image and find the last location of that image o the screen. I used the code below it gives the same locations every time Altough i drag it on the screen. How can I find the location of it what's wrong with this code. Thanks in advance..\n\npublic boolean onScroll(MotionEvent e1, MotionEvent e2,\n float distanceX, float distanceY) {\n\n view.onMove(-distanceX, -distanceY);\n\n int[] location= new int[2];\n\n view.getLocationOnScreen(location);\n Integer x=location[0];\n Integer y=location[1];\n\n Log.i(\"Location x1-->\",x.toString());\n Log.i(\"Location y1-->\",y.toString());\n\n return true;\n }\n\n public void onMove(float dx, float dy) {\n translate.postTranslate(dx, dy);\n invalidate();\n\n }\n\n\nThw logs shows this numbers all the time;\n\n05-01 12:07:01.264: I/Location x1-->(397): 24\n\n05-01 12:07:01.264: I/Location y1-->(397): 100"
] | [
"android"
] |
[
"Show/Hide Single Row in ASP.NET Repeater",
"I'm having trouble showing just a single row inside a repeater. I have all of them expanding correctly, but my efforts to show just that row have not worked out well.\n\n <asp:Repeater ID=\"rptPlayers\" runat=\"server\" OnItemDataBound=\"DataBound_ItemDataBoundEvent\">\n <HeaderTemplate>\n <thead>\n <tr>\n\n <th>Name</th>\n\n <th>Profile Approved?</th>\n <th>Playing in <%: DateTime.Now.Year %>?</th>\n <th>Roommate</th>\n <th>Manage</th>\n </tr>\n </thead>\n </HeaderTemplate>\n <ItemTemplate>\n <tbody>\n <tr>\n <td><a href=\"#\" class=\"show_hide\"><%# Eval(\"FirstName\") %>&nbsp;<%# Eval(\"LastName\") %></a></td>\n <td style=\"display: none\"><%# Eval(\"PlayerEmail\") %></td>\n <td>\n <asp:CheckBox ID=\"chkApproved\" runat=\"server\" Checked='<%# Eval(\"ProfileApproved\") %>' /></td>\n <td>\n\n <asp:CheckBox ID=\"chkPlayingCurrentYear\" runat=\"server\" Checked='<%# Eval(\"PlayingCurrentYear\") %>' /></td>\n <td>\n\n <asp:DropDownList ID=\"ddlRoommate\" runat=\"server\" AppendDataBoundItems=\"True\"></asp:DropDownList>&nbsp;\n <asp:LinkButton ID=\"lnkAssign\" runat=\"server\" OnClick=\"AssignPlayer\"></asp:LinkButton></td>\n <td>\n <asp:PlaceHolder ID=\"AdminActions\" runat=\"server\"></asp:PlaceHolder>\n <p class=\"text-danger\">\n <asp:LinkButton ID=\"lnkApproveProfile\" runat=\"server\" OnClick=\"ApprovePlayer\"></asp:LinkButton>\n <asp:LinkButton ID=\"lnkConfirm\" runat=\"server\" OnClick=\"ConfirmPlayer\"></asp:LinkButton>\n </p>\n </td>\n <td style=\"display: none\">\n <asp:Literal ID=\"ltUserId\" runat=\"server\" Text='<%# Eval(\"PlayerId\") %>'></asp:Literal></td>\n </tr>\n <tr>\n <td colspan=\"6\">\n <div class=\"slidingDiv\">\n Fill this space with really interesting content. <a href=\"#\" class=\"show_hide\">hide</a>\n </div>\n </td>\n </tr>\n </tbody>\n </ItemTemplate>\n </asp:Repeater>\n\n\nThis is my current jQuery, what am I missing to just toggle a single row?\n\n <script type=\"text/javascript\">\n $(document).ready(function () {\n $(\"div.slidingDiv\").hide();\n $(\".show_hide\").show();\n $('.show_hide').click(function () {\n $(\".slidingDiv\").slideToggle();\n // $(this).next('div.slidingDiv').eq(0).slideToggle(800);\n\n\n });\n });\n</script>"
] | [
"jquery",
"asp.net"
] |
[
"Google Chrome Mobile Emulator: How to show on screen keyboard",
"I'm debugging a mobile version of our website through Chrome's Mobile Emulation tool, but cannot figure out how to have an on-screen keyboard pop up when selecting a text field. \n\nI have clicked on the text box, but no keyboard pops up. If I do this on a mobile device, the default input method (keyboard) pops up and allows me to type. \n\nIs there a way to replicate this?"
] | [
"google-chrome",
"mobile",
"google-chrome-devtools"
] |
[
"What does \"Whitelabel\" mean in Spring Boot?",
"ErrorMvcAutoConfiguration in Spring Boot provides a default error page, \"Whitelabel Error Page\". But I don't understand what does the whitelabel mean.\n\nWhat is \"whitelabel\"? Is it a famous imaginary product in the Spring community?"
] | [
"java",
"spring",
"spring-mvc",
"spring-boot"
] |
[
"Comparing screen data at client side",
"Is there any way I can check whether the user has changed any data on the web page between the page load and save button click. If the user has opened any page to edit some data and clicks the save button without changing any data on the screen then I need to display a message.\n\nThanks in advance."
] | [
"jquery",
"asp.net"
] |
[
"How to write to an AMR-WB file in multichannel mode with Python under linux from RTP PAYLOAD",
"I've successfully written the RTP-payload into an amr-file and it works fine, according to the answer written in this question.\nhttps://stackoverflow.com/questions/61961965/convert-rtp-payload-payload-type-107-amr-wb-16khz-1channel-to-wav \n\nNow I tried to write a multichannel file according to chapter 5.2 according to document RFC 4867, but I failed. No decoder accepts the file. I've got 2 channels (stereo).\nI've already checked the correctness of the voice data in the file. And they seem correct.\nFirst I put the header according to chapter 5.2:\nhttps://tools.ietf.org/html/rfc4867#section-5.2\n\nThe magic number I checked and it's correct. Then I add the chan-desc-field and it should be as far as I understood:\nb'\\x00\\x00\\x00\\x02'\n\nIn the audiofile I read the same values. Is this correct?\nThe audiodata is saved according to 5.3 (1st paragraph):\n1.pack_chan1 1.pack_chan2, 2.pack_chan1 2.pack_chan2, etc\n\nNow clicking on the amr-file (or awb), the decoder says, that an error has occurred.\nOn the contrary, when I just write one channel in a file, according\nto chapter 5.1 and 5.3, everything works fine. It can be played with windows VLC-MEDIA PLAYER and\nLinux Ubuntu's Videos.\nWhere is my mistake?\nThanks and regards\nUpdate:\nChapter 3.5 of RFC4867, second paragraph says, that usually, codecs do not support encoding of\nmulti-channel audio content into a single bitstream, they can be\nused to separately encode and decode each of the individual channels.\nSo what can I do to produce the stereo sound with the 2 channels?"
] | [
"rtp",
"amr",
"avaudiofile"
] |
[
"Why is my Spark DataFrame much slower than RDD?",
"I have a very simple Spark DataFrame, and when running a DataFrame groupby, the performance is terrible - about 8x slower than the (in my head) equivalent RDD reduceByKey...\n\nMy cached DF is just two columns, customer and name with only 50k rows:\n\n== Physical Plan ==\nInMemoryColumnarTableScan [customer#2454,name#2456], InMemoryRelation [customer#2454,name#2456], true, 10000, StorageLevel(true, true, false, true, 1), Scan ParquetRelation[customer#2454,name#2456] InputPaths: hdfs://nameservice1/tmp/v2_selected_parquet/test_parquet2, None\n\n\nWhen I run the following two snippets, I'd expect similar performance, not the rdd version to run in 10s and the DF version in 85s...\n\nrawtempDF2.rdd.map(lambda x: (x['name'], 1)).reduceByKey(lambda x,y: x+y).collect()\n\nrawtempDF2.groupby('name').count().collect()\n\n\nAm I missing something really fundamental here? FWIW, the RDD version runs 54 stages, and the DF version is 227 :/\n\nEdit: I'm using Spark 1.6.1 and Python 3.4.2. \nEdit2: Also, the source parquet was partitioned customer/day/name - currently 27 customers, 1 day, c. 45 names."
] | [
"python",
"apache-spark",
"dataframe",
"pyspark",
"apache-spark-sql"
] |
[
"Outlook requirement set version printed does not match the method that could be used",
"I deployed an Outlook Web Addin with a customer:\nOutlook desktop version : 2016\nExchange Server : 2013, 15.0.1497.7\n3 methods from Office.js library broke the code execution : Office.context.MailboxEnums.RestVersion , Office.context.mailbox.item.body.getAsync and Office.context.ui.displayDialogAsync\nI used Office.context.requirements.isSetSupported method to print supported version. Outlook desktop says it supports up to 1.4 requirement set. Outlook on the web says up to 1.3. The Microsoft doc says a 2013 Exchange Server limits us to 1.1 - which would explain the noticed behavior with that all three methods not supported under 1.3. The addin does not appear at all on OWA with IE 11 (!).\n\nHow can it be explained ? How can we prevent bugs from hapening if the client returns a requirement set supported which is far beyond what it actually is ? How should we manage these cases ?\nWhat is the recommended way to open a web page from an addin in 1.1 requirement set : is there anything else possible rather than a pop up (window.open) which can be blocked ?"
] | [
"outlook-web-addins"
] |
[
"Bad results while getting file details C",
"I have the following function that abstract the handling of stat struct in C\n\nint isdir(const char *filename) {\n struct stat st_buf;\n stat(filename, &st_buf);\n if(S_ISDIR(st_buf.st_mode))\n return 0;\n return 1;\n}\n\n\nAnd the main function calling isdir\n\nint main(...) {\n struct dirent *file;\n DIR *dir = opendir(argv[1]);\n\n while(file = readdir(dir)) {\n printf(\"%d\\n\", isdir(file->d_name));\n }\n closedir(dir);\n /* other code */\n}\n\n\nI have a folder called Test as a parameter of the program and within two files, one is a regular file called \"archivo\" and a folder called \"carpeta\". My program prints 1 and 1, from the file and the the folder, when it should be 0 and 1. I can't see where is the error.\n\nThe stat function ran in terminal gives the output for the file and the folder.\n\nFichero: «archivo»\nTamaño: 0 Bloques: 0 Bloque E/S: 4096 fichero regular\nDispositivo: 805h/2053d Nodo-i: 3159580 Enlaces: 1\nAcceso: (0664/-rw-rw-r--) Uid: ( 1000/alejandro) Gid: ( 1000/alejandro)\nAcceso: 2013-10-31 21:08:57.556446728 -0300\nModificación: 2013-10-31 21:08:57.556446728 -0300\n Cambio: 2013-10-31 21:08:57.556446728 -0300\nCreación: -\n\nFichero: «carpeta/»\nTamaño: 4096 Bloques: 8 Bloque E/S: 4096 directorio\nDispositivo: 805h/2053d Nodo-i: 3147783 Enlaces: 2\nAcceso: (0775/drwxrwxr-x) Uid: ( 1000/alejandro) Gid: ( 1000/alejandro)\nAcceso: 2013-10-31 21:19:11.728526599 -0300\nModificación: 2013-10-31 21:19:20.867833586 -0300\nCambio: 2013-10-31 21:19:20.867833586 -0300\nCreación: -"
] | [
"c",
"file",
"file-permissions"
] |
[
"NodeJS hmac digest issue with accents",
"I'm doing a side by side comparison with Ruby, PHP and NodeJS for the following code, getting an incorrect response in NodeJS using the crypto module.\n\nPHP\n\n\nhash_hmac('sha256', 'text', 'á');\n\n\nRuby\n\n\nOpenSSL::HMAC.hexdigest('sha256', 'á', 'text')\n\n\nNodeJS\n\n\nvar signer = crypto.createHmac('sha256', 'á');\nvar expected = signer.update(\"text\").digest('hex');\n\n\nBoth Ruby and PHP return 34b3ba4ea7e8ff214f2f36b31c6a6d88cfbf542e0ae3b98ba6c0203330c9f55b, while, NodeJS returns 7dc85acba66d21e4394be4f8ead2a327c9f1adc64a99c710c98f60c425bd7411. I noticed that, if I try with utf8_encode('á') in PHP, it actually gives me the result Node expects.\n\nI'm loading the accented text in Node from a file, like so:\n\nJSON.parse(fs.readFileSync('keys.js', 'utf8'));\n\n\nHow would I go about changing my code in Node to get the resulting hash that both PHP and Ruby present?\n\nThanks!"
] | [
"node.js",
"hmac"
] |
[
"New factory rules in laravel 8",
"can someone tell me how can I now make factories with relationships and foreign keys? For example, I need to make these factories:\nUserFactory,\nCategoryFactory,\nPostFactory.\nI have done all relationships and now I just need to fill fields in the database... for the user, it is usual: name, email, some generic PW etc...\nFor categories, I just need category (like category_name) and slug\n; and for posts I need user_id (author which have a relationship with users table), category_id(relationship with categories table), title, slug, content, image, published_at(fillable is $dates).\nI tried this code for posts and categories:\nPostFactory:\n$title = $this->faker->sentence;\n $slug = Str::slug($title);\n\n return [\n 'user_id' => User::factory(),\n 'category_id' => Category::factory(),\n 'title' => $title,\n 'slug' => $slug,\n 'post_image' => $this->faker->imageUrl('900', '300'),\n 'content' => $this->faker->paragraph,\n 'published_at' => null\n ];\n\nCategoryFactory:\n$category = $this->faker->word;\n $slug = Str::slug($category);\n\n return [\n 'category' => $category,\n 'slug' => $slug\n ];\n\nBut it does not work... I used tinker to run it\nUser::factory()->count(20)->make()\nCategory::factory()->count(7)->make()\nPost::factory()->count(20)->make()\n\nAnd the issue is that it will make 20 users (this part is good), but instead of 7 categories it will make 10 and in posts will have category_id 9 which should never happen...\nAnd the second problem is categories will be sent to the database but the wrong amount and posts won't be sent to the database at all."
] | [
"laravel"
] |
[
"403 Forbidden when trying keycloak authentication",
"I am doing my first steps with SAML, I am using Wildfly + Keycloak adapter attacking a docker Keycloak server, following this guide.\nI have a patched Wildfly-14.0.1.Final, with my helloworld.war deployed, accessing to http://localhost:8080/helloworld shows the page.\nI have started the keycloak server, setup a HelloworldRealm and a helloworld client (openid-connect for the time being), Root URL is http://localhost:8080/helloworld, Valid Redirect URIs contains only http://localhost:8080/helloworld/*\nI get the installation code for standalone.xml, and I copy it into standalone.xml:\n <subsystem xmlns="urn:jboss:domain:keycloak:1.1">\n <secure-deployment name="helloworld.war">\n <realm>helloworldRealm</realm>\n <resource>helloworld</resource>\n <auth-server-url>http://localhost:9080/auth/</auth-server-url>\n <ssl-required>EXTERNAL</ssl-required>\n <credential name="secret">e99f2281-5c39-4d36-9e38-3da104f0ac32</credential>\n </secure-deployment>\n </subsystem>\n\nand I modify the web.xml of the war\n<?xml version="1.0" encoding="UTF-8"?>\n<web-app version="4.0"\n xmlns="http://xmlns.jcp.org/xml/ns/javaee"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">\n\n <welcome-file-list>\n <welcome-file>hola.html</welcome-file>\n </welcome-file-list>\n\n <security-constraint>\n <web-resource-collection>\n <web-resource-name>todo</web-resource-name>\n <url-pattern>/*</url-pattern>\n </web-resource-collection>\n \n <auth-constraint>\n <role-name>*</role-name>\n </auth-constraint>\n </security-constraint>\n\n <login-config>\n <auth-method>KEYCLOAK</auth-method>\n <realm-name>HelloworldRealm</realm-name>\n </login-config>\n</web-app>\n\nThe Wildfly is 14.0.1.Final, the keycloack adapter and the server are both 11.0.2.\nBut when I go to http://localhost:8080/helloworld, I only get a 403 Forbidden (without any redirection). Logs don't show anything, neither on my Wildfly nor in the Keycloak server.\nWhat am I doing wrong?"
] | [
"wildfly",
"keycloak",
"saml"
] |
[
"How to show precise data in value axis on amchart XY chart without rounding the decimals automatically?",
"I've been fiddling with this amchart 4 code for a few days but still could not get it to display the Y axis data precisely, its always tend to round it down or up\n\nIve tried maxprecision option, numberformat options and many other options and still could not get it parsed properly, data is being loaded via json but for jsfiddle, i have made a similar temp data within javascript\n\nchart.data = \n[{\"date\":\"2019-11-07\",\"value\":0.0051},\n{\"date\":\"2019-11-06\",\"value\":0.0063},\n{\"date\":\"2019-11-05\",\"value\":0.0059},\n{\"date\":\"2019-11-04\",\"value\":0.0071},\n{\"date\":\"2019-11-03\",\"value\":0.0101},\n{\"date\":\"2019-11-02\",\"value\":0.0113},\n{\"date\":\"2019-11-01\",\"value\":0.0101}];\n\n\nSo on the Y Axis It does not show the value as 0.0101, instead its being rounded up to 0.01 instead\n\nhere is an example code running on jsfiddle that shows the issue clearly\n\nhttps://jsfiddle.net/6gck9yz8/"
] | [
"formatting",
"decimal",
"rounding",
"amcharts",
"amcharts4"
] |
[
"How do I replace an attribute using htmlParser?",
"UPDATE: Hi Pascal, Thanks for the quick reply, This is almost what I wanted. The newlink is different for each tag, can you please help me to do that. \n\nAll I need to do is iterate over all the link tags that appear in the input String, grab their value, and replace with a different link with out disturbing the link text\n\nI am new using htmlParser in Java, please help me with this condition.\n\nhtmlString = <a class=\"user\" href=\"\">first name</a> posted on <a class=\"user\" href=\"\">Test Test</a>'s wiki entry, <a href=\"http://localhost:8080/b/lll/ddd\">werwrwrwerwerwer</a>, in \n\n\nI need to replace the href link in <a class=\"user\" href=\"\"> to another link in the tag."
] | [
"java",
"html",
"parsing"
] |
[
"Could not Autowired JobLauncherTestUtils in Spring-Batch",
"I am getting below error while performing a functional test for a step in spring-batch .\nGetting below error:\n\nCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.batch.test.JobLauncherTestUtils] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}\nat org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)\nat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)\nat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)\nat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)\n\n\nBelow is the configuration file and Test file used for this.\n\ncustom-context.xml file:\n\n<batch:job id=\"custom.entities\">\n <batch:step id=\"entity.processor\">\n <batch:tasklet>\n <batch:chunk reader=\"customReader\" writer=\"customWriter\" commit-interval=\"1\" />\n </batch:tasklet>\n </batch:step>\n</batch:job>\n\n<bean id=\"customReader\" class=\"com.batch.custom.EntityReader\" scope=\"step\">\n <property name=\"providerId\" value=\"#{jobParameters['providerId']}\" />\n</bean>\n\n<bean id=\"customWriter\" class=\"org.springframework.batch.item.file.FlatFileItemWriter\">\n <property name=\"resource\" value=\"file:c:/Temp/ledgers-output.txt\"/>\n <property name=\"lineAggregator\">\n <bean class=\"org.springframework.batch.item.file.transform.PassThroughLineAggregator\" />\n </property>\n</bean>\n\n\nCustomJobTest.java file\n\n@Autowired\nprivate JobLauncherTestUtils jobLauncherTestUtils;\n\n@Autowired\nprivate ItemReader<WatchlistDataSet> reader;\n\n@Test\n@DirtiesContext\npublic void testLaunchJob() throws Exception {\n\n JobParameters jobParameters = new JobParametersBuilder().addString(\"providerId\", \"cnp_1\").toJobParameters();\n\n JobExecution exec = jobLauncherTestUtils.launchStep(\"entity.processor\", jobParameters);\n\n assertEquals(BatchStatus.COMPLETED, exec.getStatus());\n\n}\n\npublic JobLauncherTestUtils getJobLauncherTestUtils() {\n return jobLauncherTestUtils;\n}\n\npublic void setJobLauncherTestUtils(JobLauncherTestUtils jobLauncherTestUtils) {\n this.jobLauncherTestUtils = jobLauncherTestUtils;\n}"
] | [
"spring-batch"
] |
[
"PHP ISSET Function Not Excuted",
"In My Source When I press the Remove Button,inside isset code not excuted.can any one help me,\n\n<body>\n<form method=\"post\" action=\"<?php echo $_SERVER['PHP_SELF'];?>\">\n\n<?php\n\n$dbc=mysqli_connect(\"localhost\",\"root\",\"\",\"elvis_store\") or die(\"Error Connecting to Mysql Database\");\n\nif(isset($_POST['submit'])){\n\n\necho \"Hello\";\nforeach($_POST['todelete'] as $delete_id){\n\n$query=\"DELETE FROM email_list WHERE id=$delete_id\";\nmysqli_query($dbc,$query) or die(\"Error Querying Database\");\n\n}\n\necho \"Customer(s) Removed\";\n\n\n}\n\n\n\n$query=\"SELECT * FROM email_list\";\n$result=mysqli_query($dbc,$query)or die(\"Query Syntaxt is Incorrect\");\n\nwhile($row=mysqli_fetch_array($result)){\n\necho '<input type=\"checkbox\" value=\"' . $row['id'] . '\" name=\"todelete[]\" />';\necho $row['first_name'].\" \".$row['last_name'].\" \".$row['email'];\necho \"<br/>\";\n\n\n\n\n}\n\n\n\nmysqli_close($dbc);\n\n?>\n\n<input type=\"submit\" name\"submit\" value=\"Remove\"/>\n</form>\n\n\n\n\n</body>"
] | [
"php"
] |
[
"JQuery Datepicker and Command button",
"I have a date picker to select a specific date from and that should match with the data in MySQL table.\n\nHere is the code :\n\n $(function () {\n $(\"#datepicker\").datepicker({\n dateFormat: \"yy-mm-dd\",\n showOn: \"button\",\n buttonImage: \"calendar.gif\",\n buttonImageOnly: true,\n });\n\n$(\"#datepicker\").datepicker(\"option\", \"onSelect\", function (dateText, inst) { \n ...do something... \n\n });\n });\n\n\nIf I select a date from the date picker then return data correctly from the MySQL table. But I want to execute the command by the following manner :\n\n\nFirst -> select a date from date picker\nSecond -> Press a command button like \"Show\"\nThird -> Then return the relevant data set from MySQL table\n\n\nI'm not sure what I'm going wrong. Can anyone help me ?.."
] | [
"mysql",
"datepicker"
] |
[
"T SQL multi thread for launching xp_cmdshell jobs",
"I have a job that takes database backup files and compresses them to .7z files using seven zips command line utility and at the moment it takes about 8 hours to run through all the .bak files because it is doing one at a time. This is running on has about 16 cores and the 7z process only seems to be using 1 core so I would like to be able to run multiply instances of the xp_cmdshell command to have it compress several files at a time. Is there any way to execute a list of commands in T SQL on MSSQL Server 2005?\n\nI have post my script below. \n\nThis is a link to the program I am using to zip the files.\n[http://downloads.sourceforge.net/sevenzip/7za920.zip][1] \n\n-- YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY\n-- II zip all files in a folder II\n-- VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n\n-- Zip and then Delete all files from the backup folder\n-- List all files in a directory - T-SQL parse string for date and filename \nDECLARE @PathName VARCHAR(256) , \n @CMD VARCHAR(512) \n\nCREATE TABLE #CommandShell ( Line VARCHAR(512)) \n\n -- To use the xp_cmdshell option it has to be enabled. you can use the script bellow to enable it.\n --\n -- -- run exec sp_configure to see if the option exists in this list and you can check if it is enabled.\n -- EXEC sp_configure\n -- go\n -- -- if you don't see xp_cmdshell in the list then you will have to enable advanced options first \n -- -- before you can enable the xp_cmdshell option.\n -- EXEC sp_configure 'show advanced options', 1;\n -- go\n -- reconfigure\n -- go\n -- -- if xp_cmdshell is in the list then you should just need to run this script.\n -- exec sp_configure 'xp_cmdshell', 1\n -- go\n -- reconfigure\n\nSET @PathName = 'D:\\FILES\\Backups\\' \n\nSET @CMD = 'DIR ' + @PathName + ' /TC' \n\nINSERT INTO #CommandShell \nEXEC MASTER..xp_cmdshell @CMD \n\n-- Delete lines not containing filename\nDELETE \nFROM #CommandShell \nWHERE Line NOT LIKE '[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9] %' \nOR Line LIKE '%<DIR>%'\nOR Line is null\n\n-- SQL reverse string function - charindex string function \nSELECT ROW_NUMBER() OVER (ORDER BY REVERSE( LEFT(REVERSE(Line),CHARINDEX(' ',REVERSE(line))-1 ) )) AS ROW_NUM,\n FileName = REVERSE( LEFT(REVERSE(Line),CHARINDEX(' ',REVERSE(line))-1 ) ),\n CreateDate = LEFT(Line,10)\nINTO #tempFileList \nFROM #CommandShell\nWHERE REVERSE( LEFT(REVERSE(Line),CHARINDEX(' ',REVERSE(line))-1 ) ) LIKE '%.bak'\nORDER BY FileName\n\nDROP TABLE #CommandShell\n\nDECLARE @FileMaxRownum INT\nSET @FileMaxRownum = (SELECT MAX(ROW_NUM) FROM #tempFileList)\n\nDECLARE @FileIter INT\nSET @FileIter = (SELECT MIN(ROW_NUM) FROM #tempFileList)\n\nWHILE @FileIter <= @FileMaxRownum\nBEGIN\n DECLARE @DelFile varchar(200)\n --@@\n DECLARE @cmd2 VARCHAR(1000)\n SET @cmd2 = null\n DECLARE @db_bkp_files_dir varchar(100)\n SET @db_bkp_files_dir = null\n DECLARE @archive_destination_dir varchar(100)\n SET @archive_destination_dir = null\n DECLARE @archive_name varchar(100)\n SET @archive_name = null\n DECLARE @7z_path varchar(100)\n SET @7z_path = null\n set @archive_destination_dir = @PathName --destination dir\n set @7z_path = 'D:\\FILES'\n set @db_bkp_files_dir = right(@PathName,1) --db backup files origin \n SELECT TOP(1) @archive_name = FileName FROM #tempFileList WHERE ROW_NUM = @FileIter\n SET @cmd2 = @7z_path + '\\7za a -t7z -mx5 -ms=off ' + @archive_destination_dir + @archive_name + '.7z ' + @archive_destination_dir + @archive_name\n print @cmd2\n EXEC xp_cmdshell @cmd2\n --@@\n SELECT TOP(1) @DelFile = 'del ' + @PathName + FileName FROM #tempFileList WHERE ROW_NUM = @FileIter\n EXEC xp_cmdshell @DelFile\n SET @FileIter = @FileIter + 1\nEND\nDROP TABLE #tempFileList"
] | [
"sql",
"multithreading",
"xp-cmdshell"
] |
[
"Relatively Sized Rectangles in Kivy Widget Canvas",
"I created the following Widget, which does correctly draw a checkerboard pattern. However, the edge_len variable is not (apparently) obeying the asserted definitions.\n with self.canvas:\n # Define the lengths of the edges of the squares. TODO: Check for relative growth.\n edge_len = min(self.height, self.width) // 8\n for column in range(0, 8):\n for row in range(0, 8):\n if ((row + column) % 2) == 0:\n graphics.Color(0, 0, 1)\n self.dark_rect = graphics.Rectangle(pos=(column*edge_len, row*edge_len), size=(edge_len, edge_len))\n else:\n graphics.Color(1, 1, 1)\n self.light_rect = graphics.Rectangle(pos=(column*edge_len, row*edge_len), size=(edge_len, edge_len))\n\nI'm currently just running the App to return a Boxlayout() with this Widget as its only element. When edge_len = min(self.height, self.width) // 8 is there, it makes the board quite small. When edge_len = min(self.height, self.width) is used, instead, the eighth checkerboard tile does end at the window's width, but extends much higher than that.\nI'm trying to work out how to keep the drawn result relatively sized to its layout container/child, but still perfectly square."
] | [
"python",
"kivy"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.