texts
list | tags
list |
---|---|
[
"Change the value of the Checkbox",
"I add a new line of data into the table through the form. On the form I also have checkbox which is also integrated into the table. Ticking the checkbox leads to getting a value of -1. Is it possible to change -1 into a user defined value such as 'x'?"
] | [
"ms-access",
"ms-access-2007"
] |
[
"How to fix \"struct 'FILE' has no member named'__pad'\" error when using $make in apue.3e in ubuntu-18.10",
"I'm a newbie in learning APUE. And there are some errors I don't know how to fix when I'm using $make in apue.3e folder. By the way, I use ubuntu-18.10.\n\nbuf.c:104:13: note: in expansion of macro ‘_flag’\n return(fp->_flag & _IOLBF);\n ^~~~~\nbuf.c: In function ‘buffer_size’:\nbuf.c:92:15: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘__pad’; did you mean ‘__pad5’?\n #define _base __pad[2]\n ^~~~~\nbuf.c:111:13: note: in expansion of macro ‘_base’\n return(fp->_base - fp->_ptr);\n ^~~~~\nbuf.c:91:14: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘__pad’; did you mean ‘__pad5’?\n #define _ptr __pad[1]\n ^~~~~\nbuf.c:111:25: note: in expansion of macro ‘_ptr’\n return(fp->_base - fp->_ptr);\n ^~~~\nbuf.c: In function ‘is_unbuffered’:\nbuf.c:99:1: warning: control reaches end of non-void function [-Wreturn-type]\n }\n ^\nbuf.c: In function ‘is_linebuffered’:\nbuf.c:105:1: warning: control reaches end of non-void function [-Wreturn-type]\n }\n ^\nbuf.c: In function ‘buffer_size’:\nbuf.c:115:1: warning: control reaches end of non-void function [-Wreturn-type]\n }"
] | [
"ubuntu",
"unix"
] |
[
"How to switch between ad networks randomly?",
"I have an app and I want to add advertisement from few companies, such as tapjoy, inneractive... How to make them to be changed randomly? \n\nUPD:\nI want to display advertisement from few ad-companies. For example, in the screen A it is tapjoy, in 10-15 min in the same creen it goes Moblicx, in another minutes it will be Leadbolt..."
] | [
"android"
] |
[
"php variable inside a json",
"I have this code for paypal single payout call, and want to add a php variable where the price is at 'value':\".$planPrice.\" \nIf instead of $planPrice I put any number for example: \"1000\" it works without a problem and I get the notification, but when I add the php variable it says this: \n\n\n Fatal error: Uncaught exception 'InvalidArgumentException' with\n message 'Invalid JSON String' in\n C:\\xampp\\htdocs\\website\\paypal_payouts\\PayPal-PHP-SDK\\paypal\\rest-api-sdk-php\\lib\\PayPal\\Validation\\JsonValidator.php:29\n Stack trace: #0\n C:\\xampp\\htdocs\\website\\paypal_payouts\\PayPal-PHP-SDK\\paypal\\rest-api-sdk-php\\lib\\PayPal\\Common\\PayPalModel.php(50):\n PayPal\\Validation\\JsonValidator::validate('{\\r\\n ...') #1\n C:\\xampp\\htdocs\\website\\paypal_payouts\\CreateSinglePayout.php(67):\n PayPal\\Common\\PayPalModel->__construct('{\\r\\n ...') #2\n C:\\xampp\\htdocs\\website\\admin\\reports\\paynow.php(19):\n include('C:\\xampp\\htdocs...') #3 {main} thrown in\n C:\\xampp\\htdocs\\website\\paypal_payouts\\PayPal-PHP-SDK\\paypal\\rest-api-sdk-php\\lib\\PayPal\\Validation\\JsonValidator.php\n on line 29\n\n\nThis is the code in php: \n\n$senderItem = new \\PayPal\\Api\\PayoutItem();\n$senderItem->setRecipientType('Email')\n ->setNote('Thanks for your patronage!')\n ->setReceiver($coachUsername)\n ->setSenderItemId(\"2014031400023\")\n ->setAmount(new \\PayPal\\Api\\Currency(\"{\n 'value':\".$planPrice.\",\n 'currency':'USD'\n }\"));"
] | [
"php",
"json",
"paypal"
] |
[
"Rails: \"This error occurred while loading the following files: bcrypt\"",
"Comment on the downvoting: This question has erroneously been marked as duplicate. It is clear from the gemfile which I have attached that I am using a more recent version of bcrypt. This and other differences (I am using Ubuntu 12.04 whereas the other thread mentions Windows) makes the solution of that other thread inapplicable to my case. I am still having the issue and would welcome any advice. \n\n=end of comment\n\nI'm working through the famous Rails tutorial but got stuck at Listing 7.5 - I think I followed all instructions but instead of getting I'm getting . The actual error stack is:\n\napp/models/user.rb:6:in `<class:User>'\napp/models/user.rb:1:in `<top (required)>'\napp/controllers/users_controller.rb:4:in `show'\nThis error occurred while loading the following files:\nbcrypt\nRequest\nParameters:\n{\"id\"=>\"1\"}\n\n\nHere is my Gemfile:\n\nsource 'https://rubygems.org'\nruby '2.1.1'\n#ruby-gemset=railstutorial_rails_4_0\n\ngem 'rails', '4.0.4'\ngem 'bootstrap-sass', '2.3.2.0'\ngem 'sprockets', '2.11.0'\ngem 'bcrypt-ruby', '3.1.2'\n\ngroup :development, :test do\ngem 'sqlite3', '1.3.8'\ngem 'rspec-rails', '2.13.1'\ngem 'guard-rspec', '2.5.0'\ngem 'spork-rails', '4.0.0'\ngem 'guard-spork', '1.5.0'\ngem 'childprocess', '0.3.6'\nend\n\ngroup :test do\ngem 'selenium-webdriver', '2.35.1'\ngem 'capybara', '2.1.0'\nend\n\ngem 'sass-rails', '4.0.1'\ngem 'uglifier', '2.1.1'\ngem 'coffee-rails', '4.0.1'\ngem 'jquery-rails', '3.0.4'\ngem 'turbolinks', '1.1.1'\ngem 'jbuilder', '1.0.2'\n\ngroup :doc do\ngem 'sdoc', '0.3.20', require: false\nend\n\n\nHere is the User.rb:\n\nclass User < ActiveRecord::Base\nbefore_save {self.email = email.downcase}\nvalidates :name, presence: true, length: { maximum: 50 }\nVALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i\nvalidates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false }\nhas_secure_password\nvalidates :password, length: { minimum: 6 }\nend\n\n\nHere is the routes.rb:\n\nSampleApp::Application.routes.draw do\n\nresources :users # replaces: get \"users/new\"\nroot 'static_pages#home'\nmatch '/signup', to: 'users#new', via: 'get'\nmatch '/help', to: 'static_pages#help', via: 'get'\nmatch '/about', to: 'static_pages#about', via: 'get'\nmatch '/contact', to: 'static_pages#contact', via: 'get'\n\nend\n\n\nAnd here is the user_controller.rb:\n\nclass UsersController < ApplicationController\n\ndef show\n@user = User.find(params[:id])\nend\ndef new\nend\nend\n\n\nCan you tell where is the problem?"
] | [
"ruby-on-rails",
"bcrypt",
"railstutorial.org"
] |
[
"Return data as String",
"I use this code to download an image from Angular FE:\n\n@RequestMapping(value = \"/company_logo/{job_id}\",method= RequestMethod.GET,produces = MediaType.IMAGE_PNG_VALUE)\n public @ResponseBody byte[] getImageWithMediaType(@PathVariable int job_id) throws IOException {\n\n ClassLoader classloader = Thread.currentThread().getContextClassLoader();\n InputStream is = classloader.getResourceAsStream(\"color.jpg\");\n byte[] bytes = IOUtils.toByteArray(is);\n InputStream in = new ByteArrayInputStream(bytes);\n return IOUtils.toByteArray(in);\n }\n\n\nBut I would like to return the image not as a byte[] but as String. What is the proper way to implement this?"
] | [
"java"
] |
[
"Monotouch: garbage collector, managed and unmanaged objects",
"I'm trying to understand how MT GC works to avoid memory leaks in iOS apps using (MonoTouch) MT.\n\nAs I understood (correct me if I'm wrong), MT memory management works in this manner: each object has a flag which says: \"Dear GC, now I'm free to be released whenever you want\". When the GC runs, it verifies that flag and remove the object from the memory. So, MT puts every object in a sort of limbo where objects in it will be released (next event cycle, maybe). It's a sort of autorealease mechanism. But it also possible to release explicity an object calling its dispose method. In this case, it means adopt retain-release mechanism.\n\nReading about MT, I've seen that there are objects that go into the managed heap (for example references to images) and other that go into unmanaged heap (for example images). In the first case (the managed one) I have not to be worry about it, the GC works well. In the second one (unmanaged case), I have to release memory explicity. Why this difference? Could you explain me how I can distinguish managed from unmanaged objects and when to release explicity the memory calling dispose method?\n\nThank you in advance."
] | [
"garbage-collection",
"xamarin.ios",
"unmanaged",
"managed"
] |
[
"Calculate a total with an input in JavaScript",
"I have a table which has an input at the end of each row to let the user select how many of each item they want to buy. I have made a JavaScript code that takes the data from each line of the table and makes a total price, but i can't find why it is not doing anything when i submit my form. It does show the console log but not the total which should be in my span.\n\nHere is the code:\n\n<?php\n\nif ($result->num_rows > 0) {\n\n // output data of each row\n while($row = $result->fetch_assoc()) {\n ?>\n\n <tr>\n <td><?= htmlentities($row['id']); ?></td>\n <td><?= htmlentities($row['Article']); ?></td>\n <td><?= htmlentities($row['Prix']); ?></td>\n <td><?= htmlentities($row['PrixRetour']); ?></td>\n <td><?= htmlentities($row['QuantiteeMaximale']); ?></td>\n <td><?= htmlentities($row['Projet']); ?></td>\n <td><input data-price='<?= floatval($row['Prix']); ?>' data-max-quantity='<?= intval($row['QuantiteeMaximale']); ?>' type=\"number\" name=\"quantity\"></td>\n </tr>\n\n <?php\n }\n\n ?>\n\n </table>\n\n <p>Grand Total: $<span id='grandTotal'></span></p>\n\n <script>\n console.log(\"test1\");\n const tableEl = document.getElementById('articles')\n const grandTotalEl = document.getElementById('grandTotal')\n const quantityInputEls = tableEl.querySelectorAll('input[name=quantity]');\n\n (function calTotal() {\n console.log(\"test2\");\n const updateGrandTotal = (grandTotalEl, inputEls) => {\n grandTotalEl.innerText = inputEls.reduce((total, inputEl) => {\n const maxQuantity = parseInt(inputEl.dataset.maxQuantity)\n\n if(parseInt(inputEl.value) > maxQuantity) inputEl.value = maxQuantity\n if(parseInt(inputEl.value) < 0) inputEl.value = 0\n\n const price = parseFloat(inputEl.dataset.price)\n const quantity = parseInt(inputEl.value)\n\n console.log(\"hello\");\n\n if(isNaN(quantity)) return total\n\n return total + (price * quantity)\n\n }, 0)\n }\n console.log(\"test3\");\n\n quantityInputEls.forEach(el => el.addEventListener('keyup', () => updateGrandTotal(grandTotalEl, inputEls)))\n })();\n </script>\n\n <?php\n} else {\n echo \"0 results\";\n}\n$conn->close();\n\n?>"
] | [
"javascript",
"php"
] |
[
"How can I retrieve data from an array, 3 at a time?",
"Is there a better way in PHP to access this array in groups of three?\n\nLet's say my array is a comma separated string like: \n\n(\"Thora\",\"Birch\",\"Herself\",\"Franklin Delano\",\"Roosevelt\",\"Himself (archive footage)\",\"Martin Luther\",\"King\",\"Himself (archive footage) (uncredited)\")\n\n\nAlthough the array can end up being much larger, each one will be different but still in logical groups of three (firstname, lastname, role).\n\nWhat I'm trying to accomplish is looping through the array in groups of three, so that the first record would have firstname[0]=>\"Thora\", lastname[0]=>\"Birch\" and role[0]=>\"Herself\".\n\nI'm only used to foreach loops but don't see an extra parameter like \"for each 3\" so maybe someone can shed some light?"
] | [
"php",
"arrays",
"loops"
] |
[
"Get global variables from map",
"I would like to have a groovy file for my Jenkins pipeline shared library that would store several keys with default values and be able to call and get the value of individual keys from other functions in different groovy functions such as test.groovy. I am not sure how I should or can structure the groovy file.\n\n/vars/settings.groovy\n\ndef configuration = [\n artifactoryURL: 'artifactory.example.com', \n daysToKeep: 14, \n maxRetry: 3 ]\n\n\n/var/test.groovy\n\nglobalVariables.get('artifactoryURL') // I would like this to return \"artifactory.example.com\"\n\n\nAny help would be appreciated. \n\nUpdate:\n\nI got this to work as follows:\n\n/vars/settings.groovy\n\n#!/usr/bin/groovy\ndef getConfig() {\ndef config = [\n artifactoryURL: 'artifactory.example.com',\n daysToKeep: 14,\n maxRetry: 3\n]\nreturn config\n}\n\ndef getValue(name) {\n return config[name]\n}\n\n\n/vars/retrieveValue.groovy\n\n...\necho \"value is \" + settings.getConfig()\necho \"new value is \" + settings.getValue('artifactoryURL')\n...\n\n\nOutput:\n\nvalue is [artifactoryURL:artifactory.example.com, daysToKeep:14, maxRetry:3]\nnew value is artifactory.example.com\n\n\nIs this correct syntax?\nIs there a way to simplify these?"
] | [
"jenkins",
"groovy",
"jenkins-pipeline"
] |
[
"Spring JavaMailSender: Making it asynchronous and persistent",
"Is there an easy/lightweight way to add persistence to Spring's JavaMailSender and have it operate asynchronously? Does Spring provide any \"built-in\" support for this? I'm currently looking at queues with JMS, but they seem like overkill for the task at hand (looking at ActiveMQ and RabbitMQ). Is there a lightweight JMS option?"
] | [
"spring",
"queue",
"jms",
"spring-jms"
] |
[
"Why cant I send data through this ajax?",
"Hey guys I have been trying to hook up Html select element with ajax to change the language on my website. The idea is to send the value of select thought ajax to PHP file where I would then use that value as a session to include other PHP files with language variables.\nEverything works ok, but for some reason, the PHP file is not getting the data from ajax.\nSo here is the code:\nHTML:\n <div class="lang langMobile" style="opacity: 1; transform: translateX(0px);" >\n <div data-uk-form-custom="target: true" class="uk-form-custom">\n <select class="custom-select custom-select-mobile"id="language_custom-select">\n<option class="custom-option" hidden> <?php echo $_SESSION['lang']?></option>\n<option class="custom-option" value="En"> En</option>\n <option class="custom-option" value="Bs">Bs</option>\n </select>\n\n </div>\n</div>\n\nJS:\n$('#language_custom-select').change(function() {\n var optionValue = $('#language_custom-select').val();\n console.log(optionValue)\n $.ajax({\n url:'switch.php',\n method: 'POST',\n data: {selected: optionValue},\n }).done(function(data) {\n window.location.reload();\n })\n}) \n\nPHP:\n if(isset($_POST['selected'])) {\n \n $_SESSION['lang'] = $_POST['selected'];\n\n } else if (!isset($_SESSION['lang'])) {\n $_SESSION['lang'] = "En";\n\n \n }\n \n include "include/" . $_SESSION['lang'] . ".php";"
] | [
"javascript",
"php",
"jquery",
"ajax"
] |
[
"In Flutter (ios) BehaviorSubject emit previous data every-time I add new data",
"I have one BehaviourStream object and when I add data in it. it gives me old and new data in Listener. it should give me only the latest data.\nalso, it is working fine in android as it should be. in android, it gives me every time latest data.\nFor example\nbehaviour.add(1);\nbehaviour.listen() give 1 \nbehaviour.add(2);\nbehaviour.listen() give 1 and 2 both\nbehaviour.add(3)\nbehaviour.listen() give 1 and 2 and 3"
] | [
"ios",
"flutter",
"dart",
"reactive-programming",
"rxdart"
] |
[
"django allauth redirects to login instead of login on duplicate email",
"A default behavior of django-allauth is redirect to Singup form when the email retrieved from a social profile matches already existing user's emailid.\n\nInstead, I would like to redirect the user back to the login page with the following message in case of the matching emailid on social login:\n\nAn account already exists with this \"[email protected]\" e-mail address. Please sign in to that account first, then connect your \"PROVIDER\" account. You can sign in using \"LIST OF LINKED TO THAT EMAIL PROVIDERS\".\n\nHas anybody made something similar? Any help is appreciated."
] | [
"django",
"django-allauth"
] |
[
"replace strings with variables",
"$var1 = 'abc';\n$var2 = '123';\n\n\nHow can I replace %var1 and %var2% from a string like this:\n\naaaaaaaa%var1%bbbbbbbbb%var2%ffffffff\n\n\nwith the value of $var1 and $var2 ?"
] | [
"php",
"string",
"variables",
"replace"
] |
[
"How to make this sql query",
"I have 2 SQL Server tables with the following structure\n\nTurns-time\n\ncod_turn (PrimaryKey) \ntime (datetime)\n\nTaken turns\n\ncod_taken_turn (Primary Key)\ncod_turn\n...\n\n\nand several other fields which are irrelevant to the problem. I cant alter the table structures because the app was made by someone else.\n\ngiven a numeric variable parameter, which we will assume to be \"3\" for this example, and a given time, I need to create a query which looking from that time on, it looks the first 3 consecutive records by time which are not marked as \"taken\". For example:\n\nFor example, for these turns, starting by the time of \"8:00\" chosen by the user\n\n 8:00 (not taken)\n 9:00 (not taken)\n10:00 (taken)\n11:00 (not taken)\n12:00 (not taken)\n13:00 (not taken)\n14:00 (taken)\n\n\nThe query it would have to list \n\n11:00\n12:00\n13:00\n\n\nI cant figure out how to make the query in pure sql, if possible."
] | [
"sql-server"
] |
[
"SSL peer shut down incorrectly after upgrade android studio 3.5",
"After upgrade android studio 3.5, when I debug the app, say \"SSL peer shut down incorrectly.\""
] | [
"android",
"android-studio-3.5"
] |
[
"JPA Composite key (all fields are notNull and PRI)",
"I saw that exist more then one way to map a Composite Key with JPA.\n\nBut in my case is kind of different:\n\nI have a table with only 2 column:\n\n\nmysql> desc mytable;\n+--------+-------------+------+-----+---------+-------+\n| Field | Type | Null | Key | Default | Extra |\n+--------+-------------+------+-----+---------+-------+\n| name | varchar(80) | NO | PRI | | |\n| tag | varchar(80) | NO | PRI | | |\n+--------+-------------+------+-----+---------+-------+\n\n\nMy point is: Do I need to create a new (primary key class) class just to map my composite key?\n\nI'm trying to find the easiest way to do it.\n\nSome one can help-me?\n\nThanks in advance!\n\n\n\nI'm trying with this approach: http://www.java.net/print/236710"
] | [
"java",
"jpa",
"composite-key"
] |
[
"Parsing array in JSON using ASP.NET C#",
"I am using the following tutorial to parse a JSON document.\nhttp://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2010/08/22/using-c-4.0-and-dynamic-to-parse-json.aspx\n\nThe JSON document that I am trying to parse can be accessed here:\nhttp://www.visitproject.co.uk/Tweets/Ireland.txt\n\n JavaScriptSerializer jss = new JavaScriptSerializer();\n jss.RegisterConverters(new JavaScriptConverter[] { new DynamicJsonConverter() });\n\n dynamic tweets = jss.Deserialize(json, typeof(object)) as dynamic;\n\n foreach (var tweettext in tweets.statuses.text)\n {\n Console.WriteLine(\"Tweet: \" + tweettext);\n }\n\n\nI am able to perform a watch on tweets.statuses and it does contain a collection of tweets. I would like to get the text value from each tweet. The only thing I can see that is different for the tutorial is that it is an array in JSON and I expect that this is why it is not working. Does anyone have any ideas? Thank you for your help!"
] | [
"c#",
"asp.net",
"json",
"twitter",
"collections"
] |
[
"rake pass parameters to dependent tasks",
"Here is the current way I run rak dependent tasks\n\ntask :test => [:prepare_testdir,:run_tests]\n\n\ncurrently there is no parameters for these two dependent tasks. But I need to add parameters to one of tasks. It should be running like on command line\n\nrake prepare_testdir[mydir]\n\n\nHow do I pass this new parameter to this \n\ntask :test => [:prepare_testdir,:run_tests]\n\n\nI have tried \n\ntask :test => [:prepare_testdir[mydir],:run_tests]\n\n\nand\n\n task :test => [:prepare_testdir['mydir'],:run_tests]\n\n\nboth are not working.\n\nThanks in advance"
] | [
"ruby",
"rake"
] |
[
"install make command without already having make (mac os 10.5)",
"I'm trying to write a script that uses the make command, but Mac os 10.5 doesn't come with make installed by default, and when you download the make source code from gnu's website, you have to use make itself to compile and install it. which is hard if you don't have it in the first place. How can I install make?\n(I know you can get make by installing Xcode and the developer tools that come with mac os, but I don't want people to have to go find their mac os install dvds to be able to use the script.) \n\nIt doesn't even have to be make, i'm just looking for a utility that you can easily download in a script (using ftp or curl) and use to compile source code."
] | [
"bash",
"macos",
"makefile"
] |
[
"Disable ok button on JOptionPane.dialog until user gives an input",
"I need the user to input a name and I want to disable the ok button until some input is given. How can I disable it... ?"
] | [
"java",
"swing",
"joptionpane"
] |
[
"Changing div classes with Js",
"I'm trying to change classes of div with onclick, but there seems to be something wrong with my code because it doesn't work.\n\r\n\r\nfunction changeColorsDay() {\n document.getElementById(\"wrap\").classList.toggle(\"Day\", true);\n}\r\n* {\n margin: 0;\n}\n\n#wrap {\n width: 100vw;\n height: 100vh;\n margin: 0 auto;\n font: italic bold 15px arial, sans-serif;\n background-color: rgb(0, 14, 51);\n overflow-y: scroll;\n background-size: cover;\n}\n\nwrap.Day {\n background-color: rgb(240, 230, 232);\n}\r\n<div id=\"nav\">\n <a href=\"#\" class=\"Button\">Home Page</a>\n <a type=\"button\" class=\"Button\" onclick=\"changeColorsDay()\">Change</a>\n</div>\r\n\r\n\r\n\nWhat can I do to make it work?"
] | [
"javascript",
"html",
"css"
] |
[
"Multiple groupby with comma separated values in SQL Server",
"I had the following table structure which is listed below\n\nBudhol COCODE BEN OBJ SPARE2 SPARE1 TASKNO Value Field Code\n---------------------------------------------------------------------------------\n362103 36 362101 991003 NULL MA1001 NULL 4516 613030 001\n362104 36 362104 991003 NULL MA1001 NULL 9088 613030 002\n362103 36 362101 991003 NULL MA1001 NULL 3387 613030 003\n362103 36 362101 991003 NULL MA1001 NULL 4026 613030 004\n\n\nThis is the required output\n\nBudhol COCODE BEN OBJ SPARE2 SPARE1 TASKNO Value Field Code\n---------------------------------------------------------------------------------\n362103 36 362101 991003 NULL MA1001 NULL 11929 613030 001,003,001\n362104 36 362104 991003 NULL MA1001 NULL 9088 613030 002\n\n\ni.e By doing group by i need sum of all values and comma separated Codes\n\nI had tried below query but output is not matching im getting all the codes for all the columns\n\nSELECT \n B.BEN, B.Budhol, B.COCODE, B.FIELD, B.OBJ, B.SPARE1, B.SPARE2, \n SUM(B.value) AS Value ,\n Code = STUFF((SELECT ', ' + Code \n FROM #temp2 b \n WHERE b.BEN = B.BEN \n AND b.Budhol = B.Budhol \n AND b.COCODE = B.COCODE \n AND b.FIELD = B.FIELD \n AND b.SPARE1 = B.SPARE1 \n AND b.SPARE2 = B.SPARE2 \n FOR XML PATH('')), 1, 1, '')\nFROM \n #temp2 B\nGROUP BY \n B.BEN, B.Budhol, B.COCODE, B.FIELD, B.OBJ, B.SPARE1, B.SPARE2;"
] | [
"sql",
"sql-server",
"sql-server-2008"
] |
[
"Capturing \"Selstart\", \"Sel..end\" within a non-input element",
"I'm setting up a table, formatted like this.. Please forgive the silly sample data. All of this is actually loaded with json, but the output looks like this:\n\n<table id=\"famequotes\">\n<tr><td id=\"par001\">It was the best of times, it was the worst of times.</td></tr>\n<tr><td id=\"par002\">Two things are infinite: the universe and human stupidity; and I'm not sure about the universe</td></tr>\n<tr><td id=\"par003\">In the jungle, the mighty jungle, the lion sleeps tonight...</td></tr>\n</table>\n\n\nUsing mousedown on $(\"#famequotes td\"), and mouseup, I can allow users to highlight text and capture the start and end row, and similarly capture all the rows in between with onmouseover.\n\nWhat I want to do is capture the SelStart of the start row (the table cell I started highlighting from) and the sel...stop of the last row.\n\nI have not been able to find an answer, though I have researched and google searched already. \n\nMIchal Hainc's answer is really cool, but not what I am seeking.\n\nI can see how the selection box could be useful, and I would love to incorporate it.\n\nHowever, what I'm actually seeking is so that if the user highlights text as I've highlighted in http://jsfiddle.net/vhyyzeog/1/ it would return 3 for selStart and 12 for selEnd. I'm already tracking the first highlighted row, and the last, so I know what rows to apply selstart and selend to.\n\nThank you for any help."
] | [
"javascript",
"jquery",
"highlight"
] |
[
"Restore db from backup - Amazon RDS MSSQL",
"When I try to restore db from backup, on step selecting backup file I got this error:\n\nMicrosoft_SqlServer_Management_Sdk.Sfc\n\nFailed to retrieve data for this request. \n\nAdditional information:\nAn exception occured while executing a Transact-SQL statement or batch. \n(Microsoft.SqlServer.ConnectionInfo)\n\nThe EXECUTE permission was denied on the object 'xp.fixeddrives', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)\n\n! http://prntscr.com/222cr4 \"error\"\n\nMicrosoft Management Studio version which I try:\nMicrosoft SQL Server Management Studio 10.50.1617.0\nMicrosoft SQL Server Management Studio 11.0.2100.60\nMicrosoft SQL Server Management Studio 11.0.3368.0\n\nwith no luck. \n\nAny ideas?"
] | [
"sql-server-2008",
"amazon-web-services"
] |
[
"Theme.Holo.Light.DarkActionBar on Honeycomb",
"I've an app that would run on both ICS, honeycomb. For both these flavors, I wish to keep same theme: Theme.Holo.Light.DarkActionBar which is SDK >=14.\n\nI created a custom style:\n\n <style name=\"ActionBar.Dark\" parent=\"@style/ActionBar\">\n <item name=\"android:background\">@color/actionbar_background_dark</item>\n </style>\n\n<style name=\"Holo.light.dark.actionbar\" parent=\"@android:style/Theme.Holo.Light\">\n <item name=\"android:actionBarStyle\">@style/ActionBar.Dark</item>\n <item name=\"android:titleTextStyle\">@android:style/TextAppearance.Holo.Widget.ActionBar.Title</item>\n <item name=\"android:subtitleTextStyle\">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item>\n <item name=\"android:textColor\">@android:color/white</item>\n <item name=\"android:windowActionBarOverlay\">false</item>\n <item name=\"android:backgroundStacked\">@drawable/ab_stacked_transparent_light_holo</item>\n <item name=\"android:backgroundSplit\">@drawable/ab_bottom_transparent_dark_holo</item>\n <item name=\"android:homeAsUpIndicator\">@drawable/ic_ab_back_holo_dark</item>\n </style>\n\n\nBut this does only the half job, the dropdown spinner has white background with white text and all window titles are black text on black background.\n\nHow do I know of all the attributes that I should set to achieve full Theme.Holo.Light.DarkActionBar"
] | [
"android"
] |
[
"Android show blurry preview while large image loads",
"I'm developing a gallery in Android whit Glide. When the user selects a image It loads to a preview without any problems (All images are in the device memory), except when the image is to large > (10000 x 7000) then the loading could take up to 5 seconds in some devices...\n\nWhat I'm trying to achieve now is to show a blurry image while the full resolution load.\n\nGlide.with(getContext())\n .load(path)\n .thrumnail(0.1f)\n .into(mTouchImageView);\n\n\nBy using this thrumnail method all that I manage to achieve was to show a blurry image after the delay and almost immediately before the full resolution image.\n\nI'm I doing something wrong whit this method? Is there some way to achieve this behavior or other way to workaround this issue?"
] | [
"java",
"android",
"image",
"android-glide"
] |
[
"xsl recursive loop node by index",
"I have created a recursive template for getting the first n number of items from my XML.\n\nIt uses an index(counter) just like how I would in a for loop. Now how can I get a node from my XML using the index?\n\nI have tried [position()=$index] but it had weird behaviour when trying to get deeper nodes in the XML hierarchy.\n\nIf I have XML such as:\n\n<0>\n <1>\n <2>item</2>\n <2>item</2>\n <2>item</2>\n <2>item</2>\n <2>item</2>\n <2>item</2>\n </1>\n</0>\n\n\nI want to be able to count through and copy the 2's until I have as many as I want."
] | [
"xpath",
"recursion",
"xslt",
"loops",
"indexing"
] |
[
"Pyspark Dataframe Default storagelevel for persist and cache()",
"P is a dataframe.\nI observed below behaviour in storagelevel:\n\nP.cache()\nP.storageLevel\nStorageLevel(True, True, False, True, 1)\nP.unpersist()\nP.StorageLevel\nStorageLevel(False, False, False, False, 1)\nP.persist()\nStorageLevel(True, True, False, True, 1)\n\n\nThis shows default for persist and cache is MEM_DISk\nBuT I have read in docs that Default for cache is MEM_ONLY\nPleasehelp me in understanding."
] | [
"pyspark",
"apache-spark-sql"
] |
[
"access select distinct on certain column",
"I have a table with some search results. The search results maybe repeated because each result may be found using a different metric. I want to then query this table select only the distinct results using the ID column. So to summarize I have a table with an ID column but the IDs may be repeated and I want to select only one of each ID with MS Access SQL, how should I go about doing this? \n\nOk I have some more info after trying a couple of the suggestions. The Mins, and Maxes won't work because the column they are operating on cannot be shown. I get an error like You tried to execute a query that does not include the specified expression... I now have all my data sorted, here is what it looks like \n\nID|Description|searchScore\n97 test 1 \n97 test .95\n120 ball .94\n97 test .8\n120 ball .7\n\n\nso the problem is that since the rows were put into the table using different search criteria I have duplicated rows with different scores. What I want to do is select only one of each ID sorted by the searchScore descending. Any ideas?"
] | [
"sql",
"vba",
"ms-access",
"ms-access-2007"
] |
[
"Visual Studio 2010 disable mouseover to display hidden window",
"Usually there are tabs like Toolbox, Properties, Error List, Output, Find results... on the side of screen. When I mouseover to those hidden windows, the window will popup. Is there any way to disable it? Thanks."
] | [
"visual-studio-2010"
] |
[
"How To Install FFMPEG on Elastic Beanstalk",
"This is not a duplicate, I have found one thread, and it is outdated and does not work:\nInstall ffmpeg on elastic beanstalk using ebextensions config.\n\nI have been trying to install this for some time, nothing seems to work.\nPlease share the config.yml that will make this work. \n\nI am using 64bit Amazon Linux 2016.03 v2.1.6 running PHP 7.0 on Elastic Beanstalk\n\n\n\nMy current file is \n\nbranch-defaults: \n default: \n environment: Default-Environment\n master: \n environment: Default-Environment\nglobal: \n application_name: \"My First Elastic Beanstalk Application\"\n default_ec2_keyname: ~\n default_platform: \"64bit Amazon Linux 2016.03 v2.1.6 running PHP 7.0\"\n default_region: us-east-1\n profile: eb-cli\n sc: git\npackages: ~\nyum: \n ImageMagick: []\n ImageMagick-devel: []\n commands: \n 01-wget: \n command: \"wget -O /tmp/ffmpeg.tar.gz http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.2014-03-05.tar.gz\"\n 02-mkdir: \n command: \"if [ ! -d /opt/ffmpeg ] ; then mkdir -p /opt/ffmpeg; fi\"\n 03-tar: \n command: \"tar -xzf ffmpeg.tar.gz -C /opt/ffmpeg\"\n cwd: /tmp\n 04-ln: \n command: \"if [[ ! -f /usr/bin/ffmpeg ]] ; then ln -s /opt/ffmpeg/ffmpeg /usr/bin/ffmpeg; fi\"\n 05-ln: \n command: \"if [[ ! -f /usr/bin/ffprobe ]] ; then ln -s /opt/ffmpeg/ffprobe /usr/bin/ffprobe; fi\"\n 06-pecl: \n command: \"if [ `pecl list | grep imagick` ] ; then pecl install -f imagick; fi\""
] | [
"php",
"ffmpeg",
"amazon-elastic-beanstalk"
] |
[
"Best way to parse JSON string without getting stuck with structure or class",
"Could you help me to find out the best way to parse JSON string (coming as web service parameter).\n\nusing either JavaScriptSerializer or DataContractJsonSerializer based on deserialization is useless for me since the client does't accept to share with me common data structure (class).\n\nRegards"
] | [
"c#",
"json"
] |
[
"Google Cloud Print - Query number limit",
"I need to do a lot of google cloud print queries.\nI got this error \"HTTP Error 503: Too many requests\".\n\nIn API Console I can't find \"Google cloud print\"\n\nIs there any solution?"
] | [
"google-api",
"google-cloud-print"
] |
[
"How can I prevent 404 not found error in Angular when I refresh page?",
"I have an Angular project and when I upload it on a global server it returns me a 404 not found error when I refresh the page. How can I prevent this?\nThat's my routing.component.ts\nimport { RouterModule, Routes } from '@angular/router';\nimport { NgModule } from '@angular/core';\n\nimport { PagesComponent } from './pages.component';\nimport { DashboardComponent } from './dashboard/dashboard.component';\nimport { ECommerceComponent } from './e-commerce/e-commerce.component';\nimport { NotFoundComponent } from './miscellaneous/not-found/not-found.component';\nimport { createFalse } from 'typescript';\n\nconst routes: Routes = [\n \n \n {\n\n path: '',\n component: PagesComponent,\n children: [\n {\n path: 'dashboard',\n component: ECommerceComponent,\n \n },\n {\n path: 'iot-dashboard',\n component: DashboardComponent,\n \n },\n \n \n {\n path: '',\n redirectTo: 'iot-dashboard',\n pathMatch: 'full',\n },\n \n {\n path: '**',\n component: NotFoundComponent,\n },\n ],\n\n}];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class PagesRoutingModule {\n}"
] | [
"angular",
"routes",
"page-refresh"
] |
[
"Order users based on when the relationship was created_at",
"I used the Railstutorials to create followers and followed_users http://ruby.railstutorial.org/chapters/following-users#top\n\nOn the page where I want to show a specific persons' followers/followed_users, I'd like to show them based on when the relationship was created. \n\n@users = @user.followers.order(\"created_at DESC\")\n\n\nSomething like this ^^ just shows when the user was created, not when the relationship was created. How can I run this query efficiently to get the proper ordering?\n\ndef following\n @users = @user.followed_users\nend\n\ndef followers\n @users = @user.followers\nend\n\n-User Model-\n\nhas_many :relationships, foreign_key: \"follower_id\", :dependent => :destroy\nhas_many :followed_users, through: :relationships, source: :followed\nhas_many :reverse_relationships, foreign_key: \"followed_id\",\n class_name: \"Relationship\",\n dependent: :destroy\nhas_many :followers, through: :reverse_relationships, source: :follower\n\n\n- Relationship Model - \n\nbelongs_to :follower, class_name: \"User\", touch: true\nbelongs_to :followed, class_name: \"User\", touch: true\nvalidates :follower_id, presence: true\nvalidates :followed_id, presence: true"
] | [
"sql",
"ruby-on-rails",
"ruby-on-rails-4"
] |
[
"android pass parameters to a new activity are null",
"I have a Search Button.\n\nWhen I click on it, I want to send value from the current activity to an other Activity (ProductActivity in my case)\n\nHere is the code for the search button\n\n Button nextActivity = (Button) findViewById(R.id.btnSearch);\n nextActivity.setOnClickListener(new View.OnClickListener() {\n public void onClick(View view) {\n TextView tvFileNumber = (TextView)findViewById(R.id.tv1);\n Spinner spAttachement = (Spinner)findViewById(R.id.spinner1) ;\n Spinner spExecution = (Spinner)findViewById(R.id.spinner2) ;\n Spinner spCategory = (Spinner)findViewById(R.id.spinner3) ;\n Spinner spOperation = (Spinner)findViewById(R.id.spinner4) ;\n Spinner spCollection = (Spinner)findViewById(R.id.spinner5) ;\n\n SpinnerData daAttachement =(SpinnerData)spAttachement.getItemAtPosition(spAttachement.getSelectedItemPosition());\n SpinnerData daExecution =(SpinnerData)spAttachement.getItemAtPosition(spExecution.getSelectedItemPosition());\n SpinnerData daCategory =(SpinnerData)spAttachement.getItemAtPosition(spCategory.getSelectedItemPosition());\n SpinnerData daOperation =(SpinnerData)spAttachement.getItemAtPosition(spOperation.getSelectedItemPosition());\n SpinnerData daCollection =(SpinnerData)spAttachement.getItemAtPosition(spCollection.getSelectedItemPosition());\n\n Intent myIntent = new Intent(view.getContext(), ProductActivity.class);\n //myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n myIntent.putExtra(\"col_id\",6);\n myIntent.putExtra(\"site_id\",site_id);\n myIntent.putExtra(\"brand_id\",brand_id);\n myIntent.putExtra(\"attachement_id\",daAttachement.getValue());\n myIntent.putExtra(\"execution_id\",daExecution.getValue());\n myIntent.putExtra(\"operation_id\",daOperation.getValue());\n myIntent.putExtra(\"category_id\",daCategory.getValue());\n startActivity(myIntent);\n\n }\n });\n\n\nIN MY ProductActivity\n\npublic void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n this.requestWindowFeature(Window.FEATURE_NO_TITLE);\n setContentView(R.layout.activity_product);\n Intent myIntent= getIntent(); \n int brand_id = myIntent.getIntExtra(\"brand_id\", 0); \n int col_id = myIntent.getIntExtra(\"col_id\", 0); \n int site_id = myIntent.getIntExtra(\"site_id\", 0); \n int attachement_id = myIntent.getIntExtra(\"attachement_id\", -1); \n int execution_id = myIntent.getIntExtra(\"execution_id\", -1); \n int category_id = myIntent.getIntExtra(\"category_id\", -1); \n int operation_id = myIntent.getIntExtra(\"operation_id\", -1); \n int eol = myIntent.getIntExtra(\"eol\", -1); \n\n Log.v(\"TESTCOLLECTION\",Integer.toString(col_id));\n\n\nTHE RESULT\nthe log result showing TESTCOLLECTION : 0\n\nIn my example it's suppose to be 6 myIntent.putExtra(\"col_id\",6);\n\nPlease help.\nI try so many thing and didn't find why.\n\nThanks a lot."
] | [
"android",
"parameter-passing"
] |
[
"Can anyone please explain difference between ptr+1 and ptr[0]+1",
"Assuming sizeof integer as 4 bytes and sizeof(int *) as 8 bytes , I'm not getting why ptr +1 moves forward by the size of 8 bytes and ptr[0]+1 moves forward by the size of 4 bytes.\n\nint main()\n{\n int a[] = {1, 2, 3};\n int *ptr[3]; //array of 3 elements pointed to integer \n int *b;\n\n ptr[0] = a;\n\n printf(\"a: %lu\\n\", a);\n printf(\"a + 1: %lu\\n\\n\", a+1);\n\n printf(\"ptr: %lu\\n\", ptr);\n printf(\"ptr + 1: %lu\\n\", ptr+1);\n\n printf(\"ptr[0]: %lu\\n\", ptr[0]);//ptr[0] holds base address of array a\n printf(\"ptr[1]: %lu\\n\\n\", ptr[0] + 1 );\n\n printf(\"&ptr: %lu\\n\", &ptr);\n printf(\"&ptr + 1: %lu\\n\", &ptr+1);\n}"
] | [
"c",
"arrays",
"pointers"
] |
[
"Set selected data in datepicker after click",
"I'm using datapicker jQuery. After select date one time, I want to make calendar show selected date not current date. This is my step, and need to know how I can do No. 5\n\n\nClick button\nShow Datapicker. ( It shows current date 2015-02 )\nChoose 2015-01, then automatically date set in textbox.\nClick button again.\nShow Datapicker. ( It shows current date again not 2015-01... )\n\n\ncode.\n\n $(function () {\n $('#MainContent_txtMonth').datepicker({\n changeYear: true,\n changeMonth: true,\n showButtonPanel: true,\n dateFormat: 'yy-mm',\n showMonthAfterYear: true,\n monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],\n showOn: \"button\",\n }).focus(function () {\n var thisCalendar = $(this);\n $('.ui-datepicker-calendar').detach();\n $('.ui-datepicker-close').click(function () {\n var year = $(\"#ui-datepicker-div .ui-datepicker-year :selected\").val();\n var month = $(\"#ui-datepicker-div .ui-datepicker-month :selected\").val();\n thisCalendar.datepicker('setDate', new Date(year, month, 1));\n });\n });\n });"
] | [
"jquery",
"get",
"datepicker",
"set",
"selected"
] |
[
"C block division c language",
"I have some problem in understanding the pointer\n\nI have matrix then I divided it to small block by using\n\n tiles_num = n /tile;\n// Allocate blocked matrix\nAh = (REAL **) malloc( tiles_num * tiles_num * sizeof(REAL *));\nif (Ah == NULL) {\n printf(\"ALLOCATION ERROR (Ah)\\n\");\n exit(-1);\n}\n\nfor (j = 0; j < tiles_num * tiles_num; j++) {\n Ah[j]=(REAL *) malloc(tile * tile * sizeof(REAL));\n if (Ah[ j ] == NULL) {\n printf(\"ALLOCATION ERROR (Ah[%d] )\\n\", j);\n exit(-1);\n }\n}\n\n\nwhere (tiles_num is the number of small block, n is the size one dimension of matrix, tile is size of small block)\n\nAfter that I want to give a function just a pointer to the starting of superblock then the function will move between the small block\nfor example if I have N=12 and the superblock=4 and the smallblock=2.\n1-so how I can give function point of starting the superblock then move inside by small block?\n\n2-I want to know if A[k] is the same as A+k to refernce ?"
] | [
"c"
] |
[
"Set the position of the labels inside plotly pie chart",
"i am trying to figure out how to change text position of labels in pie chart or make it more readable (?).\nBelow is a screenshot of an example and reproducible code:\n\n\n\ndf <- data.frame(Gruppierung = c(\"Very long label\", \"Very very long label\", \"Long label\", \"Short label\", \"Long label / long label\"), \n freq = c(3.1, 6.2, 8.7, 20, 21))\n\nlibrary(plotly) \nplot_ly(df, labels=~Gruppierung,values=~freq, marker = list(line = list(color = '#FFFFFF', width = 1)), type=\"pie\",\n textposition = 'auto',textinfo = 'text',\n hoverinfo = 'text',source = \"subset\",\n text=~paste(sub(\" \",\"<br>\",Gruppierung),\":\",\"<br>\",paste0(freq,\"%\") ),\n insidetextfont = list(color = '#FFFFFF')) %>%\n layout(showlegend = FALSE,separators = ',.') %>% config(displayModeBar = F)\n\n\nMy Problem (what i would like to achieve):\n\nIf Label cannot match horizontally the space that it is in, then it should be positioned outside the pie chart\n\nThanks for help!\n\n[!!] Approach suggested by @Saurabh Chauhan is very good BUT unfortunatelly it would not match every time, here is a screenshot below which could Show the Problem when even with high freq some Labels are not horizontal:"
] | [
"r",
"plotly",
"r-plotly"
] |
[
"Spring cloud contract for rest api exposed in producer side using apache cxf in spring boot",
"We are using a spring boot project which expose its services using Apache cxf, and has no controller layer in it. We want to test those Rest apis which the producer creates at the producer side with Spring Cloud Contract. How can we achieve it?"
] | [
"spring-boot",
"cxf",
"spring-cloud-contract"
] |
[
"Warnings with Homebrew",
"I did everything from this link http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#lion-install\n\nBut when I do command \"brew doctor\" I see warnings:\n\n\n Warning: \"config\" scripts exist outside your system or Homebrew\n directories. ./configure scripts often look for *-config scripts to\n determine if software packages are installed, and what additional\n flags to use when compiling and linking.\n \n Having additional scripts in your path can confuse software installed\n via Homebrew if the config script overrides a system or Homebrew\n provided script of the same name. We found the following \"config\"\n scripts:\n\n/usr/local/bin/gpg-error-config\n/usr/local/bin/ksba-config\n/usr/local/bin/pkg-config\n\n \n Warning: Your Homebrew is not installed to /usr/local You can install\n Homebrew anywhere you want, but some brews may only build correctly if\n you install in /usr/local. Sorry!\n\n\nI don't know what to do with that. I want to install the calabash-cucumber gem, but when i try to do that, it says that can't find files."
] | [
"warnings",
"homebrew"
] |
[
"Error while importing posts in wordpress from one host to another",
"I am importing a wordpress posts from one host to another.. while doing it,(i done it few times already in different projects) i have this error (image_attached) and 260 of 900 posts only imported.\n\n\nwhile i am giving ok in assign author it stated that this one,\n\n\nWhile i am contacting the admin of the host, he states that it is wordpress error, not the host error, anyone knows how to solve this error. Any relevant ideas are welcome?"
] | [
"php",
"wordpress",
"server",
"importerror",
"posts"
] |
[
"Accesing the .txt file from Remote server into my WSO2 ESB",
"Hi i am working on wso2 ESB 4.7.0, \n\nI wish to process the any particular file like .txt,.xls,.xml , my client provide the data in above format files in system folder,i need to pick from there and process that file , i wish to store that data into data base.\nSample .txt file is \n\nename intime outtime eid \n-------------------------\njohn 9.10 6.10 y001\nscott 10.00 7.00 yoo2\ntiger 9.00 6.00 y003\n\n\nabove data i need to insert in empdetails table.\nI tried with VFS transport in WSO2 ESB, it is able to write the data into text file but how to read from data into a text file.\n\nHelp me to solve this."
] | [
"wso2",
"wso2esb",
"wso2carbon",
"wso2dss",
"synapse"
] |
[
"Convert 1/2/2021 to 2021-2-1",
"I have a string that comes in the format name = "1/2/2021", how can I convert this string to the format newName = "2021-2-1"\noriginal = name\nday = original[0]\nmonth = original[2]\nyear = original[4:8]\ncombination = year + "-" + month + "-" + day\n\nI have tried using this but brings wrong values when date or month changes to more than 2 characters"
] | [
"python"
] |
[
"Inside a where clause: Casting a substring as a date only when IsDate() is true",
"I am trying to delete all rows that are older than 6 months from a table. \n\nThe issue is that the date is grabbed using a substring from a varchar column, and it is not always a valid date. \n\nHere's the query that is failing: \n\nDelete ExampleDatesTable\n where CONVERT(datetime, SUBSTRING(DateField, LEN(DateField) - 18, 19)) < DATEADD(month, -6, GETDATE())\n\n\nHere is what I am trying to do, but it isn't working: \n\n Delete ExampleDatesTable\n where IsDate(SUBSTRING(DateField, LEN(DateField) - 18, 19)) = 1\n AND CONVERT(datetime, SUBSTRING(DateField, LEN(DateField) - 18, 19)) < DATEADD(month, -6, GETDATE())\n\n\nIs there a way around this?"
] | [
"sql-server"
] |
[
"Selected text doesn't appear on the UITextField",
"Whenever I click on a UITextField, a list of contacts appear and when a contact is clicked, the phone number should appear in the textfield that was clicked. I currently have 3 textfields and each time I select a contact, it updates only the first textfield even if for example I have selected the 2nd textfield. How do I go about fixing it so that the phone number appears in the corresponding textfield that was selected?\n\nI'm using Xcode 10 and I think that the issue is arising from the func setNumberFromContact\n\n @IBOutlet weak var phonenumber: UITextField!\n @IBOutlet weak var phonenumber1: UITextField!\n @IBOutlet weak var phonenumber2: UITextField!\n\n\n func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) {\n\n\n let phoneNumberCount = contact.phoneNumbers.count\n\n guard phoneNumberCount > 0 else {\n dismiss(animated: true)\n //show pop up: \"Selected contact does not have a number\"\n return\n }\n\n if phoneNumberCount == 1 {\n setNumberFromContact(contactNumber: contact.phoneNumbers[0].value.stringValue)\n\n }else{\n\n let alertController = UIAlertController(title: \"Select one of the numbers\", message: nil, preferredStyle: .alert)\n\n for i in 0...phoneNumberCount-1 {\n let phoneAction = UIAlertAction(title: contact.phoneNumbers[i].value.stringValue, style: .default, handler: {\n alert -> Void in\n self.setNumberFromContact(contactNumber: contact.phoneNumbers[i].value.stringValue)\n })\n alertController.addAction(phoneAction)\n }\n let cancelAction = UIAlertAction(title: \"Cancel\", style: .destructive, handler: {\n alert -> Void in\n\n })\n alertController.addAction(cancelAction)\n\n dismiss(animated: true)\n self.present(alertController, animated: true, completion: nil)\n }\n }\n\n func setNumberFromContact(contactNumber: String) {\n\n var contactNumber = contactNumber.replacingOccurrences(of: \"-\", with: \"\")\n contactNumber = contactNumber.replacingOccurrences(of: \"(\", with: \"\")\n contactNumber = contactNumber.replacingOccurrences(of: \")\", with: \"\")\n guard contactNumber.count >= 10 else {\n dismiss(animated: true) {\n self.presentAlert(alertTitle: \"\", alertMessage: \"A maximum of 10 contacts allowed per session\", lastAction: nil)\n }\n return\n }\n\n phonenumber.text = String(contactNumber.suffix(10))\n\n }\n\n func contactPickerDidCancel(_ picker: CNContactPickerViewController) {\n\n }\n\n\n\n\n}\n\nextension SelfTestTimer: UITextFieldDelegate {\n func textFieldShouldReturn(_ textField: UITextField) -> Bool {\n textField.resignFirstResponder()\n return true\n }\n\n\n func textFieldDidBeginEditing(_ textField: UITextField) {\n\n if textField.hasText{\n //dont do anything\n\n }else{\n\n contactPicker.delegate = self\n self.present(contactPicker, animated: true, completion: nil)\n }\n return\n }"
] | [
"ios",
"swift",
"uitextfield"
] |
[
"Bash script beginner questions: Looping, Arrays and character checks",
"I'm taking a class that has us programming scripts in bash, and I am very new to bash.\n\nMy professor gave us an assignment:\n\"Write a Bash script, count.sh, which builds a table of counts for the commands under /bin which start with each letter. For example, if there are 3 commands starting with \"a\" (alsaumute, arch & awk) while there may be 2 commands starting with \"z\" (zcat & zsh). The first and last lines your script will print would be:\na 3\n...\nz 2\"\n\nSo I've been working on this problem and I'm able to set up the loop, but I'm fuzzy as to how I'm supposed to retrieve the bin commands(I'm assuming bin is a file with just a list of commands for bash?) and then perform a character check on the first character?\n\nHe told me to use ls and grep as a hint. I looked up ls (list files/directories) and grep search for a specific text, so I assume I use ls to get the bin commands somehow and then perform a grep on them in the loop?\n\ndeclare -a letters=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z')\n\ncounter=0\n while [ $counter -lt 26 ]; do\n current=${letters[$counter]}\n echo The counter is $counter\n echo $current\n let counter=counter+1 \n done\n\n\nThat's where I am so far, so my guess is I create a a variable array to also hold all the bin commands(using ls right?), and then use that in the loop with grep?\n\nI just want to get some advice that I'm on the right path. I'm very new to linux and I've never dealt with scripts or cmd line type stuff.\n\nHere's the output so far"
] | [
"linux",
"bash",
"loops"
] |
[
"\"Unfortunately, MainScreenActivity has stopped\" ERROR message in Android Emulator",
"I tried doing this code from this site: http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ . Everything worked out properly but when i tried to VIEW and ADD products the emulator goes \"Unfortunately, MainScreenActivity has stopped.\n\nhelp please?? :D\n\nhere is my logcat file:\n\n06-26 15:53:16.227: E/AndroidRuntime(1396): FATAL EXCEPTION: AsyncTask #1\n06-26 15:53:16.227: E/AndroidRuntime(1396): java.lang.RuntimeException: An error occured while executing doInBackground()\n06-26 15:53:16.227: E/AndroidRuntime(1396): at android.os.AsyncTask$3.done(AsyncTask.java:299)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.run(FutureTask.java:239)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.lang.Thread.run(Thread.java:856)\n06-26 15:53:16.227: E/AndroidRuntime(1396): Caused by: java.lang.IllegalArgumentException: Illegal character in authority at index 15: http://10.0.2.2 /try/get_all_products.php?\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.net.URI.create(URI.java:727)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.JSONParser.makeHttpRequest(JSONParser.java:60)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:128)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:1)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at android.os.AsyncTask$2.call(AsyncTask.java:287)\n06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.run(FutureTask.java:234)\n06-26 15:53:16.227: E/AndroidRuntime(1396): ... 3 more\n06-26 15:53:16.570: W/ActivityManager(276): Force finishing activity com.example.mainscreenactivity/.AllProductsActivity\n06-26 15:53:16.737: W/WindowManager(276): Failure taking screenshot for (266x425) to layer 21020"
] | [
"android",
"eclipse"
] |
[
"Using setState to update an array inside an object",
"I'm building an app that mimics an e-commerce site, and I don't know how I can add items to my cart.\n\nI created a Context Provider. It contains an object which contains a array to hold all potential items in the cart. (I know I can just use an array in place of a list, but I plan to add other fields to this object).\n\nimport React, { createContext, useState } from 'react';\n\nexport const CartContext = createContext();\n\nexport const CartContextProvider = (props) => {\n const [cart, setCart] = useState({items: []});\n\n return(\n <CartContext.Provider value={[cart, setCart]}>\n {props.children}\n </CartContext.Provider>\n );\n}\n\n\nNext, I have an Item component.\n\nconst Item = ( {item} ) => {\n\n const [cart, setCart] = useContext(CartContext);\n\n const handleClick = e => {\n setCart(prevCartItems => ({...prevCartItems, items: items.push(item)}));\n }\n\n console.log(cart.items);\n\n return(\n <div className=\"item\">\n <div className=\"product\">\n <h2>{item.name} : ${item.price}</h2>\n <p>Category: {item.category}</p>\n </div>\n <button onClick={handleClick} className=\"add-to-cart\">Add to Cart</button>\n </div>\n );\n}\n\n\nMy confusion particularly lies in the handleClick function in the Item component where I'm updating the state of the cart. How do I add my item to the array? I'm making use of the spread operator to copy the previous state, but how do I add my \"new\" item to the list?"
] | [
"javascript",
"reactjs",
"react-hooks"
] |
[
"Should I first train_test_split and then use cross validation?",
"If I plan to use cross validation (KFold), should I still split the dataset into training and test data and perform my training (including cross valid) only on the training set? Or will CV do everything for me? E.g.\n\nOption 1\n\nX_train, X_test, y_train, y_test = train_test_split(X,y)\nclf = GridSearchCV(... cv=5) \nclf.fit(X_train, y_train)\n\n\nOption 2\n\nclf = GridSearchCV(... cv=5) \nclf.fit(X y)"
] | [
"python",
"scikit-learn",
"cross-validation"
] |
[
"Retrieve specific string from txt file in java",
"Hey I have a txt file I wanna read only a specific string from it.\n The File:\n\nThis Ticket Being Generated as You Confirm\n\nName : John\n\nMovie : Batman\n\nLocation: MidVally\n\nTime : 7PM-9PM\n\nTime : 2\n\nSeats : [A-4, B-3, D-5, C-1, D-2, E-3]\n\nUniqueID: Batman7PM-9PMMidVally\n\n\nI only want to retrieve the UniqueID to save it in string to be in this case String UniqID = \"Batman7PM-9PMMidVally\". Any idea how to achieve it"
] | [
"java",
"java-io"
] |
[
"Silverlight DataGrid - Validating New Rows When Have Not Edited Individual Cell",
"I have a silverlight datagrid. \n\nValidation works very well using DataAnnotations. However if I add a new row to the grid I don't get validation kicking in until I actuall try and edit cells. \n\nIs there no way to force the grid to validate when a cell has not been clicked on?"
] | [
"silverlight",
"validation",
"datagrid",
"silverlight-3.0",
"data-annotations"
] |
[
"How to put the max value of a column for a each page on the header in CR",
"I have a crystal report, which lists street names.\nThe report is ordered by street name.\nIn the header of the report I need to specify the first street name on the page, and the last street name on the page.\n\nHow can I do this?\n\nTechnically, this is the max and min of the street name, however it may be useful to know it is the first and last entry on the page.\n\nThe data comes from an excel document, and the version of crystal is 10.\n\nFYI this is my first report with Crystal."
] | [
"crystal-reports"
] |
[
"Could not find a version that satisfies the requirement search (from versions: ) No matching distribution found for search",
"pip install search gives error like that: \n\n\n Could not find a version that satisfies the requirement search (from versions: )\n No matching distribution found for search"
] | [
"python-3.x"
] |
[
"Azure storage underlying technology",
"What is Azure storage made of, the underlying storage technology which supports the Azure storage we access in azure portal? \n\nIs it object based storage or block storage (persistent/ephemeral) similar to categorization in Ceph?\n\nIf there is a mix of block and object based, which storage is used for each of exposed Azure storage service - block blob, append blob, page blob, storage tables, storage queues, Azure files"
] | [
"azure",
"storage",
"azure-storage"
] |
[
"mcrypt - number of possible encryption",
"I am using mcrypt function to encrypt some data - from php.net example.\n\nI would like to know the number of encryptions for certain string. Let's say I would run the encryption for word \"product\" 1 milion times. Would I get 1 milion different encryptions ?\n\n function encrypt($s)\n{\n # --- ENCRYPTION ---\n\n # the key should be random binary, use scrypt, bcrypt or PBKDF2 to\n # convert a string into a key\n # key is specified using hexadecimal\n $key = pack('H*', \"bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3\");\n\n # show key size use either 16, 24 or 32 byte keys for AES-128, 192\n # and 256 respectively\n $key_size = strlen($key);\n\n # create a random IV to use with CBC encoding\n $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);\n $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);\n\n # creates a cipher text compatible with AES (Rijndael block size = 128)\n # to keep the text confidential\n # only suitable for encoded input that never ends with value 00h\n # (because of default zero padding)\n $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key,\n $s, MCRYPT_MODE_CBC, $iv);\n\n # prepend the IV for it to be available for decryption\n $ciphertext = $iv . $ciphertext;\n\n # encode the resulting cipher text so it can be represented by a string\n $ciphertext_base64 = base64_encode($ciphertext);\n\n return $ciphertext_base64;\n\n}"
] | [
"php",
"encryption"
] |
[
"No executable found matching command \"dotnet-watch\"",
"Trying to use dotnet watch but gettin an error:\n\n\n No executable found matching command \"dotnet-watch\"\n\n\ndotnet --version\n1.0.0-rc4-0004834\n\n\nInstalled .NET Core 1.1 SDK and .NET Core 1.1 runtime\n\nMy .csproj file:\n\n <ItemGroup>\n <PackageReference Include=\"Microsoft.AspNetCore\" Version=\"1.0.3\" />\n <PackageReference Include=\"Microsoft.DotNet.Cli.Utils\" Version=\"1.0.0-rc4-004771\" />\n <PackageReference Include=\"Microsoft.Extensions.CommandLineUtils\" Version=\"1.1.0\" />\n <PackageReference Include=\"Microsoft.Extensions.Logging\" Version=\"1.1.0\" />\n <PackageReference Include=\"Microsoft.Extensions.Logging.Console\" Version=\"1.1.0\" />\n <PackageReference Include=\"Microsoft.NETCore.App\" Version=\"1.1.0\" />\n <PackageReference Include=\"Microsoft.DotNet.Watcher.Tools\" Version=\"1.1.0-preview4-final\" />\n </ItemGroup>\n\n\ndotnet restore has done\n\nHow can I solve that?"
] | [
"asp.net-core",
".net-core"
] |
[
"Eclipse has decided that it wants to ruin my life. Team/Source options are all greyed out.",
"After staying up until 1030AM working on, and completing an assignment, I decided that I would take a short nap before formatting it and submitting it. Needless to say that nap became a 5 hour sleep session.\n\nAfter waking up, I formatted the code to eclipse google style formatting for java, and proceeded to try and commit the files. After realizing my team options did not even show up when right clicking the project, I closed Eclipse and reopened it... and now all of the Source tab options are greyed out. Is there something wrong with my Subclipse? I just started learning Java in the past couple of weeks, so I'm very unfamiliar with Eclipse =(. \n\nI can't even commmit the files using Terminal. The assignment is due in less than 6 hours. If anyone can point me in teh direction of fixing this, I would be eternally grateful =(."
] | [
"java",
"eclipse",
"subclipse"
] |
[
"AppBar shows half of content",
"I use AppBar for my application and AppBarButtons. \n\nBut ABB shows only half of title text and rest after opening AB.\nI want to hide the text completely and show it only in case of opening AB.\n\nProblem image\n\n<Page.Resources>\n <Style TargetType=\"AppBarButton\" x:Name=\"appBar\">\n <Setter Property=\"VerticalAlignment\" Value=\"Top\"/>\n <Setter Property=\"HorizontalAlignment\" Value=\"Right\"/>\n </Style>\n</Page.Resources>\n\n<Page.BottomAppBar>\n <AppBar IsSticky=\"True\" ClosedDisplayMode=\"Compact\" Background=\"LightGray\" >\n\n <StackPanel Orientation=\"Horizontal\" VerticalAlignment=\"Top\" FlowDirection=\"RightToLeft\" >\n <AppBarButton x:Name=\"mapaStackPanel\" Label=\"Mapa\" Icon=\"Map\" Click=\"MapaStackPanelClick\" Style=\"{StaticResource appBar}\" Visibility=\"Collapsed\" />\n <AppBarButton x:Name=\"mojePolohaStackPanel\" Label=\"Moje poloha\" Icon=\"Map\" Click=\"MojePolohaClick\" Style=\"{StaticResource appBar}\"/>\n <AppBarButton x:Name=\"najdiNejblizsiStackPanel\" Label=\"Najdi Nejbližší\" Icon=\"Map\" Click=\"NajdiNejblizsiClick\" Style=\"{StaticResource appBar}\"/>\n <AppBarButton x:Name=\"navigujStackPanel\" Label=\"Naviguj\" Icon=\"Directions\" Click=\"navigujStackPanel_Click\" Visibility=\"Collapsed\" Style=\"{StaticResource appBar}\"/>\n </StackPanel>\n </AppBar>\n</Page.BottomAppBar>\n\n\nThank you,\nVT"
] | [
"c#",
"windows",
"xaml",
"windows-phone",
"uwp"
] |
[
"Cross Origin Request Blocked on HTTP POST request",
"I'm sending http requests from my angular client app to .NET core web API. I'm getting a CORS error although I enabled CORS. When I send a GET request to my SearchController that goes through just fine, but when I send a POST request to my FormController I get the CORS error.\n\nI've tried running it in chrome, same result. \n\n public void Configure(IApplicationBuilder app, IHostingEnvironment env)\n {\n if (env.IsDevelopment())\n {\n app.UseDeveloperExceptionPage();\n }\n else\n {\n app.UseHsts();\n }\n\n\n app.UseCors(builder =>\n builder.AllowAnyOrigin()\n );\n\n app.UseHttpsRedirection();\n app.UseMvc();\n }\n\n\nAs you can see I have it configured to allow any origin\n\nconst httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json',\n 'Authorization': 'my-auth-token',\n\n })\n};\n\n\n\n@Injectable()\n\nexport class SendFormService\n{\n submitUrl : string = \"https://localhost:5001/api/submitForm\";\n\n constructor(private http : HttpClient){ }\n\n public SendFormData(formData : RoadmapForm) : Observable<RoadmapForm>\n {\n //remember to error handle\n return this.http.post<RoadmapForm>(this.submitUrl, formData, httpOptions);\n\n }\n}\n\n\nThe POST request that's not working\n\n public class Form\n {\n string title;\n string summary;\n string body;\n string[] tags;\n\n }\n\n [Route(\"api/submitForm\")]\n [ApiController]\n\n public class FormController : ControllerBase\n {\n [HttpPost]\n public void Post([FromBody] Form formData)\n {\n Console.BackgroundColor = ConsoleColor.Blue;\n Console.ForegroundColor = ConsoleColor.White;\n\n Console.WriteLine(formData);\n }\n }\n\n\nThe FormController class\n\nLike I said earlier it works for GET requests to my SearchController. But for some reason I get the CORS error on the POST request to my FormController."
] | [
"c#",
"angular",
"asp.net-core",
".net-core",
"asp.net-core-mvc"
] |
[
"Submit form and observe the onsubmit event",
"This should be trivial, but I am not getting it :\\\n\nHTML\n\n<form id=\"myform\" action=\"#\">\n <input type=\"submit\" value=\"Submit\" />\n <a href=\"#\" onclick=\"$('myform').submit()\">Submit</a>\n</form> \n\n\nJS (Prototype)\n\n$('myform').observe('submit', function(e) { \n alert('submitted!');\n e.stop();\n});\n\n\nWhy the submit is only triggered with the submit via input? Shouldn't the submit event be triggered with $('myform').submit() also?\n\nJSFiddle: http://jsfiddle.net/d8BdM/"
] | [
"javascript",
"prototypejs",
"dom-events"
] |
[
"How to synchronize a block of code to write whole words/lines to an output file while reading and writing char by char?",
"I have several input text files and I read from them to one output file. Each input file is being read in a separate thread. I would like to write whole words or lines to the output file. To write the whole content of input files I synchronize on FileWriter like this:\n\npublic void run() {\n synchronized (fw) {\n int character;\n try {\n while ((character= fr.read()) != -1) {\n fw.write(character); \n } \n fw.write(\"\\n\");\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n}\n\n\nwhere fw is FileWriter and fr FileReader.\n\nHow to synchronize to write words or lines? I need to read and write character by character.\n\nExample for words: file1: aaa bbb ccc; file2: AAA BBB CCC; file3: 11 222\n\noutput file:aaa AAA 11 bbb BBB 222 ccc CCC"
] | [
"java"
] |
[
"save snapshots from selenium",
"Here is my code.\n\nimport requests, time, csv, urllib2, math, os, datetime\nfrom selenium import webdriver\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.common.exceptions import TimeoutException\nfrom selenium.webdriver.common.keys import Keys\nfrom selenium.webdriver.common.action_chains import ActionChains\nfrom selenium.webdriver.common.by import By\nfrom lxml import html\nfrom scrapy import Selector as s\n\npath = \"D:\\Philip\\Snapshot\"; mydir = os.path.join(path, datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')); active_directory = os.makedirs(mydir)\n\nstocks_links = ['http://finviz.com/quote.ashx?t=A&b=1',\n 'http://finviz.com/quote.ashx?t=AA&b=1',\n 'http://finviz.com/quote.ashx?t=AAC&b=1',\n 'http://finviz.com/quote.ashx?t=AAL&b=1',\n 'http://finviz.com/quote.ashx?t=AAMC&b=1',\n 'http://finviz.com/quote.ashx?t=AAME&b=1',\n 'http://finviz.com/quote.ashx?t=A&b=1']\n\ndriver = webdriver.Chrome()\ndriver.set_page_load_timeout(30)\n\ndef get_stock_symbols(links):\n get3 = requests.get(each)\n source3 = s(text=get3.text,type=\"html\")\n Stock_symbol = source3.xpath('//td[@align=\"center\"]//a[@id=\"ticker\"]/text()').extract()\n Stock_symbol = str(Stock_symbol).replace(\"u'\",\"\").replace(\"'\",\"\")\n print Stock_symbol\n try:\n driver.get(each)\n except Exception:\n pass\n driver.maximize_window()\n driver.execute_script(\"document.body.style.zoom='90%'\")\n driver.execute_script(\"window.scrollTo(0, 160)\")\n time.sleep(2)\n driver.save_screenshot(str(active_directory)+\"/\"+Stock_symbol+'.jpg')\n time.sleep(2)\n driver.execute_script(\"document.body.style.zoom='100%'\")\n\nfor each in stocks_links:\n get_stock_symbols(each)\n\n\nAfter i execute the code i dont see any errors but my screenshots are not saving in directory . With help of OS module i did made a directory but can't see images there . Please help"
] | [
"python",
"selenium",
"selenium-webdriver",
"operating-system"
] |
[
"Passing a null parameter to a native query using @Query JPA annotation",
"In a Spring Boot application, I have a SQL query that is executed on a postgresql server as follows :\n\n@Query(value = \"select count(*) from servers where brand= coalesce(?1, brand) \" +\n \"and flavour= coalesce(?2, flavour) ; \",\n nativeQuery = true)\nInteger icecreamStockCount(String country, String category);\n\n\nHowever, \n\nI get the following error when I execute the method :\n\nERROR: COALESCE types bytea and character varying in PostgreSQL\n\nHow do I pass String value = null to the query?\n\n**NOTE : ** I found that my question varied from JPA Query to handle NULL parameter value"
] | [
"postgresql",
"hibernate",
"jpa",
"spring-boot"
] |
[
"Android RelativeLayout: Rightmost child takes all the extra space no matter what I do",
"I have a RelativeLayout with three child views laid out horizontally. I want the leftmost one to take up any extra space and the other two to take up only the space needed to wrap their content. The documentation says this can be done, but I can't make it work. Here's what I have:\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:padding=\"6dp\"\n android:textStyle=\"bold\"\n android:layoutDirection=\"rtl\">\n\n <TextView\n android:id=\"@+id/nodeLabel\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"wrap_content\"\n android:textSize=\"@dimen/text_size\"\n android:gravity=\"fill_horizontal\"\n android:layout_alignParentLeft=\"true\" />\n\n <Button\n android:id=\"@+id/launch\"\n android:text=\"@string/launch_label\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_toRightOf=\"@id/nodeLabel\"\n android:gravity=\"left\" />\n\n <Button\n android:id=\"@+id/kill\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\"\n android:layout_toRightOf=\"@id/launch\"\n android:layout_alignParentRight=\"true\"\n android:text=\"@string/kill_label\"\n android:gravity=\"left\" />\n\n</RelativeLayout>\n\n\nThe result is the TextView takes up all the space, and the two Buttons are not rendered at all. If I change android:layout_width on the TextView from match_parent to wrap_content, then all three Views show up, but the third one, the Button, takes the extra space, which is not what I want. I also tried setting layout_width on the Buttons to 0dp, and experimented with other settings values, all to no avail.\n\nHow can I make the two Buttons no bigger than needed to wrap their content, and have the TextView take up the extra space?"
] | [
"android",
"button",
"textview",
"android-relativelayout"
] |
[
"AWS Amplify Angular Customize Authentication Component",
"I am using Amplify for Authentication with my Angular application. The authentication component is:\n\n<amplify-authenticator [signUpConfig]=\"signUpConfig\"></amplify-authenticator>\n\nThis shows the AWS Authenticator UI on my page. I have customized the look by editing/adding some css. What I am trying to do now is to somehow show a loader and disable the \"Submit\"/\"Sign Up\" button once they are clicked. \n\nI have tried using Interceptors but they don't seem to work with AWS Auth clicks/calls.\n\nWhat can I do to achieve this?"
] | [
"angular",
"aws-amplify"
] |
[
"Require.js and Zend Framework",
"What is best way for including Require.js in Zend Framework? My current way of calling js files in zend framework are as follow :\n\n<?php echo $this->jQuery()->setLocalPath($this->path('js/jquery/jquery-1.7.1.min.js'))\n ->enable()\n ->setUiLocalPath($this->path('js/jquery/jquery-ui-1.8.16.custom.min.js'))\n ->uiEnable()\n ->addStylesheet($this->path('css/jquery/jquery-ui-1.8.16.custom.css'));\n\n echo $this->headScript()->appendFile($this->path('js/jquery.tipTip.js'))\n\n ->appendFile($this->path('js/customScripts/facebook.js'))\n ->appendFile($this->path('js/facebook/jquery.facebook.multifriend.select.js'))\n ->appendFile($this->path('js/customScripts/logindialog.js'))\n ->appendFile($this->path('js/customScripts/globalFunctions.js'))\n ->appendFile($this->path('js/kendo.web.min.js'))\n ->appendFile($this->path('js/customScripts/fancyAlert.js'))\n ->appendFile($this->path('js/inc/jquery.mousewheel.min.js'))\n ->appendFile($this->path('js/pagination-jq.js'))\n\n\n ->appendFile($this->path('js/jquery.tools.min.js'))\n ->appendFile($this->path('js/fancybox/jquery.fancybox-1.3.4.pack.js'))\n ->appendFile($this->path('js/jq-history/scripts/jquery.history.min.js'));\n\n ?>"
] | [
"php",
"jquery",
"zend-framework",
"requirejs"
] |
[
"How to limit the the input values for HTML to just values in a predefined list?",
"I am data scientist and need to deploy one of ML models as a web application. I am working to use HTML to get the input data and pass it to ML model for a live prediction. One of the inputs for this ML model is a 5 digit code. The code should be one of the predefined codes like one in this list [19827, 87198, 18288, ....], which contains 1000 unique values. The user should enter such a code. I want to tell the user whether the input code is valid or not. I am using the following line:\n<input type="number" name="code" placeholder="code" min="10000" max="99999" step="1" pattern="\\d+"/><br>\n\n\nbut this does not limit the input to the above list. For example, if user enter a code like 22222 and if that is not in the list the web app should tell the user that this is not valid. How can I do this one in a very efficient and professional way?"
] | [
"html"
] |
[
"storing variables in html and using text()",
"I have a particular scenario where I need a file name, not once but twice, because I pass the variable to an ASP.NET MVC controller. Is it a good idea to either store the file name in a DOM element like a span or div, and getting the value by using jQuery's .text() function? Or would a better approach be to work with JSON-like objects that are initialized and then continuously manipulated? \n\nThe question however remains. Is it a good or bad idea to store variables in HTML DOM elements?"
] | [
"javascript",
"asp.net-mvc-2"
] |
[
"Azure.CloudService 2.7 incompatible with Visual Studio 2015",
"For some reason after I installed VS 2015 the project CloudService of azure SDK incompatible and can't be opened.\n\nI tried to setup new project but then it throws this error:\n\n\nShould I install something specific for Azure SDK 2.7? Why we have this issue?"
] | [
"azure",
"cloud",
"visual-studio-2005"
] |
[
"Use a QR code to enter a password/username combination on a website",
"I'd very much like a qr code that does the following thing when being scanned, e.g. with a camera on the new IOS 11:\n\n\nGo to a specific website\nEnter login information on that website, including username and password. It should not press the actual login button.\n\n\nAs far as I understand scanning a QR code basically mimics the keyboard, as such I'd assume this to be possible. However, the websites I use to generate a QR code can only generate one for a website, and I am not able to find anyone who have tried this problem before. \n\nI thought that a potential way to do this would be to keep everything in the URL string and then redirect it to a script that automatically parses information into the login boxes, depending on the URL string. However, to be frank I am fairly lost on this.\n\nAny and all help is appreciated."
] | [
"qr-code"
] |
[
"Structuring Query to return Subquery results",
"SELECT TOP 1 dbo.tbl_Lifting_Gear.e_id, dbo.tbl_Lifitng_Details.det_con, dbo.tbl_contracts.clientID, dbo.tbl_contracts.contractNumber, dbo.tbl_contracts.fin_approved, \n dbo.tbl_work_locations.work_location, dbo.tbl_contracts.wLocationID\n FROM dbo.tbl_Lifitng_Details RIGHT OUTER JOIN\n dbo.tbl_Lifting_Gear INNER JOIN\n dbo.tbl_work_locations INNER JOIN\n dbo.tbl_contracts ON dbo.tbl_work_locations.work_id = dbo.tbl_contracts.wLocationID ON dbo.tbl_Lifting_Gear.con_id = dbo.tbl_contracts.conNo AND \n dbo.tbl_Lifting_Gear.lifting_loc = dbo.tbl_contracts.conLoc ON dbo.tbl_Lifitng_Details.det_con = dbo.tbl_Lifting_Gear.con_id AND \n dbo.tbl_Lifitng_Details.det_loc = dbo.tbl_Lifting_Gear.lifting_loc\n WHERE tbl_lifting_gear.con_id = @con AND tbl_lifting_gear.lifting_loc = @loc\n\n (\n SELECT TOP 1 e_id AS defects\n FROM tbl_Lifting_Gear\n WHERE tbl_Lifting_Gear.con_id = @con AND tbl_Lifting_Gear.e_defects = 'Y' AND lifting_loc = @loc) \n\n (\n SELECT TOP 1 e_id AS addInfo\n FROM tbl_Lifting_Gear\n WHERE tbl_Lifting_Gear.con_id = @con AND tbl_Lifting_Gear.e_add = 'Y' AND lifting_loc = @loc) \n\n (\n SELECT TOP 1 e_id AS mark\n FROM tbl_Lifting_Gear\n WHERE tbl_Lifting_Gear.con_id = @con AND lifting_loc = @loc AND tbl_Lifting_Gear.inspected = 'N') \n\n (\n SELECT TOP 1 e_id AS thorough\n FROM tbl_Lifting_Gear\n WHERE lifting_through IS NOT NULL AND lifting_through <> 0 AND con_id = @con AND lifting_loc = @loc) \n\n\nHow do I structure this query so the results for the sub queries are returned as part of the main query? (as defects, addInfo, mark and thorough). Think I have the AS statements in the wrong place, but when I try to put them outside the () for each subquery it returns a syntax error."
] | [
"sql",
"sql-server"
] |
[
"How to create account with Class of Service using SOAP Zimbra",
"Hi i need to create a user with Class of Service \"stuff\" on Zimbra. I am using zimbra soap services and mu request is:\n\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <SOAP-ENV:Header>\n <context xmlns=\"urn:zimbra\">\n <authToken>MyAuth</authToken>\n </context>\n </SOAP-ENV:Header>\n <SOAP-ENV:Body>\n <CreateAccountRequest xmlns=\"urn:zimbraAdmin\">\n <name>[email protected]</name>\n <password>PromeniMe123</password>\n <a n=\"givenName\">Mitar</a>\n <a n=\"sn\">Mirić</a><a n=\"cn\">Mitar Mirić</a>\n <a n=\"displayName\">Mitar Mirić</a>\n </CreateAccountRequest>\n </SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n\n\nI tried to put cos (Class of Service) as a <a n=\"cos\"> but it not worked.\nDoes any one know how to create a user using soap and add him to COS called \"stuff\"."
] | [
"soap",
"ldap",
"zimbra"
] |
[
"Timer before executing action again",
"In a switch statement I have a case, which represents a logout button in a game. The problem is if a player repetitively clicks it over and over it executes the c.logout() method again and again causing huge amounts of lag in my game. I'm wanting to add a timer before the player can click the button again. I'm pretty new to threads and timers so I'd really appreciate some help on this. Especially if you could explain it. Thanks a lot.\n\nThis is my code \n\n case 9154: // Logout Button\n c.logout();\n break;\n\n\nSolution thanks to Ryan\n\nJust making a simpile boolean to keep track of the log in state.\n\ncase 9154: // Logout Button\n if (loggedIn) {\n loggedIn = false;\n c.logout();\n }\n break;"
] | [
"java",
"multithreading",
"timer"
] |
[
"sql procedure import error",
"DELIMITER $$\ndrop procedure IF EXISTS `simpleproc`$$\nCREATE PROCEDURE `simpleproc`(OUT param1 INT)\nBEGIN\nSELECT COUNT(*) INTO param1 FROM t;\nEND $$\nDELIMITER ;\n\n\nI am trying to import the above code using PHP but I'm getting this error:\n\n\n Error performing query '':You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$ drop procedure IF EXISTS simpleproc$$ CREATE PROCEDURE `simplepro' at line 1"
] | [
"php",
"mysql"
] |
[
"DAX Cummulate difference of a measure to a fixed value",
"I do not get my head around the following scenario:\nI am using a data table with these three columns:\n[Date] [Count] [Expectation] \n01.01.2020 4 100\n04.01.2020 1 100\n12.01.2020 8 100\n... ... ...\n05.02.2020 4 140\n10.02.2020 5 140\n\n\nThe value in [Expectation] is the same inside each month.\nI transformed the Date into the specific QuarterDate. Now I wanted to cummulate the [Count] ascending by the Quartal by using this Measure:\nPastCertificationsCumQuarter = \nCALCULATE(\n SUM('certifiedSystems_past'[Count]),\n FILTER(\n ALLSELECTED('certifiedSystems_past'[QuarterDate].[Date]),\n ISONORAFTER('certifiedSystems_past'[QuarterDate].[Date], MAX('certifiedSystems_past'[QuarterDate].[Date]), DESC)\n )\n)\n\nThis is working fine.\n\nNow I have to calculate for each quartal the cummulated difference of the cummulated value for the quartal and the expectation value (I just use the max expectation value inside each quartal range).\nFor example As shown in the picture Q1 in 2020 reached 31 but for this quaetal the expectation was 40, so I somehow have to get the value 9.\nI have now idea how this can be solved. Am I on the correct way to use also a measure for this or is there even a more simple way?"
] | [
"powerbi",
"dax",
"powerquery"
] |
[
"getCollection() returns 1 value on frontend and multiples on backend",
"I have thhis code on my model:\n\n$categorias = Mage::getModel('catalog/product')->getCollection()\n ->addAttributeToSelect('*')\n ->addAttributeToFilter('status', 1)\n ->addAttributeToFilter('visibility', 4)\n ->groupByAttribute('name');\n\n\non my backend page this returns all the products values grouped by name, but if i call this on frontend just return 1 value. What's going on? If i remove groupByAttribute line work's fine but don't group. I need group.\nTy for help guys"
] | [
"magento"
] |
[
"SQL stored proc max date issue",
"I have a issue with getting the MAX DATE from a stored procedure.\n\nBasically, I have a list of exchange rates with date of capture, which are captured daily stored within a table and I wish to return the latest value.\n\nHere is the code I am working on..\n\nselect \ndistinct t.source_currency_code, t.target_currency_code,\n'(' + t.source_currency_code + ') ' + s.currency_name as source_currency_name, \n'(' + t.target_currency_code + ') ' + x.currency_name as target_currency_name,\nt.converted_amount as buy_rate,\nt.date_loaded as date_loaded\n\nfrom texchange_rate t, tcurrency s, tcurrency x\n\nwhere \ns.currency_code = t.source_currency_code and \nx.currency_code = t.target_currency_code\n\norder by t.source_currency_code\n\n\nMy thought was to MAX(.t.date_loaded grouped by currency_code) but that does not work... \n\nAny help is appreciated!"
] | [
"sql",
"stored-procedures",
"maxdate"
] |
[
"SQL Server: Deleting Rows with Foreign Key Constraints: Can Transactions override the constraints?",
"I have a few tables where Foreign Key constraints are added. These are used with code generation to set up specific joins in generated stored procedures.\n\nIs it possible to override these constraints by calling multiple deletes within a transaction, specifically \"TransactionScope\" in C# or is cascaded deleting absolutely required?"
] | [
"sql",
"sql-server",
"sql-server-2008",
"transactions",
"constraints"
] |
[
"JTable Cell Editor function not working with second row",
"i have table in jinternalframe, which works like whenever user presses enter next cell is selected in editing mode after previous editing is stopped, if it is the last column then selection goes to next row with column no.-1,but the problem is when i load the class it works with first row in second row its not working .Need help i m unable to find proper information on google about cell editor i need to work with only editingstop and editing cancel method..\n\ntable.getDefaultEditor(String.class).addCellEditorListener(new CellEditorListener() {\n\n @Override\n public void editingStopped(ChangeEvent e) {\n\n if (table.getSelectedColumn() == 1\n && table.getValueAt(table.getSelectedRow(), 1).toString().isEmpty()) {\n\n main = new MainWindow();\n main.itemdata.setSize(getDesktopPane().getWidth(), getDesktopPane().getHeight());\n main.itemdata.setLocation(0, 0);\n main.itemdata.show();\n getDesktopPane().add(main.itemdata);\n main.itemdata.moveToFront();\n main.itemdata.searchField.grabFocus();\n main.itemdata.searchField.selectAll();\n\n }\n\n else if (table.getSelectedColumn() == 5) {\n\n table.changeSelection(table.getSelectedRow(), 7, false, false);\n table.editCellAt(table.getSelectedRow(), table.getSelectedColumn());\n\n }\n\n else if (table.getSelectedColumn() == 7) {\n\n table.changeSelection(table.getSelectedRow(), 8, false, false);\n table.editCellAt(table.getSelectedRow(), table.getSelectedColumn());\n\n }\n\n else if (table.getSelectedColumn() == 8) {\n\n table.changeSelection(table.getSelectedRow() + 1, 1, false, false);\n table.editCellAt(table.getSelectedRow(), table.getSelectedColumn());\n\n }\n\n }\n\n @Override\n public void editingCanceled(ChangeEvent e) {\n\n System.out.println(\"Editing Cancelled\");\n }\n });"
] | [
"java",
"swing"
] |
[
"Can I use a parameter I get from another controller to the current initializable?",
"I have two different controllers, but by getting a certain value at one of them I want to use it at the second controller's initializable.\n\nThis is the part where the first controller sends the region parameter to the other controler\n\n public void enterlevel(String x) throws IOException{\n\n FXMLLoader Loader=new FXMLLoader();\n\n Loader.setLocation(getClass().getResource(x));\n\n Loader.load();\n\n regionalController reg=Loader.getController();\n reg.getRegion(region);\n\n\n //System.out.println(region);\n\n Parent root = Loader.getRoot();\n\n Stage primaryStage = new Stage();\n Scene scene = new Scene(root);\n\n primaryStage.setTitle(\"Ziga Ziga\");\n primaryStage.setScene(scene);\n primaryStage.setMaximized(true);\n primaryStage.setResizable(false);\n primaryStage.show();\n\n\n Stage stage = (Stage) loginButton.getScene().getWindow();\n stage.close();\n\n}\n\n\nThis is where the second controller gets it\n\n public void getRegion(String region) {\n System.out.println(region+\" UO UO UO \");\n regi=region;\n }\n\n\nAnd this is the initializable where I can't use the value as it starts\n\npublic void initialize(URL arg0, ResourceBundle arg1) { \n System.out.println(regi);\n try{\n Class.forName(\"com.mysql.jdbc.Driver\"); \n Connection con=DriverManager.getConnection(\"jdbc:mysql://localhost/bimbima\",\"root\",\"\"); \n Statement stmt=con.createStatement(); \n ResultSet rs=stmt.executeQuery(\"SELECT * FROM `file` WHERE Region = '\"+regi+\"'\"); \n while(rs.next()) {\n filename=rs.getString(\"filename\");\n nameofSup=rs.getString(\"Name of Supervisor\");\n System.out.println(filename);\n }\n con.close(); \n }catch(Exception e){ System.out.println(e);} \n}"
] | [
"java",
"javafx",
"fxml",
"scenebuilder"
] |
[
"Flex 4: How to skin a spark volumebar to make it work like a HSlider?",
"Can anyone point me in the direction of skinning a video player volumebar? I want a mute button on the left side and then an HSlider to the right that is always open (no popups).\n\nI've managed to change the skin to use a custom track button and a custom thumb button and it mostly looks how I want. \n\nI can't seem to figure out how to make the thumb slide horizontally across the track and how to hook it into the videoplayer. The thumb just wiggles a little up and down.\n\nI realize I can make a separate HSlider and button and then attach them to the videoplayer controls, I was just hoping since the functionality is already built in that I could override a few skins and be done with it."
] | [
"apache-flex",
"actionscript",
"flex4"
] |
[
"Intervene A Long Running Thread With contextDestroyed",
"I need to show some code to explain my problem.\n\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\n\npublic class ServletContextAttribListener implements ServletContextListener\n{\nprivate ServletContext context = null;\nprivate MyThread myThread = new MyThread(true);\n\n// This method is invoked when the Web Application\n// is ready to service requests\n\npublic void contextInitialized(ServletContextEvent event)\n{\n this.context = event.getServletContext();\n // Output a simple message to the server's console\n myThread.start();\n System.out.println(\"The Simple Web App. Is Ready\");\n}\n\npublic void contextDestroyed(ServletContextEvent event)\n{\n // Output a simple message to the server's console\n System.out.println(\"The Simple Web App. Has Been Removed\");\n myThread.setB(false);\n this.context = null;\n}\n\npublic class MyThread extends Thread\n{\n private boolean b;\n\n public MyThread(boolean b)\n {\n this.b = b;\n }\n\n @Override\n public void run()\n {\n int i = 0;\n int j = 0;\n while (b)\n {\n //This part is important\n for (i = 0; i < 1000000; i++)\n {\n }\n //\n j++;\n }\n System.out.println(\"Thread stopped i:->\" + i + \" j:->\" + j);\n }\n\n public boolean isB()\n {\n return b;\n }\n\n public void setB(boolean b)\n {\n this.b = b;\n }\n}\n}\n\n\nAs you can see it is very small and dummy program. I didn't write web.xml, I'm just using listener-class.\nWhen I deploy the war, start and stop tomcat, the output of the program is:\n\nThe Simple Web App. Is Ready\nThe Simple Web App. Has Been Removed\nThread stopped i:->1000000 j:->17296\n\n\nAs you can see i is 1000000 as in the for loop. What I want is to break the loop whether i is 1000000 or smaller than that.\n\nYou can say that I can use b condition with i<1000000 in for loop but in my real program I don't have that for loop. I just have a while loop like here but with numerous lines of code within it. I don't want to check b every time within while.\n\nI can't use sleep/interrupt by the way."
] | [
"java",
"multithreading",
"tomcat"
] |
[
"Efficient programming to overcome memory limit in R",
"I have a function that calculates an index in R for a matrix of binary data. The goal of this function is to calculate a person-fit index for binary response data called HT. It divides the covariance between response vectors of two respondents (e.g. person i & j) by the maximum possible covariance between the two response patterns which can be calculated using the mean of response vectors(e.g. Bi).The function is:\n\nfit<-function(Data){\n N<-dim(Data)[1]\n L<-dim(Data)[2]\n r <- rowSums(Data) \n p.cor.n <- (r/L) #proportion correct for each response pattern \n sig.ij <- var(t(Data),t(Data)) #covariance of response patterns\n diag(sig.ij) <-0\n H.num <- apply(sig.ij,1,sum)\n H.denom1 <- matrix(p.cor.n,N,1) %*% matrix(1-p.cor.n,1,N) #Bi(1-Bj)\n H.denom2 <- matrix(1-p.cor.n,N,1) %*% matrix(p.cor.n,1,N) #(1-Bi)Bj\n H.denomm <- ifelse(H.denom1>H.denom2,H.denom2,H.denom1)\n diag(H.denomm) <-0\n H.denom <- apply(H.denomm,1,sum)\n HT <- H.num / H.denom\n return(HT)\n }\n\n\nThis function works fine with small matrices (e.g. 1000 by 20) but when I increased the number of rows (e.g. to 10000) I came across to memory limitation problem. The source of the problem is this line in the function:\n\nH.denomm <- ifelse(H.denom1>H.denom2,H.denom2,H.denom1)\n\n\nwhich selects the denominator for each response pattern.Is there any other way to re-write this line which demands lower memory?\n\nP.S.: you can try data<-matrix(rbinom(200000,1,.7),10000,20).\n\nThanks."
] | [
"r"
] |
[
"How do I fix this error in Anylogic, and what does it mean?",
"I am getting this error from AnyLogic:\nException during discrete event execution:\nclass network_model2021.NursePractioners cannot be cast to class network_model2021.MedicalRecords (network_model2021.NursePractioners and network_model2021.MedicalRecords are in unnamed module of loader 'app')\nat network_model2021.Main$5.resourceSets(Main.java:1)\n\n at com.anylogic.libraries.processmodeling.Seize.f(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Seize.b(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Seize.b(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Seize$11.onEnter(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Wait.e(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Wait.e(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.Wait$8.onEnter(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.InputBlock$1.b(Unknown Source)\n\n at com.anylogic.libraries.processmodeling.InPort.a(Unknown Source)\n\nIm not sure what it means. I am trying to attach one agent (records) to another agent (nurses)."
] | [
"java",
"anylogic"
] |
[
"Lucene (6.2.1) deleteDocuments based on StoredField",
"I am using few StoredField and few TextField in my indexing (Lucene 6.2.1)\n\nfor every document I have my own unique ID\n\nif I create field as \n\n Field docID = new TextField(\"docID\", docId, Field.Store.YES);\n\n\nI am able to delet document like following \n\nField transactionIdField = new TextField(\"transactionId\", transactionId, Field.Store.YES); \nTerm docIdTerm = new Term(\"docID\", docId);\nAnalyzer analyzer = new StandardAnalyzer();\nIndexWriterConfig iwc = new IndexWriterConfig(analyzer);\niwc.setOpenMode(OpenMode.CREATE_OR_APPEND);\nIndexWriter writer = repositoryWriters.getTargetIndexWriter(repositoryUuid);\n\n// 4. remove document with docId\nwriter.deleteDocuments(docIdTerm);\nLOG.log(Level.INFO, \"Document removed from Index, docID: {0}\", docId);\nwriter.commit();\n\n\nBut if I create field as \n\n Field docID = new SttoredField(\"docID\", docId);\n\n\nthe document is not deleted\n\nHow can I delete a document based on a Stored Field Value?\n\nI want to keep it a StoredField so tat users can not search teh document based on docID"
] | [
"search",
"indexing",
"lucene",
"full-text-search"
] |
[
"Segmentation fault when calling class from matlab",
"I am getting a segmentation fault with the following code, and I really dont know what is happening here. It seems that it has something to do with the pointer in the Master-class, but I am not sure how to solve this. I have the following code:\n\nclass Shape\n{\npublic:\n Shape(){}\n ~Shape(){}\n\n virtual void draw() = 0;\n};\n\nclass Circle : public Shape\n{\npublic:\n Circle(){}\n ~Circle(){}\n\n void draw()\n {\n printf(\"circle\");\n // code for drawing circle\n }\n};\n\nclass Line : public Shape\n{\npublic:\n Line() {}\n ~Line() {}\n\n void draw()\n {\n printf(\"line\");\n // code for drawing line\n }\n};\n\nclass Master\n{\npublic:\n Shape* member_shape;\n\npublic:\n Master()\n {}\n ~Master()\n {}\n\n void add_shape_circle()\n {\n member_shape = new Circle();\n }\n\n void add_shape_line()\n {\n member_shape = new Line();\n }\n};\n\nMaster* master_object;\n\n\nDo you have any clue how to get this code working? Thanks.\n\nEDIT (added main function):\n\nActually there exists no main-function like the following in my code, because I am using the code in a MATLAB c-mex function. But it should look like this:\n\n//... classes from above here\nint main()\n{\n master_object = new Master();\n master_object->add_shape_circle();\n master_object->member_shape->draw(); // segmentation error here\n\n return 0;\n}\n\n\n\nEDIT\n\n\nThe error does not occur if I instatiate the Circle object dircetly in the Master-constructor. But then there is no way to choose between Line and Circle. Example: If I change my Master class to the following, then the function call master_object->member_shape->draw() does not lead to an error.\n\nclass Master\n{\npublic:\n Shape* member_shape;\n\npublic:\n Master()\n {\n member_shape = new Circle();\n }\n ~Master()\n {}\n\n void add_shape_circle(){}\n\n void add_shape_line(){}\n};\n\n\nSo, there is something up with this uninitialized pointer...I think."
] | [
"c++",
"matlab",
"inheritance",
"polymorphism",
"mex"
] |
[
"Unable to post information to asp.net MVC controller using postman",
"I am trying to send JSON to asp.net MVC controller. While I am able to call the endpoint using postman, the data which is posted is going an null.\n\nThis is how my controller looks:\n\npublic class DataController : Controller\n {\n //\n // GET: /Data/\n\n [HttpPost]\n public ActionResult Index(Employee e)\n {\n return Json(e, JsonRequestBehavior.AllowGet);\n }\n\n\n\n }\n\n public class Employee\n {\n public string Name { get; set; }\n public int Age { get; set; }\n }\n\n\nI am just returning the input & if you se the output in Postman, name is null and age is 0. \n\nAm I missing anything?"
] | [
"asp.net",
"google-chrome",
"rest-client",
"postman"
] |
[
"Variable type conversion for a view | varchar (max) to (250)",
"Is it possible to convert varchar(max) in a table to varchar(250) in a view?\nId type int\nTextxxx type varchar(max)\n\ndbo.Table:\nId | textxxx\n—--+------\n 1 | aaaa\n 2 | bbbb\n\nQuery\nCREATE VIEW dbo.view\n SELECT ALL [Textxxx] \n FROM DBO.Table\ngo\n\nAnd I want to convert this text (varchar(max)) to varchar(250)\nTotally I don't know how to do it, should I use:\nCONVERT([Text], varchar(250))\n\n???"
] | [
"sql-server",
"tsql",
"sql-server-2012",
"ssms"
] |
[
"How to sett the HTTP_VERSION in Pycurl for use with Mindtouch CURL interface",
"I am trying to access a Mindtouch Wiki using Python. I am trying to use pycurl to do this as the sparse Mindtouch documentation does give CURL command line examples. I found by trial and error that the operation needs the --http1.0 option to be put n the CURL command line in order for the operation to succeed. However I have not found out how to set this option in pycurl.\n\nWhat I get is:\n\nc.setopt(c.HTTP_VERSION_1_0, True)\nAttributeError: trying to obtain a non-existing attribute\n\n\nWhen using CURL on the command line I use a hand coded XML file and refer to it using the -T option. However it would be easier to start with the XML as a string. Any additional insight into doing that in pycurl would be great.\n\nAlternatively, if there is a better way of doing it than pycurl I would be happy to hear of it."
] | [
"python",
"pycurl",
"mindtouch"
] |
[
"AngualrJS + Firebase pre-populated input not saving to array",
"I have an AngularJS app with a Firebase database. I have a page with form fields and a click event $scope.add_new = function() { which will add all data inputed into the fields to my database. \n\nHowever I am pre-populating one of the input fields with var x:\n\nvar x = \"hello world\";\n$('#test').val(x); \n<input type=\"text\" id=\"test\" ng-model=\"data.test\"> \n\n\nBut the value in the input isn't setting to Firebase unless I manually type in the field. It seems not to register if I enter a value with Javascript.\n\nHere is my controller with the click event to create a new array list with the input values\n\n$scope.list = $firebaseArray(new Firebase(\"https://my-db.firebaseio.com/users\"));\n\n$scope.add_new = function() {\n $scope.list.$add($scope.data);\n $scope.data = {};\n $route.reload();\n}\n\n\nAny help is much appericated."
] | [
"javascript",
"jquery",
"angularjs",
"firebase"
] |
[
"How can I run psql from another docker container?",
"I have 2 containers. One of then is for postgresql. Another for php.\n\nversion: '3.7'\n\nnetworks:\n backend-network:\n driver: bridge\n frontend-network:\n driver: bridge\n\nservices:\n php-fpm:\n container_name: k4fntr_php-fpm\n build: ./docker/php-fpm\n ports:\n - \"9000:9000\"\n volumes:\n - ./:/var/www/k4fntr\n depends_on:\n - database\n networks:\n - backend-network\n - frontend-network\n\n database:\n container_name: k4fntr_database\n build: ./docker/postgres\n restart: always\n environment:\n ENV: ${APP_ENV}\n TESTING_DB: ${DB_DATABASE_TESTING}\n POSTGRES_DB: ${DB_DATABASE}\n POSTGRES_USER: ${DB_USERNAME}\n POSTGRES_PASSWORD: ${DB_PASSWORD}\n ports:\n - \"15432:5432\"\n volumes:\n - ./docker/postgres/pg-data:/var/lib/postgresql/data:Z\n networks:\n - backend-network\n\n\nI also have sh script which is copy production database into my local.\n\n#!/bin/bash\n ssh -p 22000 -C -l user host 'sh /project/copy_prod.sh' > /tmp/backup.sql\n\n (\n echo \"DROP DATABASE prod_copy;\"\n echo \"CREATE DATABASE prod_copy OWNER k4fntr;\"\n ) | (export PGPASSWORD=secret && psql -h 127.0.0.1 -U local)\n\n export PGPASSWORD=secret && psql -h 127.0.0.1 -U local prod_copy < /tmp/backup.sql\n\n\nbut got an error \n\n\n bash: psql: command not found\n\n\nIs it possible to run psql from database container?"
] | [
"docker",
"docker-compose"
] |
[
"Angular 2 ng2-completer get selected item values",
"so I am trying a new (for me) autocompleter : \nhttps://github.com/oferh/ng2-completer. Imported it and everything works. :\n\nNow I want to get selected Item values when I choose it : \n\n<ng2-completer [(ngModel)]=\"searchStr\" \n[inputClass]=\"'form-control form-control-inline'\" [datasource]=\"getSelectedItemArray?\" \n[minSearchLength]=\"0\"></ng2-completer>\n\n\nSelections : \n\n protected searchData = [\n { name: 'Bus UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Next UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Lus UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Mamama UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Cars UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Trailers UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'Busses UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'UKUK UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'MAIN UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n { name: 'LustKK UK LTD', address: 'Example', address2: 'Example2',\n pscode: '8497UK', ccode: '877SAD', veh1: '84A4DA', veh2: '846ASD', trail1: '486XSS', trail2: '8746SS' },\n ];\n\n\n constructor(private completerService: CompleterService) {\n this.dataService = completerService.local(this.searchData, 'name', 'name');\n }\n\n\nIn conclusion - I select item from a list - it becomes input value, then I want to get all of that selected item values (name,address, address1....). How do I reach that ?"
] | [
"javascript",
"arrays",
"angular",
"typescript"
] |
[
"libGDX IntelliJ IDEA cannot access com.badlogic.gdx.Application",
"I have created a project with libGDX setup ui. The\nproject works great in Eclipse but when I imported it in Android Studio, the \nandroid project MainActivity.java throws 4 exceptions:\n\njava: cannot access com.badlogic.gdx.Application\nclass file for com.badlogic.gdx.Application not found\n\njava: cannot find symbol\nsymbol: variable super\nlocation: class com.vestrel00.nekko.MainActivity\n\njava: cannot find symbol\nsymbol: method initialize(com.vestrel00.nekko.KFNekko,com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)\nlocation: class com.vestrel00.nekko.MainActivity\n\njava: method does not override or implement a method from a supertype\n\n\nDoes anyone have a solution?"
] | [
"android",
"intellij-idea",
"libgdx",
"android-studio"
] |
[
"wp_email template unable to change",
"I have created a basic html template to use in a wp_email() function.\nHere is the the template code:\n\n<?php\n\n$opties = json_decode($array_opties);\n\n\n$message .= '\n<p>'. date(\"Y-m-d H:i:s\") .'</p>\n<p>'. $titel .'</p>\n<p>'. $uitvoering_field .'</p>\n<p>'. $vermogen_gewicht_gewicht .'</p>\n<p>'. $vermogen_gewicht_type .'</p>\n<p>'. $vermogen_gewicht_kw .'</p>\n<p>'. $vermogen_gewicht_prijs .'</p>\n<p><img src=\"'. $kleurafbeelding .'\" /></p>\n<p>'. $kleurtitel .'</p>\n<p>'. $kleurprijs .'</p>\n<p><img src=\"'. $bekledingafbeelding .'\" /></p>\n<p>'. $bekledingtitel .'</p>\n<p>'. $bekledingprijs .'</p>\n<p><img src=\"'. $velgenafbeelding .'\" /></p>\n<p>'. $velgentitel .'</p>\n<p>'. $velgenprijs .'</p>\n<table class=\"table table-hover table-bordered\">\n <thead>\n <tr>\n <th>Optiepakket</th>\n <th>Omschrijving</th>\n <th>Prijs</th>\n </tr>\n </thead>\n';\nforeach ($opties as &$optie) {\n$message .= '\n <tr>\n <td>'. $optie->titel .'</td>\n <td width=\"250\">'. $optie->omschrijving .'</td>\n <td>'. $optie->prijs .'</td>\n </tr>\n ';\n}\n\n\n\n$message .= '\n</table>\n<p>'. $bedrijf .'</p>\n<p>'. $naam .'</p>\n<p>'. $adres .'</p>\n<p>'. $postcode .'</p>\n<p>'. $plaats .'</p>\n<p>'. $telefoon .'</p>\n<p>'. $mobiel .'</p>\n\n';\n\n\nThis is the code I use to send the email: \n\n $located = locate_template('mail.php');\n if(!empty($located)){\n include $located;\n } else {\n include (ABSPATH. 'wp-content/plugins/quido/frontend/mail.php');\n }\n $email_ontvangers = array('[email protected]', '[email protected]');\n $headers = 'From: from <[email protected]>' . \"\\r\\n\";\n wp_mail( $email_ontvangers, 'text', $message, $headers );\n\n\nThis was all working correctly, But I needed to add some strings to the email so I added them to the row with <p></p> elements. But this did not change the email. Then I added a table head to the table. As you can see there are 3 th tags I added one and this did not change the email. Then I just deleted everything in the file and that did not change the email. So I am sort of lost. I also tried to change the path the wp_mail used my template. So I changed 'mail.php' to the full path of the template which did also not have success. So how do I fix this?"
] | [
"php",
"wordpress",
"email",
"templates"
] |
[
"Restream Video with Wowza",
"Application publishes video stream to Wowza. Then Wowza pushes that stream to FMS server.\nI can setup restreaming manually via Stream -> Stream Targets -> New Target.\nAlso I found that it is possible with REST API( https://www.wowza.com/docs/stream-targets-query-examples-push-publishing ).\n\nBut I actually want to do it completely automatically.\nIs it possible? Maybe Wowza have some triggers on stream broadcast?"
] | [
"streaming",
"video-streaming",
"wowza"
] |
[
"Setting up http basic auth on heroku and react app",
"as mentioned in the the title I want to set up a react app with http basic auth or something similar that prevents my website to be public. I've seen that there the wwwhisper plugin on heroku that would do exactly that. But as far as I know this only works with rack and nodejs. Do you have any suggestions about this?\nThanks in advance!"
] | [
"reactjs",
"authentication",
"heroku",
"basic-authentication"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.