INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
JSTL Cannot be resolved error I have seen similar questions and the answer suggested is place the JSTL jar in the classpath. I have tried both jstl.jar and jstl 1.1.jar bit My error is persistent. The Jars are coming in my web_inf/lib directory so I do not Understand what the problem is. I am using Tomcat 7 My Jsp: <%@taglib uri=" prefix="c"%> ............. My Web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns=" xmlns:xsi=" xsi:schemaLocation=" <servlet> ...... My lib Directory After Deployment: !My WEB_INF/lib Directory What Should I do I am running out of Options :P
JSTL 1.1 also requires **Standard.jar**. The standard.jar (taglib) library is used to enable the JSTL expression language in JSP page, and it’s always used together with the jstl.jar together. **Download** and add it to your lib folder. * * * Or You can use **JSTL 1.2** which does not require standard.jar and also provides performance improvements.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, jsp, jstl" }
Hacklang Higher order functions for Collections Do Hacklang Collections have higher order functions such as `Reduce`, `Some`, `All` or an easy way to implement such methods. The Collection I am most focused on is the Vector. It seems to only have `Map` and `Filter`. The others would help in writing more clean looking functional code.
Full information on the different Hack collections is best seen on the API docs for `Vector` (and other classes). I also only see `->map` and `->filter`, though writing a utility function to do `reduce` yourself isn't particularly difficult, of course.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "arrays, anonymous function, higher order functions, hhvm, hacklang" }
Yii1 accessRules I need to allow a certain kind of user access to a controller's actions, while denying other users who have the same roles plus an additional role. For example, user x has the role 'building', and user y has the role 'building' and 'admin'. I want to allow the 'building' role, except those who also have the 'manager' role. There is also a "super user" role that should be allowed access. The following code block is equivalent to what I have right now: array('allow', 'actions' => array('frontdesk', 'cabinet', 'replace', 'discard'), 'expression' => array('User', 'isSuperStatic') ), array('allow', 'actions' => array('frontdesk', 'cabinet', 'replace', 'discard'), 'roles' => array('building') ), array('deny', 'users' => array('*') )
The solution that I came up with is to use another role that is unique to who I would consider in the 'building' department. So, instead of using 'building', I would use 'building_front_desk', for example. The manager doesn't have that role, but the desired users do.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, yii, yii1.x" }
Switch Case for dynamic amount of values So this is my Program You can add as much rows as you want to this gridview and when you press the 'Ready' button the program watches your input via the KeyDown-Event. When you press one of those Hotkeys shown in the gridview you get all the songs which are in the matching path. I thought I could do something like this: switch (e.KeyValue.ToString().Substring(0, 0)) { foreach (DataGridViewRow item in grdView) { case item.Cells[2].Value: //Get all the songs break; } } Unfortunatelly I get tons of errors. I guess it won't work like this. Is there any other way to ask for all Hotkeys written in the gridview? Thanks for any kind of advice.
foreach (DataGridViewRow item in grdView) { if(item.Cells[2].Value == theValueYouAreLookingFor) { // Do something here break; } } And also e.KeyValue.ToString().Substring(0, 0) doesn't look right, I'm pretty sure that it isn't going to do quite what you want it to do.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, gridview, foreach, switch statement, case" }
FTP: check whether file is closed My FTP client (apache commons ftpclient) needs to download file from FTP. The problem is that an external service may not have finished writing to this file before I start downloading. Is there any way to determine via FTP whether the file is already closed (i.e. there is no writing handlers opened)? The problem is that I cannot synchronize with that external service. But I mustn't download file which is not finished yet (a large JPEG). Thanks in advance!
You cannot check if the file is closed via vanilla FTP protocol - there's just nothing of the sort in it. If you can, you could instruct the external service to generate files in some sort of a temp directory and then move it over into the FTP directory. As long as both the temporary and FTP dir are on the same partition (on Linux, no idea about Windows) the move should be instantaneous.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ftp" }
Angular radio buttons and custom input I am trying to set up a form, with some radio buttons and a textarea for custom input. If I select custom input, and start typing it loses the radio selection and I must select the custom input again when I am done typing < How can I ensure that selecting the radio next to the textarea and providing custom input maintains user selection?
Use a different model object other than the object used in the `ng-value` of the checkbox <input type="radio" data-ng-model="selectedEntry" data-ng-value="newText"> <textarea rows="4" cols="40" data-ng-model="newTextInput"></textarea> And then you can grab the value in the model `newTextInput` when you click the submit button if the third one is selected. `**DEMO**`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angularjs" }
Make google crawl a site when it is cloaked I host this website. And I order a domain for it. SO the site is hosten on somedomain.be/boring I added a domain www.company.com Now In the webmastertools of google if I want to add the property they wil not verify it despite the DNS record, TXT, TAG, and file. How Can I fix this? ![enter image description here]( ![enter image description here](
I changed the config to HTTP redirect. That way it can be crawled but then I changed it back to cloaking again.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google crawlers, cloaking" }
.style("background-position", function(){...}) not populating the attribute Full code here: < The important part is at the end where I wish to use my sample data set to the correct "background-position" for the element according to the data set, the log displays that there is iteration and the data is good but it's still not being assigned. var container = d3.select('.icon-selection-container').attr('width',500); var s = container.selectAll('.icon') .data(icon_defs); s.enter() .append('div') .attr({ class : 'icon icon-book' }) .style("background-image", "url(' .style("background-position", function(d,i) { var bgPos = d.style.slice(20);//clean sample data up console.log(bgPos); return bgPos; } );
You need to remove the ; at the end of the value, so it work with var bgPos = d.style.slice(21,-1); <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, d3.js" }
How not to open a file twice in linux? I have a linked list with an fd and a string I used to open this file in each entry. I want to open and add files to this list only if this file is not already opened, because I open and parse this files and do not want to do it twice. My idea was to compare the filename with every single name in this list, but my program do it multiple times and one file in Linux can have multiple names (soft/hard links). I think it should not be so complicated, because its easy for the OS to check, whether I already used a inode or not, r? I already tried to `open` the same file with and without `flock`, but I always get a new `fd`.
When you successfully open a file use `fstat` on the file. Check to see if the `st_ino` and `st_dev` of the `struct stat` filed in by `fstat` have already been recorded in your linked list. If so then close the file descriptor and move on to the next file. Otherwise add the file descriptor, the file name and `st_ino` and `st_dev` values to the list. You can instead use `stat` to check before opening the file, but using `fstat` after will be slightly faster if the usual case is that file hasn't already been opened.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "c, linux, file, system calls, stat" }
How to override a method in the script of a XUL in another add-on? I would like to change the behavior/extend some of the functionality in another add-on. The answer in Is it possible to modify a firefox addon written using XUL with an addon written using the Addon SDK says > There are certain ways to monkey-patch code in Javascript code modules, if you really have to... but the code I want to modify is the js script for a xul overlay Is it possible to override some functions in that script? And if so, how? It looks like overlaying the xul with my own to run code in its context would work, as suggested in Overriding/Overlaying a XUL method, but is there a way to do this with the add-on sdk? (Jetpack) Thanks.
This xul article shows how to override functions: This topic here shows how to access code scope of addons: Controlling a Firefox Extension via Javascript
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, firefox addon, xul, firefox addon sdk" }
What are the rules for mixing keyword argument and * tuple in python function call I'm having difficulty understanding the rules for mixing keyword arguments and *tuple in a python function call More specifically with the regard to the below code snippet def func(a,b,c): print("These are the arguments",a,b,c) args = [2] #Case 1: expected output "These are the arguments:1,2,3" works fine func(1,c=3,*args) #Case 2:expected output "These are the arguments:1,3,2" raises TypeError func(1,b=3,*args) I wanted to understand why case 1 works but case 2 raises a `TypeError: func() got multiple values for argument 'b'` It looks to me as per the language reference doc the above form of mixing of keyword argument and *tuple is valid. Sorry if i'm missing something obvious. Tested on 3.4 and 2.7.6.
Keyword arguments are not counted when evaluating positional arguments, so in the latter case, you try to provide `b` twice, once with keyword arguments and once with positional arguments. The following method calls are equivalent: func(1, b=3, *args) func(1, *args, b=3) By the way, a very similar example is shown in the linked documentation just under the frame with CPython implementation details.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "python, python 3.x, python 2.x" }
Looking for sample application which demonstrates drawables for different screens Anyone know where I can find a decent sample application (the resources folder in particular) which demonstrates the use of images (icons etc) for different screens?
Maybe this gonna help you: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, android layout, android image, android screen, android screen support" }
Creating object with new Object{} Could you please explain how this construction actually works and what does it mean? var newObj = new Object () { public String s = "test"; public int i = 1; }; What's the class of `newObj` and how it was created?
The class of the `newObj` is an Anonymous Inner Class. Here you define this anonymous inner class inside the curly brace `{}`. > An anonymous inner class can be useful when making an instance of an object with certain “extras” such as overloading methods of a class or interface, without having to actually subclass a class. Also, the `newObj` reference refers, not to an instance of `Object` but to an instance of an anonymous subclass of `Object`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "java, anonymous class" }
how do I redirect a user to a certain page using .htaccess I have the following rule defined in the .htaccess file of my webapplication's root directory. RewriteCond %{REQUEST_URI} !^/classes/captcha.php RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page;=$2 [L] this rule give the facility of typing the url like this `xyz.com/abc/page1` which is in original is equal to `xyz.com/index.php?client=abc&page=page1` Now what I want is that when a user types in ` the address bar of the browser should display the original url i.e. `' currently if I type "` the address bar url doesn't change. Please help me modify this rule. Thanks.
Try adding the redirect flag: RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [R=301, L]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache, .htaccess, mod rewrite, redirect" }
Where in Europe can I find an aircraft turned into a hotel? I just found out that in Sweden there is an old Boeing 747 turned into a hotel. Where else in Europe can I find something like this? The closer to Germany, the better
In Netherlands there is this Airplane suite > The entire airplane has been converted into a single luxury suite for two guests. This means you have the complete craft at your disposal – including its top-flight facilities, which include a Jacuzzi, separate shower, infrared sauna, mini bar, 3 flat screen televisions, blu-ray DVD player with a comprehensive collection of DVDs, a pantry with oven/microwave combination, coffee and tea maker, free wireless internet, air conditioning, etc. > > PRICE: An overnight stay for 2 persons including a luxury breakfast costs € 350. The airplane is available to you from 15:00 on the day of your arrival to 11:00 on the day of your departure. There's also a sneak peak video featured by the BBC
stackexchange-travel
{ "answer_score": 12, "question_score": 6, "tags": "europe, hotels, where on earth, aircraft" }
Creating a Mysql database I want to create a MySQL database which should contain all the users of my site, and also There should be an option of adding other users as friends. What should be the fields of database.
I cannot tell what your user table should cover. You need to know yourself. ;) But you need a second table, e.g. "friend", holding two fields: One for the actual user and one for a friend of this user. So, you have a m:n relation between the user table and itself.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "sql, mysql, database" }
Can JMS messaging be replaced by a polling Webservice call? Existing scenario: Two Apps are communicating using Queues. One of them is always the Producer, and other is always the consumer. The 'Producer' generates and saves data in its own storage. It then sends it to the Consumer, using Queues. The more I read about JMS consumer (and listener) implementation (using Spring), it seems like we can easily replace Messaging with Polling Webservice calls. This is because all that the JMS Listeners do is keep thread(s) open, listening to the Queues. So if your JMS listener ConnectionFactory is set to have 10 connections, you will have 10 blocking threads. So, instead of keeping 10 threads open, why not just poll every 30 seconds or so using 1 thread. That one Poll can instruct the WebService to sent 100 data items (or more) to it in the response.
Both of these are just abstractions. If you think about it its just a socket you are pushing data over. What is really different are the guarantees each abstraction makes. Crazy enough you can actually have SOAP Web Services that are serviced over the JMS and JMS that uses HTTP as the transport. In Short JMS specifies a set of guarantees related to messaging(acknowledgement, redelivery, failover,etc.). Web Services(the way most people think about them) are composed mainly of a thin set of specifications describing message format(SOAP,JSON) layered on top of specifications describing transport(HTTP). Regarding Polling. Most JMS implementations are push models. The subscribers register with the broker and as messages arrive they are pushed to subscribers. Push models have higher throughput than pull models.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "java, web services, architecture, jms, messaging" }
Java Stack.peek() to objects I am attempting to use a stack to put objects in a stack. I have a Pixel class that has a simple getX function that returns a variable defined in the constructor. When I use the stack.peek().getX(); it says that it cannot find the symbol for .getX(); Stack stack = new Stack(); Pixel first = new Pixel(colorX,colorY); stack.push(first); int x = stack.peek().getX(); Am I using the peek function wrong? Or do I have my Pixel class setup incorrectly? public class Pixel { private int x, y , count = 0; Pixel(int x_in, int y_in) { x = x_in; y = y_in; } public int getX(){return x;} public int getY(){return y;}
It is _because_ you are using a raw `Stack`, instead of `Stack<Pixel>` that you get this error. A raw stack is essentially equivalent to `Stack<Object>`, so when you call `peek()` it returns `Object` and not `Pixel`. Even though the runtime type may be `Pixel`, method resolution happens at compile time and `Object` has no `getX()` method.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, class, stack, peek" }
Riddle: Which fast do people fast on different days? There is a fast that according to a clear Halacha in Mishna Berura - some people would fast on one day and others would have to fast on the following day. Which fast is this?
Yom Kippur Katan. When Rosh Chodesh falls on Shabbos, some people move up YKK (and the associated fast) to Thursday, but others - who do not say Yom Kippur Kotton yet still fast on Erev Rosh Chodesh observe it on Friday. (Mishnah Berurah 249:22)
stackexchange-judaism
{ "answer_score": 2, "question_score": 0, "tags": "riddle, halacha, fast days" }
Select all innerHTML of td in ul li hierarchy I have an html structure as follows- <ul id='abc'> <li> <table> <tbody> <tr> <td> A </td> </tr> </tbody> </table> </li> <li> <table> <tbody> <tr> <td> B </td> </tr> </tbody> </table> </li> ... ... </ul> I want to store A,B,C... values in an array using jquery.Please help...
you can do this by javascript by The > `Element.getElementsByTagName()` method returns a live HTMLCollection of elements with the given tag name var values = [] var tableUl = document.getElementById("abc"); var cells = tableUl.getElementsByTagName("td"); for (var i = 0; i < cells.length; i++) { values.push( cells[i].textContent.trim()); } fiddle
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, jquery, html, css" }
PHP Redirect Header with a Variable I have a php script that updates a mysql database. Once its done, I want to redirect back to the details page. I know that this can be done in a header redirect, but I can't get it to add the variable to the address. My code that I have is below. <?php include "../config.php"; $_GET["hiveid"] = $HiveID; $_GET["hivename"] = $HiveName; $_GET["hiveloca"] = $HiveLoca; mysql_query("UPDATE hives SET HiveName='$HiveName', LocationID='$HiveLoca' WHERE HiveID='$HiveID'") or die (mysql_error()); $URL = "../hivedetails.php?HiveID=" . $HiveID; header("Location: " . $URL); ?>
1. STOP WORKING ON THIS CODE and read up about SQL injection vulnerabilities. Your code is just begging for your server to get pwn3d 2. Learn basic PHP syntax. You're assigning your variables backwards. `$HiveID = $_GET['hiveid']` is what you want, and similarly for the other two lines 3. Your actual problem will go away once you fix #2.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php" }
What is -D option in yarn when adding vuetify When adding vuetify in docs it says to add -D option. @nuxtjs/vuetify -D What is it for? Is it something related `vuetify` or `yarn`?
It's related to yarn, actually. This flag defines that the installed package will be added to your **devDependencies** at your **package.json** file. These are your development dependencies. Dependencies that you need at some point in the development workflow but not while running your code (e.g. Babel or Flow). After the yarn build process, the entire Vue project is compiled in vanillaJS with the help of vuetify. So, the vuetify package isn't needed on a production build as it is only needed while compiling the project. That's why it is advised to install vuetify as a devDependency.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "vuetify.js, yarnpkg" }
Format float with given precision ignoring trailing zeros I'm looking for a way to `format!` a `var: f64` with a given precision `prec`. I know I can `format!("{:1$}", var, prec)`. Problem is, given `var=3.1` and `prec=3`, I'll get `"3.100"` as output. I'm looking for a way to omit those trailing zeros, so when `var=3.1` output is `"3.1"`, `3.0 => "3"` and `3.14159 => "3.142"`. Is there a not so hard way to achieve this?
Assuming you mean "trailing zeroes", you can use my library float_pretty_print. It attains output similar to what you want by running standard float formatter multiple times and choosing the appropriate output. You can set minimum and maximum width. $ cargo run --example=repl Type number to be formatted using float_pretty_print Also type `width=<number>` or `prec=<number>` to set width or precision. 3.1 3.1 3.12345 3.12345 prec=5 3.1 3.1 3.12345 3.123 width=5 3.1 3.100 Note that instead of precision, you set maximum width in characters of the whole output (not just the fractional). Also do now expect high performance - the library may allocate multiple times for processing one number.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "rust" }
rails arguments to after_save observer I want users to enter a comma-delimited list of logins on the form, to be notified by email when a new comment/post is created. I don't want to store this list in the database so I would use a form_tag_helper 'text_area_tag' instead of a form helper text_field. I have an 'after_save' observer which should send an email when the comment/post is created. As far as I am aware, the after_save event only takes the model object as the argument, so how do I pass this non model backed list of logins to the observer to be passed on to the Mailer method that uses them in the cc list. thanks
You want to store the list in a virtual attribute. It will be available in the `after_save` callback.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ruby on rails, activerecord, observer pattern" }
Currency with 3+ decimals in words How would you express currency that has over 2 decimals? For example if you said €65.37 that would be "sixty five euros and thirty seven cents". If you have €65.375 would you say "sixty five euros and three hundred seventy five cents". I guess that is wrong though since "three hundred seventy five cents" is actually €3.75
I would read `€65.375` aloud as **"sixty-five euros, thirty-seven cents and five tenths of a cent"**. It is hard to find authoritative references _in writing_ for how a figure should be _read_. But it is an established form when writing sums in legal documents - for example: > ... there shall be paid unto the said Matthew and Peter, or either of them, the sum of one cent and seven-tenths of a cent per page for each and every page of said work so printed and published by them or either of them, ... > Report Made to the Hon. John Forsyth, Secretary of State of the United States ... > > the gold coins of Croat Britain, Portugal, and Brazil, of not less than twenty-two carats fine, at the rate of ninety- four cents and eight tenths of a cent per pennyweight ; > A Dictionary Practical, Theoretical and Historical of Commerce and ...
stackexchange-english
{ "answer_score": 1, "question_score": 3, "tags": "money" }
How to migrate a collection whose document size is greater than 2MB from mongodb to cosmosDB I'm planning to migrate all collections from MongoDB to Azure cosmosDB. Since the maximum size of document in MongoDB is 16MB. I have lot of documents whose size is greater than 2MB. But in cosmosDB, maximum document size is 2MB. So, while migrating from mongo to cosmos I'm facing storage size issues. Is it possible to migrate the large documents ? If so..Can any one please suggest me the steps to migrate the large documents from mongo to cosmos.
You will need to shred the documents into smaller sizes to store in Cosmos DB, then use a query to reassemble in your application which will require some rewriting.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "mongodb, azure cosmosdb mongoapi" }
Multiple php versions with .htaccess files My webhost is offering multiple php version (running as FastCGI), ranging from 5.4 to 7.1, located inside /opt/alt/php5.X directory that can be used one at a time acting on cPanel Php selector. Actually they don't officially offer the possibility to run at the same time multiple version of php (e.g. php 5.6 for one domain and php 7.1 for one of its subdir) either using .htaccess or other config file. There is any way that I can circumvent this limitation knowing the path to the desired php version and using .htaccess or php.ini files ? I've tried with the `AddHandler application/x-httpd-php71 .php` in .htaccess with non results.
You can use conditional php version by configuring the htaccess as explained in this post. A list of PHP versions can be found in this post.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, apache, .htaccess, cgi, cpanel" }
How to transfer the contents of help(tkinter.Tk()) to a python file I am trying to transfer the output of `help(tkinter.Tk())` to a python file but for some reason it is not happening. I wanted to try this without using any `subprocess` module. Following is the code. import tkinter window=tkinter.Tk() with open('C:\\Users\\aryan21710\\help_output.txt','a') as f: #f.write(help(tkinter.Tk())) print (help(tkinter.Tk()),file=f) with open('C:\\Users\\aryan21710\\help_output.txt','r') as f: for line in f: line=line.split('\n') if 'destroy' in line: print('DESTROY FOUND IN FOLLOWING LINE:- {0}'.format(line))
Since `help()` launches interactive Python and doesn't return anything, you must run it in a subprocess and read its output: import subprocess cmd = 'python3 -c "import tkinter; help(tkinter.Tk())"' process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) Now you can access `cmd.stdout` to get the lines of the `help()`'s output. Be aware that they're bytes, but you can easily convert these lines to a single multi-line string with: help_text = ''.join(line.decode('utf-8') for line in process.stdout)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "python, python 3.x, tkinter" }
How to preg_match inside array / arraylist Ho i can get the value of arrays inside arraylist with pregmatch? i have array like this Array( [0] => Array( [judul] => extrahorror[data] => Array( [url] => url - horror[embed] => embed - horror ) ) [1] => Array( [judul] => extraadventure[data] => Array( [url] => url - adventure[embed] => embed - adventure ) ) [2] => Array( [judul] => music[data] => Array( [url] => url - music[embed] => embed - music ) ) ) i want `preg_match` that the title contain 'extra' and get the `data->url` and `data->embed` i was browsing the stack history no 1 found if anybody can found let me know or answer this please
You can do it with one loop $res = []; foreach($arr as $x) { // if a title contains 'extra' if( preg_match('~extra~', $x['judul'])) { // collect to an inner array $x['data']['judul'] = $x['judul']; // add to the result array $res[] = $x['data']; } } print_r($res); **demo**
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, arrays, arraylist" }
alsa - managing non-blocking stream Working with a usb audio device (its a HID with multiple channels) that constantly outputs data. What I'm hoping to achieve is to ignore the audio until a signal comes in from the device. At that point I would start monitoring the feed. A second signal from the device would indicate that I can go back to ignoring the data. I have opened said device in non-blocking mode so it won't interfere with other USB signals coming in. This is working fine except that when I start reading the data (via `snd_pcm_readi`) I get an EPIPE error indicating a buffer overrun. This can be fixed by calling `snd_pcm_prepare` every time but I'm hoping there is a way to let the buffer empty while Im ignoring it. I've looked at `snd_pcm_drain` and `snd_pcm_drop` but these stop the PCM and I'd rather keep it open. Suggestions?
To ignore buffer overruns, change the PCM device's software parameters: set the stop threshold to the same value as the boundary. With that configuration, overruns will not cause the device to stop, but will let it continue to fill the buffer. (Other errors will still stop the device; it would be hard to continue when a USB device is unplugged ...) When an overrun has happened, the buffer will contain more data than actually can fit into it, i.e., `snd_pcm_avail` will report more available frames than the buffer size. When you want to _actually_ start recording, you should call `snd_pcm_forward` to throw away all those invalid frames.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "usb, centos, alsa" }
Selenium: Getting xpath of element with the help of property such as link I want to know is it possible to get xpath of the element such that link="Edit". Using selenium can i achieve this. Explanation : I know that on page there is link with with text "Edit". So using selenium i can locate it dynamically such that `link="Edit"` but now i have this link in my RC and want to loop it using its `xpath` so that i can get contents in the same row where link is present. I want to achieve these kind of things in different scenarios and with different elements. I should be able to get the xpath, id, css of elements using attributes of elements. Please help, let me know is it possible using some java-script or else I am using Selenium RC with PHP. If possible i should be able to integrate things. Thanks in advance.
i don't know about "on the go" creating of xpath, but this is an xpath equivalent for `link="Edit"` in Selenium: //a[contains(text(), 'Edit')]/..
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, selenium, selenium rc" }
Why did Moshe keep his name if it was given by an Egyptian? In this weeks parsha it says (Shemos 2:10): > "וַיִגְדַּל הַיֶּלֶד וַתְּבִאֵהוּ לְבַת־פַּרְעֹה וַיְהִי־לָהּ לְבֵן וַתִּקְרָא שְׁמוֹ מֹשֶׁה וַתֹּאמֶר כִּי מִן־הַמַּיִם מְשִׁיתִהוּ׃" > > “When the child grew up, she brought him to Pharaoh’s daughter, who made him her son. She named him Moses, explaining, I drew him out of the water.” Later on and for the rest of history, everyone calls him by the name Moshe, even G-d! Why would Moshe keep this name if it was given to him by an Egyptian, not his mother nor was it given by G-d?
The Midrash Rabba in place says: > "אָמַר לוֹ הַקָּדוֹשׁ בָּרוּךְ הוּא לְמשֶׁה חַיֶּיךָ מִכָּל שֵׁמוֹת שֶׁנִּקְרְאוּ לְךָ אֵינִי קוֹרֵא אוֹתְךָ אֶלָּא בַּשֵּׁם שֶׁקְּרָאַתְךָ בִּתְיָה בַת פַּרְעֹה (שמות ב, י): וַתִּקְרָא שְׁמוֹ משֶׁה, וַיִּקְרָא אֶל משֶׁה." As Batya converted and called herself a Hebrew name - בת-יה (G-d's daughter) she also prophecized Moses' name (ברוח הקודש אמרה) and G-d agreed to use that name exclusively. NB, as for the name itself, the other Midrash in place says that the name was used exclusively as it is a reminder (and an opposition/reaction to) for Pharaoh drowning of the Jewish children in Nile.
stackexchange-judaism
{ "answer_score": 6, "question_score": 6, "tags": "names, moshe rabbeinu, parashas shemos" }
CVS - ignore Thumbs.db on Windows What I tried so far is making a file, '.cvsignore' in the root of my module and then for the contents of the file: *.Thumbs.db However when I do CVS update, it still accounts for Thumbs.db - I just want it completely ignored by _any_ cvs operation - is that possible? And I don't really prefer CVS but I'm stuck using it for a certain project which I have no say on, otherwise I'd go with Mercurial or Git.
If you want cvs to ignore files named Thumbs.db, why do you tell it to ignore files named `something[dot]Thumbs.db`? Simply add `Thumbs.db` to your `.cvsignore` and you're done. EDIT: There are several candidates for the location of the `.cvsignore` file: 1. In the directory where the Tumbs.db file is located. This will only help for that single directory. 2. In your home directory. This will then apply do anything you do with cvs no matter what repository you are using. 3. In your CVSROOT directory. This will apply to all modules that belong to this repository.
stackexchange-superuser
{ "answer_score": 10, "question_score": 3, "tags": "cvs" }
No updates since a long time Using Ubuntu, I have a habit of running: sudo apt update sudo apt upgrade on every startup. But for a month, I guess, there have been no updates whatsoever. The message shows: All packages are up to date Now I am starting to worry. Can there be a fault in my update manager? As far as I know, I've made no changes to the package manager settings. But no updates for almost a month seems kind of weird. Any feedback would be helpful. Thanks.
Lots of people ask this question between mid-December and the first week of January when a lot of the development team steps away from the keyboard to enjoy some time doing other things, like spend time with family. Updates generally resume around the 10th of January most years so long as there are not major security vulnerabilities discovered over the holidays. If you haven't seen anything by January 15th, then it's time to investigate.
stackexchange-askubuntu
{ "answer_score": 16, "question_score": 8, "tags": "updates, update manager" }
ASP.NET MVC: How to disable SSL 2.0 **Is it possible to disable SSL 2.0 in my MVC project?** SSL 2.0 contains a number of security flaws (risk of man-in-the-middle attacks etc.; see wiki for more details). So I want to prevent unsecured HTTPS requests via SSL 2.0 protocol. I know about `RequireHttps` attribute, but it do not allow to specify required SSL version.
The MVC framework knows nothing about SSL types. All it can help determine is whether or not a page has to be served over a secure connection (Https). As for what types of secure connections can be made to the server is an IIS configuration setting.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "asp.net mvc, security, ssl, https" }
Sqlplus Serveroutput not showing Here is my sqlplus script: sqlplus <<EOF>> $LOGFILE $USER_NAME_PASSWORD WHENEVER SQLERROR EXIT SQL.SQLCODE spool $LOGFILE set serveroutput on size 20000 show serveroutput set echo on set sqlblanklines off set define off @$1 spool off exit EOF RC=$? And here is my sql script: DECLARE L_COUNT NUMBER := 0; BEGIN FOR i in 1..4 LOOP l_count := l_count + 1; END LOOP; dbms_output.put_line('Num: ' || l_count); END; I would expect to see the results of l_count in my $LOGFILE, but I do not. I'm sure I'm missing some set feature when I call sqlplus. Any ideas?
You never actually execute your pl/sql anonymous block. You need to put a '/' after your END; statement: DECLARE L_COUNT NUMBER := 0; BEGIN FOR i in 1..4 LOOP l_count := l_count + 1; END LOOP; dbms_output.put_line('Num: ' || l_count); END; / Also, it's not a good idea to use both shell stdout redirection to write to the same file as specified by your SPOOL command. Pick one or the other, not both.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "oracle, plsql, sqlplus, spool" }
Nodejs. gulp not found after npm install I've got this git repo : < . Watching a series of tutorials and I got to the point where I must run gulp, but it gives me an error. From the beginning I cloned this repo, then I did `npm install` being in that folder. I inspected the `package.json` and indeed there are **gulp dependencies**. So what should I do? If I install gulp globally will it behave normally? Or I must somehow install it locally? **P.S.** **:** I tried this and encountered the error on Windows and Linux machine.
If you want to run gulp locally you could try this after having installed dependencies with an `npm install`: $(npm bin)/gulp
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 3, "tags": "angularjs, node.js, git, gulp, angular" }
Find the cartesian equations of $V$ Let $V\subset \mathbb{R}^3$ be the subspace created by $\\{(1,1,0),(0,2,0)\\}$. Write the cartesian equations of $V$. Since the two vectors are linearly independent they are a basis of the 2D-space $V$. They thus create a plane. Moreover, since $V$ is a vector space, the plane has to pass through the origin (else it would be an affine space). In order to write the plane equation in cartesian form, I need the vector normal to it. Thus I can use the cross product, since I know two vectors of the plane which are linealrly independent. \begin{equation} \textbf{v}_{n}=(1,1,0)\wedge(0,2,0)=\begin{vmatrix} \textbf{i} & \textbf{j} & \textbf{k}\\\1&1&0\\\0&2&0\end{vmatrix}=(0,0,2) \end{equation} Then the wanted equation is: $\pi: 2z=0$. I'm not convinced at all though. Can you explain to me where I messed up and how to get the right answer? Thank you all
The span of $(1,1,0)$ and $(0,2,0)$ consists of the $x$-$y$-plane, or in other words: all vectors with $z = 0$. So your equation is fine. You can test if a linear combination $u$ is part of the plane, by checking if it fulfills the normal equation of the plane $n \cdot u = 0$: $$ n \cdot (s (1,1,0) + t (0,2,0)) = s ((0,0,2) \cdot (1,1,0)) + t ((0,0,2) \cdot (0,2,0)) = 0 \quad (s, t \in \mathbb{R}) $$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "linear algebra, geometry, vector spaces, vectors" }
How to get topic name and client id from aws mqtt message broker to aws lambda After mapping send message to lambda function, in AWS IoT core with query `SELECT * From '+'`, I am getting only messages in aws lambda event object. I am using python 3. How can I get topic name and client Id along with messages.
The topic and client id need to be passed in the IoT rule using the `topic()` and `clientid()` functions. These are then available in the payload that the lambda receives. So the rule can be: SELECT *, topic() AS topic, clientid() AS clientid FROM '+' The lambda will then receive a JSON payload with the `topic` and `clientid` properties.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "aws lambda, aws sdk, aws iot, aws serverless" }
Python vs MATLAB: ARIMA Model with Known Parameter Values In MATLAB, we can specify an ARIMA(p, D, q) model with known parameter values by using the following function ![enter image description here]( tdist = struct('Name','t','DoF',10); model = arima('Constant',0.4,'AR',{0.8,-0.3},'MA',0.5,... 'D',1,'Distribution',tdist,'Variance',0.15) In Python or R, Can I do this to build my own model? After that, I need use this model to predict my dataset ![enter image description here]( In Python or R, Can I do this?
Python StatsModels example below. In. test_model = sm.tsa.ARIMA(test_data['log_PI'], [1, 1, 0]).fit() test_model.params Out. const 0.001166 ar.L1.D.log_PI 0.593834 dtype: float64 In. _ = test_model.plot_predict(end="2016-12") Out. ![enter image description here]( In. # Constant param change test_model.params.const = 0.02 # test_model.params[0] = 0.02 # AR params change # test_model.params[1] = 0.9 # test_model.arparams[0] = 0.9 _ = test_model.plot_predict(end="2016-12") Out. ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, r, statistics, statsmodels" }
Isomorphism between affine curves How to see why the affine curves $V(4x^{2}+x+y^{2})$ and $V(4x^{2}+xy+1) \subseteq \mathbb{A}^{2}$ are isomorphic? I was thinking in using the fact that every quasi-affine variety is birational to its projective closure, now their projective closures are given by $V(4x^{2}+xz+y^{2})$ and $V(4x^{2}+xy+z^{2})$ so the map $[x : y : z] \mapsto [x : y: z]$ gives an isomorphism. How can we check the first claim without using this fact?
If you make the change of variables $x\leadsto x/8-1/8$, $y\leadsto y/4$, the equation $$4x^2+x+y^2=0$$ turns into $$x^2+y^2=1.$$ Similarly, if you change $x\leadsto\sqrt{-1}x- y$ and $y\leadsto -3\sqrt{-1}x+5y$ on the equation $$4x^2+xy+1=0$$ you also get $$x^2+y^2=1.$$
stackexchange-math
{ "answer_score": 7, "question_score": 2, "tags": "algebraic geometry" }
Gelfand triples/Rigged Hilbert space notation Usually the rigged Hilbert space is denoted by $\mathcal{S} \subset L^2 \subset \mathcal{S}'$, where $L^2$ is a Hilbert space (square integrable functions), $\mathcal{S}$ is the Schwartz space and $\mathcal{S}'$ the space of tempered distributions. It's clear to me that $\mathcal{S}$ is a subset of $L^2$, but why do we write $L^2 \subset \mathcal{S}'$? These two sets have different elements. How is one subset of the other? One has functions and the other has functionals.
This is an abuse of notation. It is true that, as you've stated, $L^2$ is not a subset of $\mathcal S'$. What the notation $L^2\subset \mathcal S$ means is that $L^2$ embeds in $\mathcal S'$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "functional analysis, hilbert spaces, distribution theory" }
What is meaning of "a long way from being"? > Question: Is it bad? > Answer: "I've suggestions but this is a long way from being bad" What does this **a long way from being** mean? Does it mean "much more than just bad" or does it mean "not bad at all"?
Firstly, I am not sure whether _I have suggestions_ can be shortened to _I've suggestions_ , it sounds awkward, I've never heard such a statement. If you want it shortened, it'd maybe be a good idea to write it as _I've got a few suggestions_. _Long way from being bad_ means it's not bad (yet): this situation would need to get a lot worse to become bad. The answer in your quote says that the situation is still _OK_.
stackexchange-english
{ "answer_score": 2, "question_score": 2, "tags": "idioms" }
Detect if you're in the “Frontend Editor” mode in Visual Composer Wordpress Marketo forms tend to break the Wordpress Frontend Editor. Now - my thoughts are to detect if I am just displaying the current page or I am in the frontend editor mode. If in frontend editor mode just to replace the normal form output with a placeholder (or just not display the JavaScript that breaks everything). If somebody has any better suggestion - do not hestitate to!
So, I've dig in the core of WPBakery Visual Composer and came up with this solution: function is_vc_build() { return function_exists( 'vc_is_inline' ) && vc_is_inline() ? true : false; } Hope it will help somebody in future as I spent lots of time on this.
stackexchange-wordpress
{ "answer_score": 2, "question_score": -2, "tags": "plugins, theme development" }
Checking and deleting attributes in SVG using Batik in Java The question basically says it all. How can I check if SVG has a viewBox attribute? I am using Batik lib. I need this because I need to (at least) notify the user that there is a viewBox attribute. Can I delete it?
Using org.w3c.dom classes you'd do something along these lines... String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); URL url = new URL(getCodeBase(), "fileName.svg"); Document doc = f.createDocument(url.toString()); Element svg = doc.getDocumentElement(); if (svg.hasAttribute("viewBox")) { // notify the user somehow } to delete call svg.removeAttribute("viewBox")
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "java, svg, attributes, viewbox, batik" }
Is it possible for a function to distinguish if it is run like this? "${@}" This is my simplified script. **I am wondering if the proc() can know if it is run directly or through the runner.** #!/bin/bash runner () { "${@}" } proc() { eval 'version=$(echo "SUCCESS: **** ${BASH_VERSION} ****")' echo -e "$version"; return 0 } runner proc proc What do you think?
`proc` is not a separate process in your example. It's just a function, run in the same process as the main shell. The `$FUNCNAME` array gives it access to its backtrace: foo(){ bar; } bar(){ baz; } baz(){ proc; } proc(){ echo "${FUNCNAME[@]}"; } $ foo proc baz bar foo main So yes, it can: case ${FUNCNAME[1]} in runner) ... If you experiment with it, you will see that running it in a subshell / subprocess doesn't break the backtrace or affect it in any way: foo(){ (bar &) | cat; } => same output
stackexchange-unix
{ "answer_score": 3, "question_score": 0, "tags": "bash, shell script, scripting" }
Getting a " undefined local variable or method " error I run a command: rake db:migrate RAILS_ENV=test ruby service.rb -p 3000 -e test And I get this error: , [2013-01-31T10:25:22.197106 #999] DEBUG -- : env: test service.rb:16:in `<main>': undefined local variable or method `databases' for main:Object (NameError) I am very new to Rails, can someone brainstorm on what are the things I should be looking at to find the issue? This is from a Tutorial on creating a client app for a Sinatra Rail service with Typheous **EDIT** : Here is the link to the service.rb sourcefile that is giving error <
like Javid mentioned in the comment I was missing the line to define what is the variable "databases" Added this: databases = YAML.load_file("config/database.yml") Still have some more errors now but as far as this question, that's what was missing.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails, typhoeus" }
Are "air-waves" the same as "ether-waves"? I cannot find the meaning of the latter In a story I am reading, I would like to know what "ether-waves" mean: > The odd thing really is that one should hear, but not see; that air-waves should bring the voice, yet ether-waves fail to bring the picture.” Could it be meant to mean the same, just using another word to avoid repeating "air"?
Both are antiquated, "ether-waves" more than "air-waves". What is meant is "radio waves", or (more accurately) "electromagnetic radiation". "Air waves" is still used colloquially to mean "radio communication" but it's understood as being a bit rhetorical or even poetic in feel, hence also used in advertising-speak. _Nobody_ has used "ether waves" for 100 years. In the context you present, it would appear that the author doesn't have a clue what he is talking about. Bluntly: utter, utter blether.
stackexchange-ell
{ "answer_score": 0, "question_score": 1, "tags": "meaning, meaning in context, literature" }
Duplicate figure(1) and assign the duplicate to figure(2) I have created the following figure (figure(1)) in Matlab. ![figure\(1\)]( I am trying to create a figure(2), which is going be exactly the same as figure(1) - in other words duplicate the figure(1) and the duplicate version I want to assign it as figure(2). The reason for that is that I want to be able to present the figure(1) as it is and then in figure(2) I want to present only part of the figure(1) (for example the part for which the x is between 0.333 and 0.666). Any ideas?
You can use copyobj(gcf, groot) This creates a copy (`copyobj`) of the current figure (`gcf`), including its children, as a new child of the graphics root object (`groot`).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "matlab, matlab figure" }
What is the proper way of removing a deployment from kubernetes cleanly I have an example deployment running on a kubernetes cluster that also exposes a service and has a persistent volume bound by persistent volume claim. I would expect that running: kubectl delete deployment 'deployment_name' Will delete everything but after running the above the service and storage still exist and I still have to manually delete the service and the persistent volume for the persistent volume claim to release. Isn't there a single command to remove everything cleanly? Thank you.
If you are creating deployment, service and PV in 3 separate YAML files you will have to remove them one by one. However if you have 3 of them in the same YAML file, you can delete all three at once by applying: kubectl delete -f file.yaml
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "kubernetes" }
I'm beautiful and dangerous I am the goddess of dusk and dawn And I never stray far. I'm beautiful and dangerous And I've never been a star.
Are you > Venus I am the goddess of dusk and dawn > Called the morning star or evening star And I never stray far. > Venus is always found relatively near the horizon I'm beautiful and dangerous > Venus the goddess is beautiful and Venus the planet has a very hostile, corrosive and dangerous atmosphere And I've never been a star. > Though called the morning star or evening star, it is really a traveler (planet)
stackexchange-puzzling
{ "answer_score": 14, "question_score": 7, "tags": "riddle, rhyme" }
How much colder is hammock vs. sleeping in a tent? I just got my first hammock and am eager to try it out! I don't have an underquilt, I was planning to use my current bag and foam pad. In a tent, they would be on the lower end of comfortable for the anticipated low temperatures this week (~10-15F margin of the rated value, but I sleep cold). So I'm concerned that it would be uncomfortably cold in a hammock. Is there a rule of thumb for converting sleeping bag temperatures into what it would "feel like" in a hammock, or how much of a temperature difference you feel on the ground vs. in the air?
With a tent you would have protection from wind chill and unless you can cut the air flow to your skin some other way, the added effect of wind chill depends on the wind speed. The forumla is: wind chill (F) = 35.74 + 0.6215T - 35.75V^0.16 + 0.4275TV^0.16 where T = air temperature (F) and V = Wind Speed (mph) Pretty complicated, but it looks like the worst case is a temp diff of -20F or worse. Anyhow I would guess it depends on the wind and the rain, if you have either then it will probably be too cold, you would need some cover like a rain fly at least.
stackexchange-outdoors
{ "answer_score": 5, "question_score": 11, "tags": "sleeping bags, hammock" }
Confused about __init__.py and importing So I have a directory setup like so: some_dir/ foo/ bar/ test.py src/ __init__.py data/ __init__.py utils.py I want to import `utils.py` from my test.py module. import sys.path sys.path.append("../../") from src import data data.utils // this throws an error AttributeError: module 'src.data' has no attribute 'utils' But when I do: import sys.path sys.path.append("../../") from src.data import utils Everything works, why is this?
a) `from src.data import utils` will import `utils.py`, so everything is ok. b) `from src import data` will just import the `data package`, never import `utils.py`, if you want, you need add explicit import in `__init__.py` under the folder `data`, something like follows: _1) If need to support both python3 & python2:_ **__init__.py:** import src.data.utils # absolute import Or: **__init__.py:** from . import utils # relative import _2) If just need to support python2, make it simple:_ **__init__.py:** import utils Then, when package imported, the `__init__.py` under this package will also be executed.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python" }
Pandas: Compare two Dataframe and Groupby categorical My Question is about pandas DataFrame, I have two DataFrame both follow the same structure. df_1: Index Text Category 0 Text 01 1 1 Text 02 1 2 Text 03 1 3 Text 04 1 df_2: Index Text Category 0 Text 05 2 1 Text 02 2 2 Text 09 2 3 Text 04 2 I want to marge both for this purpose I use `pd.concat(df_1, df_2)` but it simply merge both files, but I want to merge in that manner. df_merge: Index Text Category 0 Text 01 1 1 Text 02 1,2 2 Text 03 1 3 Text 04 1,2 4 Text 05 2 5 Text 09 2 But I really don't know how to do that.
Try: Minimum reproducible example: A = pd.DataFrame({"Text":["01", "02","03","04"], "Category":[1,1,1,1]}) B = pd.DataFrame({"Text":["05", "02","09","04"], "Category":[2,2,2,2]}) C = pd.concat([A,B], ignore_index= True) C.groupby("Text").Category.unique().to_frame() Result: ![enter image description here](
stackexchange-datascience
{ "answer_score": 0, "question_score": 0, "tags": "python, pandas" }
Дополненная реальность Android Кто знает, какие классы могут использоваться в Дополненной реальности в Android ? Есть видео, с камеры на которое нужно наложить например текст или альфа изображение поверх кадров в видео. Как это можно достигнуть, достаточно ли тут обойтись Android SDK ? Важно накладывать на каждый кадр потокового видео
Посмотрите в сторону OpenCV Имеются отличные примеры в Google Play с открытым исходным кодом на GitHub. Также имеется множество статей на хабре: раз, два, три и отличная документация. Ну а по теме ruSO - вопрос слишком общий.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "android" }
How to download dynamic generated content from webpage? I'm trying to download some data from a webpage that is dynamically generated, so using wget doesn't work. The page is < I want to download the list shown for each of the options that can be selected in the field "Legislatura" once downloaded I can process the data in ruby. Just wanted to know what is the best way to download this, and if posible to select each of the options and download.
You can use the Web Inspector in Safari or Chrome or the Firebug extension in Firefox to look at how the data is loaded. The page is doing an AJAX POST request to a Perl script for this website, and the data is return as XML. I would use _cURL_ to grab the data.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby, scripting, download, html parsing, html" }
What's the need of marker interface when Attributes serve the purpose? I'm a bit confused about > The purpose of Marker Interface Vs Attributes. Their purpose looks same to me(Pardon me if I'm wrong). Can anyone please explain how do they differ in purpose?
Here are some advantages of both. Marker interfaces: * are a bit easier to check for using dynamic type checks (´obj is IMarker´); * allow for functional and data extensibility in the future (i.e. turning a “marker” interface into a “full” interface that actually declares some members); * can be used in generic type constraints; On the other hand, attributes: * provide a clearer separation of metadata; * allow for specifying additional information via their constructors or properties; * allow for multiple application to an entity; * are general-purpose in terms of applicability to different kinds of entities, not just classes; It heavily depends on the particular application's architecture and design whether it's appropriate to use a marker interface or an attribute in a particular case.
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 13, "tags": "c#, .net" }
Headphones for ps4 I hope this is the right place to ask a question regarding ps4 headphones. I bought a ps4 pro and was wondering if regular heaphones are good for using in ps4 games or does it require special ps4 headphones. Let me know if there is any difference. Thanks in advance.
You can use any at all, like literally just plug in your earphones and it will work. As long as the device has a proper audio jack it should fit and output sound through it. Plugging earphones/headphones will let sound play through your TV/Moniter and the sound device you plugged in meaning that you don't need to mute people in online games just plug in your earphones and keep them outside of your ears, as VOIP defaults to headset's.
stackexchange-gaming
{ "answer_score": 1, "question_score": 1, "tags": "ps4, voice chat" }
How to change URL for SharePoint:SiteLogoImage I have the job of migrating a sharepoint site from one server to another. Everything appears to have moved across correctly, but there is one image which has a url to the old site. I've tried editing the master page, but there seems to only be placeholders. The image appears to be part of the site definition or template. Where should I look to change the image source for this image? Update: I found the following in default.master. <SharePoint:SiteLogoImage id="onetidHeadbnnr0" LogoImageUrl="/_layouts/images/titlegraphic.gif" runat="server"/> But it seems to be getting the image source from somewhere else. So where exactly is the URL defined? Thanks
Hard to tell which image you are referring but most likey it is a URL that should have been specified by the user and not part of site definition. If you are referring to site's logo image, it may have been specified in the "Title, description and icon" page under site settings. that would browse you to _layouts/prjsetng.aspx
stackexchange-sharepoint
{ "answer_score": 2, "question_score": 2, "tags": "site definition" }
How to compile a c program without leaving the editor? I am using vim editor on Linux mint. I want to know if there is any way to compile c program without leaving the editor.
There are several possibilities. One method is to compile using :!gcc file.c But a nicer strategy would be to have a `Makefile` and compile just using :make Where the easiest `Makefile` would look like. program: gcc file.c Others can explain this a lot better.
stackexchange-unix
{ "answer_score": 21, "question_score": 16, "tags": "vim, compiling, c" }
Maximize an expression with respect to a variable after its minimization with respect to other variables I started to use Mathematica a few time ago. I want to minimize the following expression (function of $l,p,q,r,c$) with respect to variables $l, p, q, r$ and then maximize the result obtained with respect to variable $c$. However, when I try to obtain an expression function of $c$ to maximize later using Minimize, I do not get any result because it takes too long. How can I solve this issue? Minimize[{(((l^2/2)*(1-(1/4-c))+(l*p)*(1-1/4)+(l*q)*(1-(1/4+c))+(l*r)*(1-1/2)+(p^2/2)*(1-c)+(p*q)*(1-2*c)+(p*r)*(1-(1/4+c))+(q^2/2)*(1-c)+(q*r)*(1-1/4)+(r^2/2)*(1-(1/4-c)))/((l^2/2)*(1-(1/4-c))+(l*p)*(1-1/4)+(l*q)*(1-(1/4-c))+(l*r)*(1-0)+(p^2/2)*(1-c)+(p*q)*(1-(1/4-c))+(p*r)*(1-0)+(q^2/2)*(1-(1/4-c))+(q*r)*(1-1/4)+(r^2/2)*(1-0))), l >= 1, p >= 0, q >= 0, r >= 0, l + p + q + r == 1000000, 1/7<c<1/5}, {l, p, q, r}] Why does the above command never end?
This can be done numerically (only numerically in my opinion) in a standard way which takes a lot of time: f[c_?NumericQ] := NMinimize[{(((l^2/2)*(1 - (1/4 - c)) + (l*p)*(1 - 1/4) + (l* q)*(1 - (1/4 + c)) + (l*r)*(1 - 1/2) + (p^2/2)*(1 - c) + (p*q)*(1 - 2*c) + (p*r)*(1 - (1/4 + c)) + (q^2/2)*(1 - c) + (q*r)*(1 - 1/4) + (r^2/2)*(1 - (1/4 - c)))/((l^2/ 2)*(1 - (1/4 - c)) + (l*p)*(1 - 1/4) + (l* q)*(1 - (1/4 - c)) + (l*r)*(1 - 0) + (p^2/2)*(1 - c) + (p* q)*(1 - (1/4 - c)) + (p*r)*(1 - 0) + (q^2/ 2)*(1 - (1/4 - c)) + (q*r)*(1 - 1/4) + (r^2/2)*(1 - 0))), l >= 1, p >= 0, q >= 0, r >= 0, l + p + q + r == 1000000 }, {l, p, q, r}, Method -> "DifferentialEvolution"][[1]] f[0.196] (*0.732468*) Plot[f[c], {c, 0.19, 0.20}] ![enter image description here]( NMaximize[{f[c], 1/7 <= c && c <= 1/5}, c, Method -> "DifferentialEvolution"] (*{0.733816, {c -> 0.2}}*)
stackexchange-mathematica
{ "answer_score": 2, "question_score": 0, "tags": "mathematical optimization, maximum" }
Display current month on a page I currently have the following script located in my .cshtml file: <script type="text/javascript"> var d = new Date(); var month = d.getMonth; window.onload = function () { document.getElementById("currentMonth").innerHTML = month; } </script> Now, I would like to access currentMonth inside of my span here: <span style="font-size: 250%; color:red;">CURRENTMONTH HERE</span> How do I do I access my javascript variable in plain text inside `<span>` or am I going about this the wrong way? What I am trying to accomplish is to display the current month in string format inside of the span. I have tried using `@HttpContext.Current.Timestamp.Month` as well and this prints a 2 to the screen but the `ToString()` for it does not work. I have never used Javascript before so please go easy.
I don't think you need javascript for this. You can render the current date from the server. Try this: <span style="font-size: 250%; color:red;">@DateTime.Today.ToString("MMMM")</span> And drop the Javascript. EDIT: for the sake of completeness... If you want to access the name of the current month from Javascript, you can do so like this. var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var d = new Date(); document.write("The current month is " + monthNames[d.getMonth()]); Code shamelessly ripped from Get month name from Date
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "javascript, c#, razor" }
MFC/C++ equivalent of VB's AppActivate `AppActivate` seems to be what i need, I am fairly sure there must be an c++/mfc equivalent. Is there one?
You can try these: SetForegroundWindow(FindWindow(NULL, "window title")); // or SetForegroundWindow(AfxGetMainWnd());
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "c++, vb6, mfc" }
What color is the drummer's hair? Three friends - a cricketer named White, a footballer named Black and a drummer named Redhead met in a cafeteria. "It is remarkable that one of us has white hair, another one has black hair and the third one has red hair, though no one's name gives the color of their hair" said the black haired person. "You are right" answered White. > What color is the drummer's hair?
White is not > black haired since he responded back to the black haired person. So White's hair can only be > **red** since his hair is neither white nor black. The rest is easy since we know what White hair color is Black's hair color is > **white** since Black cannot have black hair. and Redhead's hair color is > **black** which is the only color left.
stackexchange-puzzling
{ "answer_score": 51, "question_score": 35, "tags": "logical deduction" }
Display inline-flex but keep full width I have place two `div` inside an `inline-flex` `div` one of the two divs width reduces. I'm using bootstrap: <section> <div class="container"> <div class="flexx"> <div class="foo"> .... </div> <div class="col-md-10"> <div class="card"> <div class="card-block"> ... </div> </div> </div> </div> </div> </section> Basically, `foo` class should be inline with `col-md-10` which it does but `col-md-10` gets small instead it should still be at 100%. Am I doing it correct? I'm not strong with css/scss.
I'm not sure I entirely understand your issue. inline-flex items do not default to full width. You will need to add some css for that to happen since in the css for bootstrap the flex-grow property is set to 0; I think adding one style and a class will fix your issue, again if I understand you right. // to your html <div class="col foo"> .... </div> // to your css [class^="col"] { flex-grow: 1; } Check out this pen for help
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "html, css, twitter bootstrap, flexbox" }
Microsoft Visual Studio 2010 Import and Export Settings error I want to change the color scheme for Microsoft VS 2010, to get a more color-balanced theme for the eyes. According to this source, it is a very simple process, one just has to download the appropriate color scheme and install it using **Tools** -> **Import and Export Settings** -> **Import selected environment settings** -> **Browse** -> **Choose settings to import** -> **Finish** However, when I try to click on Tools and Import and Export Settings, I get the following error: _The type initializer for 'Microsoft.WizardFramework.WizardSettings' threw an exception._ I tried to google this error, but all I found is a link to some msdn forum, which had this issue unsolved. Any help would be appreciated.
Figured this out on my own. For my particular case, the problem was in the used system font (which was not the default system font). For some dubious reasons, VS threw back that exception every time. Once I changed back to the default font, the error appeared no more and I was able further to apply the desired theme vs settings. Hope this helps!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "visual studio 2010" }
Working with checkbox in treeview asp.net i want to know how to program the checkbox checked inside treeview, i want to write code when user checks checkbox inside the treeview in asp.net, i got the event known as TreeNodeCheckChange event, i wrote a response.write() message inside it, but when i check the checkbox, nothing happens, does the asp.net treeview supports handling the checkbox from code behind. Thanks in advance.
Try setting `SelectAction="Select"` on the TreeNode element. <asp:TreeView ID="TreeView1" runat="server" OnTreeNodeCheckChanged="TreeView1_TreeNodeCheckChanged"> <Nodes> <asp:TreeNode ShowCheckBox="true" SelectAction="Select" /> </Nodes> </asp:TreeView>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "asp.net, checkbox, treeview" }
For estimation on the integral $g(t)=\int_{-t}^{t}\left\vert\sum_{k=1}^Ne^{ikx}\right\rvert^2dx$ for small $t>0$ For real numbers $t>0$ and $x$, let $f(x)=\sum_{k=1}^Ne^{ikx}$ and $g(t)=\int_{-t}^{t}\lvert f(x)\rvert^2dx$. Then $g(\pi)=\int_{-\pi}^{\pi}\lvert f(x)\rvert^2dx=2\pi N$. I want to know is there any results about the value of $g(t)$ for small $t$ relevant to $N$. In particular, what is the asymptotic behavior (or just the order) of the value $g\left(\frac{\pi\log N}{N}\right)$?
Using the formula for the sum of the first $n$ terms of a geometric series, we have $$|f(x)|^2=\frac{\sin^2(Nx/2)}{\sin^2(x/2)}$$ and hence for $t\downarrow 0$ $$g(t)=2\int_0^t |f(x)|^2\,dx =2\int_0^t \frac{\sin^2(Nx/2)}{\sin^2(x/2)}\,dx \\\ \sim8\int_0^t \frac{\sin^2(Nx/2)}{x^2}\,dx =4N\,\int_0^{Nt/2} \frac{\sin^2 u}{u^2}\,du \sim2\pi N=g(\pi)$$ if $Nt\to\infty$. In particular, this asymptotic holds for $t=\frac{\pi\ln N}N$. It also follows that $$g(t) \sim2\pi N=g(\pi)$$ whenever $t\in(0,\pi]$ varies so that $Nt\to\infty$.
stackexchange-mathoverflow_net_7z
{ "answer_score": 5, "question_score": 2, "tags": "ca.classical analysis and odes, cv.complex variables" }
How to pass env variable to rollup.config.js via npm cli? I have a scripts folder in which many individual scripts inside seperate folder, I would like to build each separately via passing the script name as parameter. I have set up rollup in package.json like `"watch": "rollup --watch --config rollup.config.js"` I would like to pass parameter from cli like `npm run watch script_name=abc_script` It can be accessible in rollup.config.js via process.argv But getting this error `rollup v1.23.1 bundles abc_script → dist/bundle.js [!] Error: Could not resolve entry module` Everything seems fine without npm cli parameter. Rollup have --environment variable but it's bit long to use `npm run watch -- --environment script:script_name` Is there any way to shorten this? Thanks in advance.
You can pass arguments which will be caught by `process.argv` like this npm run watch -- some_arg In your program, you will get an array in process.argv in this the last value will be the value passed to the program.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 11, "tags": "javascript, node.js, rollupjs" }
L'Hôpital's rule in proofs I was asked to prove that $\lim\limits_{x\to\infty}\frac{x^n}{a^x}=0$ when $n$ is some natural number and $a>1$. However, taking second and third derivatives according to L'Hôpital's rule didn't bring any fresh insights nor did it clarify anything. How can this be proven?
Here's a hint: after doing successive applications of L'Hospital's rule, what you get in the numerator is $n(n-1)\cdots(n-m+1)x^{n-m}$. What you get in the denominator is $(\ln a)^m a^m$. If you differentiate a polynomial of degree $n$ $n$ times, what do you get?
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "calculus, proof verification" }
How to get Hibernate + javax.persistence via Maven2 pom.xml I am a newbie with Maven2 and I write a pom.xml. Now I want to get Hibernate and javax.persistence to resolve this: import javax.persistence.Entity; ... import org.hibernate.annotations.Fetch; ... What needed to be done? I wrote in my pom.xml: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.5.6-Final</version> </dependency> But I get an error (I already get some other dependencies, but Hibernate does not work): 11.10.10 13:19:53 MESZ: Refreshing [/testProject/pom.xml] 11.10.10 13:19:54 MESZ: Missing artifact org.hibernate:hibernate:jar:3.5.6-Final:compile 11.10.10 13:19:54 MESZ: Maven Builder: AUTO_BUILD 11.10.10 13:19:55 MESZ: Maven Builder: AUTO_BUILD So, what's wrong here? Why it does not know the artifact? Thank you in advance & Best Regards.
Declare the JBoss repository: <project> ... <repositories> <repository> <id>repository.jboss.org-public</id> <name>JBoss repository</name> <url> </repository> ... </repositories> ... </project> And then the following dependency: <project> ... <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.5.6-Final</version> </dependency> ... </dependencies> ... </project> And that's all your need, the other dependencies will be pulled transitively.
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 12, "tags": "java, hibernate, maven 2, persistence, jpa 2.0" }
Update files or a table every 5 seconds or for every update to a table whichever is the less frequent There is a table 'votescount' which is being updated every time a user vote. I need to display three rows with maximum votes. Now the problem is If the users are less in number and less frequent to update, a trigger will be better to extract the rows, otherwise, if users are more frequently voting, an event will be better. So, is there a lightweight solution in between to solve the problem? I'll prefer to write the results in a file because it will be faster to access from php. I am working on a LAMP stack.
This worked for me. create event event_name on schedule every 5 second starts now() do begin if (select update_time+5>=now() from information_schema.TABLES where table_name='Table_name') then call procedure_name(); end if; end// Here the event checks every 5 seconds if any update happened in the last 5 seconds on the table. If yes it simply calls the procedure update_file or something.
stackexchange-dba
{ "answer_score": 1, "question_score": 1, "tags": "mysql, trigger, jobs, mysql event" }
Derivative of trace and norm I need to find the gradient with respect to $W$ of this equation $\text{tr}(A’ C^{-\frac{1}{2}} W C^{-\frac{1}{2}} A) + \frac{a}{2} ||W-D+Z/a||_{F}^2$ Where $A, C, W, D$, and $Z$ are matrices, and $a$ is a constant
For ease of typing, define the matrix variables $$\eqalign{ B &= \left(C^{-1/2}AA^TC^{-1/2}\right)^T \\\ Y &= W - D + \frac 1aZ &\quad\implies\quad dY = dW \\\ }$$ and let's use a colon to denote the trace/Frobenius product $$\eqalign{ B:A &= {\rm Tr}(B^TA) \\\ A:A &= \big\|A\big\|^2_F \\\ }$$ Write the objective function in terms of these new variables. Then calculate its differential and gradient. $$\eqalign{ \phi &= B:W + \tfrac a2(Y:Y) \\\ d\phi &= B:dW + \tfrac a2(2Y:dY) \\\ &= (B + aY):dW \\\ \frac{\partial\phi}{\partial W} &= B+aY \\\ &= \left(C^{-1/2}AA^TC^{-1/2}\right)^T + \Big(aW - aD + Z\Big) \\\ }$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "vector analysis" }
Randomizing in Java I have 4 Strings to represent people and 4 Strings to represent names. I'm trying to randomize them so that every time I start my application, my four people will have different names, but no one can have the same name during runtime. Example: String person_one; String person_two; String person_three; String person_four; String name_one = "Bob"; String name_two = "Jane"; String name_three = "Tim"; String name_four = "Sara"; Hope this makes some sense.
You can use Collections.shuffle(): List<String> names = new ArrayList<String>(); names.add("Bob"); names.add("Jane"); names.add("Tim"); names.add("Sara"); Collections.shuffle(names); person_one = names.get(0); person_two = names.get(1); person_three = names.get(2); person_four = names.get(3);
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "java, random" }
How to add dynamically function with the jquery plugin contextmenu? I use the contextmenu jquery plugin : < My initial menu object is defined like this : var menu = [{name: 'EN',title: 'EN_title'},{name: 'FR',title: 'FR_title'}]; $(".MyClass").contextMenu(menu); It works normally. Now, I want to add functions dynamically on each item. For example, if I click on EN, I want to trace EN_title. If I click on FR, I want to trace FR_title. The new menu object should be like that : var menu = [ { name: 'EN', title: 'EN_title', fun: function () { console.log(this.title); } }, { name: 'FR', title: 'FR_title', fun: function () { console.log(this.title); } } ]; How can I proceed ?
Try this: var menu = [{         name: 'EN',         title: 'EN_title',         fun: function () {             console.log(menu[0].title)         }     }, {         name: 'FR',         title: 'FR_title',         fun: function () {             console.log(menu[1].title)         }     }     }];   //Calling context menu  $('.testButton').contextMenu(menu);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html" }
No, really, how do you install the Ruby-Slim package in SublimeText2? I tried to follow the Ruby-Slim installation instructions provided in the answers to this question, but I don't know what to do now that I have downloaded a file or folder named 'Ruby-Slim.tmbundle' to the following location (Win7-64bit): myname\AppData\Roaming\Sublime Text 2\Packages\User. This isn't the folder/directory spec'd in the Answers at the other link, but that directory path (Library/Application Support/) didn't exist, while this one had the rest of the specified path. At the same level as 'Packages\', there are 4 directories: Installed Packages, Packages, Pristine Packages, and Settings. Packages has all the folders, like 'Ruby', full of .sublime-snippet files. So what do I do with this Ruby-Slim.tmbundle?
The answer to the linked question is the correct answer. You don't personally download the package. You install it through the package manager. Forget about the folder you just download. Go here Copy the large text that begins with `import urllib....` (this depends on which version of Sublime text you have). Open Sublime text. Open the console by pressing `ctrl + '` (this is a backtic) Paste that massive amount of text into the console. Press Enter Congrats, now you have package manager installed. Restart Sublime Text. Use package manager to install Ruby-slim by pressing `ctrl + shift + p` and typing `"Package Control: Install Package"` and in the next box type `Ruby Slim`. Select `Ruby Slim` from the options that come up and hit Enter and voila, you now have ruby slim installed.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": -3, "tags": "ruby on rails, ruby, slim lang" }
What is the correct terminology to be used when talking about % changes? Throughout my life, I read a "60% increase in x" as $ 60\% * x + x $. For example, if a question asked, "If the initial value of Gold was $39, 162 and if it increased by 50%, what is the price now?", I'd add 50% of 39,162 to get 58, 743. Now, if I was asked to describe this change, I'd say "The price of Gold increased by 50%". Recently, while I was going through the manual of a calculator though, it said this: ![enter image description here]( That is, it is describing the "incease in weight" as a 160% increase -- while to me it's just a 60% increase ($ \frac {300}{500} = 0.6 $). What is right terminology to use? To me, a 160% increase is not the same as a 60% increase. It'd make more sense to say that it _changed_ by 160%. Are both terminologies accepted (increased by 60% vs increased by 160%)? If so, how do we avoid confusion?
The manual is wrong. In the example given in the question, the percentage change is 60%, not 160%. ( _Credts: users KM101 and Jens in the comments_ ).
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "percentages" }
What is the best way to debug a crashing explorer.exe? I work for an orginization that has a custom built Access/SQL Application running in house. We have a problem Explorer.exe throwing an error and crashing. This is a picture of the crash: ![alt text]( What is the best way to start tracking this problem down and finding a solution ?
Make sure WinDBG is installed, set it up as the default debugger then use Analyze and get a crash dump. The next time you get that dialog click "OK" to attach in WinDbg
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "debugging, crash, explorer, windows explorer" }
Is any whatsapp API available to broadcast message & sent to my contacts in whatsapp? Is any whatsapp API or 3rd party API available to broadcast my message (like Text, Files, Etc..) & sent to my contacts or to whatsapp. Paid / Free API will work for me. Any API code base will be good for me like Python, C#, VB.net, java, php, etc...
WhatsApp doesn´t have a public API so far. There is just one company from the Netherlands that is currently testing it. Anyway, there are some third-party APIs as well, e. g. WhatsATool, WhatsBroadcast, etc. but they are kind of expensive. Maybe WhatsMate could be an interesting solution for you, can check it here < I´ve checked waboxapp as well, but it didn´t work, but maybe you can give a try too. I think, you know that there are some things to consider, WhatsApp doesn´t make jokes about Spam-protection ;) Hope it helps, KR, J
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, rest, web services, asp.net web api, whatsapp" }
Residue and removable singularity I have the function $\displaystyle f(z)=\frac{z^2+z+1}{z^2(z-1)}$. I have to calculate residue in isolated singularities (including infinity). I calculated residue in $z = 0$ and $z = 1$, but I don't know how to calculate it in infinity. I don't understand if infinity is removable singularity or not.
The Residue at Infinity of $f(z)$ is given by $$\text{Res}\left(f(z),z=\infty\right)=\text{Res}\left(-\frac1{z^2}f\left(\frac1z\right),z=0\right)$$ So, for $f(z)=\frac{z^2+z+1}{z^2(z-1)}$, we have $$\begin{align} \text{Res}\left(f(z),z=\infty\right)&=\text{Res}\left(-\frac1{z^2}\frac{1/z^2+1/z+1}{(1/z^2)(1/z-1)},z=0\right)\\\\\\\ &=-\text{Res}\left(\frac{z^2+z+1}{z(1-z)},z=0\right)\\\\\\\ &=-\lim_{z\to 0}\left(z\,\frac{z^2+z+1}{z(1-z)}\right)\\\\\\\ &=-1 \end{align}$$
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "complex analysis, functions, complex numbers, residue calculus, singularity" }
how to customize a UITableViewCell? to the core of it just like in other normal programming languages... we can for example override the OnPaint() of the control... can we do the same in xcode/cocoa touch/objective-c puzzle? With no disrespect for the people who like it of course, and see that it's a limitless framework.
UITableViewCell is a UIView subclass so you can override any UIView methods - including `drawRect:` method to perform whatever custom drawing you want to do...
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "objective c, cocoa touch, uikit" }
When will the .NET 4 Client Profile be pushed out over Windows Update? When will the .NET 4 Client Profile be pushed out over Windows Update? Is there a published timeframe, or do we have any educated guesses? Scott Hanselman said "later this year."
Scott Hanselman also said: > About 6-8 weeks after the .NET Framework 4 launches, the .NET 4 Client Profile will show up on Windows Update (WU) and Windows Server Update Service (WSUS) as it's considered part of the serviceable operating system. .NET Framework 4 was launched 12 April, so i hope Client Profile will be available through Windows Update not later than 15 June.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net 4.0, windows update, .net client profile" }
Render without special char encoding in JS I have the string "how are you%3F" where "%3F" represents a question mark. How can I convert it back to "?" when adding it to an HTMl element in Javascript so that it renders human readable? It needs to work for all forbidden characters eg "<" "%3C" var t = document.createTextNode("how are you%3F"); Maybe with a reg expression? I may just be lacking proper terminology as I can't find anything about this in searches. Thanks
decodeURIComponent("how are you%3F");
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "javascript, html, char" }
Is it possible to tell spring cloud sleuth to not log values like passwords? So I enabled Spring Cloud Sleuth in my spring boot app and this happened: 2021-03-03 19:11:11.164 DEBUG [OAuth2 service,b1e3783b06d8cc61,b1e3783b06d8cc61] 5056 --- [nio-8080-exec-5] o.s.web.client.RestTemplate : Writing [{grant_type=[password], client_id=[myclientid], client_secret=[b0ea9376...], username=[rose], password=[mypassword]}] as "application/x-www-form-urlencoded" As you can see at the end, the Sleuth logged the `password=[mypassword]` what is not good... Not good at all. Is it possible to configure Sleuth to not log sensitive data?
As you can see towards the beginning, this was not logged by Sleuth but by `RestTemplate`, the logger is `o.s.web.client.RestTemplate`, it has nothing to do with Sleuth. (Here is the line that does this). What Sleuth has to do with this log event is this part: `[OAuth2 service,b1e3783b06d8cc61,b1e3783b06d8cc61]`; the name of your service, the traceID and the spanID, none of them should be considered as secrets. If you don't want `RestTemplate` to log out these details, you can set it's log level to `INFO`, `WARN` or higher.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "spring boot, spring security, spring cloud sleuth" }
Read several numpy array from csv in one line I have csv file with some data. I am trying to read numpy arrays from csv file, so here is code of the program: import numpy as np train = csv.reader(open(sys.argv[1], 'r')) X = [] y = [] for row in train: X.append(row[1:]) y.append(row[0]) X = np.array(X) y = np.array(y) I know that Python syntax is very unusual. So is there any way to write turn loop in something like that? import numpy as np train = csv.reader(open(sys.argv[1], 'r')) X, y = [... for row in train]
Why you are not reading the whole csv file using `np.loadtxt`? >>> from io import StringIO >>> txt = ''' ... 1, 2, 3 ... 4, 5, 6 ... 7, 8, 9''' >>> >>> xs = np.loadtxt(StringIO(txt), delimiter=',') >>> xs array([[ 1., 2., 3.], [ 4., 5., 6.], [ 7., 8., 9.]]) >>> >>> x, y = xs[:, 1:], xs[:, 0] >>> x array([[ 2., 3.], [ 5., 6.], [ 8., 9.]]) >>> y array([ 1., 4., 7.])
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, csv, numpy" }
How to prevent jquery to keyup when inside textareas? I have this event binded to my 'body': $('body').bind('keyup', doSomething); But I want to avoid this event inside textareas. Using unbind event when focus on textareas and rebind when blur them costs too much. Is there another way o do that? Oh, I also tried: $('body:not(textarea)').bind('keyup', doSomething); but didnt work. Thanks
The two ways that come to mind are: 1. Within your existing handler test the `event.target` and do nothing if it is a `textarea` 2. Add a second handler on `textarea` elements that stops propagation of keyup events. Actual code: // option 1 $('body').bind('keyup', function(e) { if (e.target.tagName.toLowerCase()==="textarea") return; // your existing non-textarea code here }); // option 2 $('body').bind('keyup', doSomething); $('textarea').bind('keyup', function (e) { e.stopPropagation(); }); Demo for option 1: <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "jquery" }
Long integer overflow in C++ Why the below code gives integer overflow warning: #include <stdio.h> int main() { long long int x = 100000 * 99999; return 0; } Whereas below code works perfectly: #include <stdio.h> int main() { long long int x = 100000000000000; return 0; }
Because here long long int x = 100000 * 99999; two _ints_ are multiplied. Try long long int x = 100000LL * 99999;
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "c++" }
Clear session in logout.ashx I have an ashx handler and want to clear the session on request. I am getting object not set to instance of object on the Session.Abondon() line. I am trying to logout a user. public void ProcessRequest (HttpContext context) { //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); FormsAuthentication.SignOut(); context.Session.Abandon(); context.Response.Redirect("/login.aspx"); } Am I doing something wrong?
Did you forget to implement `IReadOnlySessionState` or `IRequiresSessionState` in your handler by chance? If so you would not have access to the Session and get this error. These are marker interfaces whose sole purpose it is to give you access to the Session.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, asp.net, session, authentication" }
Node JS | Grabbing last 7 days of data from the database I am trying to get last 7 days of data from my database. I have a table called `date` and I know that I could easily use `date >= DATE(NOW()) - INTERVAL 7 DAY` but that won't work for me because I have `date` values like that: `Jan 22 2017 16: +0`, `Jan 22 2017 15: +0`, `Jan 22 2017 14: +0`, `Jan 22 2017 13: +0`, `Jan 22 2017 12: +0` etc. What could be the different way doing it? Regards
Seems like you store the date as a string. In this case you could use STR_TO_DATE SELECT STR_TO_DATE(date,'%M %d %Y %h: +0') AS converted_date, [...] FROM [...] WHERE converted_date >= DATE(NOW()) - INTERVAL 7 DAY SQL Fiddle
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, node.js" }
Replace all a in the middle of string by * using regex I wanted to replace all 'A' in the middle of string by '*' using regex in python I tried this re.sub(r'[B-Z]+([A]+)[B-Z]+', r'*', 'JAYANTA ') but it outputs - '*ANTA ' I would want it to be 'J*Y*NTA' Can someone provide the required code? I would like an explanation of what is wrong in my code if possible.
Using the non-wordboundary \B. To make sure that the A's are surrounded by word characters: import re str = 'JAYANTA POKED AGASTYA WITH BAAAAMBOO ' str = re.sub(r'\BA+\B', r'*', str) print(str) Prints: J*Y*NTA POKED AG*STYA WITH B*MBOO Alternatively, if you want to be more specific that it has to be surrounded by upper case letters. You can use lookbehind and lookahead instead. str = re.sub(r'(?<=[A-Z])A+(?=[A-Z])', r'*', str)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, regex, replace" }
How to set up blog alerts in sharepoint I want to set up a blog subscription alert using SharePoint 2010. How to do this? I want to create a blog and should be able to save it in SharePoint site, if the user click for blog subscription then it should be able to invoke an alert to the their mail! How it is possible to do?? can anyone please consult me or provide at-least any right tutorial link? Thank in advance
if on the default homepage, click the 'alert me' link below the posts, right under the 'RSS Feed' link... see here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sharepoint 2010" }
resize the frame in uiwebviews How to resize the image frame in the UIwebview but i put setscalepages fit it shrinks the images and the content sizes
Hope this helps Resize images in UIWebView to viewport size
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone" }
why does this page say java is running if I don't have the java plugin installed? How do i find and disable the java plugin for firefox, and others? why does this page say java is running if I don't have the java plugin installed? How do i find and disable the java plugin for firefox, and others? < I need to make sure that java is diabled so that my pc doesn't get exploited. to answer this question i will accept: how to find the java plugin why the java plugin isn't listed in firefox how to remove the java plugin other info
If you have Java 6, like I do. you can disable the IcedTea plugin. but the exploit is only for java 7. and you can see your version on this page: javatester.org
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 1, "tags": "java" }
Loading only ActiveRecord for RSpec model tests I want to speed up my model tests. After seeing this < I thought it could be achieved if i can only require the active_record rather than loading the spec_helper.rb, which loads the whole Rails stack for every test file. I am using rspec-rails with factory_girl. But so far its not working for me. Every time i run a single file the whole migrations are getting run, which is not acceptable.And before the whole migrations run i am getting some errors. Anybody have a better idea?
If you're looking to speed up your tests by not having to reload the Rails environment each time, you should look into using Spork, Guard, and Guard::Spork. Spork allows you to run a separate, "clean" test server, while Guard enables you to keep it running in the background by observing your files for changes. Spork: < Guard::Spork: < The ever-helpful Railscast: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ruby on rails, activerecord, rspec rails" }
RSpec error: 'but it does not respond to `include?`' I am running the following rspec test expect(City.first.city_openings('2014-05-01', '2014-05-05')).to include(@listing2,@listing3) I am getting this result ![enter image description here]( This is confusing to me because it seems that my result does in fact include the right values. But rspec says that my result "does not respond to include?" Any ideas on how to fix this? I don't see much about it anywhere.
Your method city_openings return true and not a array. TrueClass is not iterable with include? method. See the documentation here < <
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "ruby on rails, ruby, rspec" }
Publish Error- VS 2010- Configuration File Changed? I am publishing a web page to a local server through VS2010- I haven't published anything new in a couple days and I haven't made any config changes(I think). I have been following my same process for 4-5 months. Publish shows as succeeded, and my hosted directory on the local machine is showing my changes(I can also debug in VS w/o isses). I am in windows XP and am running IIS 5.1. When I hit the site from an outside place- my changes do not show up. A subset of the pages (ones requiring specific access rights) show this error: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The configuration file has been changed by another program. Source Error: [No relevant source lines] Source File: C:\Hosting\XXXX\web.config
A restart of my machine fixed the issue (I thought i restarted first, but I realized something blocked it- and I was distracted and didn't notice).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "asp.net, visual studio 2010, web config, iis 5" }
Fundamental group of the complement of $3$ disjoint hypersurfaces in $\mathbb{C}P^2$ Let $X$ be the union of $3$ hypersurfaces in $\mathbb{C}P^2$, then how to compute the $\pi_1(\mathbb{C}P^2\setminus X)$? What I know is the complement of a hypersurface in $\mathbb{C}P^2$ is $\mathbb{C}^2$. I can't go further.
In the lines of @MoisheKohan after a change of co-ordinates you can assume one of your hypersurfaces is $H_3=\\{[z_1:z_2:z_3]\in \mathbb C\mathbb P^2 | \ z_3= 0 \\}$ $ \mathbb C \mathbb P^2-H_3\cong\mathbb C^2$ Thus you are reduced to computing $\pi_1(\mathbb C^2-l_1\cup l_2)$ where $l_1, \ l_2$ are two complex straight lines. Again after a change of co-ordinates you can assume $l_1=\\{(z_1,z_2)\in \mathbb C^2 :z_1=0\\}$ and $l_2=\\{(z_1,z_2)\in \mathbb C^2 :z_2=0\\}$ Then you have $\mathbb C^2 -l_1\cup l_2=\mathbb C^*\times \mathbb C^*$ So you get $$\pi_1(\mathbb C^2-l_1\cup l_2)=\pi_1(\mathbb C^*)\times \pi_1(\mathbb C^*)=\mathbb Z^2$$ Thus $$\pi_1(\mathbb C\mathbb P^2-H_1\cup H_2 \cup H_3)=\mathbb Z^2$$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "algebraic topology, projective space, fundamental groups" }
What is the difference between gradle repository and a maven repository? I’m trying to create a custom Artifactory repository to resolve dependencies in my gradle project, but I’m confused between gradle and maven repo: what repository key should I choose? And what is the real difference between a gradle repository and a maven repository?
**There is no such thing as a Gradle repository.** While Maven is the name for both a build tool and a repository type, Gradle ist just a build tool. It supports both Maven and Ivy repositories.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 16, "tags": "maven, gradle, artifactory" }
xymatrix arrow changing directions In an `\xymatrix` environment, how can I get an arrow going down, then two steps right and then up again, as in the picture? ![enter image description here]( In the good old days there was LAMSTeX to do this kind of things, but not anymore. From the XYPic manual I realize that I have to use the grave accent to type directions but I couldn't figure out how, and furthermore arrows displayed in that manual are bending and not changing direction at straight angles.
Not a direct answer to your question, but `tikz-cd` is _much_ better than Xy-pic. With some help from the manuals and a bit of luck… \documentclass{article} \usepackage{amsmath,amssymb,tikz-cd,eucal} \DeclareMathOperator{\ind}{ind} \begin{document} \[ \begin{tikzcd}[column sep=large] V_m \arrow[r,"\iota"] \arrow[rr,"{\phi_{m+b,m}}", to path = { -- ++(0,-2em) -| (\tikztotarget)[near start]\tikztonodes }, ] & \ind_{\mathcal{S}_m\times\mathcal{S}_b}^{\mathcal{S}_{m+b}}(V_m\boxtimes\mathcal{A}_b) \arrow[r,"{\Phi_{m+b,m}}"] & V_{m+b} \end{tikzcd} \] \end{document} ![enter image description here](
stackexchange-tex
{ "answer_score": 4, "question_score": 1, "tags": "arrows, xy pic, xymatrix" }
$E/K$ is a field extension. Suppose $\exists m\in Z, \forall x\in E, [K(x):K]\leq m$. Then $E/K$ is a finite extension? $E/K$ is a field extension. Suppose $\exists m\in Z_{>0}, \forall x\in E, [K(x):K]\leq m$. $\textbf{Q1:}$ Do I need separability to deduce that $E/K$ is a finite extension of degree at most $m$?(I did use separability to deduce simple extension and this makes my life significantly easier as I just run the argument of simple extension.) $\textbf{Q2:}$ If I do need separability to deduce $E/K$ finite extension, please give a non-finite extension with every element having minimal polynomial with uniform bound on the degree of minimal polynomial. It is clear that counter example should come from $char\neq 0$ case.
After only a few minutes’ thought, I did not see an example in characteristic zero. But let $k=\Bbb F_p$, $K=k(t_1,t_2,\cdots)$, what you get by adjoining infinitely many independent transcendental elements to $k$. Now let $E=K^p$, the set of all $p$-th powers of elements of $K$. Then each $x\in K$ satisfies $x^p\in E$, so every simple extension has field extension degree $p$. Of course the total extension is not finite-dimensional.
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "abstract algebra" }