INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
biztalk putting the processed file into some folder I have a requirement: If I get a file, I am putting the content of that file into a database, If there is any error in that file, I am putting it in an error folder. Can I do something like this? Suppose I have a folder "processed" and another one "unprocessed". In case of an error, result will go in "unprocessed" and if there is no error it will go into "processed". I don't know how to achieve that if biztalk processed some file then only put into some folder. I suppose if I will put filter option BTS.ReceivePortName it will also put the error file into process folder.
It's very easy to create an extra send port that archives **_all_** input files. If there's an error you just find the file, fix the issue, and re-drop it. Create a send port, set up the filters to select the input you want (like BTS.ReceivePortName as you already know), use a pass through pipeline, then configure it as to write files. Write your files to a backup directory. If you only want to catch errors then you will have to do extra setup. You must use an orchestration. Put a scope shape around your normal processing in the orchestration. Place an exception to catch errors on the scope shape. In the exception handler use a send shape to construct and write a copy of the original message to a send port. Add an expression to write some helpful message to the event log so you can debug the failure.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "biztalk" }
Conversion of Hypergeometric functions from Maple to Mathematica After a calculation I found in Maple an expression of the kind: $$f(x)=hypergeom\left(\left[\dfrac{a}{b},1\right],\left[c,d\right],h\right)$$ What is the equivalent notation in Mathematica which I suppose is the standard notation? Thanks in advance.
In Mathematica, it seems the syntax would be, HypergeometricPFQ[{a/b,1},{c,d},h] Checking how Maple translates that, mmainput := `HypergeometricPFQ[{a/b,1},{c,d},h]`: MmaTranslator:-FromMma(mmainput); hypergeom([a/b, 1], [c, d], h) Passing `HypergeometricPFQ[{3/4,1},{2,3},1.1]` to wolframalpha.com agrees with Maple evaluating `hypergeom([3/4,1],[2,3],1.1)` as `1.163416426`.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "special functions, maple, mathematica" }
Assign string values to a NSArray - iOS I have an iOS app which downloads/parses strings from a JSON file. I need to store these strings in ONE NSArray. But every time I try I get the error: expected method to write array element not found on object of type 'nsarray *' All I am doing is assigning these strings to the array in a for loop.... And yet it won't work. It is baffling me why... I have assigned strings and variables to an array in C and C++.... Surely Objective-C supports this as well. What am I doing wrong? Here is my simple for loop: for (int loop = 0; loop <= [youtube_channel_id_tags count]; loop++) { self.getYTIcon = [[YTICONGET alloc] init]; NSString *temp_url = [self.getYTIcon get_user_icon:youtube_channel_id_tags[_carousel.currentItemIndex]]; youtube_user_icons[loop] = [temp_url description]; } What am I doing wrong?? Thanks, Dan.
`youtube_user_icons` needs to be a `NSMutableArray` so that you can change its contents and the line youtube_user_icons[loop] = [temp_url description]; needs to be [youtube_user_icons addObject:[temp_url description]];
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "objective c, string, nsarray, assign" }
Is grass efficient for carbon sequestration? I wonder how much carbon dioxide does grass sequester, compared to trees. Moreover, is grass still efficient in absorbing pollution? It seems to me that grass would be more efficient in storing carbon in soil than trees.
I found this article regarding _lawns_. It suggests that lawns could be regarded as _carbon sinks_ only if they are not (frequently) mowered, and do not use pesticedes. Also: > An acre of established temperate forest can hold from 2,000 lbs. up to 6,000 or more lbs. of carbon per year, depending on the age of the trees and other conditions. Mature grasslands sequester 2,400-3,600 lbs. per acre each year.
stackexchange-sustainability
{ "answer_score": 3, "question_score": 7, "tags": "plants, carbon sequestration" }
Push Notifications warning? I am working with push notifications in my app. but I am getting this warning: Incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSData *' the code where its getting warning is: - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // Here you send the deviceToken to your server.. deviceToken = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""]; NSLog(@"Device Token: %@",deviceToken); } Can anybody tell me why did I got that warning. Thanks
Why don't you create a separate NSString called deviceTokenStr as deviceToken itself is an NSData object and it is causing the error NSString *deviceTokenStr = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""]; NSLog(@"Device Token: %@",deviceTokenStr);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, objective c, push notification, ios 4.2, apple push notifications" }
How to rename files with specific extension using pig or hadoop fs option? I have *.gz files in mm/dd/yyyy partition based folder structure . I want to rename files which ends with .gz extension. Please suggest how to rename files with specific extension using hadoop fs command line option or using pig. here is my folder structure ----root folder | ---year -- month -- day -- filename*.gz I want to rename files with .gz extension. please suggest how to achieve this.
I know it's a dirty hack, but it works for me. I assume you want to change **.gz** file extension to **.newextension** : hadoop fs -ls root/*/*/*/filename*.gz | grep .gz \ | awk '{print "hadoop fs -mv " $NF" "$NF}' | rev \ | cut -c 4-| rev | sed -e 's/$/newextension/'| bash You may experiment by changing `cut -c 4-` part as you wish. And before you're ready to run it I suggest using file output instead of direct bash piping at the end: hadoop fs -ls root/*/*/*/filename*.gz | grep .gz \ | awk '{print "hadoop fs -mv " $NF" "$NF}' | rev \ | cut -c 4-| rev | sed -e 's/$/newextension/' > rename_script.sh and when you're satisfied with it, run it: bash rename_script.sh
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "hadoop, apache pig" }
Does macOS 10.13.4 display 32-bit warnings like the beta versions do? The beta versions of macOS 10.3.4 were reported to include warnings when you started a 32-bit app. From the release notes: > To prepare for a future release of macOS in which 32-bit software will no longer run without compromise, starting in macOS High Sierra 10.13.4 a user is notified on the launch of an app that depends on 32-bit software. I've been using the released version of 10.3.4 for a few days, but I haven't seen any notices when I run 32-bit software. Was this feature removed? Or are there special conditions that need to happen before it appears?
# Yes, after midnight, April 12, 2018 in the user's local time zone From Ars Technica's "Apple has begun notifying macOS users of coming 32-bit app incompatibility". > Starting at midnight April 12, 2018 in the user's local time zone, they will see the following message the first time they launch an app that only supports 32-bit in macOS High Sierra 10.13.4: > >> This app needs to be updated by its developer to improve compatibility. > > Along with that message, they'll see a "learn more" link that takes them to Apple's support page on the subject with more information. The support page broadly explains Apple's plans to "eventually" require all Mac software to be 64-bit. ![macOS 10.3.4 32-bit app warning](
stackexchange-apple
{ "answer_score": 2, "question_score": 3, "tags": "macos, high sierra, 32 bit, beta" }
How to animate an image in iPhone app? I have a simple image which I want to animate in up and down...How do I achieve it in iPhone app? Please help Thanks
You can use an array of images and animate them in 1 UIImage: ## iOS 5: @interface UIImage (WrightsCS) +(UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration; @end if ( SYSTEM_VERSION_GREATER_THAN(@"5.0") ) { NSArray *animationFrames = [NSArray arrayWithObjects: [UIImage imageNamed:@"image_0.png"], [UIImage imageNamed:@"image_1.png"], [UIImage imageNamed:@"image_3.png"], [UIImage imageNamed:@"image_4.png"], nil]; UIImage * animatedImage = [UIImage animatedImageWithImages:animationFrames duration:2.0f]; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "iphone, objective c, ios, uianimation" }
Perforce, How to integrate a change to another branch? I have trunk and a release branch. If I fixed a bug in release branch, I definitely should integrate the fix back to trunk. However, I didn't find a command dedicated to integrate such a single change list; did I miss something?
To integrate changelist 100, for example, you'd use: p4 merge //releasebranch/...@=100 //trunk/... p4 resolve p4 submit (If you have an older Perforce server you'll have to use 'integ' instead of 'merge'.) Note that '@=100' means the same thing as '@100,100' in this context.
stackexchange-stackoverflow
{ "answer_score": 29, "question_score": 16, "tags": "branch, perforce, branching and merging" }
How do I Combine a Registry Path that has a space and a variable? function GetDefaultPrinter { param ( [string]$Comp ) Invoke-Command -ComputerName $Comp -ScriptBlock { Get-ChildItem Registry::\HKEY_Users | Where-Object { $_.PSChildName -NotMatch ".DEFAULT|S-1-5-18|S-1-5-19|S-1-5-20|_Classes" } | Select-Object -ExpandProperty PSChildName | ForEach-Object { Get-ItemPropertyValue 'Registry::\HKEY_Users\' + $_ + '\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows' 'Device'} } } so the path is: 'Registry::\HKEY_Users' + $_ + '\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows' if I use: 'Registry::\HKEY_Users\S-1-5-21-166812146-2062891607-924725345-16845\SOFTWARE\Microsoft\Windows' it works! Thank you so much!
You need to enclose string concatenation in parentheses, to force PowerShell out of argument-parsing mode 1: Get-ItemPropertyValue ('Registry::\HKEY_Users\' + $_ + '\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows') 'Device' Alternatively and more practical, use double-quotes for string interpolation: Get-ItemPropertyValue "Registry::\HKEY_Users\$_\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" 'Device' * * * [1] Here is a simplified demo of what is happening in your original code: Function Foo( $a, $b, $c ) { "a: $a"; "b: $b"; "c: $c" } Foo 1 + 2 Output: a: 1 b: + c: 2
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "powershell" }
How to take the input while the user is typing in c++ I want to make a program which does autocomplete when a user types in the console window. For that I will maintain a dictionary of words and output some of the words that starts with the same word user is typing. But how do I take the input while the user is still typing on console?
If you are working on Windows platform you can use PDCurses to get your characters one by one using getch(). you can find the documentation link : PDCurses.txt and here's a tutorial how to set up PDCurses in visual studio. If you are working on Linux, Unix or OS X you can use NCurses. Hope this will help.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c++, autocomplete" }
Rewrite path to my files I have a JS file that has a path to another script. If I do not want to reveal my directory structure, what would be the best way to obscure it? For example, can I add a rewrite rule in .htaccess file and use that in my JS file or is there a better way to do that? Current JS file: URL_PATH = '/incl/pro/dir/files/server.php'; // change to: URL_PATH = '/dir/server.php';
Create a .htaccess file in your DOCUMENT_ROOT location with following content: Options +FollowSymlinks -MultiViews RewriteEngine on RewriteRule ^dir/(.*)$ /incl/pro/dir/files/$1 [L,NC] Rewrite rule will take care of forwarding your request of `/dir/server.php` to `/incl/pro/dir/files/server.php` internally.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, javascript, .htaccess" }
How to convert the timestamps (created_at) in rails 6? Hey how do i convert this: `2020-08-04 T13:31:44.342Z` to this: 2020-08-04 in rails 6? i can not really find the answer to this one because all the answers are aged up, not reliable. I am reffering to that created_at in my Vue front-end app. So what should i add to my migration to show like this or is it something that i should manage in my front-end?? my createData migration: class CreateData < ActiveRecord::Migration[6.0] def change create_table :data do |t| t.float :temperature t.float :windspeed t.references :user, foreign_key: true t.timestamps end end end
It seems like it'd be easier to just manage the date in your front-end using, for example, JavaScript's `substring`. `"2020-08-04 T13:31:44.342Z".substring(0, 10) // "2020-08-04"`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "ruby on rails, ruby, timestamp" }
What are some good resources for learning about HttpContext, Request and Response? I'm trying to learn about HttpContext, Request and Response. What are some good resources? I'm especially interested in links to tutorials (basic things). thanks saj
If you are referring to HttpContext in ASP.Net, it is a key object that exposes the underlying Request (incoming messages) and Response (outgoing message) streams. At a low level, this object is populated by IIS and the ASP.Net framework. This means that HttpContext is available to any business object running inside of a .Net web application (not just an ASPX page, ASCX, etc). `HttpContext.Current` provides access to Request, Response, Session, Cache, and more. < For HTTP basics such as Request and Response, see the links that Younes provided.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "asp.net, httpcontext" }
Managing assets for different areas with Rails Is it possible to have different assets for different areas of a site in Rails. For example, in my `admin` area, I'm using `bootstrap` but this is getting loaded in non admin areas too. I guess it's to do with my folder structure but I've tried moving it and haven't really had any luck. Anything `admin` related is where you'd expect a normal controller, view or asset except it's nested within an `admin` folder. E.g. App > Assets > Stylesheets > Admin
You can customise the asset pipeline to whatever you require. described in detail here: < also here: < Note in your app/assets/javascripts/application.js this little line: //= require_tree . which instructs sprocket to load all files in your assets javascript folder tree. Change this this line to limit to specific files.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby on rails, asset pipeline" }
Correct way to re-install grub in Ubuntu What is the standard/correct way to re-install grub2? I am using liveusb right now and i am unable to boot into Ubuntu on my hard drive. Partitions are as follows: /dev/sda1 1 3917 31463271 7 HPFS/NTFS /dev/sda2 3918 10444 52428127+ 7 HPFS/NTFS /dev/sda3 10445 15671 41985877+ 7 HPFS/NTFS /dev/sda4 15672 19457 30411045 5 Extended /dev/sda5 * 15672 17711 16386268+ 83 Linux /dev/sda6 17712 19457 14024713+ 83 Linux Pleas help. thanks
The standard way is `grub-install`, so if you e.g. want to install `grub` on `/dev/sda` you would run grub-install hd0 or grub-install /dev/sda If you use some other, additional boot manager in `/dev/sda` adjust the parameter to `grub-install`. For some details see `info grub-install`. **EDIT** Assuming you are installing to `/dev/sda` (replace with whatever partition you use), you might want to back-up your boot sector with dd if=/dev/sda of=boot_sector.bak bs=512 count=1 so you could restore it later in case of errors with dd if=boot_sector.bak of=/dev/sda bs=512 count=1
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "ubuntu, grub" }
PHP - Specifying the SMTP server to send mail through I am developing a simple webmail client for IMAP-based email services using PHP's IMAP library, and I was wondering if there was any way to specify the SMTP server to use when sending an outgoing message, so that the message will be placed in the user's Sent mailbox when they are logged into their IMAP account. I saw that their is an imap_mail() function however it looks from the docs like it is just basically an alias for the normal mail() function, or am I wrong in assumming that?
Saving a copy to the Sent Mail folder is a function of IMAP, and is completely unrelated to queuing the message for delivery via SMTP. I.e., your code will have to do both operations separately -- one does not imply the other.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, email, smtp, imap" }
Unicode to UTF-8 in C++ I searched a lot, but couldn't find anything: unsigned int unicodeChar = 0x5e9; unsigned int utf8Char; uni2utf8(unicodeChar, utf8Char); assert(utf8Char == 0xd7a9); Is there a library (preferably boost) that implements something similar to **uni2utf8**?
Boost.Locale has also functions for encoding conversions: #include <boost/locale.hpp> int main() { unsigned int point = 0x5e9; std::string utf8 = boost::locale::conv::utf_to_utf<char>(&point, &point + 1); assert(utf8.length() == 2); assert(utf8[0] == '\xD7'); assert(utf8[1] == '\xA9'); }
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 5, "tags": "c++, boost, unicode, utf 8" }
Is Gnash installed by default in 11.04? Is the Flash player Gnash present in the default install of 11.04?
No, it's not installed by default, but you can install it from the universe repository (like in the previous releases)
stackexchange-askubuntu
{ "answer_score": 3, "question_score": 0, "tags": "11.04, gnash" }
Debug emacs hanging at startup So I've been using my custom config for a while now and no problems whatsoever, recently however there's a lag while loading emacs. It hangs at `loading /home/<user>/.emacs.d/git_config.el (source)` for about 5mins before going through. I'm not entirely sure what the problem is. I tried loading it in `--debug-mode` but to no avail. I can get over the hang by clicking `C-g`. I tried commenting out `git_config.el` but then it hangs in `helm.el`. In `git_config.el` it seems that it hangs at `(require 'git-commit)`. Any idea on how to go about debugging this?
I found the problem after hours of debugging, it seems to be an issue with **TRAMP** as stated here. As the answer sums it up, the problem is fixed by adding `(setq tramp-ssh-controlmaster-options "")` to the start of the emacs config.
stackexchange-emacs
{ "answer_score": 1, "question_score": 2, "tags": "start up" }
Which areas to focus on when testing C# vs Java performance (execution)? I am working on a school project, where I need to develop a hypothesis to be verified or falsified. My hypothesis is that C# execution time is faster than Java execution time on Windows, because C# is developed by Microsoft. Some of you might already know the answer to this hypothesis, and there have probably been studies that document this. But it does not matter, i just need to make this project myself. So i would like some ideas on areas to focus on, and how to measure them? P.S It should not be too complicated. Thanks!
Some things I would test: The time to open a file, write a line to it, and close it. The time to open a network connection. The time to open a database connection, write a single byte to it, and then close the connection. The time to create and populate an array, a standard ArrayList, and a generic ArrayList. The time to do sorting, using different algorithms. The time to run a large loop.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "c#, java, performance" }
Probability about lifetime of 100 bulbs (exponential distribution) I have some doubts about the following problem: I have 100 bulbs with a lifetime represented by an exponential distribution, with an expected value of 1000 hours. Find the probability that, at least one bulb, blown down after at most 500 hours. I have calculated the probability about one bulb with this method: $P(X \leq 500)=\int_{0}^{500}\lambda e^{-\lambda x}dx = 1-e^{\frac{1}{2}} = 0.394$ now, how can I extend this method for all the 100 bulbs? A step-by-step solution is really appreciated, I'm really newbie about statistics/probability arguments. Thank you so much and best regards. EDIT: $\frac{1}{\lambda}=1000$ hours so $ \lambda = \frac{1}{1000} $
I assume that it means "after at most 500 hours" right? In that case your computation makes sense for one bulb. What is $\lambda$ btw? For the second part, we may assume that the bulbs are all independent and blow down within $500$ hours with a probability of $p=0.394$. You have $100$ bulbs. What is the chance that none of these blows down?
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "probability, statistics, random variables, exponential distribution" }
Using the Swift Singleton I've got the following Singleton class: class Singleton { static let sharedInstance = Singleton() } I can find very little online about how to use the numerous swift implementations of the Singleton pattern. I have used it before in Objective-C on a previous application but to me it seemed much more straight forward. For instance, if I wanted to create an array of custom objects that could be used anywhere in the application, how would I declare it, and how would I implement it. In my objective-C Singleton class, I create global variables in the class file, and then implement it like so: singletonClass *mySingleton = [singletonClass sharedsingletonClass]; mySingleton.whatever = "blaaaah" I appreciate the help! Also I'm new around here and new to Swift.
There is a lot of info available on singletons in Swift. Have you come across this article with your Google prowess? < But to answer your question, you can simply define anything you'd like to use normally. class Singleton { static let sharedInstance = Singleton() // this makes singletons easy in Swift var stringArray = [String]() } let sharedSingleton = Singleton.sharedInstance sharedSingleton.stringArray.append("blaaaah") // ["blaaaah"] let anotherReferenceToSharedSingleton = Singleton.sharedInstance print(anotherReferenceToSharedSingleton.stringArray) // "["blaaaah"]\n"
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "swift, singleton, shared" }
c++ compiler choosing wrong namespace I am using the OpenCV library for my project and using namespace "cv" and "std" for my source files.I want to use the string split function to split a string based on a delimiter .But the "split" function is defaulting to the namespace "cv" and is showing errors related to wrong arguments as it is expecting arguments related to the OpenCV slpit function. What can be done to overcome this problem?I see that the same function worked fine in another source file even though that one has got both std and cv anmespace. These are the headers I am including in both files - #include "stdafx.h" #include <unordered_map> #include <iostream> // for standard I/O #include <fstream> #include <string> // for strings #include <iomanip> // for controlling float print precision #include <sstream> // string to number conversion
Avoid putting `using namespace std;` and `using namespace cv;` in your code, especially in headers. If you can't stop yourself, fully qualify the function where you need to, e.g. std::split(...)
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 1, "tags": "c++, string, visual studio 2010, namespaces" }
Foreign Keys vs Joins Is it better to use foreign keys in tables or can the same results be achieved with joins?
Foreign keys are just constraints to enforce referential integrity. You will still need to use JOINs to build your queries. Foreign keys guarantee that a row in a table `order_details` with a field `order_id` referencing an `orders` table will never have an `order_id` value that doesn't exist in the `orders` table. Foreign keys aren't required to have a working relational database (in fact MySQL's default storage engine doesn't support FKs), but they are definitely essential to avoid broken relationships and orphan rows (ie. referential integrity).
stackexchange-stackoverflow
{ "answer_score": 75, "question_score": 38, "tags": "sql" }
Using JSon like a Relational SQL Database (Javascript) So I have a JSON variable that looks like this: var peopleList = { "1": {"Name": "Lisa", "item1": "Name of Item 1"} , "2": {"Name": "Marty"} , "3": {"Name": "Jordan", "item1":"Name of Item 1", "item2":"Name of Item 2"} } I guess it's kind of like a relational database. Basically for the scope of the program i'm trying to do I need to be able to keep adding in multiple people (1-3 in this variable) and then associate multiple items to those people. Also for the variable as it is now i'm not even sure what the getters and setters would be in Javascript. For example, how would I add an item to "Marty" And how would I print out the Name for item2 from person "Jordan" Thanks for any help. I'm still a little bit new to JSON. And if there is a better way to do this that is easier to parse, i'm all ears.
to get the value of any object with `.` peopleList[3].Name // will return Jordan to add any key value pair to any object try this var MartyData = peopleList[2]; MartyData['item1'] = "Name of item 1 of Marty"; // you can check now that data added or not alert(peopleList[2].item1); // return Name of item1 of marty DEMO
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, json" }
How do I filter on a sum in a group footer? (Data View Web Part) I have a DVWP that displays groups of data. For each group, I've got a sum of one of the columns. This sum exists in the group footer in a template called dvt_1.groupfooter0. <xsl:variable name="mySum" select="sum($nodeset/@myQuantity)"/> Is there any way to filter out groups depending on this sum (e.g. if the sum is negative). I don't think that the "XSLT Filter" for the DVWP will work, since it appears to filter prior to grouping...so this doesn't work: [sum(@myQuantity) > 0] The above discards individual rows for which myQuantity is negative. Any suggestions?
You'd need to add the full XPath to the filter on the nodeset. Stuff like this is typically quite hard to do if you work directly with the XSL which SharePoint Designer generates. Another way to do it is in the dvt_1.body template, doing the calculation to determine if you should call the rowview template. Bottom line is that it's doable with XSL magic. M.
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 0, "tags": "data view web part, filter, aggregation, grouping" }
On route change view doesn't scroll to top in the new page in angular2 I have tried `autoscroll="false"` on the `router-outlet` but does't seem to work, is there any default method of angular2 for doing the same without using any third party library?
found answer here < we can subscribe to the route change event and scroll to the top with something in the lines of ngOnInit() { this.router.events.subscribe((evt) => { if (!(evt instanceof NavigationEnd)) { return; } document.body.scrollTop = 0; }); } Update - In Angular v6+ there is a new method `scrollPositionRestoration` introduced. for more info read out here * <
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "angular, routes" }
MigraDoc - How to Add image from External URL I am not able to add `image` that is saved at a URL something like "< using below code snippet: section.AddImage(url); However if I use `url` as a `relative url` of image that is present on my disk then this is working fine. Is this limitation of MigraDoc? Can someone provide workaround, code samples to over come this?
MigraDoc works with local files (relative or absolute paths), not with files that are somewhere on the Internet. `AddImage()` needs a path, not a URL. You can download the image from the URL and either store it in a local file or store it in a string using BASE64 encoding and pass that string to MigraDoc. You will have control over accessing the image from the web and can properly deal with problems. See this article on BASE64 encoding for MigraDoc images: <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "image, migradoc" }
Refresh / Update WPF controls like win forms changing the text of a label (or sophisticatedly we can say a text-based progress bar). in winforms you just Invalidate / Update. But how to do this in WPF without using Background Threads. ???
public static class ExtensionMethods { private static Action EmptyDelegate = delegate() { }; public static void Refresh(this UIElement uiElement) { uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate); } } private void LoopingMethod() { for (int i = 0; i < 10; i++) { label1.Content = i.ToString(); label1.Refresh(); Thread.Sleep(500); } } Reference: Link
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 1, "tags": "c#, wpf, winforms, invalidation" }
How do I intuitively understand what this linear transformation matrix is? $\begin{bmatrix}0 & 1 \\\ -1 & 0 \end{bmatrix}$ I know how to get the product when given another matrix. But how do I know what this matrix is doing simply by looking at it?
Note that \begin{equation} \begin{bmatrix} 0 & 1 \\\ -1 & 0 \end{bmatrix} \begin{bmatrix} x \\\ y \end{bmatrix} = \begin{bmatrix} y \\\ -x \end{bmatrix}. \end{equation} You can draw a picture to see that the vector $\begin{bmatrix} y \\\ -x \end{bmatrix}$ is what you get when you rotate $\begin{bmatrix} x \\\ y \end{bmatrix}$ clockwise by 90 degrees. You could also note that \begin{align} \left\langle \begin{bmatrix} x \\\ y \end{bmatrix}, \begin{bmatrix} y \\\ -x \end{bmatrix} \right \rangle &= xy - yx \\\ &= 0 \end{align} and \begin{align} \left\| \begin{bmatrix} y \\\ -x \end{bmatrix} \right \| &= \sqrt{y^2 + x^2} \\\ &= \left\|\begin{bmatrix} x \\\ y \end{bmatrix} \right\|. \end{align} This shows that $\begin{bmatrix} y \\\ -x \end{bmatrix}$ is a rotation of $\begin{bmatrix} x \\\ y \end{bmatrix}$ by 90 degrees.
stackexchange-math
{ "answer_score": 6, "question_score": 4, "tags": "linear algebra" }
Build an IQueryable from multiple predicates I want to build a query with where condition for filter properties when they have a value (not null). The multiple filters must be a AND combination if they are used. How can combine/add each predicate when the according property value is not null to get a final query ready for filtering? IQueryable<Customer> filter = null; Expression<Func<Customer, bool>> predicatetest1 = res => res.test1 == request.test1; Expression<Func<Customer, bool>> predicatetest2 = res => res.test2 == request.test2; Expression<Func<Customer, bool>> predicatetest3 = res => res.test3 == request.test3; if (request.test1 != null) { // add the above predicate to the filter } if (request.test2 != null) { // add the above predicate to the filter } if (request.test3 != null) { // add the above predicate to the filter }
IQueryable<Customer> filter = Context.Customers; if (request.test1 != null) { filter = filter.Where(predicatetest1); } if (request.test2 != null) { filter = filter.Where(predicatetest2); } if (request.test3 != null) { filter = filter.Where(predicatetest3); } var customers = filter.ToList(); The following would be equivalent, when all 3 properties where not null Context.Customers.Where(predicatetest1).Where(predicatetest2).Where(predicatetest3).ToList();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "entity framework, linq to entities, iqueryable" }
DOM JavaScript research for all elements and put to one input I have this simple JS code var x = document.getElementsByClassName("wc-order-item-sku"); console.log(x); document.getElementsByName("dpd_package_content")[0].value = x[0].outerText; <div class="wc-order-item-sku">a</div> <div class="wc-order-item-sku"><b/div> <div class="wc-order-item-sku">c</div> <div class="dpd_package_content"></div> I take TEXT from "wc-order-item-sku", and put into "dpd_package_content" but now I have many "wc-order-item-sku" and need all put into this same "dpd_package_content" I do not know how to resarch for all "wc-order-item-sku" on page. Can I please for some tips?
Use a for loop, and iterate through all the `wc-order-item-sku` divs. var x = document.getElementsByClassName("wc-order-item-sku"); // array of wc-order-item-sku var s = ""; // empty string for (var i = 0; i < x.length; i++) { s = s + x[i].outerText + "<br>"; // adds a line break to string } document.getElementsByClassName("dpd_package_content")[0].innerHTML = s; <div class="wc-order-item-sku">Prod 1</div> <div class="wc-order-item-sku">Prod 2</div> <div class="wc-order-item-sku">Prod 3</div> <div class="dpd_package_content" style="color: red"></div>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript" }
How many strings of $3$ decimal digits have exactly two digits as $4$? I approached the problem in this way : Fix two $4's$ and then third place can have $10$ ways to choose from {0,1,..,9} and then arrangement= ${10*3!}/2!$ = 30 But , Since we have {$4,4,4$} and {$4,4,0$} as two ways of digits which gives me {$0,4,4$} as one invalid arrangement and all $3$ arrangements of {$4,4,4$} as invalid. Therefore total = $30-1-3$=$26$ Am I missing out something or Including something extra ?
$044$ is a string of $3$ decimal digits, so unless the problem explicitly says that leading zeroes are not allowed, I would count it, getting $27$. An easier approach is to note that there are $3$ places for the digit that is not a $4$, and there are $9$ choices for that digit, for a total of $3\cdot 9=27$ strings. (And you can then subtract $1$ for the string $044$ if leading zeroes are not allowed.)
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "combinatorics, permutations" }
When does Service Fabric restart/clear state I've been reading up on Service Fabric and something I've not yet worked out is when is the state of stateful services initialised? If I'm developing locally, I assume the state is "restarted" each time I run the application. (ie press F5 to debug). If I deploy the services to Azure I am imagining that the services will start up and next time I deploy it is treated as an upgrade. Meaning the services maintain their state during an upgrade. I might be wrong there, as what happens to state if the service or actor has changes to the state being stored? Or am I wrong about that and will need to persist the state in an external store of some kind to ensure that user data is not lost. ie make the services and actors maintain a hot copy of the data and persist it when needed in case the whole system is restarted or redeployed.
By default, the state is persistent to disks (in addition to replication to 3 nodes), so it should survive the restarts. When you press F5 in Visual Studio, the default behavior is to delete your old application and deploy the current version as a new application. To maintain the state on your dev cluster, you can tick a checkbox in project properties to do upgrades instead of clean deployments. You have the same options when deploying to Azure - deploy a new app (and lose the state) or deploy an upgrade to persist the state. The old and new versions of your state class should be compatible, they are based on `DataContract` to make it a bit easier. Of course, scenarios with external state storage are also possible.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "azure service fabric" }
What is the difference between .text, .value, and .value2? What is the difference between `.text`, `.value`, and `.value2`? Such as when should target.text, target.value, and target.value2 be used?
`.Text` gives you a string representing what is displayed on the screen for the cell. Using `.Text` is usually a bad idea because you could get `####` `.Value2` gives you the underlying value of the cell (could be empty, string, error, number (double) or boolean) `.Value` gives you the same as `.Value2` except if the cell was formatted as currency or date it gives you a VBA currency (which may truncate decimal places) or VBA date. Using `.Value` or `.Text` is usually a bad idea because you may not get the real value from the cell, and they are slower than `.Value2` For a more extensive discussion see my Text vs Value vs Value2
stackexchange-stackoverflow
{ "answer_score": 298, "question_score": 229, "tags": "excel, vba" }
"Страда" и "страдать" Слова "страда" и "страдать" очень похожи по звучанию, но означают совершенно разное. Родственные ли они?
Эти слова имеют общее происхождение. От сущ. _страда_ «напряжение» (сил), «напряженная работа» > «тяжкий труд» > «мучение» с пом. глаг. суф. -а-ти образовано слово _страдати_ > _страдать_ «испытывать сильную физическую боль или нравственные мучения». От глаг. страдати «мучиться, терпеть лишения, боль и т. п.» в праслав. период образовано с суф. -ть (как честь) сущ. _stradib > _страдть «мучение, страдание», которое развилось в соврем, _страсть_ «сильное чувство». (Этимологический словарь русского языка Цыганенко Г.П.)
stackexchange-rus
{ "answer_score": 1, "question_score": 0, "tags": "этимология" }
What is the proper way to store a file name in XML? I'm using `XDocument` to cache a list of files. <file id="20" size="244318208">a file with an &amp;ersand.txt</file> In this example, I used `XText`, and let it automatically escape characters in the file name, such as the & with `&amp;` <file id="20" size="244318208"><![CDATA[a file with an &ersand.txt]]></file> In this one, I used `XCData` to let me use a literal string rather than an escaped one, so it appears in the XML as it would in my application. I'm wondering if either of them is better than the other under any certain conditions, or if it is just personal taste. Also, if it means anything, the file names may or may not contain illegal characters.
Both are essentially the same and there is no specific "best practice". Personally, I reserve `<![CDATA[]]>` for large amounts of text that requires lots of escaping (say bits of code or HTML markup). In this specific case, I would rather escape the `&` to `&amp;` as in your first example.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "c#, xml, formatting, linq to xml" }
C++ stack-based object allocation In C++ there are two ways one can declare an object. For example: // The first way vector<int> *nums = new vector<int>; // The second way vector<int> nums; People say that the first declaration allocates the object in the heap and the second on the stack. I can imagine how it works if the vector object is in the heap. The compiler would just find a free block in the heap to store the vector. But what would happen if the object is allocated on the stack as I keep pushing new elements to the vector? Will there be enough memory space? If not, how would the compiler find a sufficiently big memory block on the stack to store the vector when the size of the vector can change?
Putting `vector` object on stack doesn't mean it will put its elements on stack. Check documentation: > Internally, vectors use a dynamically allocated array to store their elements. This array may need to be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements to it. From: <
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 8, "tags": "c++, memory, memory management" }
Translation for date from / date da I need to translate "date from / date to" to Italian in a report (see picture). Is it correct to translate "date from / date to" as "Data di / Data da" ? Or is it rather "Data da / Data a" ? Or would you rather use "a partire da / entro", or something else ? ![Report](
In your case I think is better to write: "Da Data:" and "a Data:". I'm Italian :D
stackexchange-italian
{ "answer_score": 0, "question_score": 1, "tags": "translation, vocabulary" }
Objective C generics in blocks Despite its name, this question doesn't seem to address it. Is it possible to use Objective-C generics with blocks? Something like: typedef void (^MyResultBlock<__covariant ObjectType>)(NSArray<ObjectType> *items); ...and then declaring a block: MyResultBlock<NSNumber> blockName = ^void(NSArray<NSNumber> *items) {...};
No. Objective-C generics are only for classes, not `typedef`s.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": "objective c, generics, objective c blocks" }
How to get jsonpathquery or Xpathquery for columns in talend? tFileInputJson--> component --> Basic settings--> Mapping How can we get jsonpathquery or Xpathquery for columns in talend: ![enter image description here](
you will have to declare a JSON metadata for input file (Repository>Metadata>Json File). There, based on an existing jsonfile, you'll be able to get json query for all the fields. See talend help : <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "talend" }
Call Javascript function in Page load event? I'm using ASP.NET 4. C#. Is there anyway to call a Javascript function or button click event in Page Load?
you can use startup script with JavaScript or jquery string script = "$(document).ready(function() {$('button').trigger('click'); });"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, asp.net, dom events, pageload" }
Browser history issues in reactjs I'm trying to run a project based on session timeout in reactjs.. But unfortunately an error occurs.. This is the error, `'react-router' does not contain an export named 'browserHistory'.`
I think you're using React Router 4. It moves around some of those modules. You'll either need to migrate your code to use v4, or downgrade React Router in your `package.json`. React router provides a migration guide here: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "reactjs" }
Find vectors at angle intervals from a reference vector !enter image description here Referring to the figure, how can I find the vectors $V_1, V_2, V_3$ and so on that are subtended at an angle of $\theta$, $2\theta$, $3\theta$ and so on from $V_0$ respectively. The knowns are co-ordinates of $O$, $\theta$ and direction vector $V_0$.
For a rotation of angle $\theta$ about the origin, the matrix $$\begin{pmatrix}\cos\theta&\sin\theta\\\\-\sin\theta&\cos\theta\\\ \end{pmatrix}$$ will rotate any vector you operate on it with.
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "trigonometry" }
SSRS 2016 Datasource - SQL Server 2000 database Looking to upgrade SSRS from 2008R2 to 2016. Can SQL Server 2000 databases be used as data source in SSRS 2016? And are there any other known issues that could come up with the migration?
I just created a data source from SSRS 2016 to a 2000 database so yes it is possible. However, as the commenters above stated it isn't supported.
stackexchange-dba
{ "answer_score": 1, "question_score": 2, "tags": "sql server, ssrs, sql server 2000, ssrs 2008 r2, ssrs 2016" }
Using Purrr package to produce plots with correct xlab I am trying to use the `map` function from `Purrr` package to produce a bunch of plots at one time. I met issues with the `xlab` title. library(dplyr) library(purrr) df <- mtcars df %>% keep(is.numeric) %>% map(~qplot(.), geom = 'density') The `xlab` of each resulting plot turns to be `.`. I have tried to include `xlab = .` into the function, but it does not work. How can I add the correct `xlab` (e.g., the column name) to each plot? Thanks!
We can use `imap` instead of `map` and use the `.y` in `xlab` library(tidyverse) library(ggplot2) df %>% keep(is.numeric) %>% imap(~qplot(.x) + geom_density() + xlab(.y)) -output (last plot) ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "r, plot, purrr" }
Are there different difficulty settings? I started yesterday Assassin's Creed 2 on PC. I don't remember that the game asked me to select a difficulty setting at start. Is this available? I am asking it because the fights I did in the first 2 hours I played were really easy. Are the fights more difficult when the adventure proceed?
No, there's no way to select a difficulty level in the game. You're right, the combat is not that difficult, especially when you get used to using counter-kills and are good at blocking But later on you will be facing more enemies at a time and every time you make a mistake you will lose health, so you do have to be careful. I can't remember ever actually dying in combat, though. I don't remember about the first game, but there is also no difficulty selection in Assassin's Creed: Brotherhood (the 3rd in the series).
stackexchange-gaming
{ "answer_score": 9, "question_score": 4, "tags": "assassins creed 2" }
how to specify which class to select with selenium (in python) I want to use the selenium module for python 3 to get some information from a website, that information is located in a class with the name "table_dark_green". Now the problem is that there are multiple elements on this site with the class name "table_dark_green", and selenium only stores the last element with that class name. Is there a way to specify which one i would like to use?
You can use `find_elements` then specify the element: # this returns a list of elements table_elements = driver.find_elements_by_class_name("table_dark_green") print(len(table_elements)) # print to see how meny elements are in he list # you can specify the element in the list[0] or [1] ... [99] print(table_elements[0].text) Hope this helps you!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python 3.x, selenium" }
How to know DPI and if picture is in CMYK I need to check if some pictures (eps, tiff files) are in 300 DPI and if it is in CMYK format. I'm using imagemagick but I don't find any information about it. Could you help me please ?
It seems you're looking for "Resolution" and "Colorspace" fields output by ImageMagick's `identify` tool. < `identify -verbose sample.jpg`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, image, image processing, imagemagick" }
NodeJS, MySQL - JSON Stringify - Advanced query I have an object in the table column saved using JSON.stringify and it looks like this: [{ "id": 1, "uID": 10 }, { "id": 2, "uID": 10 }, { "id": 3, "uID": 94 }] I need a query that will check if a given column contains values e.g. * I want uID = 10 and id = 2 will return * I want uID = 10 and id = 5 will not return it * I want uID = 10 and id = 2, uID = 94 and id = 0 will not return it (because uID = 94 and id = 0 is not here)
Unless you are querying programmatically where you can parse the JSON and then do the logic, I would recommend something like this: SELECT * FROM Table WHERE Column LIKE '%"id": 1,"uID": 10%' The `LIKE` keyword allows us to use wildcards (%) but still do an exact text match for what we define.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql" }
How to set gross price to google play subscription item If I set price for a subscription item in google play console, it doesn't include tax. I'd like to set the same price what user will see in the app. It works fine with in-app products if I use templates, but I can't find solution for subscription items.
Finally I realized that it's not possible to give a tax included price for a subscription item in google play console. If I give a price, system will also show me that with the taxes. So the only way is that I have to play with it a bit.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, google play, google play console, in app subscription" }
Because iphone doesnt cache images over 25kb should I use individual images? Im currently creating a sprite for my retina display media query, with it being for iPhone 4 the images are doubled in size which considerably increases the file size. The elements I particularly want to enhance are the buttons and main logo. combining these make the sprite very large so should I just save each button individually keeping them all under 25kb? Here is an article for anyone who may not know about this 25kb limit: < All advice welcome and thanks
This limit might not be true. I recommend benchmarking this yourself. Reasoning: <
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "iphone, css, mobile, css sprites" }
How do we wish someone to get better? When we know somebody is sick, how can we wish them to get better? What are the best ways and also the standard ones to do that? I'd like you to differentiate among some things, _if_ and _when_ applicable: 1. Tell someone directly ( _get better soon_ ) **VS** tell someone's relative/friend (I wish your __ gets better soon); 2. When the cause is something "light" (like a flu) **VS** something more serious (being in the hospital); 3. When there is confidence with the interlocutor **VS** when there's no confidence; 4. etc... Other things that I might have forgotten.
One common phrase is this one, where X is the somebody in your question: > X/X > Zhù X zǎo rì kāng fù For example, /, which can be translated into _"wish/hope you'll recover soon."_ or _"wish/hope you'll make a speedy recovery."_ Vocabulary: > * (zhù) = Wish > * (nǐ) = You > * (zǎo rì) = in the near future, soon > * / (kāng fù) = recover from illness > This phrase can be used in most situations (mostly formal, informal and situations 1, 2 & 3 in your questions). For "light" sickness, say a cold or a headache, people often say: > 1. / = _Take more rest._ > Duō xiū xí > > 2. / = _Please take care._ > Duō bǎo zhòng > > 3. / = _Please don't get cold again._ > Xiǎo xīn bié yòu zháo liáng le > You'd often hear parents or elderly relatives say Example 3 to their kids or young people in the family when they have a cold.
stackexchange-chinese
{ "answer_score": 6, "question_score": 8, "tags": "expressions, politeness" }
Custom user fields in Devise 3 under Rails 4 I'm using the release candidate of Devise 3 so that I can use it with Rails 4. In Rails 3.2 I used to be able to add a custom field to my `User` model by simply adding that field to the registration/edit.html.erb and registration/new.html.erb files (after running the proper migration). Then I'd just add that field to the `attr_accessible` list of fields in the model. However, in Rails 4, there is no `attr_accessible` list and I can't simply add fields in the views. How do I add custom User fields?
I was told to look in the main README on the github page and there it was. Easy. class ApplicationController < ActionController::Base before_filter :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) << :username end end
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 5, "tags": "ruby on rails, devise, ruby on rails 4, attr accessible, strong parameters" }
react - Remove test only props In our code base, we use `data-automation-id` properties for both unit and end-to-end tests on react components that we want to have easy access to in these tests. For example: <button data-automation-id="sign-up-button" /> While this is useful during dev and testing, I would like to strip this property off of any react component in production mode. We are using babel6 to transpile the JSX and es2015 code and since that is where the JSX is converted into a series of react statements, I feel like this needs to be a babel plugin. Does anyone have experience with something like this? Does such a tool already exist?
You can create a babel plugin that can remove those attributes: export default function ({types: t}) { return { visitor: { JSXAttribute(path) { if (path.node.name.name === "data-automation-id") { path.remove(); } } } }; } <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, reactjs, babeljs" }
Write string with MPI IO in C I'm trying to figure out how to write an ASCII string to a file using MPI IO. Its my understanding that data written to a file using MPI IO is written out as byte data, so I'd like to find a method of writing to a file that would allow me to interpret it as a CSV. For example, I have a string named myString that contains "1,1,1,1,['a','b','c']\n". Would I just write to that string as a char array (char* myString) and then use MPI_File_write(file, myString, rank * BUFSIZE * sizeof(char), MPI_CHAR, MPI_STATUS_IGNORE) or would this not output the correct format?
It seems to work as you expected - I wrote one extra character to ensure I got null termination: #include <stdio.h> #include <string.h> #include <mpi.h> int main(void) { int rank; MPI_Status status; MPI_File fh; char *x = "1111abc\n"; MPI_Init(NULL, NULL); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_File_open(MPI_COMM_WORLD, "mpiio.dat", MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &fh); if (rank == 0) MPI_File_write(fh, x, strlen(x)+1, MPI_CHAR, &status); MPI_File_close(&fh); return 0; } If I compile and run on my laptop: me@laptop$ mpicc -o cstring cstring.c me@laptop$ mpirun -n 2 ./cstring me@laptop$ cat mpiio.dat 1111abc
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mpi" }
Is there a canonical piano grading system? The _Thompson's_ books are divided by grade (first grade, second grade, etc.). Aside from that, I have encountered a pianist who says that he is considered to be an X grade pianist. What is this grading system exactly?
There are various grading systems used throughout the world. Grades are set by various music organizations and are designed to reflect the difficulty of playing a song, or the skill depth and breadth of a musician. In Canada, I took lessons from teachers certified by the Royal Conservatory of Music and followed the RCM's grading system, complete with songbooks of graded songs and examinations. (I got my grade 8 piano before stopping lessons).
stackexchange-music
{ "answer_score": 7, "question_score": 6, "tags": "piano, grading" }
Usage of 韓服 and チマチョゴリ literally translates as hanbok (which in turn literally translates as Korean clothing), and literally translates as chima jeogori, which in turn literally translates as a chima skirt plus a jeogori top, but when do Japanese-speakers use , and when do they use ? A native speaker of Japanese said that is more commonly used than . Is that true? I suspect that in English, hanbok is more commonly used than chima jeogori, based on personal experience plus google hits. In Japanese, would you say "She wore a hanbok" using , or ? If the latter, would a man wearing a hanbok be described as wearing a (baji jeogori)? I'm mainly concerned with what's used in normal conversation, rather than technical correctness.
Perhaps I have never seen , although its meaning is instantly understandable if presented in kanji. is a specific term that refers to a certain Korean outfit for women, not Korean clothes in general. I believe most native Japanese speakers are familiar with this word. I learnt this word at middle school, and it can be the only word an ordinary Japanese people knows about Korean dresses. I didn't know what English _hanbok_ refers to, either, but if you want to talk about traditional Korean clothing in general including that for males, how about ()?
stackexchange-japanese
{ "answer_score": 2, "question_score": 1, "tags": "word choice, loanwords" }
Where lies the closest tropical rain forest to Mainland Europe? I know that "Europe" has its own tropical rain forest in French Guyana. But if you focus on continental Europe, where lies the closest tropical rain forest in terms of traveling hours?
This map shows the tropical rain forest in the whole world. As you can recognize, the rain forest in Africa are geographically located closest to Europe. !enter image description here Other references also state that the rain forest in Gambia are the closest rain forest to Europe, for example here. A quick matrix flight search turns out that you can get there from central Europe (I tried Frankfurt, Germany and all airport in a radius of 300 miles) for less than 500 Euros, and it is an only 1-stop flight. !enter image description here Other flights to typical rain forest destinations as for example Manaus in Brazil seem to be a little bit more expensive. !enter image description here
stackexchange-travel
{ "answer_score": 13, "question_score": 11, "tags": "europe, nature and wildlife, where on earth, tropical destinations" }
Most readable way to assign a double quote to a string in C# Does anyone else think that escaping characters in very short strings make them not very readable? I noticed I was using `s = "\""` in my code to assign a double quote a string, but having thought about it, I came up with the following alternative: `s = '"'.ToString()`. * Is my alternative any good? Would you prefer see the first version in code? * How would you go about assigning two double quotes (""), which might be `s = "\"\""`, to a string? _/me is marking this CW before being pressured into it._
You could use: String s = new String('"', 1); or if you like to confuse people: String s = @""""; but actually I still prefer the good-old-fashioned escape: \"
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "c#, string, quotes, readability" }
How to scroll in a tableview programmatically I have 50 row in a tableview. How to show 10 row initially and on a button click next 10 and so on?
Use `scrollToRowAtIndexPath:atScrollPosition:animated` method in UITableView Declare an index variable and when button pressed, increment that by 10, construct an `NSIndexPath` with that and call the above method. Eg: [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "ios, uitableview" }
Capturing /page-name/[0-99999] in both template and number Apologies if this has been answered already - I have singularly failed to word my question in a way that Google can help. I'm trying to create a page that acts as a base URL for a range of items with numbers - those items won't have pages, but rather than /page-name/?id=[0-99999] I'd like to create /page-name/[0-99999] Capturing the ID number in variable form and forcing all instances with that 'page-name' to be handled by a single template. I've seen WooCommerce do something like this, and am currently searching the codebase to try and figure it out, but any pointers would be appreciated.
The rewrite rule already exists to handle those requests, it's for pagination of a single page post type. You can get the value of the page number with `get_query_var('page')`. You can render all pages with the same template by creating a `page-{page-name}.php` template file.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 0, "tags": "url rewriting, page template, rewrite rules" }
How do ARM-NEON synchronize? Speaking in terms of ARM Cortex-A8, does the ARM module wait or continue its operations while NEON is executing its instructions? How is this synchronization achieved? How do ARM and NEON cores synchronize, if ARM and NEON are working on the same data/code segments?
The short answer is that they are automatically synchronized ... and they are synchronized just in the same way as all other instructions are synchronized (i.e. pipeline hazard checking). In processors that can issue multiple instructions per clock cycle, NEON instructions can be issued together with non-NEON instructions. NEON is part of the core, and uses the same caches as the regular load/store instructions. However, this also means that on some processors it can be inefficient to intermingle NEON and non-NEON loads and stores, or moving data between NEON and general-purpose registers.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 4, "tags": "embedded, arm, simd, neon, cortex a8" }
How to authenticate to gcloud SDK with a service key without commiting the service key? I'm building a CI/CD pipeline with bitbucket pipelines. I'd like the following command to run but I'd rather not have the key-file versioned. $ gcloud auth activate-service-account --key-file= The issue is that it expects the path to a key-file. Until now an encoded version of my key-file was stored in an environment variable but I can't provide it to `gcloud auth activate-service-account` (or at least I don't know how). What is the preferred way to authenticate to the SDK in a pipeline ?
I guess I can decode the encoded keyfile.. $ echo $ENVIRONMENT_VARIABLE > encrypted-key-file $ base64 --decode encrypted-key-file > key-file.json
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google cloud platform" }
How to take first file name from a folder in C# I need to get the first file name from a folder. How can I get this in C#? The code below returns all the file names: DirectoryInfo di = new DirectoryInfo(imgfolderPath); foreach (FileInfo fi in di.GetFiles()) { if (fi.Name != "." && fi.Name != ".." && fi.Name != "Thumbs.db") { string fileName = fi.Name; string fullFileName = fileName.Substring(0, fileName.Length - 4); MessageBox.Show(fullFileName); } } I need the first file name.
There's a few ways you could do this: * You could add a `break` statement after handling the first file. This will exit the foreach loop. * `DirectoryInfo.GetFiles` returns an array so you can assign it to a variable and scan through the elements until you find a suitable element. * Or if you are using .NET 3.5 you could look at the `FirstOrDefault` method with a predicate. Here's some code: string firstFileName = di.GetFiles() .Select(fi => fi.Name) .FirstOrDefault(name => name != "Thumbs.db");
stackexchange-stackoverflow
{ "answer_score": 33, "question_score": 15, "tags": "c#" }
What is the probability of the event? I am working on an assignment question and am having difficulty understanding it. My confusion comes from not understanding if there is any overlap between the different events? > Let S be the sample space {a,b,c,d}. And the events A,B,C,D be defined as A = {a}, B = {a,b}, C = {a,b,c}, and D = {b,d}. We know that Pr(A) = 1/10, Pr(B) = 1/2, and Pr(C) = 7/10. What is the Pr(D)? Am I supposed to be looking at the conditional probability between each of the given probabilities if so, what do I do after I have all 3? If thats not the way to solution any guidance would be really appreciated. Thanks
Note that the sample space $S = \big\\{ a, b, c, d \big\\}$, in the discrete probability space, we can calculate the probability mass centered at each atom: $\mathbb{P}\big( \\{ a\\} \big) = \mathbb{P}(A) = 1/10$ $\mathbb{P}\big( \\{ b\\} \big) = \mathbb{P}(B\setminus A) = \mathbb{P}(B) - \mathbb{P}(A) = 1/2 - 1/10 = 4/10$. $\mathbb{P}\big( \\{ c\\} \big) = \mathbb{P}(C\setminus B) = \mathbb{P}(C) - \mathbb{P}(B) = 7/10 - 1/2 = 2/10$. Note that the event $D$ is the complement of $\\{ a, c \\}$, then $$\mathbb{P}(D) = 1 - \mathbb{P}\big( \\{ a, c \\} \big) = 1 - \mathbb{P}(\\{ a\\} ) - \mathbb{P}(\\{ c\\} ) = 1 - 1/10 - 2/10 = 7/10 . $$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "probability" }
Can the Electorate badge be revoked? For the sake of a simple example, say you vote for exactly 601 questions and 1800 answers. Congrats, you've earned Electorate. But what if your next ten votes are all for answers? Then you'd be at 601:1810, which would put you at < 25% questions. Would the badge be taken away? I know that the general rule is that badges never go away, but the badge FAQ does state that one of the two exceptions to the rule is when "the criteria for the badge no longer exist."
No. I got the electorate badge because I stopped voting on answers, once I got it, I resume voting on answers (and in fact, I voted more on answers than on questions) losing the eligibility ratio and I did _not_ lose the badge.
stackexchange-meta
{ "answer_score": 21, "question_score": 29, "tags": "discussion, badges, stack exchange, electorate badge, revoked badges" }
If condition not detecting operator Today I have started to learn to write bash shell scripts, and the prof has tasked us to create a simple script calculator using three inputs: two of which are numeric inputs and one is an operator input. First, to my understanding, when a variable is assigned from reading input, it is treated as a string. so then by comparing the variable `op` to the string version of `+` it should evaluate `n1+n2`. however this is not the case, and I get the following errors: `./q2.txt: line 9: [+: command not found` `./q2.txt: line 13: [+: command not found` #!/bin/bash echo "Enter the operator" read op echo "Enter the first number" read n1 echo "Enter second number" read n2 if ["$op" == "+"] then n3=$((n1+n2)) elif [$op = "-"] then n3 = $((n1-n2)) fi echo "Answer: $n3" exit 0
the if syntax must left a space before and after condition `[ condition ]` so your script will be #!/bin/bash echo "Enter the operator" read op echo "Enter the first number" read n1 echo "Enter second number" read n2 if [ "$op" == "+" ] then n3=$((n1+n2)) elif [ $op = "-" ] then n3 = $((n1-n2)) fi echo "Answer: $n3" exit 0 Then it will works
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "linux, bash" }
count() and concordance() give different counts I am trying python nltk. While >>> from nltk.book import * >>> text1.concordance("monstrous") Displaying 11 of 11 matches: ... gives 11 matches and shows all of them, >>> text1.count("monstrous") 10 gives only 10. Why is there a difference?
`text1.concordance()` is **not** case sensitive but `text1.count()` **is** case sensitive. So if you look at the output there is a `"Monstrous"` capital `"M"` in the text so that is the difference in the totals If you `print text1.count("Monstrous")` it will return `1`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "python, nlp" }
Polymer property not updating via data binding I have a Polymer 1.0 custom element that wraps a text box (an HTML input element). Here is the template: <template> <input type="text" value="{{value}}"> </template> And here is the value property: value: { type: String, value: '', notify: true, observer: '_valueChanged' } As I type into the text box shouldn't the _valueChanged observer get invoked each time the input text is updated? The behaviour I'm encountering is that the observer only gets called once during initialisation of the custom element.
You need to bind as below. Read < for more details. <template> <input type="text" value="{{value::input}}"> </template>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, jquery, html, polymer, polymer 1.0" }
Prevent android studio to create more than a tag in xml files In the new android studio 3.3 or 3.2 if we create a for example button auto generate create a text like <Button android:layout_width="" android:layout_height=""/> but I would like something more like this <Button android:layout_width="" android:layout_height=""/> like old versions of Android studio is there a setting or something for that?
That is related to `XML` code `wrapping`. By default it should be on `wrap always` but maybe it's not in your `Android Studio` or they changed that in newer versions. Anyway you can find that by click on: **Preferences -> Code Style (expand it) -> XML -> Android(Tab) ->** Here you can find `Layout Files` and below options like: `Wrap always`, `Don't wrap`, `Wrap if long` etc. So set it on `Wrap always` and `Apply` changes and your `XML` code from now on should be wrapped. ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, xml, android studio, auto generate" }
z-index not working in after class I have pseudo element `:after` and using `position: absolute` with `z-index: 1` but this hide with parent `div`, how can I solve this? body { background: #2c3e50; } .box { height: 200px; width: 130px; background: #0c1e30; margin: 10px auto; transition: all 0.2s ease 0s; position: relative; } .box:after { content: ''; height: 210px; width: 120px; background: #fff; position: absolute; z-index: 1; left: 0; top: 0; } <div class="box"></div>
you should use like this:- body{background: #2c3e50;} .box{ height: 200px; width: 130px; background:#0c1e30; margin: 10px auto; transition: all 0.2s ease 0s; position: relative; } .box:after{ content: ''; height: 210px; width: 120px; background: #fff; position: absolute; z-index: -1; left: 0; top:0; } <div class="box"> </div>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, css, z index" }
Can I use the Unity launcher icon to minimize applications/windows? I don't know if this is a feature or a bug, but clicking on an active application's launcher icon doesn't minimize it. It is terribly inconvenient for folks using a persistent Unity bar to click minimize button every time. Is there any way to add minimize functionality to the launchers?
**For 14.04:** See this answer. **For 13.10 and below** : Because Mark Shuttlewoth decided it, at least for now?: > no, clicking on the icon will not minimise the app. We have a minimise button for that, it's prominent. At least, that bug now has the status opinion which means the developers won't fix it for now, but wait for community discussion. So if you would like minimize on click too, make a clear statement at launchpad.
stackexchange-askubuntu
{ "answer_score": 44, "question_score": 97, "tags": "unity, launcher, window management" }
Python получить определенные цифры которые находятся между другими словами Вопрос заключается в том что написан парсер который достаёт ссылки пример: '/asdas131/2346877/123asdasd' Мне нужно убрать все слева и справа от цифр. Каким образом я могу это реализовать. Должно получиться '2346877'
t = '/asdas131/2346877/123asdasd' можно используя метод split(), указав в параметрах, в качестве разделителя '/' r = t.split('/') разделит строку на части, вернет список строк: ['', 'asdas131', '2346877', '123asdasd'] получаем нужную строку по индексу: print(r[2])
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, python 3.x, парсер, beautiful soup, bs4" }
RESTful web service tutorials for .NET Can anyone please suggest a step by step tutorial for RESTful Web services in .NET?
Here are a few (hopefully) useful links: * MSDN: WCF Web HTTP Programming Model, < * MSDN: WCF/Web Samples, < * MSDN Magazine Jan 2009, An Introduction to RESTful Services with WCF (is pre-.Net4 but still very readable), < * A blog post focussing on the new REST features in WCF 4 and how to use them, <
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 8, "tags": ".net, web services, rest" }
Why is my virtualhost defaulting to the standard document root? I have two domains registered: **example.com** and **example.org**. For one of these, I have also registered a subdomain: **sub.example.com**. I successfully managed to set up a virtual host for my subdomain sub.example.com. So example.com points to the default document root `/var/www` and sub.example.com points to `/var/www/sub.example.com`. But for some reason, I can't get example.org to point to anything else than the default document root. So example.com and example.org leads to the same website. I have created a virtual host for example.org, but Apache doesn't seem to register it. # /etc/apache2/sites-available/example.org <VirtualHost *:80> ServerAdmin admin@example.org ServerName example.org DocumentRoot /var/www/example.org </VirtualHost>
Have you enabled the website? With `a2ensite example.org` you can enable your site. Then do `service apache2 reload` to reload the websites.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "dns, apache2, ubuntu 12.04, virtualhost" }
Change size of title in Navigation Page I use xamarin forms. To Change title size, I think I need to go through native code We have a content page, we set title = "Some String" . Can I change the size of title by use custom render? I searched on the internet, there are some solutions change the font, but not size. Anythings helpful, I appreciate it
This what did in iOS. This will change the navigation title. I haven't found easy way in android. It seem likes we need to do it with custom view in action bar. [assembly: ExportRenderer(typeof(CustomNavigationBar), typeof(CustomNavigationBarRenderer))] namespace Hello { public class CustomNavigationBarRenderer: NavigationRenderer { public override void ViewDidLoad() { base.ViewDidLoad(); this.NavigationBar.TintColor = UIColor.Grey this.NavigationBar.BarTintColor = UIColor.Black this.NavigationBar.TitleTextAttributes = new UIStringAttributes() { Font = UIFont.FromName("HelveticaNeue-Light", 15), ForegroundColor = UIColor.White }; } } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "xamarin.forms" }
How can I use same MySql database for several computers on local network Need Help. I made a vb.net project for medical clinic, it is already finished ,my project using MySql database, the application need to be connected to local network on 3-5 windows computers at the same time and share data(use same sql database at same time). i used wamp server while i was developing, but my problem is, i dont know how to make all computers use same sql database at same time.
you should set up mysql for local lan(i don't know if it's needed or it is open to network by default) and then on other computers you have to connect to mysql server running on this computer via a static ip. I think this question might help you. as mentioned it might not immediately work because of some firewall blocking issue or other network privilege problems.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql, vb.net, wamp" }
A value in a form_for field I'm trying to set a value for a form field like this: <%= form_for (@change_office_address), remote: true, format: :json, html: { class: :contact_form } do |f| %> <%= f.text_field :city_id, class: 'form-control', value: @office.city.id, disabled: true %> <%= f.submit, class: 'btn btn-default' %> <% end %> In a view I can see the id in a field, but when I tried to submit the form, I see that validation doesn't pass. The validation looks like this: class ChangeOfficeAddress < ApplicationRecord belongs_to :city validates :city_id, presence: true end In my schema the column `city_id` is set to `integer`. I also tried to change `f.text_field` to `f.number_field`, but it didn't help either. So, what can be wrong? Thanks ahead.
I think you should use `readonly: true` instead of `disabled`. Because of `disabled` won't pass your data to server. <%= f.text_field :city_id, class: 'form-control', value: @office.city.id, readonly: true %>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, forms" }
A problem about uniformly integrable over E? > Definitionlet $\mathcal F$ be a family of functions,if for each $ε0$,there is a $δ0$ such that for each $f∈\mathcal F$,if $A⊆E$ is measurable and $m(A)δ$,then $\int_A |f|ε$. We say $\mathcal F$ is uniformly integrable over $E$. > problem:let $\mathcal F$ be a family of functions,each of which is integrable over $E$ then $\mathcal F$ uniformly integrable over $E$ iff for each $ε0$,there is a $δ0$ such that for each $f∈\mathcal F$,if $A⊆E$ is measurable and $m(A)δ$,then $|\int_A f|ε$. From left to right is easy,only use the defition of uniformly integrable and a inequality, but conversely how to do? This problem comes from Royden' real Analysis.
I suppose your family consists of real valued measurable functions. Suppose the second condition is given. If $m(A) <\delta$ then (for any $f \in \mathcal F$) $m(A \cap \\{x: f(x) >0\\})<\delta$ so $|\int_{A \cap \\{x: f(x) >0\\}} f |<\epsilon$. But this is same as $\int_{A \cap \\{x: f(x) >0\\}} |f| <\epsilon$. Similarly $\int_{A \cap \\{x: f(x) \leq 0\\}} |f| <\epsilon$ Add these two finish the proof. .
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "lebesgue integral" }
React child component directly invokes Action in flux app - bad practice? I am a JS novice and developing a flux app by scratch. Currently the root component has Action instance, and child components are assigned with event handlers that invoke an Action. Deeper descendants are assigned with handlers that eventually reach Action, but it makes me reluctant to maintain the callback flow. I made a static resolver to provide the access to Action like: var action = Resolver.resolveAction(); // Returns singleton action In this way, child component can directly call Action and emit through shared Dispatcher. Only the root component is listening to Store and refresh the whole component tree. I guess this does not that deviated from flux way, though little confident. Is this a bad practice, or any alternatives?
The first action you described should be denoted as an Action Creator. This is something that is fired when an event handler is triggered. I **think** your question is asking how you should handle the data returned from the action creator? In that case, you would write another Action receives that response and emits to the dispatcher. The dispatcher would then make it to the appropriate store, and that store would emit a change to all components listening. When the store emits, it will "refresh the whole component tree" (assuming you have store listeners and state listening to those changes). This is just the flux way and allows you not to have a callback tree -- that would be bad practice.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, reactjs, flux" }
Allow, Deny or Require All in .htaccess for Different Apache Versions When we want to block bots, spam referrers using .htaccess file, some websites use following code syntax: Order allow,deny Allow from all Deny from env=spambot But some websites tell that we need to use different codes for different Apache versions: #For Apache 2.2 <IfModule !mod_authz_core.c> <IfModule mod_authz_host.c> Order allow,deny Allow from all Deny from env=spambot </IfModule> </IfModule> # For Apache 2.4 <IfModule mod_authz_core.c> <RequireAll> Require all granted Require not env spambot </RequireAll> </IfModule> Now I want to which cone is correct or both are correct?
> we need to use different codes for different Apache versions This. The syntax changed from Apache 2.2 to 2.4. However, the old (Apache 2.2) syntax was kept (in fact, it was moved to a different module: mod_access_compat) for _backwards compatibility only_ \- so it still "works". But it is deprecated and is likely to be removed in future versions. So, code on Apache 2.4 should use the `Require ...` syntax.
stackexchange-serverfault
{ "answer_score": 2, "question_score": 3, "tags": ".htaccess" }
How can I make an object disappear on the Mac? So basically I just want to have the user click on an NSButton, and have it disappear once it is clicked. How can I do that?
_NSButton_ is a sublcass of _NSView_, which has these two handy methods: * `- (void) removeFromSuperview` * `- (void) setHidden:` Whichever you need depends on what exactly your application should do.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "objective c, cocoa" }
Is it possible to view an iphones application source code? > **Possible Duplicate:** > decompile an app binary to get back to source code > Decompiling iOS Objective-C binaries Some months ago i developed and iOS application. Recently i discovered a program called "ifunbox" which through it , i can have access to my application's .nib files , icons etc. I don't own a mac at the moment , so i can't really see if i can open the files with XCode and actually see my code. So is it possible that someone can download through "ifunbox" the .nib files and see my source code , or they are compiled so there is not such an issue?
Your code is compiled. Decompilers do exist, but their output is not particularly useful. I wouldn't be concerned about it if I were you. Art assets, and some aspects of interface files will be accessible to other people who want to drill into your compiled app package, but your code is just as secure as any other closed source executable compiled from C (or it's variants like ObjC).
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 9, "tags": "iphone" }
What's causing xcopy to tell me Access Denied? The postbuild task for one of our solutions uses xcopy to move files into a common directory for build artifacts. For some reason, on my computer (and on a VM I tested), the xcopy fails with "Access Denied". Here's what I've done to try and isolate the problems: * I tried a normal copy; this works. * I double-checked that none of the files in question were read-only. * I checked the permissions on both the source and destination folder; I have full control of both. * I tried calling the xcopy from the command line in case the VS build process had locked the file. * I used Unlocker and Process Explorer to determine there were no locks on the source file. What have I missed, other than paranoid conspiracy theories involving computers out to get me? This happens on my dev machine and a clean VM, but _doesn't_ happen for anyone else on the project.
Problem solved; there's two pieces to the puzzle. The /O switch requires elevation on Vista. Also, I noticed that xcopy is deprecated in Vista in favor of robocopy. Now I'm talking with our build engineers about this.
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 23, "tags": "windows, cmd, xcopy" }
What are the qualities to evaluate when purchasing a Burner for All-Grain brewing? I want to purchase a burner for all grain brewing. What are the qualities that I should look into for each product to compare them against each other? I will be brewing indoors in my apartment if that makes a difference. For example, I assume the higher the BTUs, the better. The quicker it takes to boil a certain quantity of water, the better. What should I look for when purchasing a burner?
Whoof... I would not recommend doing a full boil inside an apartment if you can possibly avoid it. You're basically putting a gallon or two worth of water into the _air_. Things will get muggy quite quickly. Presuming you can't get a natural gas hookup, you'll be restricted to butane burners; propane gives off too much carbon monoxide. Even with a butane burner, I'd advise you to buy a CO detector if you don't already have one. (As an alternative, you should consider electric heating elements. Personally the idea of doing the boil in a plastic container weirds me out, but I know a lot of people use that approach, and there's a definite convenience advantage.) Beyond that, yeah, the only real issue is BTUs. The only other thing I'd pay much attention to when buying a burner is windproofing, and of course that won't be an issue indoors.
stackexchange-homebrew
{ "answer_score": 4, "question_score": 1, "tags": "all grain, burner" }
Creating a hidden field in html document for debugging I'm building a Django application with multiple pages. The responses for few questions in these pages are stored in a Python dictionary. I need to reset this dictionary to their default values for testing purposes. To do this, I want to create a hidden field in my html document and once I click it, a ajax function will be called to reset the dictionary.. My concern is this field should not visible to the normal user and placed such that the user does not click it unknowingly.. How can I do accomplish this?
If it is just for you to do the testing you can make your user either staff or superuser then use: {% if request.user.is_superuser %} {% endif %} or {% request.user.is_staff%} {% endif %} Also make sure the view that does the clearing of your dictionary also checks for staff or superuser
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "html, django" }
Connect to mysql database java I am trying to connect to MySQL database from Java (MySQL is hosted in WAMP server) String userName = "root"; String password = "pass"; String url = "jdbc:mysql://localhost/dbase"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url, userName, password); The connection is fine when I am running from localhost. However when I run this code from another computer replacing localhost with my computer's IP (within the same network), I get the error, message from server: "Host '<name>' is not allowed to connect to this MySQL server" I have tried with port 3306 too. Whats wrong?
That's a permission issue on the database side; you need to grant permissions to user `root` to connect from your specific IP address. Something like this should work: GRANT ALL ON foo.* TO root@'1.2.3.4' IDENTIFIED BY 'PASSWORD'; On the other hand; I wouldn't use `root` for access to the database; you should use a regular user account for this.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "java, mysql, jdbc" }
mysql query very slow I have a very slow query because using ORDER BY. Now i understand why it is slow but i have no idea how i make it faster. The table got like 13,000,000 records. (the reason why it is slow) Tables 30 Rows 13,591,548 Data 1.3 GiB Indexes 265.2 MiB Total 1.5 GiB Overhead 96 B $sql3 = mysql_query("SELECT * FROM config LIMIT 1"); $row3 = mysql_fetch_assoc($sql3); $log=$row3['con_log']; $sql2 = mysql_query("SELECT sl_start,sl_id FROM scan_list2 WHERE sl_scanned='0' ORDER BY sl_id LIMIT 40"); while($row2 = mysql_fetch_assoc($sql2)){ echo "crk|".$row2['sl_start']."|".$log."-"; $sl_id = $row2['sl_id']; mysql_query("UPDATE scan_list2 SET sl_scanned='1' WHERE sl_id='$sl_id'"); Is there any better solution for this problem?
First review your table indexes. In php you don't need to perform one update for each 40 row, run your `update` then `select` and after, perform a loop to show information about rows from `select`, like: mysql_query("UPDATE scan_list2 SET sl_scanned = '1' WHERE sl_scanned = '0' ORDER BY sl_id LIMIT 40"); $sql3 = mysql_query("SELECT * FROM config LIMIT 1"); $row3 = mysql_fetch_assoc($sql3); $log=$row3['con_log']; $sql2 = mysql_query("SELECT sl_start,sl_id FROM scan_list2 WHERE sl_scanned = '1' ORDER BY sl_id DESC LIMIT 40"); while($row2 = mysql_fetch_assoc($sql2)){ echo "crk|".$row2['sl_start']."|".$log."-"; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, sql" }
Symfony Form - clear session variable only when I enter the form I want to clear session variable only when I enter my symfony form first time. In this example session is delete even when form is not valid - how can I change this? public function dodajNewAction(Request $request, Pacjent $pacjent) { unset($_SESSION['test']); $wykbad = new Wykbadpoz($pacjent); $wykbad->setRok(date('Y')); $wykbad->setMiesiac(date('n')); //miesiac bez zera wiodacego $form = $this->createForm('nfz_wykbadpoz_new', $wykbad); $form->handleRequest($request); return [ 'form' => $form->createView() ]; }
In a Symfony project you should **never** use superglobals like `$_SESSION` (`$_GET`, `$_POST`, ...). You must use the `Request` object. Like this: public function dodajNewAction(Request $request, Pacjent $pacjent) { $wykbad = new Wykbadpoz($pacjent); $wykbad->setRok(date('Y')); $wykbad->setMiesiac(date('n')); //miesiac bez zera wiodacego $form = $this->createForm('nfz_wykbadpoz_new', $wykbad); $form->handleRequest($request); $session = $request->getSession(); if ($form->isValid() && $session->has('test')) { $session->remove('test'); } return [ 'form' => $form->createView() ]; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, forms, symfony, session, session variables" }
Comparator in Typescript for custom sort on array So I want to use a custom sort on an array I get that is always in a different order: `[{code: 'A'},{code: 'O'},{code: 'I'}], [{code: 'O'},{code: 'A'},{code: 'I'}], ...` I want it in the `[{code: 'A'},{code: 'O'},{code: 'I'}]` order. export function someSort(arrayToSort): Array { if (!arrayToSort || arrayToSort.length < 1) { return []; } const sorted = new Map(); const sorting = ['A', 'O', 'I']; for (let i = 0; i < sorting.length; ++i) { sorted.set(sorting[i], i); } return arrayToSort.sort((a, b) => sorted.get(a.code) - sorted.get(b.code)); } I tried this where I add the sorting I want to a map with key the 'A' and as value a number so it's sortable but I get an error `core.js:15724 ERROR TypeError: Cannot assign to read only property '0' of object '[object Array]'` And now I'm out of ideas.
The array comes from the redux store and it's immutable so I solved it by doing `slice()` before I call `sort()`. But still @Maryannah's solution is a lot better than mine.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "javascript, arrays, typescript, sorting" }
Multi-device hybrid apps: why <vs:feature> tag? In the documentation at < there is explained how to add a plugin including its version. Why is a new tag invented while Cordova has support for plugins and versions using **cordova save plugins** and **cordova restore plugins**. See also < I know this is still an experimental feature.
The `vs:feature` tag was added to the Multi-Device Hybrid Apps project to support plugins. At the time MDHA had its CTP 1.0 release, the save/restore feature had not yet been proposed in the Cordova community and, like you said, is currently still in its experimental stages.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "cordova, visual studio 2013, visual studio cordova" }
Electrically determine if a speaker is clipping Is there any electrical method of detecting if a speaker is clipping? Will it distort the input signal since it's also backdriving said signal, and that might show up on an oscilloscope? I'm testing an old "bass shaker", basically a linear transducer that you directly attach to a couch/wall/seat instead of having a speaker cabinet, and my curiosity sparked the question.
I never did that with speakers but with solenoid valves you can. You need to look at the _current_ profile. Explanation: when you drive a valve the stem accelerates to move and that creates an electric signal (since it's metal in a magnetic field). At end of travel it stops (so decelerates) and there is a visible notch in the current profile. It's simply magnetic interaction. Really fancy coil drivers can sense this and detect if the valve actually opened or calibrate the actual current needed. The main difference is that the valve actuator goes _inside_ the coil so there is a much bigger difference than with a speaker which only floats _above_ the coil. Also from the valve technology you can mechanically check the travel with a dial indicator on the stem, you would put that on the center of your 'cone'
stackexchange-electronics
{ "answer_score": 2, "question_score": 2, "tags": "audio" }
Where do the Gradle build-in functions come from? I am reading gradle book and it says: apply plugin: 'java' task customJar(type: Jar) { ... destinationDir = file("${buildDir}/jars") ... } > The `file()` method, which is always available inside a Gradle build file So my question is where does this method come from? Where is it defined and why is it visible to the script?
`file()` method comes from `Project` class (as many other methods). Basically if there's no object defined before method invocation there's a big likelihood that this method is invoked on `project` object which is a `Project` class instance.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "gradle" }
Convergence implies lim sup = lim inf Could someone please explain to me how the following can be proven? I get the intution but don't know how to write it rigorously. !enter image description here Thank you.
The limit sup and inf of a sequence both are equal to the limit of some subsequence of that sequence. (Definition) If $\lim_{n\to\infty} x_n=a$, then this limit is unique, that is, $\lim_{k\to\infty} x_{n_k}=a$, for all subsequences ${x_{n_k}}$. (Rudin thm. 3.2b) * * * proof of the theorem: Suppose $p\in X$, $p'\in X$, and that {p_n} converges to $p$ and $p'$. And, suppose $\varepsilon\in\mathbb{R}^+$. Then since the sequences converge, we can choose an $N$ with $n>N$ implying $d(p_n,p)<\varepsilon/2$ and an $N'$ with $n>N'$ implying $d(p_n,p')<\varepsilon/2$. Then: $$d(p,p')\le d(p,p_n)+d(p_n,p')< \varepsilon$$ (where the first inequality holds from the triangle inequality.) Since this is true for every positive real number $\varepsilon$, we can conclude that $d(p,p')=0$, so that by the definition of a metric, $p=p'$.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "probability, sequences and series, measure theory" }
What's the difference between ACCESS_NETWORK_STATE and INTERNET? What's the difference between ACCESS_NETWORK_STATE and INTERNET? If I use INTERNET, is it necessary to use ACCESS_NETWORK_STATE? In other words, can I use INTERNET without using ACCESS_NETWORK_STATE?
From the documentation: `ACCESS_NETWORK_STATE`: > Allows applications to access information about networks `INTERNET`: > Allows applications to open network sockets. In short, the `INTERNET` permission lets you use the internet, whereas `ACCESS_NETWORK_STATE` will just give you information about the network, such as whether you are connected to a network at all. You can use either one without needing the other. If you don't check that you have a valid network connection before trying to use the Internet, your HTTP requests will simply fail.
stackexchange-stackoverflow
{ "answer_score": 46, "question_score": 37, "tags": "android, android permissions" }
How do you get a dimension of an Array as an Array from a 2D array? I have this 2D array: Private _Chars As String(,) = {{"`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "="}, {"¬", "!", """", "£", "$", "%", "^", "&", "*", "(", ")", "_", "+"}} I want to Pass a Dimension (ie. the First Line) into a Function, or the Second Line into a function to switch between these two lists so that the function only requires a String() parameter not a String(,) parameter so I could loop through both like so: Sub Example(Row as String()) For Index as Integer = 0 To Row.Count - 1 MessageBox.Show(Row(Index)) Next End Sub And this function would loop though 12345 etc and !"£$% etc. If there is way to have the arrays work this was and that works in Silverlight - I would ge very grateful!
You can't do it (easily). Your best option is to create a jagged array (an array of arrays) like this: Private _Chars String()() = { New String() {"`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "="}, New String() {"¬", "!", """", "£", "$", "%", "^", "&", "*", "(", ")", "_", "+"}} You could then call your function like this: Example(_Chars(0)) Example(_Chars(1))
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "vb.net, arrays, silverlight, multidimensional array" }
Questions in distant past tense I'm a little confused about the use of did and had in past tense -- recent past and distant past. For example, If I want to ask a friend whether he applied for a job (today), I would simply ask **"Did you apply for the job?"** Similarly, if I want to ask him whether he had applied for the job _that day_ (a day in the past) -- without having to mention _that day_ \-- I'd probably say **"Had you applied for the job [that day]?"** Is this second sentence correct? If not, please help with the sentence construction in this context.
Has is not quite "recent" and "distant". That is a simplification. The past perfect ("Had you applied") indicates that the verb or action was totally completed at some point in time. This can be either stated in the sentence "that day", or inferred from context. If you asked the second sentence to an English speaker just to figure out if he applied for the job or not on a given day in the past, he might say "Had I applied by when?" - understanding that you are asking about "that day" but not knowing what the the "when" is. In general past perfect wants to mean something like "HAD you applied... WHEN [event or single point in time]", if that makes sense! You can certainly leave of the event if it's implied by context, that's not wrong.
stackexchange-ell
{ "answer_score": 1, "question_score": 0, "tags": "word usage, word choice, sentence construction" }
Now that 20k users can delete answers, should we increase the number of daily delete votes? With the new capability to vote to delete answers, 20k users now have another kind of content to vote to delete. However, we still are rate-limited to only 5 total delete votes we can cast per day (which seem to apply to both votes on questions and answers). I understand the reasons for wanting to rate-limit deletion, but with a new class of content to vote on, shouldn't we at least give a few more daily votes to the 20k users? Maybe up this to 10 delete votes a day at the 20k level?
Taking out the trash is indeed wholesome; this is being implemented such that you get an extra delete-vote (up to a maximum of 30 per day) for every 1000 rep after getting access to the moderation tools (typically 10k - I can't remember if that varies on beta/SE sites, etc) - so someone with 22k on stackoverflow would get: * 5 votes by default * 12 extra votes due to rep * for an effective 17 delete votes per day
stackexchange-meta
{ "answer_score": 19, "question_score": 26, "tags": "feature request, status completed, vote to delete, trusted user" }