INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
What do Option-Up Arrow and Option-Down Arrow do in the Finder? Okay, I have no idea how I stumbled onto this and can't recall encountering it before (and I've been using Macs for a LOONNGG time, but what does combining the Option key with the up/down arrow keys do in the Finder (Mac OSX 12.1 Monterey)? I thought it was cycling through open windows (nope), then I thought it was "walking" back through windows that have been closed (nope, I don't think), maybe it was going up/down the hierarchy (nope, that's what CMD-up/down does). I can have a single Finder window open, hit Option-Up, get some rando window, close it, do the same keystroke again, and get a completely different and unrelated, and equally random window.
A pre-emptive guess - you have Default Folder X installed. It's in the default shortcuts list… ![enter image description here]( I'm not sure I fully agree with its definition of 'Recents' - mine didn't quite match the Finder's list [though it does now I've been playing with it for half an hour, of course] Another guess - it's using its own Recents list of folders I've accessed through Open/Save dialogs rather than via Finder itself. An app I've been using maybe two decades, since before it had the 'X', & I _still_ haven't explored its full potential - I really should, one day ;)
stackexchange-apple
{ "answer_score": 2, "question_score": 1, "tags": "keyboard, finder" }
Cakephp - how to encrypt and then decrypt data that is being stored and retrieved from the database Err.... like the question says. How do I go about encrypting and then decrypting data that is being stored and retrieved from the database. By the way it's not just for storing a password which has been md5ed, I need to retrieve the data too. Thanks!
I'd do this in the various before methods in my models, or better still create a before method in my app controller which encrypted and decrypted data. afterFind(); //decrypt beforeSave(); //encrypt Would be the methods that I would choose. PS, I should mention Behaviours here also really, as that's the ideal 'Cake way' to achieve this kind of thing, <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "php, security, cakephp, encryption, md5" }
Regex character sets - and what they contain I'm working on a pretty crude sanitizer for string input in Node(express): I have glanced at some plugins and library, but it seems most of them are either too complex or too heavy. Therefor i decided to write a couple of simple sanitizer-functions on my own. One of them is this one, for hard-sanitizing most strings (not numbers...) function toSafeString( str ){ str = str.replace(/[^a-öA-Ö0-9\s]+/g, ''); return str; } I'm from Sweden, therefore i Need the åäö letters. And i have noticed that this regex also accept others charachters aswell... for example á or é.... **Question 1)** Is there some kind of list or similar where i can see WHICH charachters are actually accepted in, say this regex: /[^a-ö]+/g **Question 2)** Im working in Node and Express... I'm thinking this simple function is going to stop attacks trough input fields. Am I wrong?
Question 1: Find out. :) var accepted = []; for(var i = 0; i < 65535 /* the unicode BMP */; i++) { var s = String.fromCharCode(i); if(/[a-ö]+/g.test(s)) accepted.push(s); } console.log(s.join("")); outputs abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³ ´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö on my system. * * * Question 2: What attacks are you looking to stop? Either way, the answer is "No, probably not". Instead of mangling user data (I'm sure your, say, French or Japanese customers will have some beef with your validation), make sure to sanitize your data whenever it's going into customer view or out thereof (HTML escaping, SQL parameter escaping, etc.).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript, regex, node.js, express" }
Chemistry of cereal in milk In a nearly finished bowl of oat cereal, why do the pieces of cereal stick together? I figure that since they are composed of starches it could be hydrogen bonding. Is this true or is there some other reason?
Surface tension, not hydrogen bonding, is the primary phenomenon which causes cereal rings such as Cheerios to adhere together while floating in milk. The total linear perimeter of the 3-phase cereal-air-milk interface is minimized when pieces cling together. Here are some links: * < * < * <
stackexchange-chemistry
{ "answer_score": 7, "question_score": 4, "tags": "bond, home experiment" }
Calling a static block in footer for homepage only I want to call a static block after my footer and I want it to appear only on my homepage. Here below is my xml code as referred to This Question. But, it is loading the content above the footer when used after and not coming at all when used before. <reference name="content"> <block type="cms/block" name="home_page_content" before="footer"> <action method="setBlockId"><home_page_content>home_page_content</home_page_content></action> </block> </reference>
* Open Home Page to edit. * In `Custom Layout Update XML` textarea, paste code like this: `<reference name="before_body_end"> <block type="cms/block" name="home_page_content"> <action method="setBlockId"> <home_page_content>test</home_page_content> </action> </block> </reference>` Remember to change block id from test to your own block identifier.
stackexchange-magento
{ "answer_score": 3, "question_score": 0, "tags": "magento 1.9, xml, static block" }
TableView with observablelist now showing data - javafx I have this simple tableView designed in Scene builder. I have a button that I press, that's supposed to add the data from the ObservableList to the table, but the data doesnt appear. The table changes from "no data" to a scrollable table with no data inside it. Code: @FXML private TableView<Record> tableView; static ObservableList<Record> dataen = FXCollections.observableArrayList( new Record("January", 100), new Record("February", 200)); To set the data: @FXML private void handleButtonAction(ActionEvent event) { tableView.setItems(dataen); }
I'm guessing that you haven't specified any TableColumns or CellValueFactories for each of your columns. See the JavaDoc for TableView. You can add the TableColumns in SceneBuilder, and assign each an fx:id Then in your initialize method add for eg: monthCol.setCellValueFactory(new PropertyValueFactory("monthName")); where monthName is referring to a method `monthNameProperty()` in your Record class.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javafx" }
iOS Update UIImage with other UIImage after allocating Ok the case might sound simple, but i can't figure out how to do this: // CGImageRef ImagRef = [self imageFromSampleBuffer:sampleBuffer]; // Allocate m_pIMAGE at the first frame if(m_pIMAGE == NULL) { m_pIMAGE = [[UIImage alloc] initWithCGImage:(ImagRef)]; } else { // Copy the frame image (ImagRef) into the m_pIMAGE } CGImageRelease( ImagRef ); How do i update my m_pIMAGE with ImageRef after it was allocated at the first frame?
Image should be assigned in main thread... CGImageRef ImagRef = CGBitmapContextCreateImage(context); CFRetain(ImagRef); // Create an image object from the Quartz image if([NSThread isMainThread]) { if(m_pIMAGE == NULL) { m_pIMAGE = [[UIImage alloc] initWithCGImage:(ImagRef)]; } else { } CFRelease(ImagRef); } else { dispatch_async(dispatch_get_main_queue(), ^{ if(m_pIMAGE == NULL) { m_pIMAGE = [[UIImage alloc] initWithCGImage:(ImagRef)]; } else { } CFRelease(ImagRef); }); } // Release the Quartz image CGImageRelease(ImagRef);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ios, objective c, video, uiimage" }
php how to unit 2 fulltext search and order by date? I want to make a fulltext search, there are 2 group search query, one search match word 'Harry' and 'potter', second search query only match word 'Rowling'. How to unit them and `order dy date`? Then `$query1 relevance is 70%`, `$query1 relevance is 30%`? Thanks. $query1 = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Harry +potter' IN BOOLEAN MODE)";//all the articles both match word 'Harry' and 'potter' $query2 = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Rowling' IN BOOLEAN MODE)";//all the articles macth 'Rowling'
Both your queries select rows from the same table and the same columns set. What about UNION? $query = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Harry +potter' IN BOOLEAN MODE) UNION SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Rowling' IN BOOLEAN MODE)";
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, mysql, full text search" }
Difference between echoing json_encode and returning it in ajax I think this may be classified as basic but I was curious. Why do you have to parse json encoded data returned from ajax calls but not if it is echoed by php in the main loading document? **Edit** : Basically the question is, if I have an object called `data` with a property `id` in both cases, why I can type data.id and have the value returned when the json object has been echoed out while loading the main document, but have it throw an error when returned from an ajax call and not parsed?
By echoed, I assume you mean you did something like this: <script> var data = <? echo json_encode($data) ?>; alert(data.id); </script> If that's the case, the browser knows that the echoed json is code because it's contained by script tags. JSON is a subset of JavaScript, so what you're really doing here is generating JavaScript code that the browser then interprets. Ajax, on the other hand is different. When you load something with ajax, it might be text, xml, csv, html, svg, or any of dozens of different formats. JSON is just a data format like all the others I listed, so you've got to tell the javascript engine what it is. That's why you have to parse it. It needs to know the format of the text so it can interpret it correctly.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, json" }
How to use EXCEPT clause in multiple databases I have a query with an except clause. Underneath the except, my 2nd query is coming from a different database than the one that the first query is using. It looks something like this SELECT field1 as a FROM table 1 EXCEPT USE differentdb SELECT field2 as a FROM table 2 I have also tried this SELECT field1 as a FROM table 1 EXCEPT USE differentdb SELECT field2 as a FROM differentdb.dbo.table2 I realize that this is not allowed in SQL because I get the following error: > Msg 468, Level 16, State 9, Line 1 Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation. I am wondering if there is another way to write this query and accomplish a cross-db EXCEPT clause.
Change the collation of column on the fly like: SELECT field1 COLLATE SQL_Latin1_General_CP1_CI_AS as a FROM table 1 EXCEPT SELECT differentdb.SchemaName.field2 as a FROM table 2
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "sql, sql server" }
Why does sizeof(!5.6) give an output 2? Even if we declare `float a=5.6` then `printf("%d",sizeof(!a))` outputs `2`. Why does it output size of integer?
The `!` operator returns an integral type, likely `int`. `sizeof(int) == 2` on your architecture, apparently.
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 4, "tags": "c, sizeof" }
how to I get the statistical significance of a backtested result If I have a simple long/short value strategy (say long stocks with high e/p and short stocks low e/p or any other parameter) rebalanced monthly, and a look back window of say 15 years. How do I calculate the statistical significance of my result? thanks,
Compare Sharpe , Sortino Ratios, yearly Profit,Max Drawdowns per year of your strategy to 1) buy and hold all of the stocks in your universe 2) few strategies (with different random seeds) which randomly buy /sells stocks in your universe with monthly re-balancing If you want to go more mathematical and get p-values that your strategy's Sharpe Ratio if higher than buy and hold then compare buy and hold of index comprising your universe's stocks to your Sharpe ratio by using formulas (2-sided) from <
stackexchange-quant
{ "answer_score": 5, "question_score": 1, "tags": "statistics, trading, statistical significance" }
How do i diff two files from the web I want to see the differences of 2 files that not in the local filesystem but on the web. So, i think if have to use `diff`, `curl` and some kind of piping. Something like curl | diff but it doesn't work.
The UNIX tool `diff` can compare two files. If you use the `<()` expression, you can compare the output of the command within the indirections: diff <(curl file1) <(curl file2) So in your case, you can say: diff <(curl -s <(curl -s
stackexchange-stackoverflow
{ "answer_score": 49, "question_score": 22, "tags": "unix, curl, pipe, diff, command line interface" }
How do I list configured urls in Mercurial? Obviously I can do something like `cat .hg/hgrc` on *nix to see the paths I have configured, but is there a built-in Mercurial command? A Google search for "hg list configured urls" didn't seem to have any useful results, and neither does `hg help urls` (that I noticed). Is there any command that will display the urls I have configured?
`hg paths` is what you are looking for. `hg help paths` will give you more information.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "mercurial" }
How to commit (not load!) an svn dump? I have my own SVN server. But I need to move a project from it to another one, which is not under my administration. I know you can load a dump and this is simple if you have access to it, but I don't. So... **Is it possible to commit a dump (a number of revisions) to an SVN server?** If so, how?
The only tool I can think of is svnsync: > svnsync is the Subversion remote repository mirroring tool. Put simply, it allows you to replay the revisions of one repository into another one. > > In any mirroring scenario, there are two repositories: the source repository, and the mirror (or “sink”) repository. The source repository is the repository from which svnsync pulls revisions. The mirror repository is the destination for the revisions pulled from the source repository. Each of the repositories may be local or remote—they are only ever addressed by their URLs. > > The svnsync process requires only read access to the source repository; it never attempts to modify it. But obviously, svnsync requires both read and write access to the mirror repository.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "svn, svndump" }
How to skip a line of code inside a class during compiling I have allocated and initialized a class file which is not in the project workspace (don't have a file to import).Normally it would throw an error like Use of undeclared identifier classname.Here i want to skip this error make the build success.Is there any pragma to skip these kind of error's.
Wrap the code around `#ifdef` and `#endif` macros and do not define the macro name that is used. Example - (void)myMethod { // .... #ifdef MYMACRO // Here you need not #import ABC.h ABC *abc = [[ABC alloc] init]; [abc someMethod] #endif // ..... } Do not `#define MYMACRO` anywhere so that this code block is ignored by the compiler. Hope that helps!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "iphone, ios, debugging, compilation" }
Emotion Recognition real time analysis API calls I wanted to know. Using the sample app, in the info it says: " The exception to this is in the "EmotionsWithClientFaceDetect" mode, which performs face detection locally on the client computer using OpenCV, before submitting any images to Cognitive Services. By doing this, we can visualize the detected face immediately, and then update the emotions later once the API call returns. " But when i'm running the sample app, API calls are made regardles if a face is in the screen or not, or am I getting this wrong ? My goal is to create an app that runs 24 \ 7 live. It should make an API call just when a face is detected. Is it possible ? Thanks
There is a push request to fix it. Thank you for bringing it to the team's attention.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "microsoft cognitive" }
Display data in GridView according to priority i am stuck with some thing like I want to retrieve records from a table which having fields like id ,priority and txt. id priority txt 5 1 Hello how are you? (recently added with the 1 priority) 3 1 I am fine 2 1 where are from 4 2 Yes (recently added with the 2 priority) 1 2 No I want to show in the Grid View as (recently added record should be on top if the priority is same than next with the same priority so on) i don't want to use date time column for that. is it possible? via (Sql query) or (C# code) Thanks
If you are looking for the exact same result above, try the query select id, priority, txt from table order by priority ASC, id DESC
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, database" }
What does LF:#-# in Angband mean? At the bottom of the screen in the dungeon it says LF:1-2 What does this mean?
This is where the **level feelings** are displayed, followed by a colon **(:)**. The numbers are **monster feeling** , dash **(-)** , **object feeling**. ![Level Feeling]( > If level feelings are enabled you will see always on screen LF:M-O unless you are in the town. **Source**
stackexchange-gaming
{ "answer_score": 8, "question_score": 8, "tags": "angband" }
Quote issues reading properties file using fmt:message in JavaScript I'm using reading text from properties file. But when I'm using it in JavaScript like this: alert('<fmt:message key="mykey" />'); If there's single quote defined in properties file for this key, there will be an error. If I change the single quotes to double quotes, the error will occur if double quotes defined in properties file. Any ideas?
You could use the same technique as handlebars: put your messages in <script> tags: <script type="text/fmt" id="mykey"><fmt:message key="mykey" /></script> then: alert(document.getElementById("mykey").innerHTML); Or, if you're using jQuery: alert($("#mykey").text());
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, jsp, jstl" }
convert xml data from 1 tag to 2 different column with xslt I have <datetime xml:space="preserve">2020-08-11T04:00:00</datetime> I want to change this to 2020-08-11 04:00:00 with xslt, But I couldn't figure it out, I searched a lot but found nothing
In this case, you can use `substring-before()` and `substring-after()` using the T as reference to split up the text, like: <xsl:template match="datetime"> <xsl:value-of select="substring-before(., 'T')"/> <xsl:value-of select="substring-after(., 'T')"/> </xsl:template>
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "xslt" }
Robot anime of the 80s I am desperately trying to remember an anime I used to watch as a kid in the 80s. It was about robots, I don't remember if the boy (the protagonist) could transform into a robot or he just was the pilot but the weird thing was that before starting the "robot action" a group of girls "prepared" this guy bathing and scrubbing him (the whole scene lasted a few seconds). I am not totally sure but I think I remember that the boy looked more mature after the girls' treatment
(expanded from the comment) ## It is **_Yattodetaman_** , one of the Time Bokan Series (see this other question). When Wataru Toki turns into Yattodetaman (superhero AND robot pilot), some girls from the future help him wear the super suit. Wimpy and coward before the "treatment", he is definitely more "mature" (stronger and brave) after the transformation - this is also due to the hammer to the head, super food and super fast training. The whole transformation happens inside a time-slowing beam, so it takes only 3 seconds of "real time". ![Yattodetaman transformation]( As you said in the comment, part of the transformation is visible in episode 44, but the **very first episode** in which the full transformation sequence appears is **episode 29** (here in Italian): The girls appear again in **episode 40** (in which all characters play themselves on stage). In this case the girls undress him _completely_ , but they don't bathe him, they just dress him as Yattodetaman.
stackexchange-scifi
{ "answer_score": 3, "question_score": 4, "tags": "story identification, anime" }
What is the default time zone in Joda DateTimeFormatter if time zone is not specified? I'm not familiar with Joda DateTimeFormatter, so I'm wondering if there is no time zone specified for DateTimeFormatter, what will be the default time zone? For example I have: DateTimeFormatter stdFormatter = DateTimeFormat.forPattern("MM/dd/yyyy"); DateTime today = stdFormatter.parseDateTime("07/20/2017"); In this case, what would be the time zone of `today`? Is it gonna be 2017-07-20 00:00:00 UTC by default? Thank you!
Referring to the `DateTime` documentation here, the DateTime internally stores the value as milliseconds past 1970-01-01T00:00:00Z, where Z is the UTC zone. The way it is output depends on how you decide to format it (i.e. if you want to print the DateTime in a different time zone, you can use the Joda libraries to do so). In this case, `DateTimeFormat.forPattern` uses the JVM default locale, which is determined by `Locale.getDefault()`, whatever that may be for you. So, your DateTime will contain the time at UTC for `'07/20/2017 00:00:00 {YOUR TIME ZONE}'`. Say your time zone is PDT (i.e. UTC-7). Then "07/20/2017 00:00:00 PDT" == "07/20/2017 07:00:00 UTC". Your DateTime object will store that UTC time.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, jodatime" }
Is the percepetron algorithm's convergence dependent on the linearity of the data? Does the fact that I have linearly separable data or not impact the convergence of the perceptron algorithm? Is it always gonna converge if the data is linearly separable and not if it is not ? Is there a general rule ?
Yes, the perceptron learning algorithm is a linear classifier. If your data is separable by a hyperplane, then the perceptron will always converge. It will never converge if the data is not linearly separable. In practice, the perceptron learning algorithm can be used on data that is not linearly separable, but some extra parameter must be defined in order to determine under what conditions the algorithm should stop 'trying' to fit the data. For example, you could set a maximum number of iterations (or epochs) for the algorithm to run, or you could set a threshold for the maximum number of allowed misclassifications.
stackexchange-datascience
{ "answer_score": 5, "question_score": 3, "tags": "perceptron, convergence" }
Select the first visible cell in every sheet with a loop in VBA I use the below **VBA** to select the **first visible cell** in a filtered range: Sub Postioning_Option_01() Sheet1.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 2).Select End Sub Now, instead of only applying this `VBA` to `Sheet1` I want to **loop through** all sheets. Therefore, I tried to go with this `VBA`: Sub Postioning_Option_02() Dim b As Worksheet For Each b In Worksheets b.Select b.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 2).Select Next b End Sub When I run this `VBA` I get error `Object variable or With block variable not set`. What do I need to change in the `VBA` to make it work?
This will skip sheets with no autofilter: Sub Postioning_Option_02() Dim b As Worksheet For Each b In Worksheets If b.AutoFilterMode Then b.Select b.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 2).Select End If Next b End Sub
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel, vba" }
How to search in listview I am trying to create a Loop that will read through the information on my ListView through the SubItem to find the text that matches the text in my Textbox whenever I hit the search button and Focuses the listbox onto the matched text. Below is what I have but it keeps telling me that the value of string cannot be converted. I am also pretty sure that my numbers wont loop correctly but I am not really sure how to cause them to loop endlessly till end of statement. Dim T As String T = Lines.Text For r As Integer = 0 to -1 For C As Integer = 0 to -1 If List.Items(r).SubItems(C).Text = Lines.Text Then List.FocusedItem = T End If Next Next End Sub
Instead of looping like that through the ListView, try using a For Each instead: searchstring as String = "test1b" ListView1.SelectedIndices.Clear() For Each lvi As ListViewItem In ListView1.Items For Each lvisub As ListViewItem.ListViewSubItem In lvi.SubItems If lvisub.Text = searchstring Then ListView1.SelectedIndices.Add(lvi.Index) Exit For End If Next Next ListView1.Focus() This will select every item which has a text match in a subitem. Don't put this code in a form load handler, it won't give the focus to the listview and the selected items won't show. Use a Button click handler instead.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "vb.net, listview, search" }
bootstrap installation in angular 14 fail I wanted to install Bootstrap in Angular 14 using "ng add @ng-bootstrap/ng-bootstrap" but I get an error in PhpStorm IDEA. What should I do? Error Error
**Later edit** Looks like the latest release v13.0.0 of `ng-bootstrap` adds support for Angular 14.1 **Original answer** The latest stable version of `@ng-bootstrap/ng-bootstrap` which today 6/16/2022 is 12.1.2 is designed for Angular 13. The error you are seeing is due to the fact they have a peerDependecy to Angular 13 in their library. According to this issue < they are currently working on releasing a new version that supports Angular 14. At this time you might get be able to install `ng-bootstrap@next` (which is version `13.0.0-beta.1` that's designed for Angular 14)
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "angular, npm, bootstrap 4, angular ui bootstrap" }
Can I use IIF in SSRS data sets I have a problem with IIF statements in SSRS. I know and have seen many examples of IIF statements in an expression but i need it to be in the data set and standard IF statements used in normal SQL are not recognised. Basically I want something similar to below: SELECT a, b, c, IF ( D is not NULL, 1, 0) FROM ... WHERE .... Its just the `IF ( )` line. Or it could just be a bug with SSRS but can't see anything on any other sites.
Although you don't specify the type of DBMS in use, `IIF` is not valid SQL syntax. Use `CASE` instead: SELECT a, b, CASE D WHEN NULL THEN 0 ELSE 1 END FROM...
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "reporting services, dataset" }
Adding insulation to exterior wall; remove stucco cladding, or add on top of it? I have an exterior stucco wall that's not in super great condition. The outermost-layer was applied very badly and is flaking off, so doing a patch job or yet another layer seems like a bad idea because the layer it would be adhering to is itself not adhering well. As part of this project, I will be adding rigid foam insulation to the exterior side of the wall. My question is this: can I reasonably screw-and-glue the rigid panels right over the existing stucco cladding, or should I really remove all the prior layers of stucco first and attach the foam directly to the wall sheathing? Advantages and disadvantages to each?
Fastening rigid board by screwing through the stucco into the cladding (or framing) will hold the stucco in place, so its poor condition matters little. Remove any mold or rotted stucco, and remove any organic debris. I wouldn't bother trying to glue to flaking stucco. Additionally, the stucco left in place will continue to provide a moisture, thermal, critter, and sound barrier that is desirable. Advantages: cheaper, cleaner work, and easier to do. Disadvantages: the exterior will be slightly (1/2 inch?) larger. * * * The only advantage I can think of to removing the stucco is the idea that you'll remember it as getting rid of the mess.
stackexchange-diy
{ "answer_score": 3, "question_score": 4, "tags": "insulation, stucco" }
Windows Server Receiving Blank Files Whenever we ftp batch files from our Ubuntu Computer to Windows Server 2008, all the files that are under 1kb are blank. Files over 1kb are fine, only files under 1kb are affected and only if we ftp batch. The files are ASCII, we are sending them BINARY. FTP server is standard Window Server 2008 R2 FTP Client is Standard Ubuntu.
Isolate the problem by: 1. Trying another FTP client 2. FTPing from your Ubuntu computer to another FTP server. If you use the console to FTP you can turn on hash mark printing. Turn on hash mark printing and see if this makes any difference, e.g., can you see the hash marks? In general FTP does not 'just break down' when you have two robust operating systems as you describe so there has to be something unique to your environment, but before we can give a sensible reply you will have to isolate the problem further.
stackexchange-serverfault
{ "answer_score": 0, "question_score": 0, "tags": "windows server 2008, ubuntu, ftp" }
Killing Spark job using command Prompt What is the command to kill spark job from terminal. I don't want to kill a running spark job via spark UI
If you are running on yarn use yarn application -kill applicationID Get application id from WEB UI or list with `yarn application -list` ./bin/spark-class org.apache.spark.deploy.Client kill <master url> <driver ID> or you can look the `spark-submit` id by the command `jps` and kill the process but this is not the suggested way
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 8, "tags": "apache spark" }
add data to element so jquery's .data("key") works I see that jquery has a function `.data("key")` which returns the value for that key in the element it's called off of. I would like to use that method, but to do so I need to set the data using html. (I need to set it in my handlebars template helper before the element exists.) For example, say I have the following html text: '<button id=\"my-button\">button</button>'); And I want: $('#my-button').data('datakey'); to return `42`, how would I do that in the html? Alternately, if that is impractical to do, what way should I do it?
To use `data`, you need to have a `data-` style attribute: `<button id="my-button" data-key="42">button</button>` OR set the value using the data function: `$('#my-button').data('key', 42);` Then you can retrieve the value with `$('#my-button').data('key'); //returns 42` <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -3, "tags": "javascript, jquery" }
Convert a curl request API into axios request I am using an API and I want use axios to fetch this API inside a Vue App This is the request `curl --request GET \ --url ' \ --user 'provider:token'` provider is something like "1234" and token is 'azertyuiop12344...' I tried something but its not working mounted() { axios .get({ baseURL: " params: { provider: "1234", token: "azertyuiop12344..." } }) .then(res => console.log(res)); }
Ok I found the answer but my error was most a NuxtJS error than Javascript For the ones who are looking for simple Javascript Axios request you should do something like var axios = require("axios"); axios .get(" { auth: { username: "username", password: "password" } }) .then(res => console.log(res)) .catch(function(error) { console.log("Error on Authentication"); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "api, curl, axios" }
Finding overlapping weighted polygons 'highest' area I have a number of polygons which are in the form of a list of coordinates. Each of these polygons represents an area on a global map and each has a weight. I need to find the area on the map where this weight is the highest. This means that where polygons overlap the weight will be the sum of the two polygons for the intersection area. I would like to make the calculation as efficient as possible. Any help would be greatly appreciated.
The simplest approach to this problem would be to cluster the polygons by nearest neighbours. This step is optional and only used to make the search for intersecting polygons more efficient. Instead the clustering can as well be omitted, which would require an exhaustive search for intersecting polygons. In the next step you can replace two intersecting polygons `A` and `B` by three polygons as follows: a polygon that consists of the area of `A` without the intersection-area with the weight of `A`, an equivalent polygon for `B`, and a third polygon that covers the intersection-area of `A` and `B` with the added weights of `A` and `B` as weight. Replace `A` and `B` by the three generated polygons and update cluster. Repeat this step until no intersecting rectangles can be found and you're done.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, algorithm, maps, shapes, polygons" }
Index a matrix using two equal-length vectors for row and column indices Imagine you have a 5x5 matrix and want to select values using two equal-length vectors, one representing the index row and the other representing the index column: m <- matrix(1:25, ncol = 5) R <- c(1, 3, 5) C <- c(2, 4, 4) The desired output here is a single vector of of `6` (row 1, column 2), `18` (row 3, column 4), `20` (row 5, column 4). The best I could come up with was: diag(m[R,C]) But this constructs a matrix of size `length(R) * length(C)` and so is slow if R and C are long. How do you do this?
You can use `cbind(R, C)` for indexing with `[`: m[cbind(R,C)] #> [1] 6 18 20
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "r, matrix, subset" }
Searching unsorted array in perl? I have an array with... lets say 100 elements. I want to check to see if any of the elements matches a particular string. For example: @array = ('red','white','blue'); I also want to know if the array contains the string 'white' as one of the elements. **I know how to do this with a foreach loop and comparing each element** , but... is there an easier (faster) way than looping through the whole array? -Thanks
It won't be any faster than looping, but you can use grep within Perl. $ perl -e "@array = ('red','white','blue'); print grep(/^white$/, @array);" white
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "arrays, perl" }
show rows by quantity of orders I have following table NAME quantity a 5 b 3 c 2 I need write some oracle sql (only) query which will output following: NAME quantity a 1 a 1 a 1 a 1 a 1 b 1 b 1 b 1 c 1 c 1
with row_num as (select rownum i from dual connect by level <= (select max(quantity) quantity from tab)) select NAME, QUANTITY from tab join row_num on row_num.i <= tab.quantity order by 1 The CTO query provides the grid (rows 1 to max `quantity`). Use it to join to your table constraining the quantity.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, oracle" }
How to send more than 1gig of email attachment We need a webhost server that can handle of sending and receiving huge amount of POP3 emails around 500MB to 1Gig. Is there site capable of this? Or is this possible if we will setup a 24/7 PC linux server and install postfix? Thanks,
It's not only the host you have your domain at. You might configure your server to 500MB+, but the rest of the world doesnt. An email bounces through various servers (when not SSL-ing) before it ends up at the reciever, 500MB+ doesn't _bounce_ very well, with an very high chance the first server will do 'nope'. I suggest: \- you find a (cheap) hosting and send a downloadlink to the file* \- You use something like wetransfer.com (is a userfriendly 'downloadlink' system, up to 2GB) \- Use something like Dropbox to sync files between users. _*Use a downloadscript to send chuncks of data to the user, otherwise people will have to wait forever before the [you want to download this]-dialog even pops up with these filesizes._
stackexchange-webmasters
{ "answer_score": 2, "question_score": 0, "tags": "email" }
Azure functions as job scheduler application I am planning to move our on-premise scheduler windows service application to azure. This application uses Quartz .NET to schedule jobs. We have around 1000 jobs that are running under this application. 90% of the jobs access SQL server database. I am planning to use azure functions to trigger jobs and I do not want to create 1000 function apps for each job. I will create a function app with timer trigger and a queue trigger. Timer trigger runs every minute and fetches and queues active jobs from database and Queue trigger function then run those queued jobs. I would like to know if this an reliable approach? If not are there any other options?
I used durable functions with fanout architecture.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 2, "tags": "azure, azure functions" }
Is there a way to obtain information about the instrument to which a Logic Pro X Script is attached? Is it possible for a Logic Pro X midi script to query information about the instrument to which it is attached? For example, find out if it is transposed or has a particular midi range filter? I have been all through the Apple documentation on the scripter and just don't see that this is possible. <
## Can Scripter plug-in of Logic Pro X query information about the instrument of its channel strip? > NO Scripter is a built-in MIDI FX plug-in of Logic Pro X. MIDI FX are plug-ins inserted in software instrument channel strips that process or generate MIDI data —played from a MIDI region or a MIDI keyboard— in real time. MIDI plug-ins are connected in series `before the audio path of a software instrument` channel strip and hence act as a modulator (using MIDI/CC/PC data) for various parameters of a software instrument. ![simplex]( As the signal flow is simplex (one directional), Scripter cannot query information about instrument.
stackexchange-music
{ "answer_score": 1, "question_score": 1, "tags": "midi, logic pro" }
Swapping image on a screen in android Im working on a school project and it's my first time on android development. I've searched the whole web but couldn't find any answers to my problem. I have a list of images and i would like to put them on one screen and the user would be able to navigate through these images without changing the whole screen. Also Im trying to put an AutoComplete search box to call any image from the list on the same screen. I tried to use viewFlipper method but did not work out. Is there any other way to do it?
You could add an onClick listener to the ImageView. Something like this: ImageView imgFavorite = (ImageView) findViewById(R.id.favorite_icon); imgFavorite.setClickable(true); imgFavorite.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //Change the image here. } }); Source: Android ImageView's onClickListener does not work
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, image, screen, swap, viewflipper" }
Fulton's deformation to the normal cone vs Verdier's Let $X$ be a smooth variety over a field $k$, and let $Y$ be a smooth subvariety. In the literature, I've seen two versions of the **deformation to the normal cone** : **Verdier's version:** $\tilde{X}_Y^\mathrm{Ver} := \operatorname{Bl}_{Y\times \\{0\\}}(X\times \Bbb A^1_k) - \operatorname{Bl}_Y(X)$ **Fulton's version:** $\tilde{X}_Y^\mathrm{Ful} := \operatorname{Bl}_{Y\times \\{0\\}}(X\times \Bbb P^1_k) - \operatorname{Bl}_Y(X)$ Evidently, $\tilde{X}_Y^\mathrm{Ver}$ is just $\tilde{X}_Y^\mathrm{Ful}$ with the subvariety $X\times \\{\infty\\}\subseteq (X\times \mathbb P^1_k)-(Y\times \\{0\\})\subseteq \tilde{X}_Y^\mathrm{Ful}$ removed. > **My Question:** In what sort of situation is it necessary to use one version and not the other?
_The following answer was emailed to me by Claude Sabbah. I have received his permission to post it here._ Whenever you need to get some object on $Y$ from an object existing on the normal cone (in fact normal bundle in your case), you need to proceed by pushforward. As it is better to use a proper pushforward, the version $\tilde{X}_Y^{\mathrm{Ful}}$ is best suited to the question. This is the way Fulton defines Chern classes for example. He needs to use a projection formula that only holds when the fibre of the projection is a projective space, not an affine space. On the other hand, Verdier is not interested in pushing forward to $Y$. The specialization of a perverse sheaf is defined on the normal bundle, and one recovers the nearby cycles by restricting to a section $Y \times \\{1\\}$, if it exists. Together with Fourier-Sato transform, this also gives the vanishing cycle functor.
stackexchange-mathoverflow_net_7z
{ "answer_score": 5, "question_score": 6, "tags": "ag.algebraic geometry, complex geometry, intersection theory, perverse sheaves, constructible sheaves" }
What is the difference in terms of application of a rucksack with greater than 50L capacity? I am looking to buy a rucksack. I want to move quickly and pack minimally on a week-10 day long trip so I"m tempted by packs around the 45-55L range. However, I want to get a pack that is also versatile and there will be times in the future where I will want to go for longer trips. Packs are expensive so I want to make sure that I buy one that covers what I want to do. What is the extra affordance of packs with greater capacity that round the 55L mark. In the 55L pack I am planning to fit Sleeping bag , Mat, Cotton shirt, Hiking trousers, socks, Underwear, Sunglasses, Suncream, Swim trunk, micro Towel, Sandals, Buff hat, Multi fuel, Mess tin, Utensils, Food, Water, Water carrier , Camelback / hydration pack, Bivvy bag , Camera , Backup battery , iPhone, iPhone rugged case, backup , walking poles, Solar charger , Backup battery: , Maps, Notebook?, GPS, batteries, Pens / pencils, Multi tool.
From my experience, I would recommend getting a larger pack, especially if you're planning to do longer trips. Also, if you ever go on a trip in the winter, it will usually require more clothing and possibly larger sleeping bags/mats. For reference, I have a 48L pack and that is enough room (for me) for about a weekend trip. If I'm sharing gear with others, I can extend that. To me, a 55L pack sounds pretty small for a 10 day long trip, so I would recommend something _at least_ 65L.
stackexchange-outdoors
{ "answer_score": 6, "question_score": 4, "tags": "backpacks" }
How is a pointer to char assigned by a string in C? I am new to C/C++. char *x="hello world"; char x[]="hello world"; I know first one is a pointer and second one is a character array.but,I can't understand how char*x works. int a=1; int *b=&a; &a is the memory address.b is the pointer.but,what is the memory address for "hello world".how it apply to x pointer?can anyone explain a little bit?
In C all literal string are stored as non-modifiable (but _not_ constant) arrays of characters, including the null-terminator. When you do: char *x = "hello world"; you initialize `x` to point to the first element of such an array (remember that arrays decays to pointers to their first element). It's similar to: char s[] = "hello world"; char *x = s; But with the difference that the string in this example is modifiable.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c, arrays, string, char, c strings" }
chrome.windows.onRemoved.addListener deprecated? I'm working on a google chrome extension: chrome.windows.onRemoved.addListener(function callback) !first Deprecated javascript symbol - WHERE? !same chrome.windows.onRemoved.addListener(function(){});
This error is shown by your IDE because it doesn't know about `chrome` API and it thinks you're using the deprecated DOM method MediaQueryList.addListener. The solution is to install DefinitelyTyped @types/chrome library in your IDE. If you need an instruction, google up e.g. "how to load definitelytyped in vscode".
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "javascript, google chrome extension" }
Is 'take out' phrase idiomatic in this context? Let's say I am in airplane, my luggage is in the overhead compartment and very heavy. I want to request the person adjacent to me > If you don't mind, can you please **take out** my bag from the overhead compartment? Is the phrase **take out** natural for the native speakers? If not, what is the natural way to say this?
Presumably you're speaking to someone standing between you and the compartment. We'd be more likely to say something like: > (*pointing) Would you mind handing me my bag ? _or_ > Could I ask you to hand me my bag ... ? This puts just a tiny bit more emphasis on the fact that the other person is doing something helpful for you and a tiny bit less emphasis on the effort involved. I doubt the words _overhead compartment_ would come into it, since you'd have to indicate, one way or another, which bag is yours. You might use something like "from up there" if you had to redirect the other person's look.
stackexchange-ell
{ "answer_score": 5, "question_score": 3, "tags": "phrase usage" }
Stellar mass limits for Neutron Star and Black Holes Don't hate on me if I am asking a very basic and straightforward thing. I have a few questions about black holes and neutron stars. 1. **What is the mass range (in terms of solar masses) for a main sequence star to end its life as . . .** * A) a neutron star? * B) a black hole? 2. **Is it there a (practically observed or proven) possible method for a main sequence star to form a neutron star (or black hole) at the end of its life cycle _without undergoing through the process of supernova_?** If yes, please explain or guide me some article on this matter. 3. **What is the mass range of a main sequence star to end up as a pair instability supernova?** If the range of pair instability supernova overlaps with that of neutron star or black hole forming supernovae, how do we determine what type of end a star would have?
A succinct summary of supernova types is given in the following image based on Heger et al. (2003): ![]( Image courtesy of Wikipedia user Fulvio 314 under the Creative Commons Attribution-Share Alike 3.0 Unported license. The graph is based on the graph in Fig. 1 of the linked paper. The pair instability realm is upwards of ~100 solar masses, though it is metallicity-dependent (Question 3). As Figure 1 (below) shows, neutron stars form in the mass range of >9 solar masses - again, this is metallicity-dependent (Question 1a). Starting at around 25 solar masses, black holes will form (Question 1b). ![]( It is thought to be possible for a black hole to form without a supernova (see the section of the graph marked "direct black hole"). This has not been confirmed observationally, although there are some possibilities. I've written about this in more detail here.
stackexchange-astronomy
{ "answer_score": 9, "question_score": 5, "tags": "black hole, supernova, stellar evolution, mass, neutron star" }
Regression coefficient interpretation in binary logistic regression I have performed a binary logistic regression with re-contracted as the DV (not re-contracted =0, re-contracted =1). Team ladder position at the end of the year is a significant predictor. This varible is a rank (1-18) with 1 being "top" of the ladder and "18" being the bottom. The regression coefficient for this variable is -0.044 and the exponentiated coefficient is 0.957. I am confused by the interpretation given that that a one unit increase in the predictor variable would actually be a worse result e.g. a higher number is toward the bottom of the ladder. Does this then mean that "a one unit increase in ladder position (towards the bottom) reduces the probability of being re-contracted by -0.044? and thus, the odds of being re-contracted are reduced by 0.957 for each one unit increase in ladder position (towards the bottom of the ladder)? I'm going round in circles! have I interpreted correctly?
No. The interpretation would be that a one-unit increase in ladder rank is associated with an expected (1 -.957)% = 4.3% _decrease_ in the odds of being contracted. To obtain the probability at rank level $X$, you'd need to calculate, $\hat{p}$=$exp(X\hat{\beta})\over{1+exp(X\hat{\beta})}$.
stackexchange-stats
{ "answer_score": 2, "question_score": 3, "tags": "regression, logistic, binary data" }
Double indentation in Vim using python plugins I followed sontek's tutorial (< to turn Vim into a python IDE. Unfortunatately, when there should be an identation (when pressing ENTER after : or ( ), I have both 4 spaces and a tabulation, making the indentation twice too big. I should add that to fix Vim saying Error detected while processing /home/maxime/.vim/bundle/tasklist/plugin/tasklist.vim: line 369: E227: mapping already exists for \t I added `noremap <leader>v <Plug>TaskList` at the beginning of `.vimrc` So my vimrc file is: nnoremap <leader>v <Plug>TaskList call pathogen#incubate() filetype off syntax on filetype plugin indent on call pathogen#helptags() Any idea how to fix it?
Actually, it is my tab that was too long after I had removed all the plugins. Adding set tabstop=4 set shiftwidth=4 set expandtab Solved that
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, vim" }
Data type errors in verilog I have written some Verilog code in which a part of the code is as below: int i; add_bit = 1'b0; for (i = 0; i < add_len; i++) add_bit = add_bit ^ (pat[4 + i]); end After executing this, I am getting error as: Do not use bit, byte, shortint, int and longint Can you suggest any fixes here?
`int` is a SystemVerilog keyword (IEEE Std 1800). To avoid that compile error, you either need to enable SV in your simulator, or you can replace `int` with the `integer` keyword.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "verilog" }
GridView Docking Issue I have a gridview and textbox control in my form. Textbox is on left top and under gridview anchored left, right and bottom. I want it saves the distance with textbox above it. This is my code below and it doesn't save the distance between textbox. when i make the window full screen there are so much distance between them as image. dataGridView1.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom); ![enter image description here](
this is what you need private void Form2_Load(object sender, EventArgs e) { //just setting panel color to red. so you can see the panel. var panel = new Panel() { BackColor= Color.Red}; this.Controls.Add(panel); panel.Dock = DockStyle.Top; var textBox = new TextBox() { Top = 20, Left = 20, Height=10, Width=330}; panel.Controls.Add(textBox); var dataGridView = new DataGridView() ; dataGridView.Columns.Add("Name","Text"); this.Controls.Add(dataGridView); dataGridView.AutoGenerateColumns = true; dataGridView.DataSource = Enumerable.Range(0, 10).ToList(); dataGridView.BringToFront(); dataGridView.Dock = DockStyle.Fill; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "winforms, layout, datagridview, anchor" }
Multiple rows out of a single record lets say that e.g if i did `SELECT * FROM X` i'd get A1, A2, A3, A4, A5, A6, A7 is it possible to do a query that for each record returns A1, A2, A3 A1, A2, A4 A1, A2, A5 A1, A2, A6 A1, A2, A7 ???? My actual problem ( and this is just additional information, not required to answer the question ) --> i have a db about football matches so i have players etc but the table **matches** are like this: homeplayer1 (fk) homeplayer2 (fk) . . . homeplayerN (fk) and same for away players but i'm working on a multidimiensional db implementation that requires to have only one player associated per match so it'd be 22 records per match to fit the 22 players. I'm using postgresql.
select a1, a2, unnest(array[a3,a4,a5,a6,a7]) from X Test on sqlfiddle.com
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql, postgresql" }
Github Login Issue with VS code I have to log in again and again whenever I try to push to my repository. If I untick the above then only it works fine but still it asks me again for username and password which is not ideal. !My VS config PC configuration:- \- VSCode Version: 1.45 Debian \- OS Version: Ubuntu 18.04
From Github VSCode Docs: **GitHub authentication for GitHub repositories** VS Code now has automatic GitHub authentication against GitHub repositories. You can now clone, pull, push to and from public and private repositories without configuring any credential manager in your system. Even Git commands invoked in the Integrated Terminal, for example `git push`, are now automatically authenticated against your GitHub account. You can disable GitHub authentication with the `git.githubAuthentication` setting. You can also disable the terminal authentication integration with the `git.terminalAuthentication` setting. **UPDATE:** Refer to the solution here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "git, authentication, github, visual studio code" }
Application.ThreadException: memory leak if not detached? The reference page for Application.ThreadException says > Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result. Notwithstanding the fact that the sample code on that very page does not detach the event handler, does it really leak if the event handler is not detached? It seems the only time the handler should be detached is if the application shuts down. In that case, whether or not the handler is detached, all the memory used by the application will be freed anyway?
It is probably very uncommon, but a WinForms application's `Main()` method could possibly, for some reason, look like this: static bool AbortStartup { get; set; } [STAThread] public static void Main() { Application.Run(new CancelableSplashScreen()); if (!AbortStartup) Application.Run(new MainWindow()); } When the splash screen closes, the main window will appear, unless the splash screen set the `AbortStatup` property to `true`. If you added an event handler to `Application.ThreadException` from within the splash screen, the instance of `CancelableSplashScreen` won't be garbage collected until the application terminates, which may be a considerable time later.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 10, "tags": ".net, memory leaks" }
Replacing the character \n by an actual linebreak on text So, I have a text file that looks like that: this text \n and more text. I am trying to replace the characters \n by a real linebreak and for that I am trying something like this: sed 's/\n/\n/g' inputfile Any ideas on how to use sed to do this ? Thank you.
Bodo's answer works on Linux (with GNU `sed`). But on systems with BSD `sed`, e.g. MacOS, `\n` in the replacement string isn't replaced with a newline, so you need to put a literal newline into the replacement. And it needs to be escaped, otherwise you get the error "unescaped newline inside substitute pattern". sed $'s/\\\\n/\\\n/g' `$'...'` tells `bash` to replace C-style escape sequences in the string. So you need to double all the backslashes to get them literally into the string.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "bash, unix, sed" }
How do I return all CSS properties applied to an element by an external stylesheet class (not get computed styles!)? Given css class: .red { color: rgb(255,0,0); background-color: rgb(0, 255, 0); } I then add a div to the dom via: $("<div></div>").addClass("red").hide().appendTo("body"); I can get single properties using: $(".red").css("color"); Which returns rgb(255, 0, 0); My question is how can I loop through the css class properties and return them all without directly using the property name?
I've actually found a solution using this very handy jQuery library: < I can now loop through each stylesheet and the declaration and return: var key is a loop through the css property names $.stylesheet("." + key + "").rules()[0].style Which then returns all the style properties: 0 "color" "rgb(255, 0, 0)" 1 "background-color" "rgb(0, 255, 0)" etc Which I'm now serialising into a json array for a unit test! Thanks for all your very helpful replies!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, css, dom" }
How to configure URIEncoding for a certain web application? If I need to set the same encoding for all applications deployed in a tomcat instance, I can edit `server.xml` and add a section like this: <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/> Is there a way to specify encoding for a certain application? (maybe in its `web.xml` or somewhere else)?
As far as I know web.xml does not allow what you want, so I'd suggest the following ways. 1. set it per page (e.g. for JSP `<%@page pageEncoding="UTF-8" %>`) 2. Use HTTP filter to set encoding. In this case you do not have to set it for each page separately. 3. If you are using web framework try to use tools it provides. For example for Struts you can define encoding in template definition.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "java, tomcat, encoding" }
Write the data from an Excel sheet to the text file using C# I need to write the data from an Excel sheet/workbook to the text file using C#. Also, I want all Excel worksheet data in single text file. Apart from reading the data from Excel sheets one by one and then appending it to the existing text file, is there any other simple way to do it?
I would suggest using `OleDbDataReader` with a connection string from www.connectionstrings.com to read the Excel file. You can use your favorite method, say `StreamWriter`, to spit the data out to a text file.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "c#, excel, text files" }
How to remove django-filter additional keywords in form fileld label When i customize search type in the filter: django_filters.CharFilter(lookup_expr='icontains') it adds _'[field_name] contains'_ keyword to the end of displaying label in template `{{ field.label }}`. I specifically use `verbose_name='Some filed'` argument in my model to make it accessible in template, but filter modifies it for inexplicable reason. Is there any option for it to be displayed as i set it in versbose_name? UPD: Solved this adding this to settings.py def FILTERS_VERBOSE_LOOKUPS(): from django_filters.conf import DEFAULTS verbose_lookups = DEFAULTS['VERBOSE_LOOKUPS'].copy() verbose_lookups.update({ 'exact': (''), 'iexact': (''), 'contains': (''), 'icontains': (''), }) return verbose_lookups
You can add the `label` parameter to the filter to explicitly set the field's label: django_filters.CharFilter(lookup_expr='icontains', label='the label') < Also, if you don't like the way django-filters creates its filters, you can play with the `FILTERS_VERBOSE_LOOKUPS` setting (< I haven't tested it but it says that you can set it to `False` to disable this behavior - you may want to try this instead.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "django, django filters" }
How many pages does a book leaf have? A co-worker asked a riddle that got me wondering about the anatomy of books and book binding methods. **The Riddle:** > A leaf is torn from a paperback novel. The sum of the remaining page numbers is 15,000. What pages were torn out? According to the answer (and a lot of the internet), it claimed that a leaf: _is a single sheet bound in a book, and a leaf has two pages_. I thought this assumption was vague and that a leaf can either have two pages or four pages depending on how it is bound. This assumption also changes the answer of the riddle. **Leaf with two page binding:** ![Two page binding]( **Leaf with four page binding:** ![Four page binding]( **Are both definitions of a`book leaf` correct? Or is there only one? Is one more commonly assumed than the other?**
A quick Google search revealed that > Very generally, "leaves" refers to the pages of a book, as in the common phrase, "loose-leaf pages." > > A leaf is a single sheet bound in a book, and a leaf has two pages. (Source: Biblio) A folded grouping of leaves is a "gathering", so the left image under "leaf with 4 pages" in your question is actually a gathering of 4 leaves (8 pages). The right hand image is a gathering of 2 leaves (4 pages) Note that if you tear one leaf out of a bound book, as books are more commonly bound in gatherings, often one other leaf will also become loose, and maybe fall out — especially if the leaf torn out is in the centre of a gathering. But that is a separate leaf, not the other half of the same.
stackexchange-crafts
{ "answer_score": 3, "question_score": 2, "tags": "paper, terminology, book binding" }
Should I choose sub-directories over sub-domains in this case? I'm developing an application at the moment which shows local content based on location. Since the site is intended for local users, there won't be much need to change domain. For example: someone from London visiting `london.mysite.com` will receive only London-related content and would not necessarily be interested in anything on `edinburgh.mysite.com`. The whole subdomain vs. sub-directory thing has been haunting me though and I'm not sure if this approach is best or if we'd be better with `mysite.com/edinburgh`. Can any SEO gurus out there lend some advice?
@Gavin Morrice: From a hosting and development point of view, sub-directories are so much easier and quicker to maintain (especially if you're not on a dedicated server). While trying to find the latest information on which method is the preferred or best one, the general sense I get is that (as far as Google is concerned), it really doesn't matter anymore. _If you build it, they will come_. It's about content; it has always been about content. If you can sort out relevance and structure, whether your articles about London are on `london.mysite.com` or `mysite.com/london/`, doesn't make much of a difference and tales of sub-domains diluting Google's PageRank from the main site remain tales and certainly don't seem to be true anymore.
stackexchange-webmasters
{ "answer_score": 3, "question_score": 4, "tags": "seo, subdomain, subdirectory" }
BDD And Unit Testing I have been doing TDD and was using it more as unit testing than to drive my design. Recently I have read a lot about BDD; now that I have a better idea about them both, I was trying to figure out how to use BDD and unit testing concurrently. For example I would drive my design using BDD, Dan North style, and lets say I am working on an app and I have a simple spec and I implement it. I have just enough bdd/spec to cover it. Now after I've re-factored it and am happy and it's passed as done for that spec, should I start writing Unit tests to cover all possible inputs, because that's what I did in TDD? I am the only developer in the company and everything is on my shoulders, although the other team do try to manual test the app, I would like to lower the defect rate.
Pick up "The RSpec Book". The book uses Cucumber & RSpec. Could easily be Cucumber & NUnit or something else though. Cucumber and BDD extend the red, green, refactor concept a level deeper. < Cucumber: < RSpec: < NUnit: < JUnit: <
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 9, "tags": ".net, tdd, bdd" }
How to select across a relationship using LINQPad? I have a simple table structure Images(image_id, image_library_id,...) Links(link_id, image_id, link_component_code...) I am trying to perform a simple query using LINQ var q = from i in Images where i.Link.link_component_code = "x" select i; However the intellisense in LINQPad doesn't provide the "Link" object in where i.Link.link_component_code instead I only get a "Links" object, which is an EntitySet and doesn't go on to list the table fields just methods such as Add, Select, Where etc However if I do it the other way around var q = from l in Links where l.Image.image_library_id = 1234 select l; It works as expected What is this EntitySet and where am I going wrong?
The way your relationship is set up, each image as 0 or more links (many links). The Links property of an Image is a queryable collection of the related link records. Try this where clause where i.Links.Any(link => link.link_component_code == "x")
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, linq to sql, linqpad" }
REST vs Android API What's the difference in using the android API and the REST API? Are they equivalent? Can I do the same thing in both? What are the limitations of one and the other? I intend to start developing a mobile APP with HERE MAP.
There are 2 flavours of the HERE Mobile SDKs at the moment: Starter and Premium edition. The starter edition is more or less identical to the REST interfaces and is using it also under the hood. It takes away all the boilerplate code you'd have to write (map tiling, fetching tiles and tile scrolling, REST requests to al the services and converting it into local objects, and so on). The premium edition is using the HERE Hybrid engine instead. This means a lot of the services also work offline and run directly on your device, the mapdata is a special vector format that is also downloaded on your device, and you use online services and offline services mixed. The premium edition has (beside offline capabilities) also some additional features you won't get in REST or in starter SDK, like turn by turn guidance or LiveSight.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "here api, here maps rest" }
PhoneNumberUtil returns missing or invalid default region on a few devices I parse phone numbers from `String` representation via `com.google.i18n.phonenumbers.PhoneNumberUtil`> I faced with the issue > INVALID_COUNTRY_CODE. Missing or invalid default region : * phone number on Lollipop is parsed successfully and on KitKat (at least on some devices) the same phone number is parsed with `NumberParseException` It gives me a thought the issue can be in versions of library. Do you have any other ideas?
You should use Android's PhoneNumberUtils Please have a look at the link, it's easy to use.
stackexchange-stackoverflow
{ "answer_score": -8, "question_score": 0, "tags": "android" }
Short circuit and voltage source ![enter image description here]( I don't understand why when you replace a wire between a and b with a short circuit, you could just ignore 160 Ix voltage source. I understand that those two resistors in parallel will be shorted, but why the voltage source? And if that voltage source was to the left of a 20 ohm resistor, would it still be shorted?
We can ignore the \$160I_x\$ voltage source because \$I_x\$ is zero. \$I_x\$ is the current through the \$40\Omega\$ resistor and when we short circuit that resistor no current will pass through it, all the current will pass through the wire.
stackexchange-electronics
{ "answer_score": 1, "question_score": -1, "tags": "short circuit" }
Facing problem in plotting Grey Level Co-occurrence Matrix (GLCM) of an image in MATLAB I am working in the filed of digital image processing. Recently I read a paper that plots Grey Level Co-occurrence Matrix (GLCM) of an image for some processing. As it is shown in following Figure ![this figure]( I am trying to plot GLCM in MATLAB using the `graycoprops` function but not getting expected results. I am using the following MATLAB code. img = imread('lena.bmp'); if(size(img, 3) == 3) img = rgb2gray(img); end subplot(1,2,1), imshow(img); subplot(1,2,1), plot(graycoprops(img)); Kindly tell me that how can I plot GLCM as it is shown in the Figure.
As pointed out by A_A, you need to use the `graycomatrix` function to get the GLCM: img = imread(' if(size(img, 3) == 3) img = rgb2gray(img); end subplot(1,2,1), imshow(img); X = graycomatrix(img, 'NumLevels', 256, 'Symmetric', true); I = log10(X); I(I==-inf)=nan; subplot(1,2,2), pcolor(I); shading flat; colormap hsv; axis equal; ![enter image description here](
stackexchange-dsp
{ "answer_score": 1, "question_score": -1, "tags": "image processing, matlab" }
C# - Looping methods and putting delays inbetween them I have several methods that are declared in the Main method. Although how could I put a loop in, so in this case OutputChanges() would loop around to FileChanges(). And is it possible to put an break / interval of say 10 seconds inbetween the loop? static void Main(string[] args) { FileChanges(); FolderChanges(); OutputChanges(); }
You don't mention how many times you want to loop...so I'll go with the infinite loop (using `Thread.Sleep()` to halt execution for 10 seconds between iterations): static void Main(string[] args) { while(true) { FileChanges(); FolderChanges(); OutputChanges(); Thread.Sleep(10000); } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, .net, windows, loops, methods" }
Is there a possibility to change the response time in Operational Analytic console IBM MobileFirst Is there a possibility to change the response time in Operational Analytic console Or any of Network Activities properties that IBM Mobilefirst captures by it self on any network call from client. I want to change these details from client app. (Android).
The response time that is collected on the MobileFirst Operational Analytics Console is data collected from server. This response time is collected on a MobileFirst adapter call. We do not allow you to change your response time because that would be manipulating your data. This data is used to see if your response time is too low and allows you to take the appropriate action to speed it up, whether that be changing the payload size, enforcing use only when a good connection is made, etc.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ibm mobilefirst, mobilefirst server, mobilefirst analytics" }
Why does the zenburn colour scheme look different on different computers I have just started using the zenburn theme in emacs on my macbook and I really like how it looks. It looks like this: !MacbookZenburn However when I put it on my ubuntu pc (my .emacs.d directory is synced with git and I double checked it was working properly by copying it over through dropbox as well and the files should be identical in both .emacs.d directories) it looked like this: !UbuntuZenburn Can anyone suggest what's going on here and how I can get emacs to look the same on my ubuntu machine as on my macbook?
The problem was that the terminal on my ubuntu computer was only using 8 colours, and as such couldn't use the colours shown on my macbook. You can find out how many colours your terminal has in emacs using `M-x list-colors-display` The solution was either to run it outside the terminal or add `[[ $COLORTERM = gnome-terminal ]] && TERM=xterm-256color`(found at stackoverflow.com/a/64585/1590790/) to my .bashrc file so that it could use 256 colours.
stackexchange-emacs
{ "answer_score": 2, "question_score": 1, "tags": "themes, colors" }
What curve are you shifting when you calculate DV01 for a swap? I understand that a general swap has 4 curves attached to it: the flat forecast curve associated with the fixed leg, the forecast curve associated with the floating leg, the fixed leg discount curve and the floating leg discount curve. I also understand that $DV01 = \dfrac{\partial V_{swap}}{\partial y}$, where $y$ is the yield. What I don't understand is which curve(s) is the $y$? Which curve are we shifting by $1bp$ to calculate the $DV01$?
Let's step back and look at the reason for making a DV01 calculation first before answering the question; The reason for making a DV01 calculation is to quantify what market movements has impact on the valuation of the trade. Since the 'flat' forecast curve won't be affected by market movements the answer is (using pre-2008 methodology): The floating forecast curve. After 2008 the discount curves became more important regarding the valuation as the previous standard to discount on the floating forecast curve (aka. IBOR-curve) was replaced by discounting on OIS (Overnight Index Swap)-curves or discount curves based on the collateral posted by the trade counter party. In such a case DV01 would be calculated for the forecast curve, and for the discounting curve (which should be the same for both legs of the swap as long as both legs are in the same currency), resulting in two DV01 measurements.
stackexchange-quant
{ "answer_score": 5, "question_score": 4, "tags": "fixed income, swaps, yield curve, duration, discount factor curve" }
vim : The term 'vim' is not recognized as the name of a cmdlet? I'm following a tutorial on Laravel. I've never used it before. The tutorial say I should use create a file with `vim database/database.sql` but when I do I get the error: vim : The term 'vim' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vim + ~~~ + CategoryInfo : ObjectNotFound: (vim:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I've tried to install vim from vim.org but don't know if this is right. Any help is greatly appreciated. I'm using windows 10.
In addition to installing Vim from vim.org, you also need to make sure it's added to $PATH in order to use it from the command line without using the full path. On Windows, you can do this with Control Panel -> System -> Edit the system environment variables -> Click Environment Variables -> Find the `PATH` variable -> Click "edit" -> Check if Vim is here, otherwise click "new" -> Click "browse" -> Navigate to the Vim executable that you installed After vim has been added to `PATH`, you should be able to use it from the command line. You will need to close and re-open Cmd/PowerShell.
stackexchange-stackoverflow
{ "answer_score": 28, "question_score": 15, "tags": "laravel, vim" }
Error php export to PDF when use mpdf I use mpdf (< to generate 1 pdf file <?php $html = '... the body of the document encoded in UTF-8 is ...'; $mpdf=new mPDF(); $mpdf->allow_charset_conversion = true; $mpdf->charset_in = 'utf-8'; $mpdf->WriteHTML($html); $mpdf->Output(); ?> Result `"... the body of the document encoded in UTF-8 is [][][][][][][][][] ...'"`, How to fix it?
Try adding these : $mpdf->useAdobeCJK = true; $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; Check if it is working.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, mpdf" }
ComboBox with two DataContext I have a UserControl with a ListView inside the `ItemTemplate` property has a ComboBox i need use two datacontext for this ComboBox 1. ItemsSource DataContext from UserControl 2. SelectedItem DataContext from ListViewItem ## how to achieving this?
You can use `RelativeSource` in your binding to traverse the Visual Tree to find the `DataContext for UserControl`. Whereas for `ListViewItem`, you don't need RelativeSource since `Combobox will inherit the DataContext of its parent which is ListViewItem` itself. Your structure would look somewhat like this - <UserControl> <ListView> <ListView.ItemTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding DataContext.CollectionSource, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}}" SelectedItem="{Binding YourItemHere}"/> </DataTemplate> </ListView.ItemTemplate> </ListView> </UserControl>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, wpf, mvvm light" }
linux conversion of caf file with iLBC codec 2 wav Used < \- I only get static from the files that ilbc_test.exe creates. Does anyone have other suggestions? sox doesn't seem to be able to convert it as far as I can tell.
This was solved by using the software on the url above. Also we needed to remove the caf headers from the ilbc file.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "linux, audio, sox" }
QPushbutton: Two different Font size Is it possible to have two different Font size for the QPushButton? For example, for the text "LIVE VIDEO' in a QPushButton, I want to have the font-size 16 for 'LIVE' and 12 for 'VIDEO'.
Derive from QPushButton and draw the text yourself. You can refer this post for reference. Two colours text in QPushButton
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "c++, qt" }
What is ambiguity in this example? The instructor for my class assigned homework that is not covered in both the class and the textbook. As a result I found this problem and cannot find anyway to solve it. Can someone link some reading materials or explain the concept I'm missing please? I don't know what I'm looking at here. > Enter T or F depending on whether the formula is ambiguous (T) or not (F). (You must enter T or F -- True (true) and False (false) will not work.) > > 1. p∨(q∨r) > > 2. p∧q∧r > > 3. p > 4. p∨q > 5. p∧q∨(q∧r) > This is homework, so I'm not asking anyone to do it **for** me per se, but an example would help me (and my equally confused classmates) out greatly!
I am not sure, but I imagine in that case "ambiguous" is understood as "can be interpreted as different nonequivalent formulas by adding parentheses". For instance, if I understand correctly, $p \wedge q \wedge r$ is not ambiguous, because the two ways to understand it, namely $p \wedge (q \wedge r)$ and $(p \wedge q) \wedge r$, are equivalent (they are either both true or both false, depending on whether $p$, $q$, and $r$ are). The last one, however, would be ambiguous, because it can be understood either as $(p \wedge q) \vee (q \wedge r)$ or as $p \wedge (q \vee (q \wedge r))$, which are not equivalent. Indeed, if $p$ is false but $q$ and $r$ are true, the first one is true while the second one is false.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "discrete mathematics, propositional calculus" }
Get Text From a ListView SubItem I am creating an application for windows desktop using Visual Basic 2010 Express. The program I am designing has three main controls: a ListView, a TextBox, and a Button. What I need is when the user clicks a row inside of the ListView control, the TextBox will show the text within the first SubItem. To elaborate, the ListView control has two columns (Name and Description). In the SelectedIndexChanged event, I need code that will display the Description text in the TextBox (the ListView SubItem). I would post my code to show what I have done, but I do not know where to even start, for all my code has just given me errors. I tried something like this: textbox1.text = listview1.items.subitems.tostring But obviously this method is useless and completely off track. I know this is basic, but I do not understand it. Thanks
for the text of the selected LV Item: textbox1.text = listview1.SelectedItem.ToString For the text of SubItem N of the First selected Item: textbox1.text = listview1.SelectedItems(0).SubItems(N).Text you can also get it using `listview1.Items(X).SubItems(N).Text` where X is the index of the Item (row) you want
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "vb.net" }
evaluate struts2 tags in java script I am adding rows to a table using a java scripts function. Each row has textFields and select boxes. I wants to use the struts tags for these controls. When i set innerHTML directly to a tag, no results are shown on the screen. Even i tried to eval function on the string content before setting html, but did not work either.
Struts tags will finally be evaluated to HTML tags, if your JavaScript is in JSP and will be called during page load, your Struts tag will be evaluated and you will be able to see the output, If you are placing your JavaScript code inside a Java Script file then your Struts tag is not going to be evaluated and you wont be able to see the HTML output, as Struts tag evaluation is carried out by your server not the client, to a web browser there is nothing called as Struts tag it just understands HTML tags.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, struts2, tags, eval" }
Usage and meaning of "bad behavior to begin with" I see the usage of ' _bad behavior to begin with_ ' in many places but I can't grasp the real meaning of it. I see following in internet. eg: * Above all this isn't a place to call out _bad behaviour to begin with_. * I'm doing is explaining _bad behaviour to begin with_. Can someone let me know about it? Thanks.
"Bad behavior to begin with" is not a special term. In the context of your sentences there is no special connection between 'bad behavior' and 'begin with' -- the two phrases just happened to be used together. 'Bad behavior' has no importance here. The usage is related to 'begin with.' As a member has rightly explained, 'to begin with' is a common form of speech meaning 'first of all' or 'in the first place.' Examples: 1.You are talking to the wrong official, to begin with. And it's a hopeless case anyway. (Meaning: first of all, you are talking to the wrong official. Secondly, it is a hopeless case.) 2.You have brought a complaint against your neighbors; but let's examine your own disciplinary record to begin with. (Let us first consider the complaints against you, is the implied meaning.) 3.The appeal was wrongly framed to begin with; so they didn't even go into the merits of the case. (The appeal was rejected because it was wrongly framed in the first place.)
stackexchange-english
{ "answer_score": 2, "question_score": 0, "tags": "meaning, meaning in context, ambiguity" }
Read the content of a PDF with PHP? I need to read certain parts from a complex PDF. I searched the net and some say FPDF is good, but it cant read PDF, it can only write. Is there a lib out there which allows to get certain content of a given PDF? If not, whats a good way to read certain parts of a given PDF? Thanks!
I see two solutions here: * converting your PDF file into something else before: text, html. * using a library to do so and bad news here, most of them are written in Java. <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "php, pdf" }
showing an element of $E''$ is actually in $E$ Let $E$ be a Banach space, and let $E'$ denote its dual space. Suppose I define a functional $f:E'\to\mathbb{C}$ and claim that it is actually in the image of the canonical embedding $E\hookrightarrow E''$. This has been tossed around, but I just want to double check: Is it sufficient to check that it is continuous with respect to the $w^*$-topology on $E'$? It seems to me that if I had an element of $E''$, not in $E$, that were continuous with respect to the $w^{*}$-topology on $E'$, that this would force the weak star topology to have "extra" open sets, in the sense of being the weakest topology such that all the seminorms $p_{\varphi}$ defined by $$p_{\varphi}(F) = F(\varphi)$$ are continuous. Is my logic correct, or is there more to check here?
Yes, you need only check continuity in the weak$^*$-topology. The continuous dual of $E'$ with the weak$^*$-topology consists solely of the evaluation functionals. Hence if $f$ is weak$^*$-continuous, then it is evaluation by some $x\in E$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "functional analysis, banach spaces" }
How do I update a parent object if children are changed? How do I update a parent object if children are changed? I have entity City that has children Street. I would like save in City entity total kilometers of streets. City id | name | total 1 | example | 1000 Street id | city_id | name | kilometers 1 | 1 | first | 800 2 | 1 | second | 200 I tried Lifecycle Callbacks (PreUpdate and PostUpdate) and Doctrine listeners - preUpdate i postUpdate. Both for City, but both not are not working if I don't edit City. So if I set listeners for Street, then this is good, but listeners are executed for each edited one of streets. I can make this in the controller, but I would like to use events.
You have to set the rules by yourself. In my case I have done this using a version field in the parent that is a timestamp. There is a setVersion setter that doesn't receive any parameter that updates that value with te timestamp. Then I call this method from the children entities every time I update any field. I use it to trigger document updates in an Elasticsearch index, managed by FosElasticaBundle.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, symfony" }
What is the impact of forming the students into a Biotic Company? In Grissom Academy: Emergency Evacuation we can choose between having the students in a support role or having them be a front line force. This either improves the 103rd Marine Divison (+50 strength) or activates the Biotic Company (+75 strength) War Assets. Are there other consequences, such as dialogues which will not appear, from this action? For example are the War Assets for Jack and Kahlee Sanders added regardless of your choice? Will the option to allow Citadel entry for Grissom instructors and students still appear at the Spectre terminal regardless of your choice?
You will meet Jack in Purgatory some time later and she will tell how the kids are doing. Her dialogue will be different depending on your choice. It doesn't look like there are other consequences beyond that.
stackexchange-gaming
{ "answer_score": 2, "question_score": 2, "tags": "mass effect 3" }
How to calculate the birth date ? And sum of digits of n? Naga was born in the year 19n. ‘n’ is a two digit number. In the year 2014 he completed ‘n’ years of his age. The sum of the two digits of ‘n’ is- Let Naga was born -19XY Then how to corelate the value of n to find answer??.
2014 - n = 1900 + n and solve for n.
stackexchange-math
{ "answer_score": 0, "question_score": -2, "tags": "algebra precalculus, word problem" }
Declare and iterate through ArrayList of classes that extend a class I may be going about this the wrong way, but is it possible to iterate through a collection of classes that extend a specific class? i'm thinking of declaring like : ArrayList<? extends InterfaceComponent> components = new ArrayList<? extends InterfaceComponent>(); but that throws an error. Is it possible? Edit : And i would then iterate though it with : for (<? extends InterfaceComponent> t : components) { t.callSomeMethod(); } Right?
Try this: `ArrayList<InterfaceComponent> components = new ArrayList<InterfaceComponent>();` And on that list You can have any object that implements `InterfaceComponent`. EDIT: iterate like this: `for (InterfaceComponent t : components) { }`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, arraylist" }
Why does $\sum_{J\subset I\subset S/F}(-1)^{|I|}=0$? (Alvis-Curtis Duality) Suppose $S$ is the reflection generators of the Coxeter group of some reductive algebraic group $G$. Let $F$ denote the Frobenius automorphism. The Alvis-Curtis duality $D_G$ is known to an involution on virtual characters, and part of the proof boils down to > $\sum_{J\subset I\subset S/F}(-1)^{|I|}=0$ whenever $J\neq S/F$, since it's the expansion of $(1-1)^n$, where $n$ is the number of elements in the complement of $J$ in $S/F$. How does one deduce this combinatorial interpretation?
For any finite sets $A,B$, any set $S$ with $A \subseteq S \subseteq B$ can be written as $A \cup T$ where $T$ is an arbitary subset of $B \backslash A$. Letting $n = |B \backslash A|$, we get $$\sum_{A \subseteq S \subseteq B} (-1)^{|S|} = \sum_{T \subseteq B \backslash A} (-1)^{|T| + |A|} = (-1)^{|A|}\sum_k \sum_{T \subseteq B \backslash A, |T| = k} (-1)^{k} = (-1)^{|A|}\sum_k {n \choose k} (-1)^k = (-1)^{|A|}(1+-1)^n = 0$$ if $n > 0$.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "combinatorics" }
Is there a function that gives unique values when a unique sequence of numbers is given as input? Consider a random sequence of numbers, like 1, 4, 15, 21, 27, 15... There are no constraints on what numbers may appear in the sequence. Think of it as each element in the sequence is obtained using a random number generator. The question is, do we have a function that will give unique output by performing mathematical operations on this sequence? By unique, I mean when the function is applied on sequence A, it must output a value that's different from the output obtained by applying the same function on any other sequence (or the same sequence but numbers placed in different order) in the world. If we don't have such functions, can you tell me if it is even possible? Do we have anything that gets close?
Assume each input sequence has finitely many terms, and all terms are nonnegative integers. Let the function $f$ be given by $$f\bigl((x_1,...,x_n)\bigr) = p_1^{1+x_1}\cdots p_n^{1+x_n}$$ where $p_k$ is the $k$-th prime number. Then by the law of unique factorization, the function $f$ has the property you specified. More generally, if negative integer values are also allowed, then define $f$ by $$f\bigl((x_1,...,x_n)\bigr) =p_1^{e(x_1)}\cdots p_n^{e(x_n)}$$ where $$ e(x_k)= \begin{cases} 1+x_k&\text{if}\;x_k\ge 0\\\\[4pt] x_k&\text{if}\;x_k < 0\\\\[4pt] \end{cases} $$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "sequences and series, functions" }
Sorting array of objects based on multiple parameter (with one parameter as date) I have an array of JavaScript objects: var objs = [ { key: 10, date: Thu Nov 09 2017 22:30:08 GMT+0530 }, { key: 10, date: Thu Oct 10 2017 22:30:08 GMT+0530 }, { key: 20, date: Thu Dec 09 2017 22:30:08 GMT+0530 } ]; AND Trying to get the results like this var objs = [ { key: 20, date: Thu Dec 09 2017 22:30:08 GMT+0530 }, { key: 10, date: Thu Oct 10 2017 22:30:08 GMT+0530 }, { key: 10, date: Thu Nov 09 2017 22:30:08 GMT+0530 } ]; Array should sort based on both key and date, Key should sort based on descending order and date should sort based on ascending order if and only if key is same. How I can achieve this? Here date is the Date object, so need to consider date in millisecond not as string
To sort numbers in descending order, you would use a comparison function such as: function (a, b) { return b - a; } If you want a backup comparison, use `||` so that if the first comparison yields `0`, you can use the backup comparison. To compare dates in ascending order, use `a - b`. objs.sort(function (a, b) { return b.key - a.key || a.date - b.date; });
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "javascript, arrays, sorting" }
I provided my XPUB and YPUB to Trezor support - should I continue to use my Trezor? I have a Trezor. In attempting to find out why I have have not received Bitcoin Gold coins Trezor Support asked for my XPUB - I gave it to them along with the YPUB too. Is this safe? Should I move my coins? Your help is greatly appreciated.
XPUB refers to an extended public key, and because it is only a public key, you have not compromised your private keys. Thus it is safe to continue using, yes. You have, on the other hand, compromised your privacy, as with that xpub Trezor support can derive all your addresses and know they are all yours. But it's likely they just want to look to see if you have any bitcoin gold balance on any of them, it's probably completely harmless
stackexchange-bitcoin
{ "answer_score": 2, "question_score": 1, "tags": "trezor, safety, xpub" }
How to add more user identity session attributes in Yii2? In Yii2 you can access the identity interface for the current user by using the identityInterface object from within the \yii\web\User class with something like this \Yii::$app->user->identity->id; **Is there a way to get and set additional parameters (without extending the identity class)?** Basically a equivalent of Yii 1.x `getState()`, and `setState()` methods in `CWebUser` to store and retrieve session information like this Yii::app()->user->setState("some_attribute",$value); Yii::app()->user->getState('some_attribute',$defaultValue);
Okay it seems this was removed intentionally to avoid "confusion". See < So the only way to do this by calling the session class directly. \Yii::$app->session->set('user.attribute',$value); \Yii::$app->session->get('user.some_attribute'); Because it now stored directly in session without prefix it is best to namespace the keys with identifiers like `user.xxxx` to avoid collision with some other key set at different point of the application.
stackexchange-stackoverflow
{ "answer_score": 24, "question_score": 20, "tags": "php, yii, yii2" }
PHP money format with spaces I am wondering if there is a way to separate thousands with space character. For example: $number = 21234.56; setlocale(LC_ALL, 'pl_PL.utf8'); echo money_format('%i', $number); is giving me: 21.234,56 PLN And I want: 21 234,56 PLN I don't want to make str_replace. I am sure there is a better way.
You can use `number-format`. For example : echo number_format($number, 2, ',', ' '); But you will have to put the unit yourself. Otherwise, this comment of the `money_format` documentation page gives a version of the function with some code that you can modify to change the thousand separator. You can also do something like this : $locale = localeconv(); $text = money_format('%i', $number); $text = str_replace($locale['mon_thousands_sep'], ' ', $text);
stackexchange-stackoverflow
{ "answer_score": 21, "question_score": 10, "tags": "php, money format" }
Why doesnt the '\b' work after using a for-loop in java? for(int i=0; i<5; i++) { System.out.print("B x "); } System.out.print("\b\b"); I want to get the answer as `B x B x B x B x B`, but the `\b\b` doesn't work so that the answer becomes `B x B x B x B x B x`. Why is that?
[It's Working Fine , Run it again Using some ide like netbeans or Eclipse] public static void main(String[] args) { for(int i=0;i<5;i++){ System.out.print("B x "); } System.out.print("\b\b"); } run: B x B x B x B x B BUILD SUCCESSFUL (total time: 0 seconds)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java" }
Memory leak when injecting class instead of instance? Am I susceptible to memory leaks if I inject dependencies as classes and not as instances? The reason I want to do this is that the 3rd-party library I am integrating only exposes class methods. Is it dangerous if I do just that? (and why and when would this danger show up): var service: ServiceProtocol.Type init(withService service: ServiceProtocol.Type = Service.self) { self.service = service } and then inside the class I just call a method like this: self.service.doSomething()
It is safe. `Service.self` is just a reference to the type, and types exists during the whole runtime of the program anyway, so it doesn't introduce any additional expenses. One thing you should be careful with in this case is allocating "static" memory. For example if `self.service.doSomething()` adds an element to an array that is a static field of the class, make sure to clean it up when it is no longer needed. Otherwise it will stay in memory until the program is terminated.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, swift, dependency injection, memory leaks, retain cycle" }
How to load a WPF FormattedText object (from RTF or RichTextBox) My WPF app displays lots of text snippets at various places on a large canvas (a kind of post it note app) I am currently rendering the text using FormattedText objects and 'drawing them' straight into Visual objects (for speed/efficiency) Challenge I have is how to load/save/edit that rich text. I'd like to use a RichTextBox to edit the text - but I can't find a way to get the text out of the text box and into a FormattedText object (or visa versa) Anyone know how this might be achieved? Only way I can think is to have some kind of 'serialise to/from RTF' capability on the FormattedText object - but that doesn't seem to exist. Thanks
The link posted by Clemens above < addresses my issue. Similar to fooook's answer - iterate through the inline objects and apply their attributes to a FormattedText object. Shame that FormattedText doesn't support images (like NSAttributedString on iOS/OSX)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, wpf, richtextbox, rtf" }
ConsumerRecord returns Null value I have started learning apache kafka newly and trying to create a sample application project of POS. In this project i am facing an issue with ConsumerRecord object. this object is providing me null value corresponding to value attribute, where i am expecting object of type PosInvoice.class. **codebase is at below location:-** < Not sure what i am doing incorrect. please can someone advise. Thanks a alot in advance.
You are missing the "return" statement on line no 31 of learning/kafka/tutorial/pos/simulator/deserializers/JsonDeserializer.java
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "apache kafka, kafka consumer api" }
Binding to checkbox and getting the selected value using knockout I need help to create checkbox list using knockout js for a collection Array. I have created the arrayobject , but not sure how to bind it to checkbox and get the corresponding checkbox selected value on click of the checkbox.Below is the js code function axViewModel() { var self = this; self.Methods = ko.observableArray([]); function addMethod(id, name){ return { Id : ko.observable(id), Name : ko.observable(name) } } function LoadMethod() { self.Methods.push(new addMethod('1', 'StartWith'); self.Methods.push(new addMethod('2', 'Contains'); self.Methods.push(new addMethod('3', 'Contains'); } LoadMethod(); }
try this <div class="col-sm-6" data-bind="foreach: Methods"> <div class="radio"> <label> <input type="radio" name="optradio" data-bind="value: MethodId,checked: $parent.selected"><span data-bind=" text: MethodName" ></span> </label> </div> </div> self.selected = ko.observable(''); self.Methods = ko.observableArray([{MethodId:2,MethodName:'Athul'},{MethodId:1,MethodName:'Athul'}]); self.selected(2); self.selected.subscribe(function(newValue) { alert("new value is " + newValue); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "knockout.js" }
Zero, the Additive Identity, as the Multiplicative Annihilator In the structures I have encountered so far, I have always seen a zero, which is usually defined as the additive identity. For example: > $\exists 0 \in \mathbb{Z}$ s.t. $\forall a \in \mathbb{Z}, a + 0 = 0+a = a$ It just so happens to be that whenever the need arose, $0$ also served as the multiplicative annihilator, i.e. where $X$ is some commutative ring: $\forall a \in X, a \cdot 0 = 0$, as proven below: > $0=0$, so $0+0 = 0$, so $a\cdot(0+0) = a \cdot 0$, so $a\cdot 0 + a \cdot 0 = a \cdot 0$, so $0 = a \cdot 0$. My question is whether the zero **always** serves as the multiplicative annihilator as well, whether this is actually part of its definition (or an always-implicit corollary), or if it is possible to have a zero that does not serve as a multiplicative annihilator.
It is clear from the OP's argument: $0a = (0 + 0)a = 0a + 0a \Rightarrow 0a = 0 \tag{1}$ that $0$ being a multiplicative annihilator depends on two things: i.) the fact that zero is the identity element for the "$+$" operation; and (ii.) the fact that multiplication distributes over addition in the sense that $a(b + c) = a(b + c)$. So, if you want the zero element to _not_ be a multiplicative annihilator, you'll have to bust one of these postulates. Well, busting the additive identity won't work and leave us with an Abelian group under "$+$"; thus we'd have to let go of distributivity, the axiom which ties addition and multiplication together. If _that_ postulate is eliminated or severely altered, all I can say is: _**We'll be left with something VERY un-ring like!_** So, as long as we want rings to be **_rings_** , as it were, we have to accept $0$ as multiplicative annihilator that it is. Hope this helps. Cheerio, and as always, _**Fiat Lux!!!_**
stackexchange-math
{ "answer_score": 5, "question_score": 3, "tags": "real analysis, elementary set theory" }
Graphs: find a sink in less than O(|V|) - or show it can't be done I have a graph with `n` nodes as an _adjacency matrix_. Is it possible to detect a sink in less than `O(n)` time? If yes, how? If no, how do we prove it? **Sink vertex** is a vertex that has incoming edges from other nodes and no outgoing edges.
Suppose to the contrary that there exists an algorithm that queries fewer than (n-2)/2 edges, and let the adversary answer these queries arbitrarily. By the Pigeonhole Principle, there exist (at least) two nodes v, w that are not an endpoint of any edge queried. If the algorithm outputs v, then the adversary makes it wrong by putting in every edge with sink w, and similarly if the algorithm outputs w.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 10, "tags": "algorithm, graph, computer science, graph theory, sink vertex" }
GPE/GWT Plugin Doesn't work My eclipse 4.2 Juno can’t install anything related to Google App Engine Java SDK & Google Web Toolkit. I have seen similar questions & answers. They suggested opening eclipse with –clean argument, running with administrative permissions, installing plugins with administrative permissions etc. I tried all of them & needless to say none of them worked. Whenever I check for “ **what is already installed** ” I can see them installed but they don’t appear anywhere. !Plugins Are Greyed I am using Android SDK bundle which is Eclipse Juno wrapped with android tools. As long as these plugins/SDK s have compatibility issue with android plugins it shouldn't matter. Installed plugins/SDKs looks like !This One or !This one
I have tried installing all the above plugins with JUNO. It works. The order of installation for me is - Juno Java EE - GPE - GWT and GAE Online - Offline - Android -
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, eclipse, google app engine, gwt, google plugin eclipse" }