qid
int64
1
74.7M
question
stringlengths
0
70k
date
stringlengths
10
10
metadata
sequence
response
stringlengths
0
115k
961,256
How would I increase the child index of a movie clip by 1?
2009/06/07
[ "https://Stackoverflow.com/questions/961256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115182/" ]
Do you mean move it one level higher in its parent's stacking order? Then you do it by swapping it with the clip above it. Like this: ``` var index:int = myMC.parent.getChildIndex( myMC ); myMC.parent.swapChildrenAt( index, index+1 ); ``` If that's not what you want to do, maybe you could expand on what you mean by child index?
66,706,905
I have a shell script below. This already works by doing sh start\_script.sh But I want this to work automatically using cron jobs. Already made it executable using **chmod +x** Below is shell script and the cron job: ``` 2 * * * * /home/glenn/projects/database_dump/backup/script_backupMongoDB.sh ``` ``` #!/bin/sh TIMESTAMP=`date +%F-%H%M%S` FILENAME=configurator_`date +%m%d%y%H`_$TIMESTAMP.tar.gz DEST=/home/glenn/projects/database_dump/backup SERVER=127.0.0.1:27017 DBNAME=siaphaji-cms DUMPFOLDER=$DEST/$DBNAME DAYSTORETAINBACKUP="7" # DUMP TO DEST FOLDER mongodump -h $SERVER -d $DBNAME --out $DEST; # COMPRESS THE DUMPFOLDER AND NAME IT FILENAME tar -zcvf $FILENAME $DUMPFOLDER # DELETE DUMP FOLDER rm -rf $DUMPFOLDER find $DEST -type f -name '*.tar.gz' -mtime +$DAYSTORETAINBACKUP -exec rm {} + ```
2021/03/19
[ "https://Stackoverflow.com/questions/66706905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9352676/" ]
The solution was to use the `api.selfasserted.profileupdate` content definition (instead of `api.localaccountpasswordreset`) for the `LocalAccountDiscoveryUsingEmailAddress` technical profile. ```xml <TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress"> <DisplayName>Reset password using email address</DisplayName> <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Metadata> <Item Key="IpAddressClaimReferenceId">IpAddress</Item> <Item Key="ContentDefinitionReferenceId">api.selfasserted.profileupdate</Item> <Item Key="UserMessageIfClaimsTransformationBooleanValueIsNotEqual">Your account has been locked. Contact your support person to unlock it, then try again.</Item> <Item Key="EnforceEmailVerification">false</Item> </Metadata> <CryptographicKeys> <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" /> </CryptographicKeys> <IncludeInSso>false</IncludeInSso> <OutputClaims> <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" /> <OutputClaim ClaimTypeReferenceId="verificationCode" Required="true" /> <OutputClaim ClaimTypeReferenceId="objectId" /> <OutputClaim ClaimTypeReferenceId="userPrincipalName" /> <OutputClaim ClaimTypeReferenceId="authenticationSource" /> </OutputClaims> <ValidationTechnicalProfiles> <ValidationTechnicalProfile ReferenceId="REST-EmailVerification" /> <ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingEmailAddress" /> </ValidationTechnicalProfiles> </TechnicalProfile> ``` It looks mostly as a workaround, but it's the only option not to use the preview features of the display controls. To further protect the validation, there is an API-side check in the REST-EmailVerification validation technical profile, that re-checks the code previously validated client-side: ```xml <ValidationTechnicalProfiles> <ValidationTechnicalProfile ReferenceId="REST-EmailVerification" /> <ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingEmailAddress" /> </ValidationTechnicalProfiles> ``` Additionally I'm currently adding a captcha to avoid abuses of the sending logics. As soon as the display controls will be generally available, I'll reccomend my client to use them. The reason why it didn't work with the password-reset-specific content definition, is that it doesn't support other custom fields: <https://learn.microsoft.com/it-it/azure/active-directory-b2c/contentdefinitions> [![enter image description here](https://i.stack.imgur.com/5fN2W.png)](https://i.stack.imgur.com/5fN2W.png)
36,166,205
I want to have a single line of code with an `if` and the result on the same line. Example ``` if(_count > 0) return; ``` If I add a breakpoint on the line, it is set on the `if(_count > 0)`: [![Breakpoint on the if statement](https://i.stack.imgur.com/aNRcf.jpg)](https://i.stack.imgur.com/aNRcf.jpg) but what I want is to have the breakpoint on the `return;` like so: [![Breakpoint on return](https://i.stack.imgur.com/dBv9E.jpg)](https://i.stack.imgur.com/dBv9E.jpg) Is this doable? NOTE: The closest question I could find on SO was [this](https://stackoverflow.com/q/15942830/1467396) (which is not the same thing).
2016/03/22
[ "https://Stackoverflow.com/questions/36166205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1467396/" ]
Just click on a part of the line and press F9. This will set breakpoint in the middle of the line.
6,969,265
I am attempting to fade out the contents of a container, then replace with some new html and fade them back in. \**Note: The container will always contain at least one child div* Here is my code: ``` $("#identifier div:first").fadeOut(300,function(){ $(this).parent().html("<div> some new element </div>"); }).fadeIn(300); ``` I have tried a few different methods, and no luck. The new elements appear, but without the sought after fade effect. *the one i posted seemed to be the clearest.. the rest were long shots at best* I assume that this probably isn't the correct method to do such a task, however it is all I can think of. Any direction would be appreciated. Cheers!
2011/08/06
[ "https://Stackoverflow.com/questions/6969265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/829835/" ]
Try this ``` $("#identifier div:first").fadeOut(300,function(){ $(this).parent().html("<div> some new element </div>") $(this).fadeIn(300); }); ```
65,522,968
how do you make this box fade out on a click in javascript? . Button 3 is where I am having a bit of difficulty. I'm a neophyte to coding please be patient. ```js document.getElementById("button1").addEventListener("click", function(){ document.getElementById("box").style.height = "250px"; }); document.getElementById("button2").addEventListener("click", function(){ document.getElementById("box").style.backgroundColor = "blue"; }); document.getElementById("button3").addEventListener("click", function(){ document.getElementById("box").style.opacity = "0" }); document.getElementById("button4").addEventListener("click", function(){ document.getElementById("box").style.height = "150px"; }); ``` ```html <p>Press the buttons to change the box!</p> <div id="box" style="height:150px; width:150px; background-color:orange; margin:25px"></div> <button id="button1">Grow</button> <button id="button2">Blue</button> <button id="button3">Fade</button> <button id="button4">Reset</button> ```
2020/12/31
[ "https://Stackoverflow.com/questions/65522968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14851946/" ]
You could just add the [transition](https://developer.mozilla.org/en-US/docs/Web/CSS/transition) property to your box element: ``` transition: opacity 1s ease-out; ``` You code also has some syntax errors. You can see a working snippet below: ```html <div id="box" style="height:150px; width:150px; background-color:orange; margin:25px; transition: opacity 1s ease-out;"></div> <button id="button1">Grow</button> <button id="button2">Blue</button> <button id="button3">Fade</button> <button id="button4">Reset</button> <script type="text/javascript"> document.getElementById("button1").addEventListener("click", function(){ document.getElementById("box").style.height = "250px"; }); document.getElementById("button2").addEventListener("click", function(){ document.getElementById("box").style.backgroundColor = "blue"; }); document.getElementById("button3").addEventListener("click", function(){ document.getElementById("box").style.opacity = "0" }); document.getElementById("button4").addEventListener("click", function(){ document.getElementById("box").style.height = "150px"; }); </script> ``` **Note:** If your project gets bigger, I would recommend to have an external css file for your styles.
1,134,370
In my application, I want the user to be able to select a directory to store stuff in. I have a text field that I'm using to display the directory they've chosen. If they just click on a directory (don't browse it), everything is fine. However, if they double click on the directory and look inside it, the directory name is duplicated. Ex. They're in the home directory, single click the folder Desktop...path returned is ~/Desktop. On the other hand, if they're in the home directory, double click the folder Desktop, and now are in the Desktop folder, path returned is ~/Desktop/Destkop. Here's what I'm doing: ``` JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); loadField.setText(f.getPath()); } ``` I've also tried to do something like `chooser.getCurrentDirectory()` but that doesn't really work either. Edit: Using Mac OS X, Java 1.6
2009/07/15
[ "https://Stackoverflow.com/questions/1134370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122358/" ]
Seems to work for me. ``` import javax.swing.JFileChooser; public class FChoose { public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { java.io.File f = chooser.getSelectedFile(); System.err.println(f.getPath()); } }}); } } ``` 6u13 on Vista. Is there something strange about your setup or what you are doing? If there's a specific bug in a Mac OS X implementation of Java, you may want to, say, check if the file exists and if not de-dupe the last to elements of the path.
1,041,457
We have a new project for a web app that will display banners ads on websites (as a network) and our estimate is for it to handle 20 to 40 billion impressions a month. Our current language is in ASP...but are moving to PHP. Does PHP 5 has its limit with scaling web application? Or, should I have our team invest in picking up JSP? Or, is it a matter of the app server and/or DB? We plan to use Oracle 10g as the database.
2009/06/24
[ "https://Stackoverflow.com/questions/1041457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51281/" ]
You do realize that 40 billion per month is roughly 15,500 *per second*, right? Scaling isn't going to be your problem - infrastructure *period* is going to be your problem. No matter what technology stack you choose, you are going to need an enormous amount of hardware - as others have said in the form of a farm or cloud.
10,094,811
To begin with, I have to say that I'm totally new in spring, my first task was to change application context. I think it should be placed in \*.xml files, but can' find the field. I've google it as well, but didn' find any solution. Probably poor searcher :(.
2012/04/10
[ "https://Stackoverflow.com/questions/10094811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/552629/" ]
`if(array_key_exists($searchedfor,$lines)){...}else{...}` Should work for you
887,297
How many subsets of the set of divisors of $72$ (including the empty set) contain only composite numbers? For example, $\{8,9\}$ and $\{4,8,12\}$ are two such sets. I know $72$ is $2^3\cdot 3^2$, so there are $12$ divisors. Besides $2$ and $3$, there are $10$ composite divisors. Would this mean $\binom{10}{1}+\binom{10}{2}+...+\binom{10}{10}$? If so, how would you calculate this? Thank you.
2014/08/04
[ "https://math.stackexchange.com/questions/887297", "https://math.stackexchange.com", "https://math.stackexchange.com/users/165551/" ]
There are 10 composite divisors. ($4,8,6,12,24,9,18,36,72$). Any set of divisors that contains only composite numbers must be a subset of this set of 10. Conversely, any subset of this set of 10 is a subset that contains only composite numbers. So your problem is how to count how many subsets there are of this set of 10. Do you know a formula or a way of counting the numbers of subsets of a set?
50,217,930
I did read a following article: <http://surbhistechmusings.blogspot.com/2016/05/neo4j-performance-tuning.html> I come across > > We loaded the files into OS cache > > > It is about loading file (on local disk) into OS cache. Could you explain me how to do such loading? And tell me please if such cache is in-memory? What is cause that it can help?
2018/05/07
[ "https://Stackoverflow.com/questions/50217930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9720141/" ]
Operate on Unicode strings, not byte strings. Your source is encoded as UTF-8 so the characters are encoded from one to four bytes each. Decoding to Unicode strings or using Unicode constants will help. The code also appears to be Python 2-based, so on narrow Python 2 builds (the default on Windows) you'll still have an issue. You could also have issues if you have graphemes built with two or more Unicode code points: ``` # coding: utf-8 import re t = u" [°] \n € dsf $ ¬ 1 Ä 2 t3¥4Ú"; print re.sub(ur'[^A-Za-z0-9 !#%&()*+,-./:;<=>?[\]^_{|}~"\'\\]', '_', t, flags=re.UNICODE) ``` Output (on Windows Python 2.7 narrow build): ``` __ [_] _ _ dsf _ _ 1 _ 2 t3_4_ ``` Note the first emoji still has a double-underscore. Unicode characters greater than U+FFFF are encoded as surrogate pairs. This could be handled by explicitly checking for them. The first code point of a surrogate pair is U+D800 to U+DBFF and the second is U+DC00 to U+DFFF: ``` # coding: utf-8 import re t = u" [°] \n € dsf $ ¬ 1 Ä 2 t3¥4Ú"; print re.sub(ur'[\ud800-\udbff][\udc00-\udfff]|[^A-Za-z0-9 !#%&()*+,-./:;<=>?[\]^_{|}~"\'\\]', '_', t, flags=re.UNICODE) ``` Output: ``` _ [_] _ _ dsf _ _ 1 _ 2 t3_4_ ``` But you'll still have a problem with complex emoji: ``` # coding: utf-8 import re t = u"‍‍‍"; print re.sub(ur'[\ud800-\udbff][\udc00-\udfff]|[^A-Za-z0-9 !#%&()*+,-./:;<=>?[\]^_{|}~"\'\\]', '_', t, flags=re.UNICODE) ``` Output: ``` ___________ ```
28,148,414
I have a query and have tried to do some research but i am having trouble even trying to google what i am looking for and how to word it. Currently each div has a label and then an input field. i have made all these input fields with rounded edges. my problem is when i click in the chosen area a rectangular border appears around the edge. the image can be viewed here: `http://www.tiikoni.com/tis/view/?id=6128132` how can i change the appearance of this border? This is is my css code: ``` div input{ border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300px; border-radius: 25px; } ``` This is part of my html: ``` <div class="fourth"> <label> Confirm Password: </label> <input type="text" name="cPassword" class="iBox" id="cPassword" onkeyup="passwordValidation()" placeholder="confirm it!" autocomplete="off"> <p id="combination"></p> </div> ```
2015/01/26
[ "https://Stackoverflow.com/questions/28148414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4486219/" ]
One solution is to remove default outline on focus using: ``` div input:focus{ outline: none; } ``` ```css div input { border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300px; border-radius: 25px; } div input:focus { outline: none; } ``` ```html <div class="fourth"> <label>Confirm Password:</label> <input type="text" name="cPassword" class="iBox" id="cPassword" onkeyup="passwordValidation()" placeholder="confirm it!" autocomplete="off" /> <p id="combination"></p> </div> ```
89,492
This question is inspired by recent news about some of the [strange, out-of-control behavior](https://futurism.com/bing-ai-names-enemies) from Microsoft's new Bing chat AI, but I am asking hypothetically here. If an AI chatbot such as Bing Chat or ChatGPT said factually untrue things that did measurable harm to a real person's reputation, would that person have a case against the company that owns the chatbot for defamation? If not defamation, maybe something else? My understanding is that a key part of defamation is malicious intent, which does not really apply to a non-sentient piece of software. However, if the AI says something that does real harm to a persons reputation, couldn't the company be held responsible for this? What if the company was aware of the harm being done but chose not to take action? This seems similar to the situation where a company is held responsible for the words or actions of an employee.
2023/02/20
[ "https://law.stackexchange.com/questions/89492", "https://law.stackexchange.com", "https://law.stackexchange.com/users/49158/" ]
AI-generated text can easily be defamatory: that is simply a matter of content. Let's say the text is "John Q Smith murdered my parents", and that the statement is untrue. The scenario, as I understand it, is that Jones is chatting with a bot maintained by Omnicorp, and the bot utters the defamatory statement. A possible defense is that the literally false statement also cannot be taken to be believable – to be defamation the statement also has to be at least somewhat believable and not just random hyperbolic insulting. Since these bots are supposed to be fact-based (not ungrounded random text generators like Alex), I thing this defense would fail. It may be necessary in that state to prove some degree of fault, viz that there was negligence. For example, a person who writes a defamatory statement in their personal locked-away diary is not automatically liable if a thief breaks in and distributes the diary to others. It is very likely that the court would find the bot-provider to be negligent in unleashing this defamation-machine on the public. It is utterly foreseeable that these programs will do all sorts of bad things, seemingly at random. Perhaps the foreseeability argument would be very slightly lessened a couple of months ago, at this point it is an obvious problem. There is some chance that the bot-provider is not liable, in light of "Section 230" which says that "No provider or user of an interactive computer service shall be treated as the publisher or speaker of any information provided by another information content provider". If the bot is an information content provider, the platform operator is not liable. The bot is one if that entity "is responsible, in whole or in part, for the creation or development of information provided through the Internet or any other interactive computer service". Needless to say, claims of "responsibility" are legally ill-defined in this context. It is not decided law what "responsibility" programs have for their actions. If the court finds that the program is not responsible, then the platform is relieved of liability as publisher. The software creators are not liable for creating a machine with the capacity to create defamatory text, but the software creators could be the same as the platform-operators in a particular case. Malicious intent is relevant for a subclass of defamation cases: defamation of public figures. You can defame famous people all you want, as long as you don't do so with malice. This is a special rule about public figures.
108,718
I have a little question about a 2x2 design that keeps on confusing me. If I have this kind of 2x2 design where I can have these combinations in the conditions. No/No, Yes/No, No/Yes, Yes/Yes. The interaction effect is the effect of the two IVs, right? As the Yes/Yes condition consist of both IVs, is the Yes/Yes condition here the same as the interaction effect of A and B? ![2x2](https://i.stack.imgur.com/9eGfa.png)
2014/07/21
[ "https://stats.stackexchange.com/questions/108718", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/40037/" ]
There is no kernel that outperforms all other for all problems, even when the class of problems is reduced to a particular domain. Linear SVM are a popular choice for text classification, because many text classification problems are [linearly separable](http://www.cs.cornell.edu/people/tj/publications/joachims_98a.pdf), and because [they scale well to large amount of data](http://cseweb.ucsd.edu/~akmenon/ResearchExam.pdf). Still, you may try the three of them (linear, polygonal and radial basis function) and see which one performs better. The additional advantage of linear SVM is that there is only one parameter to tune (the regularization term). For polygonal and RBF you need to perform grid search (search over combinations of values for the regularization term and the rest of parameters, like the degree of the polynomial, for example).
55,558,064
An guessing and answering game. Each Card comprises a Suit, one of A,B,C,D,E,F,G, and a Rank, one of 1|2|3. I need to have a function to guarantee input(String) whether is valid type. And also write an instance declaration so that the type is in the Show class. I am not sure about the function toCard, how to express "String" in the function and meet it with the condition. ``` data Suit = A|B|C|D|E|F|G deriving (Show , Eq) data Rank = R1|R2|R3 deriving (Show, Eq) data Card = Card Suit Rank deriving (Show, Eq) instance Show Card where show (Card a b) = show a ++ show (tail show b) toCard :: String -> Maybe Card toCard all@(x:xs) | (x=A|B|C|D|E|F)&&(xs==1|2|3) = Just Card | otherwise = Nothing ``` edit toCard function, input should be any String, so i use a list expression, but it seems to be not correct, cause i try it in ghci, (x=A|B|C|D|E|F)&&(y==1|2|3) is not valid
2019/04/07
[ "https://Stackoverflow.com/questions/55558064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9684220/" ]
1) Firstly, ``` instance Show Card where show (Card a b) = show a ++ show (tail show b) ``` You have automatically derived a `Show` instance for `Card`, so this will conflict (you can only have 1 instance), and further it won't compile. The `show` should go on a new line, and `tail` should be applied to the *result* of `show b`. ``` instance Show Card where show (Card a b) = show a ++ " " + tail (show b) ``` 2) Secondly, ``` toCard :: String -> Maybe Card toCard all@(x:xs) | (x=A|B|C|D|E|F)&&(xs==1|2|3) = Just Card | otherwise = Nothing ``` The syntax `(x=A|B|C|D|E|F)&&(xs==1|2|3)` is pretty wild, and certainly not valid Haskell. The closest approximation would be something like, `x `elem` ['A','B','C','D','E','F'] && xs `elem` ["1","2","3"]`, but as you can see this rapidly becomes boilerplate-y. Also, `Just Card` makes no sense - you still need to use the `x` and `xs` to say what the card actually is! eg. `Just $ Card x xs` (though that still won't work because they're still character/string not Suit/Rank). One solution would be to automatically derive a `Read` instance on `Rank`, `Suit`, and `Card`. However, the automatic derivation for `read` on `Card` would require you to input eg. `"Card A R1"`, so let's try using the instance on `Rank` and `Suit` to let us write a parser for `Card`s that doesn't require prefixed `"Card"`. First attempt: ``` toCard :: String -> Maybe Card toCard (x:xs) = Just $ Card (read [x] :: Suit) (read xs :: Rank) ``` Hmm, this doesn't really allow us to deal with bad inputs - problem being that `read` just throws errors instead of giving us a `Maybe`. Notice however that we use `[x]` rather than `x` because `read` applies to `[Char]` and `x :: Char`. Next attempt: ``` import Text.Read (readMaybe) toCard :: String -> Maybe Card toCard [] = Nothing toCard (x:xs) = let mSuit = readMaybe [x] :: Suit mRank = readMaybe xs :: Rank in case (mSuit, mRank) of (Just s, Just r) -> Just $ Card s r _ -> Nothing ``` This copes better with bad inputs, but has started to get quite long. Here's two possible ways to shorten it again: ```hs -- using the Maybe monad toCard (x:xs) = do mSuit <- readMaybe [x] mRank <- readMaybe xs return $ Card mSuit mRank -- using Applicative toCard (x:xs) = Card <$> readMaybe [x] <*> readMaybe xs ```
38,979,709
Just upgraded from grails 2.3.11 to 3.2.0.M2 Have a problem with dbm-gorm-diff and other dbm-\* scripts My app has multiproject structure. Domain classes placed in separate plugin. Build.gradle ``` buildscript { repositories { mavenLocal() maven { url "https://repo.grails.org/grails/core" } } dependencies { classpath "org.grails:grails-gradle-plugin:$grailsVersion" classpath "org.grails.plugins:hibernate5:6.0.0.M2" classpath "org.grails.plugins:database-migration:2.0.0.RC4" } ``` } ``` version "0.1" group "core" apply plugin:"eclipse" apply plugin:"idea" apply plugin:"org.grails.grails-plugin" apply plugin:"org.grails.grails-plugin-publish" configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } repositories { mavenLocal() maven { url "https://repo.grails.org/grails/core" } } dependencyManagement { imports { mavenBom "org.grails:grails-bom:$grailsVersion" } applyMavenExclusions false } dependencies { compile "org.springframework.boot:spring-boot-starter-logging" compile "org.springframework.boot:spring-boot-autoconfigure" compile "org.grails:grails-core" compile "org.grails:grails-dependencies" compile "org.grails.plugins:hibernate5" compile "org.grails.plugins:cache" compile "org.hibernate:hibernate-core:5.1.0.Final" compile "org.hibernate:hibernate-ehcache:5.1.0.Final" console "org.grails:grails-console" profile "org.grails.profiles:plugin:3.2.0.M2" provided "org.grails:grails-plugin-services" provided "org.grails:grails-plugin-domain-class" provided 'javax.servlet:javax.servlet-api:3.1.0' runtime "org.grails.plugins:database-migration:2.0.0.RC4" runtime "mysql:mysql-connector-java:5.1.39" testCompile "org.grails:grails-plugin-testing" } grailsPublish { // TODO: Provide values here user = 'user' key = 'key' githubSlug = 'app/core' license { name = 'Apache-2.0' } title = "Core" desc = "***" developers = ["***"] portalUser = "" portalPassword = "" } sourceSets { main { resources { srcDir "grails-app/migrations" } } } ``` application.yml ``` grails: profile: plugin codegen: defaultPackage: core spring: transactionManagement: proxies: false info: app: name: '@info.app.name@' version: '@info.app.version@' grailsVersion: '@info.app.grailsVersion@' spring: groovy: template: check-template-location: false --- grails: plugin: databasemigration: updateOnStart: true updateOnStartFileNames: - changelog.groovy - changelog-part-2.groovy hibernate: cache: queries: false use_second_level_cache: true use_query_cache: false region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory' dataSource: dbCreate: none driverClassName: "com.mysql.jdbc.Driver" dialect: "org.hibernate.dialect.MySQL5InnoDBDialect" url: "jdbc:mysql://localhost:3306/project?zeroDateTimeBehavior=convertToNull&autoreconnect=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" username: "root" password: "root" properties: jmxEnabled: true initialSize: 5 maxActive: 50 minIdle: 5 maxIdle: 25 maxWait: 10000 maxAge: 600000 timeBetweenEvictionRunsMillis: 5000 minEvictableIdleTimeMillis: 60000 validationQuery: SELECT 1 validationQueryTimeout: 3 validationInterval: 15000 testOnBorrow: true testWhileIdle: true testOnReturn: false jdbcInterceptors: ConnectionState defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED ``` Stacktrace ``` 2016-08-16 18:57:06.731 WARN 5736 --- [ main] o.s.mock.web.MockServletContext : Couldn't determine real path of resource class path resource [src/main/webapp/WEB-INF/sitemesh.xml] java.io.FileNotFoundException: class path resource [src/main/webapp/WEB-INF/sitemesh.xml] cannot be resolved to URL because it does not exist at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:48) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.mock.web.MockServletContext.getRealPath(MockServletContext.java:458) ~[spring-test-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:78) [grails-web-sitemesh-3.2.0.M2.jar:3.2.0.M2] at org.grails.web.servlet.view.SitemeshLayoutViewResolver.loadSitemeshConfig(SitemeshLayoutViewResolver.java:105) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] at org.grails.web.servlet.view.SitemeshLayoutViewResolver.init(SitemeshLayoutViewResolver.java:67) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:146) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] at org.grails.web.servlet.view.SitemeshLayoutViewResolver.onApplicationEvent(SitemeshLayoutViewResolver.java:42) [grails-web-gsp-3.2.0.M2.jar:3.2.0.M2] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:877) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) [spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1] at grails.boot.GrailsApp.run(GrailsApp.groovy:55) [grails-core-3.2.0.M2.jar:3.2.0.M2] at grails.ui.command.GrailsApplicationContextCommandRunner.run(GrailsApplicationContextCommandRunner.groovy:55) [grails-console-3.2.0.M2.jar:3.2.0.M2] at grails.ui.command.GrailsApplicationContextCommandRunner.main(GrailsApplicationContextCommandRunner.groovy:102) [grails-console-3.2.0.M2.jar:3.2.0.M2] 2016-08-16 18:57:07.035 INFO 5736 --- [ main] .c.GrailsApplicationContextCommandRunner : Started GrailsApplicationContextCommandRunner in 21.719 seconds (JVM running for 23.484) 2016-08-16 18:57:07.035 INFO 5736 --- [ main] grails.boot.GrailsApp : Application starting in environment: development Command execution error: Bean named 'sessionFactory' must be of type [org.springframework.beans.factory.FactoryBean], but was actually of type [org.hibernate.internal.SessionFactoryImpl] 2016-08-16 18:57:07.185 INFO 5736 --- [ Thread-7] g.u.s.DevelopmentWebApplicationContext : Closing grails.ui.support.DevelopmentWebApplicationContext@2abc224d: startup date [Tue Aug 16 18:56:48 MSK 2016]; root of context hierarchy 2016-08-16 18:57:07.382 INFO 5736 --- [ Thread-7] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase -2147483648 2016-08-16 18:57:07.406 INFO 5736 --- [ Thread-7] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown ``` Can you help me?
2016/08/16
[ "https://Stackoverflow.com/questions/38979709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6250067/" ]
Already found it. This is known issue - <https://github.com/grails-plugins/grails-database-migration/issues/81>
9,638,009
I have a following XAML: ``` <ComboBox Name="groupComboBox" ItemsSource="{Binding Path=MyServiceMap.Groups}" DisplayMemberPath="{Binding Name}"/> ``` In the code behind i set this.DataContext to my viewModel. ``` private ServiceMap _serviceMap; public ServiceMap MyServiceMap { get { return _serviceMap; } set { _serviceMap = value; OnPropertyChanged("MyServiceMap"); } } ``` My ServiceMap class is ``` public class ServiceMap { //other code public List<Group> Groups = new List<Group>(); } ``` and finally: ``` public class Group { public string Name { get; set; } } ``` Unfortunately, this is not working. How can i bind combobox to show Group Name?
2012/03/09
[ "https://Stackoverflow.com/questions/9638009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1076067/" ]
There are two problems with your code. First is bindings are only work on properties, so the binding couldn't find the Group field. Change it to a property. ``` public class ServiceMap { public List<Group> Groups { get; set; } } ``` The second one is that the DisplayMemberPath waits for a string not a binding. Change it simply to "Name". ``` <ComboBox Name="groupComboBox" ItemsSource="{Binding Path=MyServiceMap.Groups}" DisplayMemberPath="Name" /> ```
64,168,266
HTML: ``` <div class="form-row"> <div class="col-md-6 mb-3"> <label for="validationCustom03">Service</label> <input type="text" class="form-control" id="validationCustom03" value="Describe service you need" required> <div class="invalid-feedback"> Please write here a needed service. </div> </div> </div> ``` CSS ``` #validationCustom03{ height: 100px; } input[id=validationCustom03]{ display:inline; padding-top: 0px; margin-top: 0px; color:red; } ``` Hello guys, I am trying to stylize the value of form - text input, but the only one thing I can reach is red color. My purpose is to remove break line before and after the text, to make is from the very first line in the input, please check out the picture. Thank you for your time and wisdom ! [![This is how it looks like](https://i.stack.imgur.com/oCo6t.jpg)](https://i.stack.imgur.com/oCo6t.jpg)
2020/10/02
[ "https://Stackoverflow.com/questions/64168266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14219248/" ]
I think you should use a `<textarea>` form attribute instead of an `<input>` element. Here's an example: ```css #validationCustom03{ height: 100px; } textarea[id=validationCustom03]{ display:inline; padding-top: 0px; margin-top: 0px; color:red; } ``` ```html <div class="form-row"> <div class="col-md-6 mb-3"> <label for="validationCustom03">Service</label><br> <textarea rows="4" cols="50" name="comment" class="form-control" id="validationCustom03" form="usrform" value="Describe service you need" required> Enter text here...</textarea> <div class="invalid-feedback"> Please write here a needed service. </div> </div> </div> ```
18,304,382
I have an application in Rails 3.2 which is ready to deploy. I am wondering should I upgrade it to Rails 4 or not. I also not sure about which of the gems might give issues with while upgrading. Below is my Gemfile with several common gems. Gemfile.rb ``` source 'https://rubygems.org' gem 'rails', '3.2.8' gem 'pg', '0.12.2' gem 'bcrypt-ruby', '3.0.1' gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.6' gem 'simple_form', '2.0' gem 'rails3-jquery-autocomplete', '1.0.10' gem 'show_for', '0.1' gem 'paperclip', '3.3.1' gem 'cocoon', '1.1.1' gem 'google_visualr', '2.1.0' gem 'axlsx', '1.3.4' gem 'acts_as_xlsx', '1.0.6' gem 'devise' ,'2.1.2' gem 'cancan', '1.6.8' gem 'bootstrap-datepicker-rails', "0.6.32" gem 'country_select', '1.1.3' gem 'jquery-rails', '2.1.4' gem 'annotate', '2.5.0', group: :development gem 'ransack', '0.7.2' gem "audited-activerecord", "3.0.0" gem 'prawn', '1.0.0.rc2' gem 'exception_notification', '3.0.1' gem 'daemons', '1.1.9' gem 'delayed_job_active_record', '0.4.3' gem "delayed_job_web", '1.1.2' gem "less-rails" gem "therubyracer" gem 'twitter-bootstrap-rails', '~>2.1.9' gem "spreadsheet", "~> 0.8.8" # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.5' gem 'coffee-rails', '3.2.2' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platforms => :ruby gem 'uglifier', '1.2.3' end # To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0' # To use Jbuilder templates for JSON # gem 'jbuilder' # Use unicorn as the app server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger # gem 'debugger' group :development, :test do gem 'rspec-rails', '2.11.0' end group :test do gem 'capybara', '1.1.2' gem 'factory_girl_rails', '4.1.0' gem 'faker', '1.0.1' end ``` I started working on this application last year (Nov 2012) after reading this great book at <http://ruby.railstutorial.org/>. I have also checked out what's new in Rails 4 like strong parameters and it's all very tempting to try an upgrade. But I am concerned about compatibility of these gems and effort it may take. I need some advice from experienced guys in the community or someone who has tried upgrading before I move ahead.
2013/08/18
[ "https://Stackoverflow.com/questions/18304382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1799633/" ]
I uploaded your gemfile to [Ready for Rails 4](http://www.ready4rails.net/), and it appears that you only have a couple gems that are not ready and one gem that is unknown. For some of the gems listed that do not have notes, I would suggest checking out their GitHub page (if they have one), and see if the gem has been updated recently on rubygems, just to confirm whether or not the gem works.
4,311,203
In 2 different action listeners, a dialog will be shown when some conditions are met. If both of the action listeners need to show dialog, 2 dialogs will be shown at the same time. But I want them to be shown one by one. Simplified code: ``` SwingUtilities.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(getTopLevelAncestor(), "dialog 1"); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(getTopLevelAncestor(), "dialog 2"); } }); ``` Those 2 "SwingUtilities.invokeLater" invocations are in different classes.
2010/11/30
[ "https://Stackoverflow.com/questions/4311203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319106/" ]
Make a class that keeps track about that; this class would contain a queue of dialogs to display; whenever a dialog is closed, the first one of the queue is shown and removed from the queue. When another class needs to show a dialog, it's immediately shown if the queue is empty, or inserted into the queue else.
284,441
I can get to a site form my Squid server directly using lynx `http://my-URL` , ie not using squid as the proxy, just to prove the connectivity exists. Lynx connects fine to the site - its a Weblogic portal When I try the same site from client with the squid machine as a proxy I get a squid error indicating that the destination site refused the connection from Squid. The squid server is a RHEL5.5 server. The error is something like ``` The following error was encountered: Connection Failed The systen returned: (13) Permission denied ``` The squid access.log just indicates a TCP\_MISS. It's as if the destination site knows its been accessed by squid and is not allowing ?
2011/06/27
[ "https://serverfault.com/questions/284441", "https://serverfault.com", "https://serverfault.com/users/73401/" ]
Sounds like you need to toy around with your squid ACL rules. I bet you that's the issue in there. Hopefully your squid.conf is well commented so you can figure it out easily enough. I suspect you'll want to take a look at ACL rules that refer to your LAN and HTTP connections.
1,388,053
In XAML, if you insert ``` <TextBlock Text="Hello World" /> ``` You will see the words "Hello World". If you insert ``` <TextBlock Text="{Binding}" /> ``` it will trigger the data binding functionality. But what if I really wanted the display text to be "{Binding}"?" Are there the equivalent of escape characters in XAML strings? Or is my only solution to do this: ``` <TextBlock>Binding</TextBlock> ```
2009/09/07
[ "https://Stackoverflow.com/questions/1388053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25216/" ]
You can escape the entire string with "{}": ``` <TextBlock Text="{}{Binding}"/> ``` Or individual curly braces can be escaped with a backslash: ``` <TextBlock Text="{Binding Foo,StringFormat='Hello \{0\}'}" /> ```
71,792,169
I am working on an app but there is a problem with hamburger icon as it is not working. It is not opening the navigation menu when i am clicking on it. what is the problem please tell me? I am trying to solve it but dont know what is the problem with it. I am new to code please help me. **Here is my fragment code** ``` public class HomeFragment extends Fragment{ NavigationView navigationView; ActionBarDrawerToggle toggle; DrawerLayout drawerLayout; Toolbar toolbar; private int[] images; private SliderAdapter sliderAdapter; public HomeFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); navigationView = view.findViewById(R.id.navmenu); drawerLayout = view.findViewById(R.id.drawerlayout); toolbar = view.findViewById(R.id.toolbar); ActionBar mActionBar; ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); Objects.requireNonNull(((AppCompatActivity) getActivity()).getSupportActionBar()).setTitle(""); toggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, R.string.open, R.string.close); drawerLayout.addDrawerListener(toggle); toggle.syncState(); ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((AppCompatActivity) getActivity()).getSupportActionBar().setHomeAsUpIndicator(R.drawable.menu3); return view; } } ``` **Here is my XML file** ``` <?xml version="1.0" encoding="utf-8"?> <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/drawerlayout" tools:openDrawer="start" android:background="@color/white" tools:context=".HomeFragment"> <androidx.coordinatorlayout.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <com.google.android.material.appbar.AppBarLayout android:id="@+id/appBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/reddark" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/Theme.AppCompat.Light"> <ImageView android:layout_width="150dp" android:layout_height="50dp" android:layout_gravity="center_horizontal" android:src="@drawable/backsssososos" /> </androidx.appcompat.widget.Toolbar> <RelativeLayout android:id="@+id/search_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/toolbar" android:background="@color/reddark" android:padding="10dp" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <EditText android:id="@+id/searchbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/searchbardesign" android:backgroundTint="#F8F8F8" android:drawableLeft="@android:drawable/ic_menu_camera" android:drawableRight="@android:drawable/ic_menu_search" android:drawablePadding="22dp" android:gravity="left|center" android:hint="Enter City,Colony name..." android:imeOptions="actionSearch" android:inputType="text" android:maxLines="1" android:padding="10dp" android:textColor="@color/black" android:textColorHint="@android:color/darker_gray" android:textSize="16dp" /> </RelativeLayout> </com.google.android.material.appbar.AppBarLayout> <androidx.core.widget.NestedScrollView android:id="@+id/nestedScrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:orientation="vertical"> <com.smarteist.autoimageslider.SliderView android:id="@+id/imageSlider" android:layout_width="match_parent" android:layout_height="300dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:sliderAnimationDuration="600" app:sliderAutoCycleDirection="back_and_forth" app:sliderAutoCycleEnabled="true" app:sliderIndicatorAnimationDuration="600" app:sliderIndicatorGravity="center_horizontal|bottom" app:sliderIndicatorMargin="15dp" app:sliderIndicatorOrientation="horizontal" app:sliderIndicatorPadding="3dp" app:sliderIndicatorRadius="2dp" app:sliderIndicatorSelectedColor="#5A5A5A" app:sliderIndicatorUnselectedColor="#FFF" app:sliderScrollTimeInSec="1" app:sliderStartAutoCycle="true" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_file_2"></TextView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_file_2"> </TextView> </LinearLayout> </androidx.core.widget.NestedScrollView> </androidx.coordinatorlayout.widget.CoordinatorLayout> <com.google.android.material.navigation.NavigationView android:id="@+id/navmenu" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" app:itemIconTint="@color/black" android:theme="@style/NavigationDrawerStyle" app:headerLayout="@layout/navheader" app:itemTextColor="#151515" app:menu="@menu/navigationmenu"> </com.google.android.material.navigation.NavigationView> </androidx.drawerlayout.widget.DrawerLayout> ```
2022/04/08
[ "https://Stackoverflow.com/questions/71792169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11915666/" ]
you must attach toolbar in ActionBarDrawerToggle ``` mDrawerToogle = new ActionBarDrawerToggle(this, drawer,toolbar,R.string.navigation_drawer_open, R.string.navigation_drawer_close); bar.setHomeButtonEnabled(true); bar.setDisplayHomeAsUpEnabled(true); mDrawerToogle.syncState(); drawer.setDrawerListener(mDrawerToogle); ```
1,759,420
I want to hide page extensions like stackoverflow does. How does the following work? ``` http://stackoverflow.com/tags/foo http://stackoverflow.com/tags/bar ``` I've seen a lot of sites that do this, but I still don't know how this is accomplished (I have a LAMP stack).
2009/11/18
[ "https://Stackoverflow.com/questions/1759420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/214135/" ]
When a web server gets a request for a URL, it has to decide how to handle it. The classic method was to map the head of the URL to a directory in the file system, then let the rest of the URL navigate to a file in the filesystem. As a result, URLs had file extensions. But there's no need to do it that way, and most new web frameworks don't. They let the programmer define how to map a URL to code to run, so there's no need for file extensions, because there is no single file providing the response. In your example, there isn't a "tags" directory containing files "foo" and "bar". The "tags" URL is mapped to code that uses the rest of the URL ("foo" or "bar") as a parameter in a query against the database of tag data.
37,724
A company that's using the contracting firm said they'd pay me $X per hour, and the same amount for hours over 40 in a given week. Apparently there's an exemption from the 1.5x pay for certain engineering positions, which I was told this was. I was (and am) happy with the pay we agreed on. So the contracting firm sent me a copy of the standard contract to read and sign. But the contract said I was to be paid 1.5x the amount of my normal rate for overtime. Before signing, I sent them a message saying, "I think this is a mistake." And they came back and said, "You're right, it's supposed to be 1x for overtime." They sent me another copy, but it had the same mistake in it. At that point, I signed it since we were on the same page regarding the terms even though it was still wrong. My thinking was that it was just a piece of (digital) paper that was wrong, and in my favor anyway. The actual contract (the intangible agreement between the two parties) was correct and mutually agreed upon. My question is, **with the contract as it stands, is there any risk that I am taking by not fixing it?** I'm getting paid the amount I expect (1x for overtime) and have no intentions to pull more out of them just because the written contract is wrong. I don't want to be in a bad situation, but I don't want to go through the hassle of changing something that doesn't matter either. Note: I live/work in New York state
2019/02/28
[ "https://law.stackexchange.com/questions/37724", "https://law.stackexchange.com", "https://law.stackexchange.com/users/24585/" ]
Clearly in this case the writing does not reflect your actual agreement. If you were to bill for 1.5x your normal rate for hours over 40/week, relying on the writing, and it came to court, you might win, based on the general rule that matters explicitly covered in the written agreement are treated as final, and evidence of contradictory oral agreements are often not accepted to contradict the contract document. This is known as the *parole evidence* rule. But you don't plan to issue such a bill, so that won't come up. I don't see that you are at any legal risk. But you could send the client a letter saying that you signed the contract document so as not to hold the job up, but you think there is a mistake in it (pointing out exactly where and what the error is). This would help establish your ethics and good faith, so that if somehow there was a problem over this later (although that seems unlikely) you can't be accused of any improper actions. Keep a copy of any such letter. By the way, if you are an independent contractor, the governmental standard for overtime does not normally apply (in the US). If you are an **employee** of a consulting company, it may or may not, depending on your salary level and the kind of work you do. An independent contractor **can** contract for a higher rate for overtime hours, if the client is willing to agree. Many clients will not be willing.
49,680,958
I want to copy Numeric DS to Alpha DS. First Idea was MOVEA, but that does not seem to work. Error: "The Factor 2 or Result-Field of a MOVEA does not refer to an array" ``` D Alpha DS D TBR1 5A D TBR2 5A D Num DS D TBR1N 5 0 D TBR2N 5 0 C MOVEA Alpha Num ```
2018/04/05
[ "https://Stackoverflow.com/questions/49680958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/977711/" ]
There seem to be a lot of misconceptions about data structures in RPG. In the past month there have been two questions because someone thought he could coerce the data structure to be a UCS2 value. It won't work. The data structure is a fixed length character field using the job's CCSID. The fact that it has some internal structure is meaningless if you are using the data structure name as your variable. This seems to be compounded by fixed form RPG's ability to implicitly define a field as character or numeric without giving it a data type. Stand alone fields and data structures treat this condition differently. See the following table: ``` field type | decimal positions | Implicit data type ---------------------------------------------------- stand alone | blank | A | not blank | P ---------------------------------------------------- data | blank | A structure | not blank | S ``` So for your definitions: ``` D Alpha DS D TBR1 5A D TBR2 5A D Num DS D TBR1N 5 0 D TBR2N 5 0 ``` `Alpha` is CHAR(10) `TBR1` is CHAR(5) `TBR2` is CHAR(5) `Num` is CHAR(10) `TBR1N` is ZONED(5 0) `TBR2N` is ZONED(5 0) There are no arrays so you can not use `MOVEA` with any of these on both sides., but `MOVEL` would work to assign `Alpha` to `Num` like this: ``` C MOVEL Alpha Num ``` That being said, you should not be using Fixed Form any more. All supported versions of the OS support Free Form RPGIV, and you can gain some advantages by using it. Specifically to this case, the implicit numeric data type is not possible in Free Form. So you would have something like this: ``` dcl-ds Alpha Qualified; tbr1 Char(5); tbr2 Char(5); end-ds; dcl-ds Num Qualified; tbr1n Zoned(5:0); tbr2n Zoned(5:0); end-ds; Num = Alpha; ``` Data types are now explicit, and you can even qualify your data structures so that you can say something like this: ``` num.tbr1n = %dec(alpha.tbr1:5:0); ```
52,006,600
I am fairly new to Spring Webapplication and need to do a little project for university. Currently I have a simple html site that displays some Data that I manually inserted into the database. Now I am currently working on a new html file to insert Data through a seperate form. On my "main" page I have a navbar, where I want to click on an item and get redirected to a specific page. I tried redirecting the link directly to an html file in my resources folder, but it doesnt seem to work. ``` <li class="nav-item active"> <a class="nav-link" href="/inputbook.html">Add Book <span class="sr-only">(current)</span></a> </li> ``` I also tried to link it by: * "${pageContext.servletContext.contextPath}/inputbook.html" (Found that in another thread) * "./inputbook.html" * "../inputbook.html" Is there a way to simply link this page or do I need to make an action + a method in a Controller? Thank you! UPDATE: Something interresting just happened. I added the method to map the site in my controller. When I try to open this site through the navbar, it tells me that it isnt mapped. Now (for testing, I have the form from the "inputbook.html" file also in my main page) when I input data through the main pages form, it saves it to the database and displays it correctly. After this process when I click on the Nav Bar again, it opens the "inputbook.html" site without any problems? Controller: ``` @RequiredArgsConstructor @Controller @RequestMapping("/books") public class BookController { private final BookService bookService; private final BookRepository bookRepository; @GetMapping public String showBooks(Model model) { List<Book> books = bookService.findAll(); model.addAttribute("books",books); return "books"; //view name } @PostMapping(value="/search") public String serachByTitle(Model model, @RequestParam Optional<String> searchTerm) {//Parameter heißt wie Feld in html form List<Book> books = searchTerm.map(bookService::findByTitleLike) .orElseGet(bookService::findAll); model.addAttribute("searchTerm",searchTerm.get()); model.addAttribute("books",books); return "books"; } @GetMapping("inputbook.html") public String inputbook() { return "inputbook"; // this returns the template name to be rendered from resources/templates. You don't need to provide the extension. } @PostMapping(value="/insert") public String insertBook(Model model,@RequestParam String title) { Book book = Book.builder() .title(title) .description("beschreibung") .author("auth" ) .isbn(12353) .creator("creator") // fake it till spring security .creationTS(LocalDateTime.MIN) .publisher("pub") .available(true) .deliveryTimeDay(2) .build(); bookRepository.save(book); return showBooks(model); } ``` } books.html("Main" Page) ``` <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Books</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"/> </head> <body> <nav class="navbar navbar-expand-lg navbar-light bg-light"> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item active"> <a class="nav-link" href="inputbook.html">Add Book <span class="sr-only">(current)</span></a> </li> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li> </ul> </div> </nav> <div class="container"> <form method="post" th:action="@{/books/search}"> <div class="form-group"> <label th:for="searchTerm">Searchterm</label> <input type="text" class="form-control" th:name="searchTerm"> </div> <button type="submit" class="btn btn-primary">Search</button> </form> **<form method="post" th:action="@{/books/insert}"> <div class="form-group"> <label th:for="title">Titel</label> <input type="text" class="form-control" th:name="title"> </div> <button type="submit" class="btn btn-primary">Save</button> </form>** <table class="table"> <thead> <tr> <th>Title</th> <th>CreationTS</th> <th>Author</th> <th>Creator</th> </tr> </thead> <tbody> <tr th:each="book : ${books}"> <td th:text="${book.title}">Betreff</td> <td th:text="${book.creationTS}">2018-01-01 10:01:01</td> <td th:text="${book.author}">TestAuthor</td> <td th:text="${book.creator}">TestCreator</td> </tr> </tbody> </table> </div> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> </body> </html> ``` inputbook.html ``` <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>Books</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"/> </head> <body> <div class="container"> <form method="post" th:action="@{/books/insert}"> <div class="form-group"> <label th:for="title">Titel</label> <input type="text" class="form-control" th:name="title"> </div> <button type="submit" class="btn btn-primary">Save</button> </form> </div> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> </body> </html> ```
2018/08/24
[ "https://Stackoverflow.com/questions/52006600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6057538/" ]
You can define a helper class to support piecewise construction: ``` template <typename T> struct Piecewise_construct_wrapper : T { template <typename Tuple> Piecewise_construct_wrapper(Tuple&& t) : Piecewise_construct_wrapper(std::forward<Tuple>(t), std::make_index_sequence<std::tuple_size_v<Tuple>>{}) {} template <typename Tuple, size_t... Indexes> Piecewise_construct_wrapper(Tuple&& t, std::index_sequence<Indexes...>) : T(std::get<Indexes>(std::forward<Tuple>(t))...) {} }; ``` Then you can make your `Composition` inherit `Piecewise_construct_wrapper<Mixins>...`: ``` template <typename... Mixins> struct Composition : private Piecewise_construct_wrapper<Mixins>... { template <typename... Packs> Composition(Packs&&... packs) : Piecewise_construct_wrapper<Mixins>(std::forward<Packs>(packs))... { } }; ```
37,669,768
I'm trying to get data from my SendGrid account via their API. I'm using classic ASP. I found [some code that works](https://stackoverflow.com/questions/27368436/classic-asp-parse-json-xmlhttp-return) except that I need to add authorization for SendGrids API as described [in their documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/authentication.html). I've found several examples that seem to suggest I need to add xmlhttp.setRequestHeader after the xmlhttp.open and before the xmlhttp.send but when I uncomment the line "xmlhttp.setRequestHeader" below I get a 500 error in my browser. Can anyone tell me now to add the authorization part to the xmlhttp object? **Edit for clarity:** When I comment the line "xmlhttp.setRequestHeader..." the script runs and returns the expected json result that says I need to authenticate. When I uncomment that line I get a 500 error. I have replaced my working api key (tested with a cURL command) with a generic placeholder in my code below. The real key is in place in the file on my server. Heres the code I'm using: ```vb <%@ Language=VBScript %> <% Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.6.0") xmlhttp.open "GET", "https://api.sendgrid.com/v3/campaigns?limit=10&offset=0 HTTP/1.1", false 'xmlhttp.setRequestHeader "Authorization", "Bearer my-correct-sendgrid-api-key" xmlhttp.send "" Response.AddHeader "Content-Type", "application/json;charset=UTF-8" Response.Charset = "UTF-8" pageReturn = xmlhttp.responseText Set xmlhttp = Nothing response.write pageReturn %> ``` It seems the basics are working because the code above returns the expected json results, the error message that says I need to authenticate: ```js { errors: [ { field: null, message: "authorization required" } ] } ``` SendGrids documentation uses this example: ```none GET https://api.sendgrid.com/v3/resource HTTP/1.1 Authorization: Bearer Your.API.Key-HERE ```
2016/06/07
[ "https://Stackoverflow.com/questions/37669768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2800784/" ]
Thanks everyone! Credit goes to [Kul-Tigin](https://stackoverflow.com/users/893670/kul-tigin) for pointing out my error, which was misinterpreting the comment "HTTP/1.1" for part of the url in SendGrids example. When I changed: ``` xmlhttp.open "GET", "https://api.sendgrid.com/v3/campaigns?limit=10&offset=0 HTTP/1.1", false xmlhttp.setRequestHeader "Authorization", "Bearer my-correct-sendgrid-api-key" ``` to: ``` xmlhttp.open "GET", "https://api.sendgrid.com/v3/campaigns?limit=10&offset=0", false xmlhttp.setRequestHeader "Authorization", "Bearer my-correct-sendgrid-api-key" ``` It started working without errors. Here's the working code: ``` <!-- language: lang-js --> <%@ Language=VBScript %> <% Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.6.0") xmlhttp.open "GET", "https://api.sendgrid.com/v3/campaigns?limit=10&offset=0", false xmlhttp.setRequestHeader "Authorization", "Bearer my-correct-sendgrid-api-key" xmlhttp.send "" Response.AddHeader "Content-Type", "application/json;charset=UTF-8" Response.Charset = "UTF-8" pageReturn = xmlhttp.responseText Set xmlhttp = Nothing response.write pageReturn %> ``` [SearchAndResQ](https://stackoverflow.com/users/1682881/searchandresq) I'll read the link you provided on error trapping. Thanks!
35,189,387
Why the below code doesn't print any output whereas if we remove parallel, it prints 0, 1? ``` IntStream.iterate(0, i -> ( i + 1 ) % 2) .parallel() .distinct() .limit(10) .forEach(System.out::println); ``` Though I know ideally limit should be placed before distinct, but my question is more related with the difference caused by adding parallel processing.
2016/02/03
[ "https://Stackoverflow.com/questions/35189387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2645833/" ]
The real cause is that *ordered parallel* `.distinct()` is the full barrier operation as [described](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#distinct--) in documentation: > > Preserving stability for `distinct()` in parallel pipelines is relatively expensive (requires that the operation act as a full barrier, with substantial buffering overhead), and stability is often not needed. > > > The "full barrier operation" means that all the upstream operations must be performed before the downstream can start. There are only two full barrier operations in Stream API: `.sorted()` (every time) and `.distinct()` (in ordered parallel case). As you have non short-circuit infinite stream supplied to the `.distinct()` you end up with infinite loop. By contract `.distinct()` cannot just emit elements to the downstream in any order: it should always emit the first repeating element. While it's theoretically possible to implement parallel ordered `.distinct()` better, it would be much more complex implementation. As for solution, @user140547 is right: add `.unordered()` before `.distinct()` this switches `distinct()` algorithm to unordered one (which just uses shared `ConcurrentHashMap` to store all the observed elements and emits every new element to the downstream). Note that adding `.unordered()` *after* `.distinct()` will not help.
13,182,664
Currently I have a jqGrid in html. I am looking for a way to pull the data from the HTML elements, not from the jqGrid object, and put each column into an array. I've looked at a bunch of examples and been unable to find something that works the way I need it.. This is what I have currently. It pulls the jgGrid, which is a .d class and loads it into dTags. Then I grab the tableId and try and pull the row data(I actually need column data was just using for an example) and am having no luck. Any help would be much appreciated. ``` function generateXML() { // get class tags d, np, ch var dTags = $(".d"); var npTags = $(".np"); var chTags = $(".ch"); for(var i = 0; i<dTags.size(); i++) { log(dTags.size()); var tableId = dTags[i].id; var tableName = "#" + tableId + " td:nth-child(0)"; log(tableName); var colArray = $(tableName).map(function(){ return $(this).text(); }).get(); log(JSON.stringify(colArray)); } } ``` HTML - Looks like this ``` <table id="polarizationTable" class="d" ></table> ``` The html the jqGrid generates looks like this... ![table](https://i.stack.imgur.com/Y96YE.png) and the code that generates that is.. ``` <div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all" id="gbox_polarizationTable" dir="ltr" style="width: 729px; "><div class="ui-widget-overlay jqgrid-overlay" id="lui_polarizationTable"></div><div class="loading ui-state-default ui-state-active" id="load_polarizationTable" style="display: none; ">Loading...</div><div class="ui-jqgrid-view" id="gview_polarizationTable" style="width: 729px; "><div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix"><a role="link" href="javascript:void(0)" class="ui-jqgrid-titlebar-close HeaderButton" style="right: 0px; "><span class="ui-icon ui-icon-circle-triangle-n"></span></a><span class="ui-jqgrid-title">Polarization Table</span></div><div style="width: 729px; " class="ui-state-default ui-jqgrid-hdiv"><div class="ui-jqgrid-hbox"><table class="ui-jqgrid-htable" style="width: 711px; " role="grid" aria-labelledby="gbox_polarizationTable" cellspacing="0" cellpadding="0" border="0"><thead><tr class="ui-jqgrid-labels" role="rowheader"><th id="polarizationTable_TestTime" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_TestTime" class="ui-jqgrid-sortable">Minutes<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_RdgA" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_RdgA" class="ui-jqgrid-sortable">Reading A<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_CorrA" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_CorrA" class="ui-jqgrid-sortable">Corr A<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_RdgB" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_RdgB" class="ui-jqgrid-sortable">Reading B<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_CorrB" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_CorrB" class="ui-jqgrid-sortable">Corr B<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_RdgC" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 97px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_RdgC" class="ui-jqgrid-sortable">Reading C<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th><th id="polarizationTable_CorrC" role="columnheader" class="ui-state-default ui-th-column ui-th-ltr" style="width: 94px; "><span class="ui-jqgrid-resize ui-jqgrid-resize-ltr" style="cursor: col-resize; ">&nbsp;</span><div id="jqgh_polarizationTable_CorrC" class="ui-jqgrid-sortable">Corr C<span class="s-ico" style="display:none"><span sort="asc" class="ui-grid-ico-sort ui-icon-asc ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-ltr"></span><span sort="desc" class="ui-grid-ico-sort ui-icon-desc ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-ltr"></span></span></div></th></tr></thead></table></div></div><div class="ui-jqgrid-bdiv" style="height: 250px; width: 729px; "><div style="position:relative;"><div></div><table id="polarizationTable" class="d ui-jqgrid-btable" tabindex="1" cellspacing="0" cellpadding="0" border="0" role="grid" aria-multiselectable="false" aria-labelledby="gbox_polarizationTable" style="width: 711px; "><tbody><tr class="jqgfirstrow" role="row" style="height:auto"><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 97px; "></td><td role="gridcell" style="height: 0px; width: 94px; "></td></tr><tr role="row" id="1" tabindex="0" class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight" aria-selected="true"><td role="gridcell" style="text-align:center;" title="0.25" aria-describedby="polarizationTable_TestTime">0.25</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="2" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="0.5" aria-describedby="polarizationTable_TestTime">0.5</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="3" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="0.75" aria-describedby="polarizationTable_TestTime">0.75</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="4" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="1" aria-describedby="polarizationTable_TestTime">1</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="5" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="2" aria-describedby="polarizationTable_TestTime">2</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="6" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="3" aria-describedby="polarizationTable_TestTime">3</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="7" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="4" aria-describedby="polarizationTable_TestTime">4</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="8" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="5" aria-describedby="polarizationTable_TestTime">5</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="9" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="6" aria-describedby="polarizationTable_TestTime">6</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="10" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="7" aria-describedby="polarizationTable_TestTime">7</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="11" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="8" aria-describedby="polarizationTable_TestTime">8</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="12" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="9" aria-describedby="polarizationTable_TestTime">9</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr><tr role="row" id="13" tabindex="-1" class="ui-widget-content jqgrow ui-row-ltr"><td role="gridcell" style="text-align:center;" title="10" aria-describedby="polarizationTable_TestTime">10</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrA">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrB">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_RdgC">&nbsp;</td><td role="gridcell" style="text-align:center;" title="" aria-describedby="polarizationTable_CorrC">&nbsp;</td></tr></tbody></table></div></div></div><div class="ui-jqgrid-resize-mark" id="rs_mpolarizationTable">&nbsp;</div></div> ``` Essentially I need the data from Minutes, Reading A, Corr A, etc.. into respective arrays... later down the road I will be building an custom XML file from this data. Hope this clears things up a bit.
2012/11/01
[ "https://Stackoverflow.com/questions/13182664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688975/" ]
You can use `:nth-child` and the `.map()` function: ``` var minutes = jQuery('.ui-jqgrid-bdiv tr.ui-widget-content td:nth-child(1)') .map(function(){ return $(this).html(); }); var readingA = jQuery('.ui-jqgrid-bdiv tr.ui-widget-content td:nth-child(2)') .map(function(){ return $(this).html(); }); /// and so on... ``` With a little bit of work you could wrap this in a `.each()` handler to step each column name programmatically, rather than manually specifying them all.
4,340,016
I am asked to provide two random variables, $X=(X\_1,X\_2)$ and $Y = (Y\_1, Y\_2),$ taking values in $\mathbb{N\_{0}}^2,$ such that $X\_1, Y\_1$ and $X\_2, Y\_2$, respectively, have the same distribution but $X$ and $Y$ don't. Let's suppose $X\_1, Y\_1$ have the Poisson distribution and let's say $X\_2, Y\_2$ the uniform one. It is unclear to my, why $X, Y$ would not necessarily have the same distribution. Can somebody provide an example of a bivariate random variable satisfying the required property ? Thanks.
2021/12/22
[ "https://math.stackexchange.com/questions/4340016", "https://math.stackexchange.com", "https://math.stackexchange.com/users/996159/" ]
All four variables have the same distribution. $X\_1$ independent of $X\_2$ while $Y\_1=Y\_2$.
18,774,863
What does PHP syntax `$var1[] = $var2` mean? Note the `[]` after `$var1` varable.
2013/09/12
[ "https://Stackoverflow.com/questions/18774863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1163755/" ]
It means that `$var1` is an array, and this syntax means you are inserting `$var2` into a new element at the end of the array. So if your array had 2 elements before, like this: ``` $var1=( 1 => 3, 2 => 4) ``` and the value of $var2 was 5, it would not look like this: ``` $var1=( 1 => 3, 2 => 4, 3 => 5) ``` It also means that if $var2 was an array itself, you have just created a two dimensional array. Assuming the following: ``` $var1=( 1 => 3, 2 => 4) $var2=( 1 => 10, 2=>20) ``` doing a `$var1[]=$var2;` wouls result in an array like this: ``` $var1=( 1 => 3, 2 => 4, 3 => (1 =>10, 2 => 20)) ``` As an aside, if you haven't used multi-dimensional arrays yet, accessing the data is quite simple. If I wanted to use the value 20 from our new array, I could do it in this manner: ``` echo $var1[3][2]; ``` Note the second set of square brackets - basically you are saying I want to access element two of the array inside element 3 of the $var1 array. On that note, there is one thing to be aware of. If you are working with multi-dimensional arrays, this syntax can catch you out inside a loop structure of some sort. Lets say you have a two dimensional array where you store some records and want to get more from the database: ``` $var1 = ( 1 => (id =>1, age => 25, posts => 40), 2 => (id =>2, age => 29, posts => 140), 3 => (id =>3, age => 32, posts => 12) ) ``` A loop like this following: ``` while($row=someDatabaseRow) { $var1[]=$row['id']; // value 4 $var1[]=$row['age']; // value 21 $var1[]=$row['posts']; // value 34 } ``` will infact insert a new element for every execution, hence your array would end up looking like this: ``` $var1 = ( 1 => (id =>1, age => 25, posts => 40), 2 => (id =>2, age => 29, posts => 140), 3 => (id =>3, age => 32, posts => 12), 4 => 4, 5 => 21, 6 => 34 ) ``` The correct way would be to assemble the array first, then append it to your current array to maintain the strucutre, like this: ``` while($row=someDatabaseRow) { $tempArr= array(); $tempArr[]=$row['id']; // value 4 $tempArr[]=$row['age']; // value 21 $tempArr[]=$row['posts']; // value 34 $var1[]=$tempArr; } ``` Now your array would look like you expected, namely: ``` $var1 = ( 1 => (id =>1, age => 25, posts => 40), 2 => (id =>2, age => 29, posts => 140), 3 => (id =>3, age => 32, posts => 12) 4 => (id =>4, age => 21, posts => 34) ) ```
181,657
I applied for PhD at some top US universities (Electrical & Computer Engineering dept). I received an email from a professor at one of the places, about a position in his group, to work on a very specific topic. If I am interested, an interview could be set up to discuss things further. However, I am not interested in this topic at all. From the email, it is clear that funding is available only for this topic. **Question**: If I reject this offer, does it hurt my chances of getting admitted by a different faculty member at the same department? My question is based on the following assumption: Faculty members *sit together* and pick a few candidates each, from the pool of applicants. The faculty member who contacted me had picked me. Therefore, if I reject his offer, I would not be considered by the other faculty members, because they have already picked other candidates. Is this how it usually works?
2022/01/27
[ "https://academia.stackexchange.com/questions/181657", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/66924/" ]
> > My question is based on the following assumption: Faculty members sit together and pick a few candidates each, from the pool of applicants. The faculty member who contacted me had picked me. > > > As Buffy said, in the US, candidates are normally chosen by committee, and there is no one-to-one matching between students and advisors. This is different than the situation in Europe. > > Therefore, if I reject his offer, I would not be considered by the other faculty members, because they have already picked other candidates. > > > Things will vary widely across academia, so it is hard to give general advice (and I'm not familiar with EECE departments, so take my advice for what it's worth). But the committee does generally try to ensure some rough alignment between the students' interests and the department's needs. It could be that the department is only interested in you because you seem like a good match to this project / advisor, and so declining this project would probably result in your not being admitted. Or it could be that they really like you and are offering you this opportunity on top of a forthcoming admissions offer. It is really impossible to say what they might be thinking, but it's certainly *possible* that rejecting this offer could reduce your odds of admission. > > If I am interested, an interview could be set up to discuss things further. However, I am not interested in this topic at all. > > > Still, I'm not sure any of this matters. You are not interested in the project, and getting an offer of admission based on your willingness to work on this odious project would not be very useful. So, I recommend being straightforward with them: perhaps you are willing to meet with the professor and discuss further, but your initial reaction is that the project doesn't seem like a strong match to your skills or interests. If this means they don't admit you, that's better than getting admitted but not being able to find a suitable advisor once you're there. By the way, you might want to keep an open mind with respect to the project. Sometimes working on a less interesting project with an awesome advisor is worth it. And sometimes apparently uninteresting projects turn out to be connected to things you are interested in.
28,852,008
If I have this string given by a ffmpeg command when you try to get information about a video: > > Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.4.7 > (GCC) 20120313 (Red Hat 4.4.7-11) configuration: > --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint libavutil 54. 19.100 / 54. 19.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 23.106 / 56. 23.106 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 > libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 > libpostproc 53. 3.100 / 53. 3.100Input #0, mov,mp4,m4a,3gp,3g2,mj2, > from '/var/zpanel/hostdata/zadmin/public\_html/chandelier.mp4': > Metadata: major\_brand : isom minor\_version : 512 compatible\_brands: > isomiso2avc1mp41 URL : Follow Me On > www.hamhame1.in compilation : 0 > title : Follow Me On > www.hamhame1.in artist : Follow Me On > > www.hamhame1.in album : Follow Me On > www.hamhame1.in date : Follow > Me On > www.hamhame1.in genre : Follow Me On > www.hamhame1.in comment > : Follow Me On > www.hamhame1.in composer : Follow Me On > > www.hamhame1.in original\_artist : Follow Me On > www.hamhame1.in > copyright : Follow Me On > www.hamhame1.in encoder : Follow Me On > > www.hamhame1.in album\_artist : Follow Me On > www.hamhame1.in > season\_number : 0 episode\_sort : 0 track : 0 disc : 0 media\_type : 0 > Duration: 00:03:51.35, start: 0.000000, bitrate: 2778 kb/s Stream > 0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, **1920x1080** [SAR 1:1 > DAR 16:9], 2646 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 > tbc (default) Metadata: handler\_name : VideoHandler Stream #0:1(und): > Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s > (default) Metadata: handler\_name : SoundHandlerAt least one output > file must be specified > > > In this case video dimension is: 1920x1080 How can I export video dimension knowing that yuv420p and [SAR 1:1 > DAR 16:9] might be different (and also that. 1920x1080 could be 402x250 or 24x59). I'm not really interested in using third-party classes.
2015/03/04
[ "https://Stackoverflow.com/questions/28852008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2922834/" ]
Try this regex: ``` (\b[^0]\d+x[^0]\d+\b) ``` Demo <https://regex101.com/r/bM6cN0/1> Don't parse everything with regex, bro.
4,039,176
I work for a company that built interactive seating charts using Javascript. Here's an example: <http://seatgeek.com/event/show/457624/miami-dolphins-at-new-york-jets-2010-12-12/>. In many ways they mimic the functionality of Google Maps. We're dealing with an odd problem--performance for the maps is fine in all browsers except IE8. I'm including IE6 and IE7 in the "all browsers" category. We're seeing markedly worse JS performance in IE8. When you try to drag the map in IE8, it locks up a bit and there's a noticeable lag. But that's not a problem in IE6 or IE7. We've isolated that the problem is related to the markers on the map. It's much more prevalent when you zoom in and there are more markers displayed. We've done some benchmarking using [dynaTrace](http://ajax.dynatrace.com/pages/) and it seems the delay is not caused by JS processing, per se, but rather by what dynaTrace refers to as "rendering". Seems surprising that the newer version of IE would have worse rendering.
2010/10/28
[ "https://Stackoverflow.com/questions/4039176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135156/" ]
Have you run the script Profiler in the IE8 Developer Tools? It will tell you exactly how much time is spent on each function. See: [Link](https://learn.microsoft.com/en-us/archive/blogs/ie/introducing-the-ie8-developer-tools-jscript-profiler)
71,105
The [official FAQ](http://us.battle.net/support/en/article/diablo-iii-installation-troubleshooting-mac#10) says that FileVault and FileVault2 are incompatible with Diablo 3. How can I install Diablo 3 on my Mac if my harddrive uses FileVault?
2012/05/30
[ "https://gaming.stackexchange.com/questions/71105", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/26598/" ]
Blizzard's archive format is incompatible with FileVault due to its [low level nature](http://www.quora.com/Blizzard-Entertainment/What-about-Blizzards-game-install-process-is-incompatible-with-Apples-Filevault). To get around this problem, you need to move the installer to a partition that does not use FileVault. I would also recommend installing it to a partition that does not use FileVault as well, in case later game updates use the MPQ archive format as well. I was able to use the following steps to get around this: * Created a new partition of suitable size (I went with 50GB) * Moved the installer to that new partition * Created an "Applications" folder on that partition * Launched the D3 installer from the new partition * Selected the "Applications" folder on the new parition This allows you to keep FileVault enabled on your primary partition while also installing Diablo3. That is, you get the best of both worlds at the cost of creating a special partition for Diablo3. This way you do not have to disable FileVault for your entire computer.
253,541
How to get Field values of a list item using CSOM Powershell? I am using below code: ``` foreach($field in $List.Fields) { write-host $field } ``` I am getting the values as output: ``` Microsoft.SharePoint.Client.Field Microsoft.SharePoint.Client.FieldDataTime Microsoft.SharePoint.Client.FieldLookup ``` But I want all field values like ID, Title, Created By etc.
2018/11/30
[ "https://sharepoint.stackexchange.com/questions/253541", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/78229/" ]
Your code does not retrieve any list items. This is an example of how you do it: ``` $listItems = $list.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()) $ctx.load($listItems) $ctx.executeQuery() foreach($listItem in $listItems) { Write-Host "ID - " $listItem["ID"] "Title - " $listItem["Title"] } ``` Credits to: <https://www.c-sharpcorner.com/article/list-item-operations-using-csom-with-powershell-for-sharepoi/>
73,827,697
I have a table to track the mailbox and groups. 1 mailbox will have 3 different groups. I want to check each day's connected status of all mailboxes and groups. I have created the below query but it returns multiple rows. I want to aggregate data like the one below. Could someone please help! ``` Select cast (CreatedDate as Date), Connected, GroupOrMbx, GroupType from [dbo].[Mbx_test] group by cast (CreatedDate as Date), Connected, GroupOrMbx, GroupType ``` Expected output: [![enter image description here](https://i.stack.imgur.com/IKbpn.png)](https://i.stack.imgur.com/IKbpn.png) Table & data ``` CREATE TABLE [dbo].[Mbx_test]( [GroupOrMbx] [varchar](10) NOT NULL, [GroupName] [varchar](255) NULL, [GroupEmail] [varchar](255) NULL, [GroupType] [varchar](10) NULL, [MBXName] [varchar](255) NULL, [MBXEmail] [varchar](255) NULL, [Connected] [bit] NOT NULL, [CreatedDate] [datetime] NOT NULL ) INSERT INTO Mbx_test VALUES ('mbx', NULL, NULL,NULL,'mbx1','mbx1@test.com',1,'2022-09-22'), ('group', 'group1','group1@test.com','W','mbx1','mbx1@test.com',1,'2022-09-22'), ('group', 'group2','group2@test.com','M','mbx1','mbx1@test.com',1,'2022-09-22'), ('group', 'group3','group3@test.com','R','mbx1','mbx1@test.com',1,'2022-09-22'), ('mbx', NULL, NULL,NULL,'mbx2','mbx2@test.com',1,'2022-09-22'), ('group', 'group4','group4@test.com','W','mbx2','mbx2@test.com',1,'2022-09-22'), ('group', 'group5','group5@test.com','M','mbx2','mbx2@test.com',1,'2022-09-22'), ('group', 'group6','group6@test.com','R','mbx2','mbx2@test.com',1,'2022-09-22'), ('mbx', NULL, NULL,NULL,'mbx3','mbx3@test.com',0,'2022-09-22'), ('group', 'group7','group7@test.com','W','mbx3','mbx3@test.com',0,'2022-09-22'), ('group', 'group8','group8@test.com','M','mbx3','mbx3@test.com',0,'2022-09-22'), ('group', 'group9','group9@test.com','R','mbx3','mbx3@test.com',0,'2022-09-22'), ('mbx', NULL, NULL,NULL,'mbx4','mbx4@test.com',0,'2022-09-22'), ('group', 'group10','group10@test.com','W','mbx4','mbx4@test.com',0,'2022-09-22'), ('group', 'group11','group11@test.com','M','mbx4','mbx4@test.com',0,'2022-09-22'), ('group', 'group12','group12@test.com','R','mbx4','mbx4@test.com',0,'2022-09-22') ``` Code is saved here <https://dbfiddle.uk/WRW7xKeO>
2022/09/23
[ "https://Stackoverflow.com/questions/73827697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8756709/" ]
A statement using conditional aggregation returns the expected results: ``` SELECT CreatedDate, Connected, COUNT(CASE WHEN GroupOrMbx = 'mbx' THEN GroupOrMbx END) AS [Mbx], COUNT(CASE WHEN GroupOrMbx = 'group' THEN GroupOrMbx END) AS [Group], COUNT(CASE WHEN GroupType = 'W' THEN GroupType END) AS [W], COUNT(CASE WHEN GroupType = 'M' THEN GroupType END) AS [M], COUNT(CASE WHEN GroupType = 'R' THEN GroupType END) AS [R] FROM Mbx_test GROUP BY CreatedDate, Connected ```
19,475,475
I tried to use the code below : ``` read choice case $choice in "1") less /var/log/messages if [$? -ne 0]; then less /var/log/syslog fi ;; etc etc etc *) echo "Please enter a choice between 1 and 20";; esac ``` when executing ./myScript.sh I got this : ``` ./myScript.sh: line 4: [1: command not found ``` I can't find the problem !
2013/10/20
[ "https://Stackoverflow.com/questions/19475475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2899642/" ]
In your `if` statement, put space after `[` and before `]`, as ``` if [ $? -ne 0 ]; then ```
1,206,750
Let $$f(x)= \sum\_{n=0}^{\infty} \frac{x^n}{n!} $$ for $x\in \mathbb R$. Show $f′ =f$. **Note:** Do not use the fact that $f(x) = e^x$. This is true but has not been established at this point in the text.
2015/03/25
[ "https://math.stackexchange.com/questions/1206750", "https://math.stackexchange.com", "https://math.stackexchange.com/users/130272/" ]
If the series converges uniformly to $f$ then you may use termwise derivative then for any $x \in Dom f$ we have $$\require{cancel} f' (x) = \frac{d}{dx}\bigg(\sum\_{n=0}^{\infty} \frac{x^n}{n!}\bigg) = \sum\_{n=0}^{\infty} \frac{d}{dx}\bigg(\frac{x^n}{n!}\bigg) = \sum\_{n=1}^{\infty} \frac{n x^{n-1}}{n!} = \sum\_{n=1}^{\infty} \frac{\cancel nx^{n-1}}{\cancel n(n-1)!} = \sum\_{n=0}^{\infty} \frac{x^n}{n!} = f(x)$$
41,660,580
I have environment variables in my application.properties like this `spring.mail.username=${username}` The `${username}` is declare in eclipse environment variable. When I build maven package and install, then deploy it to tcServer. The TC Server does not know `${username}`. Another word, the environment variables do not include in the war file during build. How do I get the environment variable in eclipse to include in war file for deployment?
2017/01/15
[ "https://Stackoverflow.com/questions/41660580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3184890/" ]
Use a click counter, so when you click on the button the second time, it shows the "edit" button and resets the counter back to 0. When you then click on the "ok" button it changes back to the "edit" button, and because you now have done the first edit, next time you click on the button it changes to "ok" right away. ``` $('.edit').each(function() { var clickCounter = 0, // Sets click counter to 0 - No clicks done yet firstEdit = false; // Sets first edit to false $(this).on('click', function() { clickCounter++; if( clickCounter == 2 || firstEdit == true ) { $(this).toggle(); $(this).next('.ok').toggle(); clickCounter = 0; // Reset counter firstEdit = true; } }); }); $('.ok').on('click', function() { $(this).toggle(); $(this).prev('.edit').toggle(); }); ``` [Working Fiddle](https://jsfiddle.net/9zw2a2x3/3)
15,852,123
I am learning to write thread-safe programs and how to evaluate codes which are not thread safe. A class is considered thread-safe if it function correctly when executed by multiple threads. My Counter.java is not a thread-safe one, however the output was printed as expected from 0-9 for all 3 threads. Can anyone explains why? and how thread-safety works? ``` public class Counter { private int count = 0; public void increment() { count++; } public void decrement() { count--; } public void print() { System.out.println(count); } } public class CountThread extends Thread { private Counter counter = new Counter(); public CountThread(String name) { super(name); } public void run() { for (int i=0; i<10; i++) { System.out.print("Thread " + getName() + " "); counter.print(); counter.increment(); } } } public class CounterMain { public static void main(String[] args) { CountThread threadOne = new CountThread("1"); CountThread threadTwo = new CountThread("2"); CountThread threadThree = new CountThread("3"); threadOne.start(); threadTwo.start(); threadThree.start(); } } ```
2013/04/06
[ "https://Stackoverflow.com/questions/15852123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247814/" ]
Your code runs fine in your specific test. That doesn't mean it will always work fine. Try iterating a lot more times, and you'll probably start seeing anomalies. Your test is a bit like if you tested that a bridge can support 20 trucks by riding on the bridge with a single car. It doesn't demonstrate anything. And demonstrating that th code is thread-safe using a test is almost impossible. Only careful reading and understanding of all the potential problems can guarantee that. A non thread-safe program might work fine for years and suddenly have a bug. To make you counter safe, use an AtomicInteger. EDIT : Also, as noted by @SpringRush, you're not sharing a single counter between threads. Each thread has its own counter. So your code is actually thread-safe, but I don't think it does what you intend it to do.
50,106,748
Please could someone guide me on a good practice using 'Error Handling' approaches with my 'working' (Swift 4) code below... (eg: 'Guards', 'Do', 'Catch', Throw', 'if', 'else')... //// Import //// import UIKit import CoreData //// Custom Function //// func insertCoreData(){ if let coreData = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext { let data = MyEntity(entity: MyEntity.entity(), insertInto: coreData) data.name = "Joe Blogs" data.country = "United Kingdom" try? coreData.save() print("Data Saved...") } } //// Output Function /// insertCoreData() // Working and Gives
2018/04/30
[ "https://Stackoverflow.com/questions/50106748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
you can do this by updating the default style. you must update the AndroidManifest.template.xml by somethink like ``` <application android:persistent="%persistent%" android:restoreAnyVersion="%restoreAnyVersion%" android:label="%label%" android:debuggable="%debuggable%" android:largeHeap="%largeHeap%" android:icon="%icon%" android:theme="@style/myAppTheme" android:hardwareAccelerated="%hardwareAccelerated%"> ``` and then you must provide a style.xml with the setting you need (like make the statusbar translucent) exemple of style.xml : ``` <?xml version="1.0" encoding="utf-8"?> <resources> <style name="myAppTheme" parent="@android:style/Theme.Material.Light.NoActionBar"> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item> <item name="android:windowDrawsSystemBarBackgrounds">false</item> <item name="android:colorPrimary">#ff2b2e38</item> <item name="android:colorAccent">#ff0288d1</item> <item name="android:windowBackground">@drawable/splash_screen</item> <item name="android:statusBarColor">#ff0087b4</item> </style> </resources> ``` see exemple of a demo app that override the default style at <https://github.com/Zeus64/alcinoe> (demo is alfmxcontrols)
52,550,699
I have set the state of a array as [] empty, in componentDidMount i am getting the API Response.. now i want to set the state of the empty array with the new array of json response how can i do this? ``` constructor(props) { super(props) this.state = { categoryList : [] } } componentDidMount() { axios.get('http:xxxxxxxxxxxxxxxxxxxxxxx') .then(res => { this.setState = { categoryList : res.data.body.category_list(json path) } }) .catch(function(error) { console.log('Error on Authentication' + error); }) } ```
2018/09/28
[ "https://Stackoverflow.com/questions/52550699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10319533/" ]
1. If you are using Bitrise, go to 'Xcode Archive & Export for iOS' step. 2. Scroll down and expand the 'Debug' section. Scroll down to 'Do a clean Xcode build before the archive?' and change this to 'yes'. 3. Save your settings start a new build, do not rebuild as it will use the old settings.
51,617,624
I have two lists named `extra` and `be` in my code. `extra` output is `[7,27]` and `be` output is ```python 'Feed Forage', '', '', '', 'Social Play', '', 'Feed Forage', 'Nonsocial Play', '', 'Nonsocial Play', '', '', '', '', 'Nonsocial Play', '', '', '', '', '', '', '', '', 'Social Play', '', '', '', '', '', '', '', '', 'Nonsocial Play', 'Groom', 'Feed Forage', '', '', 'Nonsocial Play', '', '', 'Feed Forage', '', 'Feed Forage', '', 'Feed Forage', '', 'Social Play', '', 'Social Play', '', '', 'Social Play', '', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', '', '', 'Feed Forage', '', '', '', '', '', 'Feed Forage', '', '', '', 'Groom', 'Groom', '', '', '', '', 'Groom', 'Groom', 'Groom', '', 'Groom', '', '', '', 'Feed Forage', '', '', 'Feed Forage', 'Nonsocial Play', '', '', '', 'Pace', '', '', '', 'Feed Forage', '', 'Nonsocial Play', '', 'Feed Forage', '', 'Social Play', '', 'Feed Forage', '', 'Social Play', '', 'Social Play', '', '', '', '', '', 'Nonsocial Play', '', 'Social Play', '', '', '', '', 'Feed Forage', '', '', '', '', '', '', '', 'Nonsocial Play', '', 'Nonsocial Play', '', 'Feed Forage', 'Social Play', '', '', '', 'Feed Forage', '', 'Nonsocial Play', '', '', 'Feed Forage', '', '', '', '', 'Self Groom', '', '', 'Groom', '', '', 'Self Groom', '', '', '', '', '', 'Groom', '', '', 'Self Groom', '', '', 'Feed Forage', '', '', '', '', '', 'Pace', '', 'Self Groom', '', '', '', 'Self Groom', '', 'Self Groom', '', 'Social Play', '', 'Social Play', '', 'Self Groom', 'Groom', '', '', 'Groom', '', 'Groom', '', 'Groom', 'Groom', 'Groom', '', '', 'Self Groom', '', 'Groom', '', 'Groom', '', 'Feed Forage', '', 'Feed Forage', '', 'Feed Forage', '', '', '', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', 'Nonsocial Play', '', '', 'Self Groom', 'Nonsocial Play', '', '', '', 'Groom', '', '', 'Groom', '', 'Groom', '', '', 'Groom', '', '', 'Groom', '', '', 'Groom', '', '', '', '', '', '', 'Groom', 'Groom', '', 'Groom', '', '', 'Groom', '', '', '', 'Self Groom', '', '', '', '', '', '', 'Groom', '', 'Groom', '', 'Feed Forage', ''] ``` I need to find the 7th and 27th word elements of `extra` (i.e. elements don't count if they are an empty string). It should be `Nonsocial Play` and `Groom` but the for-loop I have only prints `Nonsocial Play` These are the for-loops I am using: ``` for x in extra: count = 0 for y in be: if y != '': if x == count: print(be[x]) count += 1 elif x != count: count += 1 ``` If you have any idea why it isn't working, please let me know! EDIT: I want to print these statements but I also need to delete them
2018/07/31
[ "https://Stackoverflow.com/questions/51617624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10000684/" ]
I created simple function `filter_iter(itr)` that filters the iterable in argument `itr` from any empty values. Then you can access the resulting filtered list with values from list `extra`: ``` extra = [7,27] be = ['Feed Forage', '', '', '', 'Social Play', '', 'Feed Forage', 'Nonsocial Play', '', 'Nonsocial Play', '', '', '', '', 'Nonsocial Play', '', '', '', '', '', '', '', '', 'Social Play', '', '', '', '', '', '', '', '', 'Nonsocial Play', 'Groom', 'Feed Forage', '', '', 'Nonsocial Play', '', '', 'Feed Forage', '', 'Feed Forage', '', 'Feed Forage', '', 'Social Play', '', 'Social Play', '', '', 'Social Play', '', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', '', '', 'Feed Forage', '', '', '', '', '', 'Feed Forage', '', '', '', 'Groom', 'Groom', '', '', '', '', 'Groom', 'Groom', 'Groom', '', 'Groom', '', '', '', 'Feed Forage', '', '', 'Feed Forage', 'Nonsocial Play', '', '', '', 'Pace', '', '', '', 'Feed Forage', '', 'Nonsocial Play', '', 'Feed Forage', '', 'Social Play', '', 'Feed Forage', '', 'Social Play', '', 'Social Play', '', '', '', '', '', 'Nonsocial Play', '', 'Social Play', '', '', '', '', 'Feed Forage', '', '', '', '', '', '', '', 'Nonsocial Play', '', 'Nonsocial Play', '', 'Feed Forage', 'Social Play', '', '', '', 'Feed Forage', '', 'Nonsocial Play', '', '', 'Feed Forage', '', '', '', '', 'Self Groom', '', '', 'Groom', '', '', 'Self Groom', '', '', '', '', '', 'Groom', '', '', 'Self Groom', '', '', 'Feed Forage', '', '', '', '', '', 'Pace', '', 'Self Groom', '', '', '', 'Self Groom', '', 'Self Groom', '', 'Social Play', '', 'Social Play', '', 'Self Groom', 'Groom', '', '', 'Groom', '', 'Groom', '', 'Groom', 'Groom', 'Groom', '', '', 'Self Groom', '', 'Groom', '', 'Groom', '', 'Feed Forage', '', 'Feed Forage', '', 'Feed Forage', '', '', '', '', '', '', '', 'Feed Forage', '', '', '', '', 'Feed Forage', 'Nonsocial Play', '', '', 'Self Groom', 'Nonsocial Play', '', '', '', 'Groom', '', '', 'Groom', '', 'Groom', '', '', 'Groom', '', '', 'Groom', '', '', 'Groom', '', '', '', '', '', '', 'Groom', 'Groom', '', 'Groom', '', '', 'Groom', '', '', '', 'Self Groom', '', '', '', '', '', '', 'Groom', '', 'Groom', '', 'Feed Forage', ''] def filter_iter(itr): return [i for i in itr if i] be = filter_iter(be) print([be[e] for e in extra]) ``` Prints: ``` ['Nonsocial Play', 'Groom'] ```
41,269,038
I have found a code that will predict next values using python scikit-learn linear regression. I am able to predict single data .. but actually I need to predict 6 values and print the prediction of six values. Here is the code ``` def linear_model_main(x_parameters, y_parameters, predict_value): # Create linear regression object regr = linear_model.LinearRegression()< regr.fit(x_parameters, y_parameters) # noinspection PyArgumentList predict_outcome = regr.predict(predict_value) score = regr.score(X, Y) predictions = {'intercept': regr.intercept_, 'coefficient': regr.coef_, 'predicted_value': predict_outcome, 'accuracy' : score} return predictions predicted_value = 9 #I NEED TO PREDICT 9,10,11,12,13,14,15 result = linear_model_main(X, Y, predicted_value) print('Constant Value: {0}'.format(result['intercept'])) print('Coefficient: {0}'.format(result['coefficient'])) print('Predicted Value: {0}'.format(result['predicted_value'])) print('Accuracy: {0}'.format(result['accuracy'])) ``` I tried doing like this: ``` predicted_value = {9,10,11,12,13,14,15} result = linear_model_main(X, Y, predicted_value) print('Constant Value: '.format(result['intercept'])) print('Coefficient: '.format(result['coefficient'])) print('Predicted Value: '.format(result['predicted_value'])) print('Accuracy: '.format(result['accuracy'])) ``` error message is : ``` Traceback (most recent call last): File "C:Python34\data\cp.py", line 28, in <module> result = linear_model_main(X, Y, predicted_value) File "C:Python34\data\cp.py", line 22, in linear_model_main predict_outcome = regr.predict(predict_value) File "C:\Python34\lib\site-packages\sklearn\linear_model\base.py", line 200, in predict return self._decision_function(X) File "C:\Python34\lib\site-packages\sklearn\linear_model\base.py", line 183, in _decision_function X = check_array(X, accept_sparse=['csr', 'csc', 'coo']) File "C:\Python34\lib\site-packages\sklearn\utils\validation.py", line 393, in check_array array = array.astype(np.float64) TypeError: float() argument must be a string or a number, not 'set' C:\> ``` and ``` predicted_value = 9,10,11,12,13,14,15 result = linear_model_main(X, Y, predicted_value) print('Constant Value: '.format(result['intercept'])) print('Coefficient: '.format(result['coefficient'])) print('Predicted Value: '.format(result['predicted_value'])) print('Accuracy: '.format(result['accuracy'])) ``` got these errors ``` C:\Python34\lib\site-packages\sklearn\utils\validation.py:386: DeprecationWarnin g: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0 .19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample. DeprecationWarning) Traceback (most recent call last): File "C:Python34\data\cp.py", line 28, in <module> result = linear_model_main(X, Y, predicted_value) File "C:Python34\data\cp.py", line 22, in linear_model_main predict_outcome = regr.predict(predict_value) File "C:\Python34\lib\site-packages\sklearn\linear_model\base.py", line 200, in predict return self._decision_function(X) File "C:\Python34\lib\site-packages\sklearn\linear_model\base.py", line 185, in _decision_function dense_output=True) + self.intercept_ File "C:\Python34\lib\site-packages\sklearn\utils\extmath.py", line 184, in safe_sparse_dot return fast_dot(a, b) ValueError: shapes (1,3) and (1,1) not aligned: 3 (dim 1) != 1 (dim 0) C:\> ``` and if I make changes like this: ``` predicted_value = 9 result = linear_model_main(X, Y, predicted_value) print('Constant Value: {1}'.format(result['intercept'])) print('Coefficient: {1}'.format(result['coefficient'])) print('Predicted Value: {}'.format(result['predicted_value'])) print('Accuracy: {1}'.format(result['accuracy'])) ``` it will again give me error saying it crosses limit. What has to be done?
2016/12/21
[ "https://Stackoverflow.com/questions/41269038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7302915/" ]
Here is a working example. I have not constructed your functions, just shown you the proper syntax. It looks like you aren't passing the data into `fit` properly. ``` import numpy as np from sklearn import linear_model x = np.random.uniform(-2,2,101) y = 2*x+1 + np.random.normal(0,1, len(x)) #Note that x and y must be in specific shape. x = x.reshape(-1,1) y = y.reshape(-1,1) LM = linear_model.LinearRegression().fit(x,y) #Note I am passing in x and y in column shape predict_me = np.array([ 9,10,11,12,13,14,15]) predict_me = predict_me.reshape(-1,1) score = LM.score(x,y) predicted_values = LM.predict(predict_me) predictions = {'intercept': LM.intercept_, 'coefficient': LM.coef_, 'predicted_value': predicted_values, 'accuracy' : score} ``` ​
8,261,654
I've been evaluating messaging technologies for my company but I've become very confused by the conceptual differences between a few terms: **Pub/Sub** vs **Multicast** vs **Fan Out** I am working with the following definitions: * **Pub/Sub** has publishers delivering a separate copy of each message to each subscriber which means that the opportunity to guarantee delivery exists * **Fan Out** has a single queue pushing to all listening clients. * **Multicast** just spams out data and if someone is listening then fine, if not, it doesn't matter. No possibility to guarantee a client definitely gets a message. Are these definitions right? Or is Pub/Sub the pattern and multicast, direct, fanout etc. ways to acheive the pattern? I'm trying to work the out-of-the-box RabbitMQ definitions into our architecture but I'm just going around in circles at the moment trying to write the specs for our app. Please could someone advise me whether I am right?
2011/11/24
[ "https://Stackoverflow.com/questions/8261654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/536546/" ]
I'm confused by your choice of three terms to compare. Within RabbitMQ, Fanout and Direct are exchange types. Pub-Sub is a generic messaging pattern but not an exchange type. And you didn't even mention the 3rd and most important Exchange type, namely Topic. In fact, you can implement Fanout behavior on a Topic exchange just by declaring multiple queues with the same binding key. And you can define Direct behavior on a Topic exchange by declaring a Queue with `*` as the wildcard binding key. Pub-Sub is generally understood as a pattern in which an application publishes messages which are consumed by several subscribers. With RabbitMQ/AMQP it is important to remember that messages are always published to exchanges. Then exchanges route to queues. And queues deliver messages to subscribers. The behavior of the exchange is important. In Topic exchanges, the routing key from the publisher is matched up to the binding key from the subscriber in order to make the routing decision. Binding keys can have wildcard patterns which further influences the routing decision. More complicated routing can be [done based on the content of message headers](https://stackoverflow.com/questions/3280676/content-based-routing-with-rabbitmq-and-python) using a headers exchange type RabbitMQ doesn't guarantee delivery of messages but you can get guaranteed delivery by choosing the right options(delivery mode = 2 for persistent msgs), and declaring exchanges and queues in advance of running your application so that messages are not discarded.
5,207,187
I have html code `<input onclick="function_name(1)">` and I want to use it in Jquery something like `function function_name(i) { alert(i); }`. It doesn't work, any tips? Thank you.
2011/03/05
[ "https://Stackoverflow.com/questions/5207187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/237681/" ]
``` <input id="myId"/> ``` and ``` $("#myId").click(function() { alert('something'); }); ``` If I have understood you right.
36,802,428
When I put my cursor right on top of the link text, the link is not clickable, but if I put my cursor a little bit below the text, it becomes clickable. I'm learning right now so please explain to me why it's doing that and how to fix it. HTML ``` <!DOCTYPE html> <html Lang="en"> <head> <meta charset="utf-8"> <title>Welcome!</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> ``` ```css *{ margin: 0; padding: 0; } header{ width: 1024px; margin: 0 auto; background-color: #81D4FA; height: 50px; } header h1{ color: white; position: relative; left: 100px; top: 5px; } nav{ margin-top: -20px; margin-right: 100px; } nav ul{ float: right; margin: 0; padding: 0; } nav ul li{ list-style-type: none; display: inline-block; } nav ul li a{ text-decoration: none; color: white; padding: 16px 20px; } a:hover{ background-color: #84FFFF; } .main{ width: 1024px; margin-left: auto; margin-right: auto; } .laptop{ width: 1024px; } .title{ background-color: #0D23FD; height: 50px; width: 300px; position: relative; top: -650px; left: -10px; border-bottom-right-radius: 10px; border-top-right-radius: 10px; } .title h3{ color: white; text-align: center; position: relative; top: 13px; } ``` ```html <header> <h1>Jack Smith</h1> <nav> <ul> <li><a href="#">About</a></li> <li><a href="#">My Work</a></li> <li><a href="#">Contact Me</a></li> </ul> </nav> </header> <div class="main"> <img class="laptop" src="images/laptop.jpg"> <div class="title"> <h3>Front-End Web developer</h3> </div> </div> ```
2016/04/22
[ "https://Stackoverflow.com/questions/36802428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It's because your `<h1>` is a block-level element, which will lay over the menu elements. If you give it `display: inline-block`, it will work as supposed. > > A **block-level element** always starts on a new line and takes up the > full width available (stretches out to the left and right as far as it > can). > > > See my example below. ```css * { margin: 0; padding: 0; } header { width: 1024px; margin: 0 auto; background-color: #81D4FA; height: 50px; } header h1 { color: white; position: relative; left: 100px; top: 5px; display: inline-block; /* Added */ } nav { margin-top: -20px; margin-right: 100px; } nav ul { float: right; margin: 0; padding: 0; } nav ul li { list-style-type: none; display: inline-block; } nav ul li a { text-decoration: none; color: white; padding: 16px 20px; } a:hover { background-color: #84FFFF; } .main { width: 1024px; margin-left: auto; margin-right: auto; } .laptop { width: 1024px; } .title { background-color: #0D23FD; height: 50px; width: 300px; position: relative; top: -650px; left: -10px; border-bottom-right-radius: 10px; border-top-right-radius: 10px; } .title h3 { color: white; text-align: center; position: relative; top: 13px; } ``` ```html <header> <h1>Jack Smith</h1> <nav> <ul> <li><a href="#">About</a> </li> <li><a href="#">My Work</a> </li> <li><a href="#">Contact Me</a> </li> </ul> </nav> </header> <div class="main"> <img class="laptop" src="images/laptop.jpg"> <div class="title"> <h3>Front-End Web developer</h3> </div> </div> ```
31,079,542
``` #include<stdio.h> int main() { char arr[] = "abcdef"; char *ptr = arr; while(*ptr != '\0') ++*ptr++; printf("%s %s",arr,ptr); return 0; } ``` Output: bcdefg It is printing next alphabet of every alphabet given. What exactly is happening?
2015/06/26
[ "https://Stackoverflow.com/questions/31079542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3605325/" ]
I've run into a lot of complicated error scenerios using Kill and created a nifty function to deal with it. Here it is for anyone that is interested. It's pretty simple but will help not having to have such insane error handling involving Kill. Hope it helps you and others out. First Add this function to a/the module: ``` Function KillAndWasKilled(strFilePath As String) As Boolean 'attempt to kill a file and report success; trying to head off all the oddball stuff that can happen in functions when kill is used On Error GoTo ErrHandler Kill strFilePath KillAndWasKilled = True Exit Function ErrHandler: KillAndWasKilled = False End Function ``` Now Replace This: ``` Kill Download_Location ``` With This ``` if dir(Download_Location) <> "" then 'the file exists; if it doesnt exist then there's nothing to attempt to kill! if KillAndWasKilled(Download_Location) = false then 'something went wrong when trying to kill the file err.Raise -666, , "Unable to Delete " & Download_Location end if end if ```
32,515,030
**I am running the following function:** ``` import nltk from nltk.corpus import wordnet as wn def noun_names(list): for synset in list: for lemma in synset.lemmas(): print lemma.name() noun_names(list(wn.all_synsets(wn.NOUN))) ``` **and it returns a long list of all the names of nouns in wordnet:** e.g. ``` epoch Caliphate Christian_era Common_era day year_of_grace Y2K generation anniversary ``` How do I take this output, which is neither a string or a list, and turn it into a list? Thanks so much.
2015/09/11
[ "https://Stackoverflow.com/questions/32515030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5310650/" ]
Example 1: ``` loop { var x = anyobject do something with x } ``` create x and then release x each loop Example 2: ``` var x = anyobject loop { do something with x } ``` x inside the loop has the same memory with x outside the loop. Doesn't create/release each loop or end of the loop
27,426,786
I'm trying to make database for my program and I'm having a lot of dumb problems... It's fragment of main activity: ``` Database db = new Database(this,editText.getText().toString()); String text = db.printRow(); textView.setText(text); ``` Now database class: ``` String nickname="EmptyNick"; public Database(Context context, String name) { super(context, "database.db", null, 1); nickname = name; } public void onCreate(SQLiteDatabase db) { if(!nickname.equals("EmptyNick")) { db.execSQL("create table player(id integer primary key autoincrement,nick text);"); Users user = new Users(); user.setNick("Mariusz"); addPlayer(user); } else { //not important } } private void addPlayer(Users user) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put("nick",user.getNick()); db.insertOrThrow("player",null,values); } public String printRow() { String string=null; if(!nickname.equals("EmptyNick")) { String[] collumns = {"id","nick"}; SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query("player",collumns,null,null,null,null,null); cursor.moveToFirst(); while (cursor.moveToNext()) { string += cursor.getString(1); } } else { //not important } return string; } ``` Errors: no such table: player Caused by: java.lang.reflect.InvocationTargetException Caused by: android.database.sqlite.SQLiteException: no such table: player (code 1): , while compiling: SELECT id, nick FROM player I really can't see what's wrong. Error says there is no table 'player', but it is. On the beggining of onCreate methon in line: ``` db.execSQL("create table player(id integer primary key autoincrement,nick text);"); ``` Can somebody help me? If I make Toast instead of text.setText(...) it shows me empty field, so yes, it can't create specific row. I understand the error, but do not from where and why it comes.
2014/12/11
[ "https://Stackoverflow.com/questions/27426786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4334269/" ]
No need to delete from your list. Just shuffle it and iterate over it once. It will be faster and you can reuse your original list. So do `random.shuffle(bingo)` then iterate over `bingo`. Here is how to incorporate this into your original code: ``` import random bingo=["H", "He", "C", "O"] random.shuffle(bingo) for item in bingo: if input("Bingo?") == "no": print item else: break ```
3,508,701
Where are they stored? And is there a way to determine when they get deleted? Is there a way to make it so that they are never deleted, so as to improve performance for example? Another issue - in a busy hosting environment how big could all the dll's get? Let's say if you have 1000 medium websites?
2010/08/18
[ "https://Stackoverflow.com/questions/3508701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239362/" ]
> > Where are they stored? > > > It depends on if you compile them before deployment or after deployment. If you compile them before deployment you will deploy them directly to the /bin folder of your app. This is what I normally do. If you let asp.net compile after deployment there are a couple places they can end up, and it's not something I usually concern myself with. They are only re-compiled if something in the site changes, and so they are not deleted ever, merely over-written. The size of a compiled dll file is generally comparable to that of the source files that are used to build it. Note that these .Net dlls consist mainly of IL and do not yet have fully-compiled native code. They will be taken the rest of the way to native code when your app is started (in asp.net: when the first http request comes in) by the just-in-time compiler. You can use a tool like ngen to pre-compile them, but this is not normally the best option. Again, the location of this final code is not something I normally concern myself with.
355,517
This seems like pretty basic experiment, but I'm having a lot of trouble with it. Basically, I have two timer gates that measure time between two signals, and I drop metal ball between them. This way I'm getting distance traveled, and time. Ball is dropped from right above the first gate to make sure initial velocity is as small as possible (no way to make it 0 with this setup/timer). I'm assuming $v$ initial is $0 \frac{m}{s}$. Gates are $1$ meter apart. Times are pretty consistent, and average result from dropping ball from $1.0$ meters is $0.4003$ seconds. So now I have $3$ [constant acceleration] equations that I can use to get $g$. 1. $$d\_{traveled} = v\_{initial} . t + \frac{1}{2} a t^2$$ $$a = \frac{2d}{t^2}$$ $$a = \frac{2.1}{(.4003)^2}$$ $$a = 12.48 \frac{m}{s^2}$$ 2. $$v\_f^2 = v\_i^2 + 2ad$$ $$a = \frac{v\_f^2-v\_i^2}{2d}$$ $$v\_f = \frac{distance}{time}=\frac{1.0}{0.4003}=2.5 \frac{m}{s}$$ $$a = \frac{(2.5 \frac{m}{s})^2}{2.1 m}$$ $$a = 3.125 \frac{m}{s^2}$$ 3. $$v\_f = v\_i + at$$ $$a= \frac{v\_f-v\_i}{t}$$ $$a = \frac{2.5 m/s - 0}{ 0.4003 s}$$ $$a = 6.25 \frac{m}{s^2}$$ I'm getting three different results. And all of them are far from $9.8\frac{m}{s^2}$ . No idea what I'm doing wrong. Also, if I would drop that ball from different heights, and plot distance-time graph, how can I get acceleration from that?
2017/09/05
[ "https://physics.stackexchange.com/questions/355517", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/168267/" ]
The time you should be getting is $0.4516$ seconds. The measurement is off by $0.05$ seconds. This is reason why you are getting $12.48$ instead of $9.8$. This is one of the cases where even small errors in calculations can give you very wrong answers. Since the time is squared, it will bring more error to the answer. Moving on, in your second and third calculations, you used a very wrong formula to get final velocity. The relation,$Velocity=\frac{Distance}{Time}$, can only be used when motion in uniform (unaccelerated). But since the body is falling under gravity, the motion is accelerated. Therefore, the last two calculations will always give wrong results because the usage of equations is wrong. However, the equations used in first equation are correct.
71,401
In the biblical texts of Genesis, God is the one who creates everything into existence. If that was the case then why would God need to send Jesus as a sacrifice for the sins of humanity? God should not be required to function within a system of checks and balances as God is the creator in the first place. Furthermore isn't it much more feasible for God to just show off the heavenly splendor such that everybody will believe instead of getting Jesus killed for the sins of humanity?
2019/06/15
[ "https://christianity.stackexchange.com/questions/71401", "https://christianity.stackexchange.com", "https://christianity.stackexchange.com/users/45829/" ]
Christ could have made superabundant satisfaction for our sin with one drop of His Precious Blood, as St. Bernard said, so His passion was not necessary in the sense of "anything which of its nature cannot be otherwise" ([*Summa Theologica* III q. 46 a. 1 "Whether it was necessary for Christ to suffer for the deliverance of the human race?"](https://isidore.co/aquinas/summa/TP/TP046.html#TPQ46A1THEP1) co.). Yet, the Passion was necessary in another sense, for these achieving these purposes ([*ibid*.](https://isidore.co/aquinas/summa/TP/TP046.html#TPQ46A1THEP1)): > > 1. on our part, who have been delivered by His Passion, according to [John (3:14)](http://drbo.org/cgi-bin/d?b=drl&bk=50&ch=3&l=14-#x): "The Son of man must be lifted up, that whosoever believeth in Him may not perish, but may have life everlasting." > 2. on Christ's part, who merited the glory of being exalted, through the lowliness of His Passion: and to this must be referred [Lk. 24:26](http://drbo.org/cgi-bin/d?b=drl&bk=49&ch=24&l=26-#x): "Ought not Christ to have suffered these things, and so to enter into His glory?" > 3. on God's part, whose determination regarding the Passion of Christ, foretold in the Scriptures and prefigured in the observances of the Old Testament, had to be fulfilled. And this is what St. Luke says ([22:22](http://drbo.org/cgi-bin/d?b=drl&bk=49&ch=22&l=22-#x)): "The Son of man indeed goeth, according to that which is determined"; and ([Lk. 24:44](http://drbo.org/cgi-bin/d?b=drl&bk=49&ch=24&l=44-#x),[46](http://drbo.org/cgi-bin/d?b=drl&bk=49&ch=24&l=46-#x)): "These are the words which I spoke to you while I was yet with you, that all things must needs be fulfilled which are written in the law of Moses, and in the prophets, and in the psalms concerning Me: for it is thus written, and thus it behooved Christ to suffer, and to rise again from the dead." > > >
6,594,814
Our team is assigned a project on database. We are all set to start. But we will be working at our homes. Each member is given tables to create, insert MBs of data, and write one table-orientes triggers and stored pros. But ultimately we will have to merge then in a single database file and each member will be having his .mdf file of his tables. How to we merge these tables??? We need to combine all the data into a single database file only.... Please bear with me if this question is a cake! I'm just a newbie :-)
2011/07/06
[ "https://Stackoverflow.com/questions/6594814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/825901/" ]
Moving objects from one database to another is easily achieved by scripting the objects. <http://msdn.microsoft.com/en-us/library/ms178078.aspx> Once the individual work is done, script out the tables, stored procedures, triggers, views, etc, and create them in your target database (this can be on a different server). Then you can use the Import and Export Wizard to move your data. <http://msdn.microsoft.com/en-us/library/ms140052.aspx>
143,774
So, I installed the Android SDK, Eclipse, and the ADT. Upon firing up Eclipse the first time after setting up the ADT, this error popped up: ``` [2012-05-29 12:11:06 - adb] /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory [2012-05-29 12:11:06 - adb] 'adb version' failed! /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory [2012-05-29 12:11:06 - adb] Failed to parse the output of 'adb version': Standard Output was: Error Output was: /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory [2012-05-29 12:11:06 - adb] /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory [2012-05-29 12:11:06 - adb] 'adb version' failed! /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory [2012-05-29 12:11:06 - adb] Failed to parse the output of 'adb version': Standard Output was: Error Output was: /home/drsmith/Downloads/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory ``` I'm not quite sure how this is. Feels weird that there's a missing library there. I'm using Ubuntu 12.04. No adb is a pretty big blow as an Android developer. How do I fix?
2012/05/29
[ "https://askubuntu.com/questions/143774", "https://askubuntu.com", "https://askubuntu.com/users/27601/" ]
Android SDK platform tools requires `ia32-libs`, which itself is a big package of libraries: ``` sudo apt-get install ia32-libs ``` --- **UPDATE:** Below are the [latest instructions from Google](https://developer.android.com/sdk/installing/index.html?pkg=tools) on how to install Android SDK library dependencies: > > If you are running a 64-bit distribution on your development machine, you need to install additional packages first. For Ubuntu 13.10 (Saucy Salamander) and above, install the `libncurses5:i386`, `libstdc++6:i386`, and `zlib1g:i386` packages using `apt-get`: > > > > ``` > sudo dpkg --add-architecture i386 > sudo apt-get update > sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386 > > ``` > > For earlier versions of Ubuntu, install the `ia32-libs` package using `apt-get`: > > > > ``` > apt-get install ia32-libs > > ``` > >
149,592
Till now I have used a following flow for training a random forest model. ``` create 10 folds of data. for each fold i: - use ith fold as validation data - use remaining 9 folds as training data - apply normalization on training and validation data - # apply feature selection on training data - # select same features from validation data - train random forest on training data - predict values for validation data combine all predictions. ``` Now I want to do feature selection using `varImp()` function. I am confused as it is said that `varImp` itself trains a model on training data to find out best set of features. How should I use `varImp` to get important features (say using `partial least squares`) and then again apply training model on training data?
2015/05/04
[ "https://stats.stackexchange.com/questions/149592", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/46224/" ]
This sounds a lot like recursive feature elimination. See the [caret help page for feature selection](http://topepo.github.io/caret/featureselection.html).
405,533
I ordered an ssl certificate from InstantSSL and got the following pair of files: > > my\_ip.ca-bundle, my\_ip.crt > > > I also previously generated my own key and crt files using openssl. I concatenated all the crt files: > > cat my\_previously\_generted.crt my\_ip.ca\_bundle my\_ip.crt > chained.crt > > > And configured nginx as follows: ``` server { ... listen 443; ssl on; ssl_certificate /home/dmsf/csr/chained.crt; ssl_certificate_key /home/dmsf/csr/csr.nopass.key; ... } ``` I don't have a domain name as per the clients request. When I open the browser with `https://my_ip` chrome gives me this error: ``` The site's security certificate is not trusted! You attempted to reach my_ip, but the server presented a certificate issued by an entity that is not trusted by your computer's operating system. This may mean that the server has generated its own security credentials, which Google Chrome cannot rely on for identity information, or an attacker may be trying to intercept your communications. You should not proceed, especially if you have never seen this warning before for this site. ``` Is there any way to make an ssl certificate work with only an IP address? Or am I forced to get a domain name to get a proper https connection to my site?
2012/07/06
[ "https://serverfault.com/questions/405533", "https://serverfault.com", "https://serverfault.com/users/64674/" ]
First of all, when you open the site in Chrome and you view the certificate properties, is it the right certificate? If not, fix your nginx so it's serving the right cert. I can't really help there. Assuming it's correct, the IP address needs to be defined in the certificate for the browser to trust it. Specifically, it either needs to be set as the Common Name (CN) or a DNS value in the Subject Alternative Name. Note, there's an IP address value that you can use in the Subject Alternative Name, but Chrome doesn't use it. It only trusts the IP value if it's in a DNS entry.
4,487,189
Taking the combintorialist point of view that a cycle of a permutation$~\sigma$ of a finite set $S$ is an orbit of the action of the subgroup generated by$~\sigma$ in its (natural) action on$~S$, it is known that whenever $S$ admits $k$-cycles at all (so $0<k\leq n$ where $n$ is the size of $S$), the expected number of $k$-cycles of$~\sigma$ where $\sigma$ is chosen uniformly at random among all permutations of$~S$, is precisely$~\frac1k$. Stated differently, the statistic "number of $k$-cycles" takes an average value of$~\frac1k$ when $\sigma$ runs over all permutations of$~S$. I am looking for nice, intuitive, transparent, proofs of this fact, notably where the fraction$~\frac1k$ comes about naturally, preferably as the probability of obtaining a specific value when choosing an element uniformly from a $k$-element set. While I know a few easy computations that prove the result, none I've seen so far have achieved this highest standard, though some arrive at the fraction after some very basic cancellations. The cases $k=1$ (the expected number of fixed points of a permutation is precisely $1$) and $k=n$ (there are $(n-1)!$ distinct cyclic permutations of $S$, which is $\frac1n$ of all permutations) are very well known and with easy proofs, but I would like a proof that covers all allowed values of $k$ in a uniform manner. I've seen quite a few questions on this site that come close to this one, but few state the result in isolation and none specifically ask for elegant arguments, so I don't feel this question is truly a duplicate of any of them. --- This question was inspired by watching [this video](https://www.youtube.com/watch?v=iSNsgj1OCLA&t=706s) (with a rather click-bait title) where the deduction of the case for $k=n$ (from 8:17 on) is followed by the irrefutable argument "this is a general result" (implying it's validity for all $k$) with no mention of expectation (for $k=n$ the only possible numbers of cycles are $0$ and $1$, so the expected value is just a probability) and no explanation whatsoever.
2022/07/06
[ "https://math.stackexchange.com/questions/4487189", "https://math.stackexchange.com", "https://math.stackexchange.com/users/18880/" ]
One argument is that looking at a particular single element, the probability that the cycle that element is in is of length $k$ is $\frac1n$. (A *seats on a plane* argument justifies this.) So the expected number of elements finding themselves in a cycle of length $k$ is $n\left(\frac1n\right)=1$, by linearity of expectation. Since cycles of length $k$ have $k$ elements, the expected number of cycles of length $k$ is $\frac1k$.
37,522,050
I didn't find a way to perform optimize.minimize from scipy with a multidimensional function. In nearly all examples an analytical function is optimized while my function is interpolated. The test data set looks like this: ``` x = np.array([2000,2500,3000,3500]) y = np.array([10,15,25,50]) z = np.array([10,12,17,19,13,13,16,20,17,60,25,25,8,35,15,20]) data = np.array([x,y,z]) ``` While the function is like F(x,y) = z What I want to know is what happens at f(2200,12) and what is the global maximum in the range of x (2000:3500) and y (10:50). The interpolation works fine. But finding the global maximum doesn't work so far. The interpolation ``` self.F2 = interp2d(xx, -yy, z, kind, bounds_error=False) ``` yields ``` <scipy.interpolate.interpolate.interp2d object at 0x0000000002C3BBE0> ``` I tried to optimize via: ``` x0 = [(2000,3500),(10,50)] res = scipy.optimize.minimize(self.F2, x0, method='Nelder-Mead') ``` An exception is thrown: ``` TypeError: __call__() missing 1 required positional argument: 'y' ``` I think that the optimizer can't handle the object from the interpolation. In the examples the people used lambda to get values from their function. What do I have to do in my case? Best, Alex
2016/05/30
[ "https://Stackoverflow.com/questions/37522050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4808110/" ]
First, to find global maximum (instead of minimum) you need to interpolate your function with opposite sign: ``` F2 = interp2d(x, y, -z) ``` Second, the callable in `minimize` takes a tuple of arguments, and `interp2d` object needs input coordinates to be given as separate positional arguments. Therefore, we cannot use `interp2d` object in `minimize` directly; we need a wrapper that will unpack a tuple of arguments from `minimize` and feed it to `interp2d`: ``` f = lambda x: F2(*x) ``` And third, to use `minimize` you need to specify an initial guess for minimum (and bounds, in your case). Any reasonable point will do: ``` x0 = (2200, 12) bounds = [(2000,3500),(10,50)] print minimize(f, x0, method='SLSQP', bounds=bounds) ``` This yields: ``` status: 0 success: True njev: 43 nfev: 243 fun: array([-59.99999488]) x: array([ 2500.00002708, 24.99999931]) message: 'Optimization terminated successfully.' jac: array([ 0.07000017, 1. , 0. ]) nit: 43 ```
17,881,115
in my app i want to calculate the distance between two points that has a latitude and a longitude. i managed to get the equations used to calculate it from this website (<http://andrew.hedges.name/experiments/haversine/>) and here is the equations: ``` dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2 c = 2 * atan2( sqrt(a), sqrt(1-a) ) d = R * c (where R is the radius of the Earth ``` so i translate them as code, here it is: ``` float distanceLongitude = lon2 - lon1; float distanceLatitude = lat2 - lat1; float a = powf(sinf((distanceLatitude/2)), 2) + cosf(lat1) * cosf(lat2) * powf((sinf(distanceLongitude/2)),2); float c = 2 * atan2f(sqrtf(a), sqrtf(1-a)); float d = 6373 * c; //6373 radius of earth ``` i tried the code with the following coordinates: lat1 = 33.854025 lon1 = 35.506923 lat2 = 33.856835 lon2 = 35.506324 according to the website, the results are 0.317 km or 0.197 miles. however, my code's output is giving me 18.143757. how can i fix that? (please check the converter in the website to know what i'm talking about. Note: d should be the final result.
2013/07/26
[ "https://Stackoverflow.com/questions/17881115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2176995/" ]
Why wouldn't you use the Apple API to calculate this distance? You could just perform something like this: ``` CLLocation *locA = [[CLLocation alloc] initWithLatitude:lat1 longitude:long1]; CLLocation *locB = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; CLLocationDistance distance = [locA distanceFromLocation:locB]; ``` Note that CLLLocationDistance it's just a typedef to a float, and the distance variable will have the value in meters.
2,557,492
I am in the UK, studying GCSE, if that means anything to you. What would you recommend to me, to further my understanding of mathematics, of my current level or further? Thanks.
2017/12/08
[ "https://math.stackexchange.com/questions/2557492", "https://math.stackexchange.com", "https://math.stackexchange.com/users/511660/" ]
I would recommend a two-pronged approach! Strengthening your algebra and problem solving skills beyond what is covered in GCSE would be very valuable. Books such as 'Student Problems from the Mathematical Gazette', ISBN 0 906588 49 9, available from the Mathematical Association, would provide good challenges for you. For general appreciation of Mathematics (which should whet your appetite for your future maths education) there are many good and popular books - for example '17 equations that changed the world' by Ian Stewart.
51,273,604
For example I'm writing an email (console) based application for fun. I was trying to incorporate files into it to read the information from it. For example if my txt format is as following how can I read each variable? ``` Server: gmail User: test@mail.com Password: pass123 To: to@mail.com CC: to@mail.com, to@mail.com, to@mail.com BCC: to@mail.com, to@mail.com Subject: subject Body: 123 454 6464 This is still part of the body File: filename.zip ``` However, the CC and BCC should be a string array I believe, right?
2018/07/10
[ "https://Stackoverflow.com/questions/51273604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7833897/" ]
* Create 2 layers using `::before` and `::after`pseudo elements having same heights equal to 50% height of the parent element. * Apply `background`, `border-radius` and other necessary CSS properties on these layers. * Use `skewX()` transformation on hover to create the triangular effect. **Demo:** ```css *, *::before, *::after { box-sizing: border-box; } body { background: #333 url("https://k39.kn3.net/A01CCB6AE.jpg") no-repeat; background-size: cover; height: 100vh; padding: 10px; margin: 0; } .nav { font-family: Arial, sans-serif; list-style: none; padding: 0; margin: 0; } .nav li + li { margin-top: 3px; } .nav li a { text-decoration: none; border-radius: 2px; position: relative; padding: 12px 18px; overflow: hidden; display: block; color: #000; } .nav li a::before, .nav li a::after { transition: transform .2s linear; transform-origin: left top; background-color: #dcdcdc; position: absolute; opacity: 0.5; content: ''; height: 50%; z-index: -1; right: 0; left: 0; top: 0; } .nav li a::after { transform-origin: left bottom; top: auto; bottom: 0; } .nav li a:hover::before { transform: skewX(30deg); } .nav li a:hover::after { transform: skewX(-30deg); } ``` ```html <ul class="nav"> <li><a href="#">Item 1</a></li> <li><a href="#">Item 2</a></li> <li><a href="#">Item 3</a></li> <li><a href="#">Item 4</a></li> </ul> ```
64,362,029
Given a **string** resembling HTML **(but not actually HTML)**, how can I use JavaScript to remove all 'HTML tags' except a specific 'tag' (and its 'children')? For instance, if I have the following **string**: ``` '<p><span>Sample data: <math><msqrt><mo>y</mo></msqrt></math></span> <div><strong>hello world</strong><math><msqrt><mo>x</mo></msqrt></math></div></p>' ``` And I only want to keep raw text & 'math tags' (and everything inside each 'math tag'), how would I go about doing that? ``` const html = '<p><span>Sample data: <math><msqrt><mo>y</mo></msqrt></math></span> <div><strong>hello world</strong><math><msqrt><mo>x</mo></msqrt></math></div></p>'; const result = stripNonSpecifiedHTML(html, 'math'); // expected result: // 'Sample data: <math><msqrt><mo>y</mo></msqrt></math>hello world<math><msqrt><mo>x</mo></msqrt></math>' function stripNonSpecifiedHTML(html, tagNameToKeep) { // ... } ```
2020/10/14
[ "https://Stackoverflow.com/questions/64362029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9935570/" ]
It looks rather awful, but it woks (with some limitations): * split the string by `<math>` and `</math>` * remove all html tags in every second element * add `<math>` and `</math>` around every second element * join the array back into a string ```js const html = '<p><span>Initial data: <math><msqrt><mo>y</mo></msqrt></math></span> <div><strong>hello world</strong><math><msqrt><mo>x</mo></msqrt></math></div></p>' var text = html.split('<math>') .map(t => t.split('</math>')).flat() .map((t, i) => {return (i % 2==0 ) ? t.replace(/<.+?>/g,''): t }) .map((t, i) => {return (i % 2==0 ) ? t : '<math>' + t + '</math>' }) .join(''); console.log(text); // OUTPUT: Initial data: <math><msqrt><mo>y</mo></msqrt></math> hello world<math><msqrt><mo>x</mo></msqrt></math> ```
23,794,049
In my application I `$watch` if the form is valid before doing some stuff. The problem is that ngForm won't compile `models` before I use it. Exemple : <http://plnkr.co/edit/Y7dL67Fn7SaSEkjiFf2q?p=preview> **JS** ``` $scope.results = []; $scope.$watch(function() { return $scope.testForm.$valid; }, function( valid ) { $scope.results.push( valid ); } ) ``` **HTML** ``` <ng-form name="testForm" ng-init="test = 1"> <input ng-model="test" required> </ng-form> <p ng-repeat="result in results track by $index" ng-class="{'false': !result, 'true': result}">{{ result }}</p> ``` **Results :** ``` false // Wrong true ``` The form shouldn't be invalid at first because `$scope.test` is set to 1. Any clue ?
2014/05/21
[ "https://Stackoverflow.com/questions/23794049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2099829/" ]
According to **[the docs](https://docs.angularjs.org/api/ng/type/%24rootScope.Scope#%24watch)**: > > After a watcher is registered with the scope, the listener `fn` is called asynchronously (via `$evalAsync`) to initialize the watcher. In rare cases, this is undesirable because the listener is called when the result of `watchExpression` didn't change. To detect this scenario within the listener `fn`, you can compare the `newVal` and `oldVal`. If these two values are identical (===) then the listener was called due to initialization. > > > --- It (almost always) makes sense to ignore this first call using a check: ``` $scope.$watch('testForm.$valid', function (newValue, oldValue) { if (newValue === oldValue) { return; } $scope.results.push(newValue); }); ``` See, also, this **[short demo](http://plnkr.co/edit/UDPcJQtQcXaFnJKmuuoM?p=preview)**.
51,561,762
I am writing the code below in VBA macro excel, my problem is that I get the object our of range error in the line (107, col 10) and I don't know why. the line I get the error ``` .Range(.Cells(x, "A"), .Cells(x, "AC")).Select ``` my code is below ``` Sub MRP() ' ' Macro1 Macro ' ' Dim wks As Worksheet Dim OPwks As Worksheet Dim MRPwks As Worksheet Dim OPDwks As Worksheet Dim DbCwks As Worksheet Dim x As Long Dim p As Integer, i As Long, q As Long Dim a As Integer, m As Integer, k As Long Dim rowRange As Range Dim colRange As Range Dim LastCol As Long Dim LastRowOPwks As Long Dim LastRowMRPwks As Long Dim LastRowDBCwks As Long Set MRPwks = Worksheets("MRP") Set OPwks = Worksheets("OpenPOsReport") Set DbCwks = Worksheets("CompDB") Set wks = ActiveSheet Worksheets("OpenPOsReport").Activate LastRowMRPwks = MRPwks.Cells(MRPwks.Rows.Count, "A").End(xlUp).Row LastRowOPwks = OPwks.Cells(OPwks.Rows.Count, "A").End(xlUp).Row LastRowDBCwks = DbCwks.Cells(DbCwks.Rows.Count, "A").End(xlUp).Row 'Set rowRange = wks.Range("A1:A" & LastRow) 'For m = 8 To LastRow 'Cells(m, "N") = 0 'Next m For i = 2 To LastRowDBCwks p = 0 For q = 8 To LastRowOPwks If DbCwks.Cells(i, "V") = 0 Then k = 0 Else: k = p / Cells(i, "V") If OPwks.Cells(q, "A") = DbCwks.Cells(i, "A") Then If OPwks.Cells(q, "D") = 0 Or OPwks.Cells(q, "B") < 1 / 1 / 18 Then GoTo Nextiteration Else If (OPwks.Cells(q, "C") + DbCwks.Cells(i, "C")) >= (DbCwks.Cells(i, "F") + k) Then OPwks.Cells(q, "N").Value = 1 OPwks.Range(Cells(q, "A"), Cells(q, "N")).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 .PatternTintAndShade = 0 End With Else p = p + OPwks.Cells(q, "D").Value OPwks.Cells(q, "N").Value = 0 OPwks.Range(Cells(q, "A"), Cells(q, "O")).Select With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With End If End If Nextiteration: Next q Next i 'For q = 8 To LastRow ' If Cells(q, "N") = 1 Then ' End If ' Next With MRPwks For x = 5 To LastRowMRPwks If .Cells(x, "AC").Value > 0 Then .Range(.Cells(x, "A"), .Cells(x, "AC")).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 .PatternTintAndShade = 0 End With End If If .Cells(x, "AC") = 0 Then .Range(.Cells(x, "A"), .Cells(x, "AC")).Select With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With End If Next x End With End Sub ``` I dont know why I get the Object out of range error in the first part of the code.
2018/07/27
[ "https://Stackoverflow.com/questions/51561762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9317553/" ]
You have `Worksheets("OpenPOsReport").Activate` in your code, then you try to select `.Range(.Cells(x, "A"), .Cells(x, "AC")).Select` on `MRPwks` which is not active at that time. This is not possible. Change your code to ``` With MRPwks For x = 5 To LastRowMRPwks If .Cells(x, "AC").Value > 0 Then With .Range(.Cells(x, "A"), .Cells(x, "AC")).Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 .PatternTintAndShade = 0 End With End If If .Cells(x, "AC") = 0 Then With .Range(.Cells(x, "A"), .Cells(x, "AC")).Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With End If Next x End With ``` It is not neccessary to select the range first.
39,018,272
I have a task to carry out 3 times a day on a WS2012R2 to get the Disk size, total number of files and folders including subdirectories from a folder on a remote server. Currently I get this information by RDP'ing to the target, navigating to the folder and right clicking the folder to copy the info: [![enter image description here](https://i.stack.imgur.com/JxXFY.png)](https://i.stack.imgur.com/JxXFY.png) I have already tried the PowerShell script : ``` Get-ChildItem E:\Data -Recurse -File | Measure-Object | %{$_.Count} ``` and other PowerShell scripts. Which produced countless errors pertaining to not having permissions for some sub directories or simply gave results I didn't want such. I have tried VBscript but VBscript simply cannot get this information.
2016/08/18
[ "https://Stackoverflow.com/questions/39018272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5142580/" ]
You can just access the count property: ``` $items = Get-ChildItem E:\Data -Recurse -File ($items | Where { -not $_.PSIsContainer}).Count #files ($items | Where $_.PSIsContainer).Count #folders ```
23,338,038
I've tried to give my "get\_threads" variable some additional content, based on the actual case. But it doesn't work as expected, the query isn't executing at all. It looks like there are some blanks that are missing in the "final" variable. But when i add them to the value, the output completely dissapears. The output query is: ``` SELECT id, main_forum_id, icon_id, title, description, author_id, closed, views, posts, date_created, last_post_author_id, last_replyTime FROM forum_thread WHERE main_forum_id= ('1') ORDER BY views ASC LIMIT 0, 20 ``` And that's the code: ``` $get_threads = "SELECT id, main_forum_id, icon_id, title, description, author_id, closed, views, posts, date_created, last_post_author_id, last_replyTime FROM forum_thread WHERE main_forum_id= ('" . $actualBoard . "')"; if (isset($_GET[ 'sortField' ])) { switch ($_GET[ 'sortField' ]) { case topic: $get_threads .= " ORDER BY title ASC "; break; case rating: $get_threads .= " ORDER BY rating ASC "; break; case replies: $get_threads .= " ORDER BY replies ASC "; break; case views: $get_threads .= " ORDER BY views ASC "; break; case lastReply: $get_threads .= " ORDER BY last_replyTime DESC "; break; } } else { $lastReplyClass = 'columnLastPost active'; $get_threads .= " ORDER BY last_replyTime ASC "; } $get_threads .= " LIMIT $start, $perPage"; ``` SOLUTION: Okay, i'm such an idiot.. Had a format function for the time and deleted it. That caused the error: ``` Fatal error: Call to undefined function formatDateString() ```
2014/04/28
[ "https://Stackoverflow.com/questions/23338038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3580759/" ]
``` SELECT id, main_forum_id, icon_id, title, description, author_id, closed, views, posts, date_created, last_post_author_id, last_replyTime FROM forum_thread WHERE main_forum_id= ('1') ORDER BY last_replyTime ASCLIMIT 20, 20 ``` ASCLIMIT ? There has to be a space. You should add a space before your LIMIT and before your ORDER BY ``` $get_threads .= " ORDER BY last_replyTime ASC"; } $get_threads .= " LIMIT $start, $perPage"; ```
45,326,201
I am trying to get the current path of my Angular app. However, this is always returned empty. ``` constructor( private route: ActivatedRoute ) { this.route.url.subscribe(segments => { var currentPath = segments[0].path; console.log("Current Route: ", currentPath); }); } ``` No matter where I navigate, this is always empty: [![enter image description here](https://i.stack.imgur.com/lXcwk.png)](https://i.stack.imgur.com/lXcwk.png) What am I doing wrong here?
2017/07/26
[ "https://Stackoverflow.com/questions/45326201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814241/" ]
If you want to get current route url , you can use this code : ```js import { Router, ActivatedRoute } from '@angular/router'; constructor( private router: Router, private activatedRoute: ActivatedRoute) { console.log(activatedRoute.snapshot.url[0].path); } ``` If you want to get full url of web app . you should use this : ```js window.location.pathname ```
46,329,195
i would like to ask, how to get file(image) from my form.php ,then move file in another folder and get path of picture in Controller.php. I am not sure how to get that file from post. form.php ``` <form method="post"> <input name="image" type="file"><br> <input type="submit" value="Uložit článok" /> </form> ``` Controller.php ``` $folder_path "images/" . $_FILES["image"]["name"] $folder = "images/"; move_uploaded_file($_FILES["image"]["tmp_name"], "$folder" . $_FILES["image"]["name"]); $Manager->AddPhoto($folder); //this is just adding into database ```
2017/09/20
[ "https://Stackoverflow.com/questions/46329195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8588611/" ]
Once you set your response field on successful sending, call next() as a last step, so the next middleware gets the request and sends the response back. So basically: ``` ... res.json(yourResponse); next(); ... ``` Or, if this is the last middleware, send the response back to client: ``` res.send(yourResponse); ```
8,694,492
I was reading Foursquare API and trying to find how to use it for places search (as alternative to Google Places). However I was surprised that it requires the client secret key to be provided always!. I'm using it in the browser, and the only way to get a response is to provide both client secret and client id in the request. It's "Client Secret" there should be another way of doing this, without using the client secret. Google API checks for the referring url and client id. Do Foursquare supports something like this? I know that I can make the request in my server to foursquare and call it from my JavaScript client code. But that would be very ugly (IMO) since user have to wait for doubled response time `user -> my-server -> foursquare-api` instead of just `user -> foursquare-api`. A page in my Web Application that would use it: [Where can I a great place in the city to see Christmas lights in Boston, MA?](http://www.tipntag.com/q/719/where-can-i-a-great-place-in-the-city-to-see-christmas-lights-in-boston-ma), try to share a tip in order to find out (you don't have to really post it!).
2012/01/01
[ "https://Stackoverflow.com/questions/8694492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161278/" ]
It's ugly, yes. But my two cents: If your needs for security greatly outweigh your needs for speed, then use a server-side proxy… It's basically what everyone does, most proxies are disguised in one way or another some are 3rd party services, some are tiny stand-alone rails/express/etc apps, some are just a endpoint on your existing app, some use google appengine, but kid yourself not, most people use a proxy. If your need for speed greatly outweighs your need for security: Then go the "unsafe" way of exposing your key. It's not that bad really as along as you decouple data that's sensitive for your users that does not come from foursquare from data accessed via foursquare. You're only sharing some potentially fake geo data, some potentially fake place data and well, you get picture: it's not your user's financial statements, it's a big game called Foursquare. Worse comes to worse, change your API key once in a while. IMO, in situations like these there is no middle ground, you have to balance it in your head so that one greatly outweighs the other (security vs speed). I have yet to see a situation where both are truly and honestly equally important and nothing can be traded-off.
33,539,774
How can I create Global Helper functions in `react-native`? I would like to use for accessing `sqlite` database or fetching data from server. Can I create a `JavaScript` file with functions and call that functions from multiple views?
2015/11/05
[ "https://Stackoverflow.com/questions/33539774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3714480/" ]
The way we've done it in the past: 1. Create a file that exports a function: ```js module.exports = function(variable) { console.log(variable); } ``` 2. Require the file when you want to use it, in a variable: ```js var func = require('./pathtofile'); ``` 3. Use function: ```js func('myvariable'); ```
52,090,080
so I have this code to send data unto the backend ``` var $word = "minds & brains"; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log(xhttp.responseText); } xhttp.open("GET", 'http://mywebsite.com/controller/sample_controller?keyword='+$word, true); xhttp.send(); ``` but on my php it only gets the mind ``` <?php echo $_GET['keyword']; ``` any ideas, help on how to acquire the exactly word "minds & brains"?
2018/08/30
[ "https://Stackoverflow.com/questions/52090080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1292042/" ]
You need to use [encodeURIComponent](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) to escape the `&` character: ``` xhttp.open("GET", 'http://mywebsite.com/controller/sample_controller?keyword='+ encodeURIComponent($word), true); ```
78,584
I have 12 volt and 135 ampere battery. Now I want to connect a device approximately 300 feet away from the battery. When I connect it at this distance, my device does not work. When I connect the same device to the same battery at a shorter distance, the device does work. What can I do?
2013/08/10
[ "https://electronics.stackexchange.com/questions/78584", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/27347/" ]
The battery is too far away. The voltage drop seems to big. You should have a bigger voltage on the battery side (DC-DC boos converter) or thicker cables. Voltage drop is affected by the current flowing through the cables, length of the cables and cable thickens. You can look for more info here <http://www.buildmyowncabin.com/electrical/copper-wire-resistance.html> . It even has a calculator, so you can just put your values in and get the voltage drop.
47,026,927
I am making a Choose Your Own Story game just as a little project to help me learn Java, and I don't know why this loop is behaving the way it is. The issue is if you enter B when it prompts you to choose an option, it repeats the prompt, "Choose a response:". And if you enter B again, it outputs the right thing. If you enter A, it works fine the first time. I don't know why it takes two times for B to work. I know the code is probably pretty bad other than that as well, so any other advice is also welcome. Here's the code: ``` import java.util.Scanner; import java.util.ArrayList; public class Game { public static void main(String[] args) { Scanner reader = new Scanner(System.in); String storyBlock = "one"; String option; ArrayList<Choices> choiceRepo = new ArrayList<>(); ArrayList<Story> storyRepo = new ArrayList<>(); boolean continueFlag = true; Story one = new Story("one", "The many rolling fields within Argonia are ideal for\n" + "raising sheep, which is what my family has done for generations. In my grandfather's\n" + "day, our village was known all round for having some of the best sheep in the land.\n" + "It's not anymore. For years we've barely had enough sheep to help keep our family fe\n " + "and clothed. It's been tough ever since the Ostians invaded our land and pillaged our towns\n" + "and villages. After years of teetering on the edge of warfare, our countries finally clashed.\n" + "We lost, obviously. Ostia is a much rougher country than ours, and it didn't take long for our\n" + "peace seeking king to surrender his country. Though naive, I have to respect him for doing\n" + "what he thought would save the most lives. And maybe it did save the most lives, but at the\n" + "steep price of our freedom and well being. My village has struggled, but it hasn't been as\n" + "bad as some of the villages that aren't as far out in the hills as we are. I've heard rumors that\n" + "the Dark Hordes have taken to ravaging the countryside again, though, so it's only a matter\n" + "of time until something very bad happens.\n" + "The thought of them coming to my village and having to defend it makes me...\n"); storyRepo.add(one); Choices ch1ChoiceA = new Choices("one", "A", "frightened", "twoA"); choiceRepo.add(ch1ChoiceA); Choices ch1ChoiceB = new Choices("one", "B", "faintly excited at the notion of getting to fight", "twoB"); choiceRepo.add(ch1ChoiceB); Story twoA = new Story("twoA", "...frightened. The Dark Horde is notorious for their savagery,\n" + " and the king lets them loose to keep the populous of our country in fear of him. Their warriors\n" + "are cold blooded killers, and their mages are even worse. Just thinking of coming into contact\n" + "with them makes me stir from the place I have been sitting on the hill. I look up and after a\n" + "quick count I realize that Pud has gone missing. That fluffer, always going over one hill or\n" + "another. I just hope he hasn't gotten lost in the woods again. I might have to chase off another\n" + "bear."); storyRepo.add(twoA); Story twoB = new Story("twoB", "...faintly excited at the notion of getting to fight. Though\n" + " the Dark Horde is notorious for their savagery, I would almost welcome a chance to fight some\n" + "of them. The king lets them loose to keep the populous of our country in fear of him. Their\n" + "warriors are cold blooded killers, and their mages are even worse. This makes me concerned for\n" + "my family and friends, but inside myself I can feel a craving for the adventure they would\n" + "bring. While tending the flock I have fought bears, cougars, and even run into some roving hob\n" + "goblins. My job has been to keep the flock safe, and I am very capable. And it also would give\n" + "me a chance to practice the sword skills my father has been teaching me since he came back from\n" + "the war that we lost. After a quick count realize that Pud has gone missing. That fluffer,\n" + "always going over one hill or another. I just hope he hasn't gotten lost in the woods again."); storyRepo.add(twoB); Choices ch2Choice = new Choices("twoA", "A", "Continue", "three"); choiceRepo.add(ch2Choice); while (continueFlag) { ArrayList<Choices> specificChoices = new ArrayList<>(); for (Story story : storyRepo) { if (story.storyName.equals(storyBlock)) { story.printStory(); for (Choices choice : choiceRepo) { if (choice.storyBlock.equals(storyBlock)) { choice.printChoices(); specificChoices.add(choice); } } } System.out.println("Choose a response: "); option = reader.nextLine(); if (!option.equals("A") && !option.equals("B") && !option.equals("Exit")) { System.out.println("Invalid input. Enter A, B or Exit"); option = reader.nextLine(); } if (option.equals("Exit")) { continueFlag = false; break; } for (Choices specificChoice : specificChoices) { if (specificChoice.option.equals(option)) { storyBlock = specificChoice.result; } } } } } } ```
2017/10/31
[ "https://Stackoverflow.com/questions/47026927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7841544/" ]
I would suggest using `NumberFormatter` and setting its `maximumSignificantDigits` property: ``` let fmt = NumberFormatter() fmt.numberStyle = .decimal //fmt.minimumSignificantDigits = 5 // optional depending on needs fmt.maximumSignificantDigits = 5 var n = 0.43578912 for _ in 0..<5 { print(fmt.string(for: n)!) n *= 10 } ``` Output: > > 0.43579 > > 4.3579 > > 43.579 > > 435.79 > > 4,357.9 > > > You can specify other formatting options as desired such as disabling the grouping separator. Setting `minimumSignificantDigits` will be useful if you want trailing zeros with numbers that have fewer digits.
57,154,739
I got an array like so ``` const array = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1] ``` and what I want is to just locate these ones and get the number of zeroes between these ones, and then return the biggest length of them so in this case it will return 5 and if the case was like so ``` const array = [1,0,0,0,0,0,1] ``` then the output should be 5 either and if there wasn't but one one in the array like so ``` const array = [1,0,0,0] ``` I should get err I have tried to locate the first one using .findIndex() like so ``` const firstOneIndex = intoArray.findIndex(el => el = 1); ```
2019/07/22
[ "https://Stackoverflow.com/questions/57154739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10287480/" ]
```js const arr = [1, 0, 1, 1, 0, 0, 1]; function getDiff(array) { // identify the 1's in the array // strip the array down to a list of only the ones with values. var mapped = array.map((v, i) => { if (v == 1) return i; }).filter(v => v != undefined); var max = 0 var start; var end; // identify the largest gap between 1's for (var ind in mapped) { var gap = mapped[ind] - mapped[ind - 1]; // store largest gap start and stop indexs if (gap > max) { start = ind - 1; end = ind; max = gap; } } // we do mapped[end] +1 because we want to include the last 1 in the splice, not exclude it. var splice = array.splice(mapped[start], mapped[end] + 1); return splice; } console.log(getDiff(arr)); ```
41,554,125
According to answers to this questions [Is overloading on all of the fundamental integer types is sufficient to capture all integers?](https://stackoverflow.com/questions/41552514/is-overloading-on-all-of-the-fundamental-integer-types-is-sufficient-to-capture) overloading of all fundamental types may not be able to handle types like `int8_t` `int64_t` etc. On another side according to documentation [std::ostream formatted output](http://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt) and [std::istream formatted input](http://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt) is implemented exactly by overloading all fundamental types. So on platform where `int8_t` and others could not be handled by such overloading how C++ streams would have to handle them? Would it fail to compile? Would standard library implementors have to provide additional undocumented methods? Something else?
2017/01/09
[ "https://Stackoverflow.com/questions/41554125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/432358/" ]
For integer types, [istream] defines: ``` basic_istream<charT,traits>& operator>>(bool& n); basic_istream<charT,traits>& operator>>(short& n); basic_istream<charT,traits>& operator>>(unsigned short& n); basic_istream<charT,traits>& operator>>(int& n); basic_istream<charT,traits>& operator>>(unsigned int& n); basic_istream<charT,traits>& operator>>(long& n); basic_istream<charT,traits>& operator>>(unsigned long& n); basic_istream<charT,traits>& operator>>(long long& n); basic_istream<charT,traits>& operator>>(unsigned long long& n); ``` Any code of the form `is >> x` may fail to compile if `x` is an integer type that's not in that list. As a quality of implementation issue, an implementation which offers extended integer types could add `operator>>` overloads for those types. This is permitted by [member.functions]/2 (as noted by hvd in comments), talking about classes in the standard library: > > An implementation may declare additional non-virtual member function signatures within a class: > > > [...] > > > * by adding a member function signature for a member function name. > > > A call to a member function signature described in the C ++ standard library behaves as if the implementation declares no additional member function signatures. > > > This is a stronger guarantee than the general rule that implementations may add extensions that don't break conforming programs. The behaviour of conforming programs using SFINAE might be affected by the presence of the extra overloads. --- For output, integer types not in the list will be implicitly convertible to another integer type which is in the list.
26,031,492
What's the easiest way to authenticate into Google BigQuery when on a Google Compute Engine instance?
2014/09/25
[ "https://Stackoverflow.com/questions/26031492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132438/" ]
This is a interesting question, but I believe it doesn't. DI is more about automatic dependency injection. You declare the dependencies and someone, normally a Inversion of Control (IoC) container, injects those deps in your class. Be aware that jsp is converted to a servlet class and `<jsp:include>` is a method call to another servlet class. I suggest the above reading: <http://www.martinfowler.com/articles/injection.html> <http://misko.hevery.com/code-reviewers-guide/>
5,103,113
To create Button and its click event in run time I use: ``` Button b = new Button(); b.Name = "btn1"; b.Click += btn1_Click; ``` But now I have an array of Buttons to create in run time; how to set each button's event - I cannot interpolate because it's not a string. ``` Button[] b = new Button(Count); for (int i=0; i < Count; i++) { b[i] = new Button(); b[i].Name = "btn" + i; b[i].Click += ?????? } ``` what should I do for "?????"
2011/02/24
[ "https://Stackoverflow.com/questions/5103113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/529310/" ]
You can bind all buttons to the same event, so put the line like `b[i].Click += button_Click;`. Then inside the `button_Click` event you can differentiate between the buttons, and take the proper actions. For example: ``` public void button_Click(object sender, ButtonEventArgs e) { if( sender == b[0] ) { //do what is appropriate for the first button } ... } ```
5,101,017
``` $fav = explode("|","0 | 1 | 2 | "); print_r($fav); $fav = array_pop($fav); echo "<br>after <br>"; print_r($fav); ``` what's the problem in my code? i want to remove the last value in the array `$fav`.
2011/02/24
[ "https://Stackoverflow.com/questions/5101017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/612987/" ]
`array_pop` returns last value not remaining part. so change this line `$fav = array_pop($fav);` to `array_pop($fav);`
42,341,537
I have a list of gaming rooms which is created by Spring. Each rooms corresponds some rules (which is enum), and the code is: ``` @Bean List<Room> rooms() { return Arrays.stream(Rules.values()) .map(rule -> new Room(rule)) .collect(Collectors.toList()); } ``` But now I need the rooms to be `@Beans` too: I want Spring to process `@EventListener` annotation in them. However, I don't want to declare them manually in config as the `Rules` enum can be updated in the future. How can I solve this problem? Thanks.
2017/02/20
[ "https://Stackoverflow.com/questions/42341537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2572584/" ]
It can be accomplished by invoking another method which is marked with `@Bean` i.e. creates `Room` bean as shown below ``` @Bean List<Room> rooms() { return Arrays.stream(Rules.values()) .map(rule -> room(rule)) .collect(Collectors.toList()); } @Bean Room room(Rule rule) { return new Room(rule); } ``` This should suffice without need of `@EventListener`. Let know in comments if any more information is required.
563,424
What I'm trying to do is to display the third row first then the second row and then the first row, is there a way to do that? Thanks again in advance for your help. ``` \documentclass{beamer} \begin{document} \begin{frame}{test} $\begin{bmatrix} \pause 1 & -3 & 0 & 5 \\ \pause -1 & 1 & 5 & 2 \\ \pause 0 & 0 & \tfrac{7}{2} & \tfrac{7}{2} \\ \end{bmatrix}$ \end{frame} \end{document} ```
2020/09/20
[ "https://tex.stackexchange.com/questions/563424", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/98778/" ]
You cal use the `calc` library. ``` \documentclass[border=1cm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (3,1); \fill (A) circle (0.1); \fill (B) circle (0.1); \draw (A) node[below] {A} -- (B) node[below] {B} -- ($ (B)!1!-90:(A) $) -- ($ (A)!1!90:(B) $) -- cycle; \end{tikzpicture} \end{document} ``` [![Square](https://i.stack.imgur.com/TwD3t.png)](https://i.stack.imgur.com/TwD3t.png)
55,023
Note: by external website I mean a website that we do not have access to the code. For example www.facebook.com I want to record how many social share clicks we have from our customer newsletters. For example, when a customer receives a newsletter they can click "Share this on Facebook" which shares the hosted version of the newsletter. If I wanted to record these newsletter clicks to our website I understand we'd use Google URL Builder (<https://support.google.com/analytics/answer/1033867?hl=en>) to create a UTM URL but because we're linking to an external site, how do we record this?
2013/11/11
[ "https://webmasters.stackexchange.com/questions/55023", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/10111/" ]
If you cannot insert Analytics Code at the target site then the easiest (and probably only) way would be to send them to a page on your own domain that records the click and then redirects to the intended URL. (This is how e-mail tracking in most professional newsletter software packages works in any case.)
63,302
![2:15 pm](https://i.stack.imgur.com/JlbBRm.png) I have figured out the 1st box which is basic: *I Understand*. What is the answer to the second box, circled in yellow? I am not sure if the circled 25 & 31 are part of the puzzle or just the number of the puzzle.
2018/04/04
[ "https://puzzling.stackexchange.com/questions/63302", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/47598/" ]
I think the one in yellow circle means. > > Equal Time > > >
12,700,708
So this tutorial that I am using is not being as straight forward as I am hoping for. The next step requires the following: "We need to create a class implementing abstract LocationListener class. This class will be registered with Location Manager to receive updates of location. We need to override all four methods of this class, namely onLocationChanged, onProviderDisabled/Enabled, and onStatusChanged. As we are just interested in getting location updates, we will modify the code of onLocationChanged to navigate to the new location received in the map view. This is achieved by calling animateTo method of MapController." I would just like a little bit of advice as to if its a class I need to create on my own (new>Class) method, or is it just code I am supposed to add into another file.
2012/10/03
[ "https://Stackoverflow.com/questions/12700708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1715787/" ]
This is a new addition in [ServiceStack's New API](https://github.com/ServiceStack/ServiceStack/wiki/New-Api) which allows you to document the expected Response Type that the Request DTO will return, e.g. with ``` ReqDTO : IReturn<List<ResDTO>> { ... } ``` Which lets you call using any of the C# Service Clients with: ``` List<ResDTO> response = client.Get(new ReqDto()); ``` If you didn't have the IReturn marker your client call would have to look like: ``` List<ResDTO> response = client.Get<List<ResDTO>>(new ReqDto()); ``` Which is something the client/consumer of your service needs to know about. If you had the marker on the DTO the response type is already known. The `IReturn<>` marker is also used to determine the Response DTO that's used in the HTTP Responses in ServiceStack's `/metadata` pages.
57,687,611
I have written the below SQL query to join four tables and do the calculations based on criteria but throws an error. Will appreciate for any help. Thanks Not sure where I am doing wrong or whether my logic is not right? ``` SELECT C.cust_name, R.Reg_name, sum(CASE WHEN P.Class = 'R' THEN T.Amount*.1 WHEN P.Class = 'P' THEN T.Amount*.2 ELSE T.Amount*.1 END) AS Calc_Amount FROM Customers C, Regions R, transactions T, customer_class P WHERE C.reg_id = R.reg_id, C.cust_id = T.cust_id, C.cust_id = P.cust_id AND P.class_id, P.class IN (SELECT max(class_id), class FROM customer_class GROUP BY cust_id) AND T.Time, T.Amount IN (SELECT max(time), Amount FROM transactions GROUP BY cust_id) GROUP BY C.cust_name ORDER BY C.cust_name ``` SQL command not properly ended
2019/08/28
[ "https://Stackoverflow.com/questions/57687611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10695168/" ]
You can't combine multiple conditions with an `,` in the WHERE clause. You probably want an and there: ``` WHERE C.reg_id = R.reg_id AND C.cust_id = T.cust_id AND C.cust_id = P.cust_id ``` But I strongly recommend to switch to an explicit `JOIN` in the FROM clause: ``` FROM Customers C JOIN Regions R ON C.reg_id = R.reg_id JOIN transactions T ON C.cust_id = T.cust_id JOIN customer_class P ON C.cust_id = P.cust_id ``` Additionally, when you want to use multiple columns with an IN operator, you need to enclose the columns on the left hand side with parentheses, e.g. `(P.class_id, P.class)` instead of `P.class_id, P.class`. You also need to include all columns that are not used in an aggregation in the `group by` clause. So the complete query should look something like: ```sql SELECT C.cust_name, R.Reg_name, sum(CASE WHEN P.Class = 'R' THEN T.Amount*.1 WHEN P.Class = 'P' THEN T.Amount*.2 ELSE T.Amount*.1 END) AS Calc_Amount FROM Customers C JOIN Regions R ON C.reg_id = R.reg_id JOIN transactions T ON C.cust_id = T.cust_id JOIN customer_class P ON C.cust_id = P.cust_id WHERE (P.class_id, P.class) IN (SELECT max(class_id), class FROM customer_class GROUP BY cust_id) AND (T.Time, T.Amount) IN (SELECT max(time), Amount FROM transactions GROUP BY cust_id) GROUP BY C.cust_name, R.Reg_name ORDER BY C.cust_name ```
70,524,236
I am trying to find specific digits in a Microsoft Word Document which contains text and digits, with VBA. For example the text in the document is as follows; (1) 52.203-19, This is a some text here (2) 52.204-23, Quick brown fox jumped over the lazy dog 52 times. (3) 52.204-25, I tried to search for a solution 52.204 times. (4) 52.2, Could not find any luck though (5) 52.203, this is blowing my mind away with mac 2.36 I wish to find the exact digits "**52.2**" as a whole. I don't want to find instances where **52.2** is a part of another number like **52.2**03 or **52.2**04. Also when I would like to find **52.203** then I want to exclude all instances like 52.203-xx where xx could be any two digit number. In short I would like to find the exact number only as a whole and not in between the numbers, just like Excel's EXACT function. Should I use RegEx or should I use Word's Advanced Find function with wildcards through VBA? What I have finds all instances which I don't want. ```vb Selection.Find.ClearFormatting With Selection.Find .Text = "52.2" .Replacement.Text = "" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute ```
2021/12/29
[ "https://Stackoverflow.com/questions/70524236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17791302/" ]
Split the query into two queries for each part of the `OR`. Then combine them with `UNION`. ``` SELECT id, name, GROUP_CONCAT(DISTINCT externalDisplayID SEPARATOR ', ') AS tags FROM ( SELECT c.id, c.name, tags.externalDisplayID FROM checklist c LEFT JOIN questionchecklistjoin qcheckj on qcheckj.checklistID = c.id LEFT JOIN questioncategoryjoin qcatj ON qcatj.questionID = qcheckj.questionID LEFT JOIN crosswalk cw on cw.fromQuestionCategoryJoinID = qcatj.id LEFT JOIN questioncategoryjoin qcj1 on qcj1.id = cw.toQuestionCategoryJoinID LEFT JOIN question tags on tags.id = qcj1.questionID UNION ALL SELECT c.id, c.name, tags.externalDisplayID FROM checklist c LEFT JOIN questionchecklistjoin qcheckj on qcheckj.checklistID = c.id LEFT JOIN questioncategoryjoin qcatj ON qcatj.questionID = qcheckj.questionID LEFT JOIN questioncategoryjoin qcatjsub on qcatjsub.parentQuestionID = qcatj.questionID LEFT JOIN crosswalk cw on cw.fromQuestionCategoryJoinID = qcatjsub.id LEFT JOIN questioncategoryjoin qcj1 on qcj1.id = cw.toQuestionCategoryJoinID LEFT JOIN question tags on tags.id = qcj1.questionID ) AS x GROUP BY x.id ORDER BY x.name ``` Also, it doesn't make sense to include `externalDisplayID` in `ORDER BY`, because that will order by its value from a random row in the group. You could put `ORDER BY externalDisplayID` in the `GROUP_CONCAT()` arguments if that's what you want.
54,555
I have to write essays in two examinations which will be conducted soon. Those exams need essays to be written in 250 words. The topics are given on the time of the exams and are usually anything based on government schemes, matters of national and international importance, or anything that is often in news, etc. Last year (I think), they asked essays on Ethical banking, Influence of social media, Contribution of unorganised Sector in Indian economy, etc. **Question:** Essentially, this is a test of writing rather than that of knowledge. However, I think it's best if the essay essentially is somehow "complete" covering as many important aspect as possible even if in layman's terms. So, what structure may I follow to write good yet comprehensive essays in the word limits of 250 words?
2021/01/20
[ "https://writers.stackexchange.com/questions/54555", "https://writers.stackexchange.com", "https://writers.stackexchange.com/users/47115/" ]
I would take the standard 5 paragraph Essay format but modified for brevity. Your thesis or introduction answer should be your immediate answer to a writing prompt and should be no more than one sentance. Rephrase the question as your sentance (i.e. if the question is "What would be the platform you would run on if you were running for President of the United States?" then your response should be "If I were to run for President of the United States, my platform would address [item 1], [Item 2], and [item 3]."). Your conclusion paragraph should restate the thesis. The three paragraphs in between should briefly address best arguements for your thesis in order of strongest to weakest (for me, my answers would be economic improvement by reworking tax laws, foreign policy that would place the country in step with a more neutral pre-WWII dealing, and an infrastructure modernization program.). A good 3-4 paragraph argument would suffice for each. Now before I give you my last piece of advise, do keep in mind that this was given to me by a teacher at an all boys high school, so it was tailored to it's audience of teenager boys who naturally have only one thing on their mind at any give momement. It still helps me to this day, and the somewhat crass nature of the analogy hammers it in: > > "A good essay should be like a girl's skirt: It should be long enough to cover everything but short enough to keep it interesting." > > > That is you shouldn't get far into the weeds on your point or points, especially on test essays. Also do not feel the need to hold strictly to the word count other than try to get the 250 word mark (most essays graders will judge by the eye, so a little wiggle room is allowed. Additionally most won't mark down if the essay goes over 250, though again, keep it close... they aren't asking for a Tolkien novel series. Obviously if you have a word counting program (assuming it's typed and not handwritten), don't short by a word and find a way you can squeeze in a fancy adjective that isn't going to be supferlous. 250 isn't a lot to work with. To get an idea, a 500 word essay assumes 5 paragraphs, each 3-4 sentances long and will fill about one 8X11 inche page on a word processor with a 12 inche font and double spaced. To give yourself a guestimate, google some writing prompts and try to answer them with 250 words but less than 300.
442,432
Picture a planet wandering intergalactic space. Such a planet would only couple to vacuum flucuations and the cosmic microwave background. (Ignore stray Hydrogen atoms.) If this planet started as a pure quantum state, how fast would that state lose its coherence? In such a system, clearly there are many more degrees of freedom that are isolated from the environment compared with those coupled to the outside. So I want to know if those isolated DOF somehow protect the purity of the quantum state.
2018/11/21
[ "https://physics.stackexchange.com/questions/442432", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/132789/" ]
> > If this planet started as a pure quantum state, how fast would that state lose its coherence? > > > In this answer, I'm interpreting "started as a pure quantum state" to mean "started in a quantum superposition of different locations". The speed of decoherence for objects of various sizes in various environments was analyzed by Tegmark in "Apparent wave function collapse caused by scattering", <https://arxiv.org/abs/gr-qc/9310032>. One of the environments considered in that paper is the Cosmic Microwave Background (CMB), and the largest object considered in that paper is a bowling ball. Here, I'll apply Tegmark's equation to an earth-sized planet, assuming that the only source of decoherence is the CMB. This answer uses some numbers from Tables 1 and 2 in that paper, along with an equation from section 4.1 in that paper. Tegmark starts with a quantum model of ordinary scattering processes, such as the scattering of CMB from the object, and derives this equation: $$ \rho(\mathbf{x},\mathbf{y},t)\approx \rho(\mathbf{x},\mathbf{y},0) \exp\left(-\Lambda t\left[ 1-e^{-r^2/2\lambda^2} \right]\right) \tag{1} $$ with $r\equiv |\mathbf{x}-\mathbf{y}|$. The quantity $\rho(\mathbf{x},\mathbf{y},t)$ is called the **reduced state** or the **reduced density matrix**. (In this case, the "matrix" has continuous "indices" $\mathbf{x}$ and $\mathbf{y}$.) It represents the degree to which a quantum superposition of different object-locations $\mathbf{x}$ and $\mathbf{y}$ remains coherent in the presence of environmental effects. If $\rho(\mathbf{x},\mathbf{y},t)$ is zero for $|\mathbf{x}- \mathbf{y}|>R$, then coherence over distances $> R$ is lost. Equation (1) tells us how quickly this happens. Equation (1) involves two constants, $\Lambda$ and $\lambda$, with the following meanings: * $\Lambda=\sigma\Phi$, where $\sigma$ is the total scattering cross-section (of the bowling ball or the earth) and, in Tegmark's words, $\Phi$ is the "average particle flux per unit area per unit time." In the present example, the "particle flux" is the flux of the CMB. * $\lambda$ is a length scale that characterizes the effect of the environment in equation (1). According to Tegmark's Table 1, the CMB is characterized by $\lambda\sim$ 2 millimeters. According to Tegmark's Table 2, a bowling ball has $\Lambda\sim 4\times 10^{15}\text{ s}^{-1}$. To scale this up to the earth, we can assume that the scattering cross-section is proportional to the object's cross-sectional area. Using $\sim 10$ cm for the radius of a bowling ball and $\sim 6,000$ km for the radius of the earth, the ratio of their areas is $\sim 4\times 10^{15}$. Therefore, for the earth, we have $\Lambda\sim 10^{31}\text{ s}^{-1}$. We can use this value of $\Lambda$, together with $\lambda\sim 2$ millimeters for the CMB, to draw the following conclusions from equation (1): * If the earth starts in a quantum superposition of two different locations separated from each other by much more than $2$ millimeters, then it decoheres (effectively "collapses" into just one of the locations) in $\sim 10^{-31}$ seconds. * For smaller separations, decoherence is slower, but still very fast. If the earth starts in a quantum superposition of two different locations separated from each other by roughly the width of a single atom, then it decoheres in $\sim 10^{-15}$ seconds — roughly one hundreth of the time required for light to cross the diameter of a typical hair folicle. So... > > If this planet started as a [quantum superposition of different locations], how fast would that state lose its coherence? > > > **Answer:** Very, *very* quickly. > > In such a system, clearly there are many more degrees of freedom that are isolated from the environment compared with those coupled to the outside. So I want to know if those isolated DOF somehow protect the purity of the quantum state. > > > Equation (1) depends only on the *size* of the object (more accurately, on its scattering cross-section), not on its internal composition. Since the earth is bound together as a single object, decoherence caused by scattering of CMB at the surface causes decoherence of the whole thing. You can't hide from decoherence by tunneling underground. By the way, a planet-sized object always has a significant gravitational field, which influences the motion of all interplanetary molecules that are anywhere nearby. Since that influence depends on the planet's location, this is presumably sufficient to cause rapid decoherence even if the CMB were absent. But since we don't yet have an empirically-established theory of quantum gravity, I'll leave that fun thought on the shelf for now. --- **Edit** As pointed out in comments, my answer above only considered one example, aptly described in a comment as $|\text{here}\rangle+|\text{there}\rangle$. My answer was also specialized in another respect: it only considered decoherence resulting from the planet's interaction with *external* entities. That specialization is relatively easy to handle mathematically, because it ignores the object's internal structure. But a real planet has a *rich* internal structure on the molecular level, and the molecular complexity *of the planet itself* is more than sufficient to account for decoherence of its various parts. This implies, once again, that the planet's interior is not protected from decoherence, and this assertion is not restricted to examples of the form $|\text{here}\rangle+|\text{there}\rangle$.
6,037,996
I need to implement a multi-agent system for an assignment. I have been brainstorming for ideas as to what I should implement, but I did not come up with anything great yet. I do not want it to be a traffic simulation application, but I need something just as useful.
2011/05/17
[ "https://Stackoverflow.com/questions/6037996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/758257/" ]
I once saw an application of multiagent systems for studying/simulating fire evacuation plans in large buildings. Imagine a large building with thousands of people; in case of fire, you want these people to follow some rules for evacuating the building. To evaluate the effectiveness of your evacuation plan rules, you may want to simulate various scenarios using a multiagent system. I think it's a useful and interesting application. If you search the Web, you will find papers and works in this area, from which you might get further inspiration.
4,150
StackExchange [continues to support TUG with corporate membership](https://tex.meta.stackexchange.com/questions/4140/should-we-keep-our-tex-user-group-membership) (many thanks). With that come eight individual memberships that can be given out to members of the community. The time has come to select our representatives for 2014. For reference, Eight top voted members during last year [TUG Membership: Names for 2013](https://tex.meta.stackexchange.com/q/2906/15717) who have enjoyed [TUG membership benefits](http://tug.org/aims_ben.html) Following the model from previous years, I'd like to ask people to put themselves forward. There are no restrictions on standing other than having to be a member of the TeX StackExchange site: in particular, the existing 'representatives' are very welcome to put their names forward to continue. [Note: I've called the people we put forward 'representatives', but that's mainly because I can't think of a better term. Nominees should not feel the need to represent TeX-sx other than being members of the site and therefore interested in TeX in some way!] The model for selection of representatives is as follows. We will have a two stage process, first 'nomination' then 'election'. The first phase runs for five days, until 1700 GMT on 2014-01-07. Each person who wishes to be considered should post an answer, where they can (if they wish) say what makes them a good choice. They should then immediately delete their answer. The second phase will then begin. All of the answers will be undeleted, and everyone should take a look at these answers and vote for deserving candidates: remember there are eight places available! Again, there will be five days to vote, ending 1700 GMT on 2014-01-12. At that stage, the top eight names will be forwarded to the StackExchange community staff for notification to TUG. In the event of a tie in number of votes, the mod team will decide which of the tied members are put forward to StackExchange. The mod team may also include additional names *if* at the end of the voting process there are fewer than eight nominees with positive scores. --- At the end of the voting period, the tallies were as follows: * [Harish Kumar](https://tex.stackexchange.com/users/11232/harish-kumar), 25 * [Sean Allred](https://tex.stackexchange.com/users/17423/sean-allred), 20 * [Ulrike Fischer](https://tex.stackexchange.com/users/2388/ulrike-fischer), 18 * [cgnieder](https://tex.stackexchange.com/users/5049/cgnieder), 18 * [azetina](https://tex.stackexchange.com/users/10898/azetina), 17 * [Torbjørn T.](https://tex.stackexchange.com/users/586/torbjorn-t), 17 * [Henri Menke](https://tex.stackexchange.com/users/10995/henri-menke), 17 * [morbusg](https://tex.stackexchange.com/users/1410/morbusg), 17 * [Fran](https://tex.stackexchange.com/users/11604/fran), 16 * [Stefan Kottwitz](https://tex.stackexchange.com/users/213/stefan-kottwitz), 13 Our representatives for 2014 are therefore Harish Kumar, Sean Allred, Ulrike Fischer, cgnieder, azetina, Torbjørn T., Henri Menke, and morbusg. Congratulations!
2014/01/02
[ "https://tex.meta.stackexchange.com/questions/4150", "https://tex.meta.stackexchange.com", "https://tex.meta.stackexchange.com/users/73/" ]
*If* and *only if*, there are free slots, and if nobody notices my nomination in other way, I would like to put my name just to have a taste of TUG membership. Though I have been in TeX world for long time, I was never a member (I just didn't think of it). If I like it I will go for an individual membership after this. I have no specific goals/aims regarding what I do with the membership, hence feel free to downvote. :-)
23,058
I am a new cyclist who is on my 2nd year of biking. I bought a cheapo Schwinn MTB at Walmart to start with but now I want a real road bike. I currently have $2k saved up and am looking into a Specialized Secteur Exprt Disc which is aluminum. I did pick up a carbon frame bike at the shop and although it is lighter, not by much. How sturdy are these carbon frames? From what I've read they can crack if you get in a tumble, and at that point you are done. Vs an aluminum frame will more likely than not be OK. I'd have to spend over $1000 more to get a carbon frame and as good components (Shimano 105 or above) so I don't know if its worth it or not. I'm just a casual cyclist who likes to go on long solo rides for fitness/fun.
2014/06/16
[ "https://bicycles.stackexchange.com/questions/23058", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/12641/" ]
There's no reason to worry about carbon fibre durability. I'm riding on a 20 year old Specialized Epic Allez (CF tubes with Al lugs), and it's just as light and stiff as it was when new. If you have a serious accident CF may break in a non-repairable way, but the same is more-or-less true about aluminium as well, although it may take more of a tumble to break it. (In theory Al can be welded, but you have to be very careful, as the welding will wreck the heat treatment.) At the same time, CF *is* more expensive. If I would buy a new bike today I would probably get a decent aluminium frame and instead spend more money on the components, rather than an expensive frame with sub-par groupset.
201,042
I am extending this post following from [here](https://codereview.stackexchange.com/questions/200861/generic-single-linked-list-using-smart-pointers/200988?noredirect=1#comment387172_200988). I made some of the changes that I could make in the previous post. Although, I have not been successful in creating iterators for my class. The reason for the new post is to see if there is any additional changes I need to make to my code. As well as steps in creating iterators for this class. Should I perhaps follow what is done [here](https://www.geeksforgeeks.org/implementing-iterator-pattern-of-a-single-linked-list/)? I am still in the learning process with smart pointers and there is still much I need to learn, I find it useful when people post detailed answers instead of computer science jargon that my ears are still new to. Here is my header file: ``` #ifndef SingleLinkedList_h #define SingleLinkedList_h template <class T> class SingleLinkedList { private: struct Node { T data; std::unique_ptr<Node> next = nullptr; // disable if noncopyable<T> for cleaner error msgs explicit Node(const T& x, std::unique_ptr<Node>&& p = nullptr) : data(x) , next(std::move(p)) {} // disable if nonmovable<T> for cleaner error msgs explicit Node(T&& x, std::unique_ptr<Node>&& p = nullptr) : data(std::move(x)) , next(std::move(p)) {} }; std::unique_ptr<Node> head = nullptr; Node* tail = nullptr; void do_pop_front() { head = std::move(head->next); } public: // Constructors SingleLinkedList() = default; // empty constructor SingleLinkedList(SingleLinkedList const &source); // copy constructor // Rule of 5 SingleLinkedList(SingleLinkedList &&move) noexcept; // move constructor SingleLinkedList& operator=(SingleLinkedList &&move) noexcept; // move assignment operator ~SingleLinkedList(); // Overload operators SingleLinkedList& operator=(SingleLinkedList const &rhs); // This function is for the overloaded operator << void display(std::ostream &str) const { for (Node* loop = head.get(); loop != nullptr; loop = loop->next.get()) { str << loop->data << "\t"; } str << "\n"; } friend std::ostream& operator<<(std::ostream &str, SingleLinkedList &data) { data.display(str); return str; } // Memeber functions void swap(SingleLinkedList &other) noexcept; bool empty() const { return head.get() == nullptr; } int size() const; void push_back(const T &theData); void push_back(T &&theData); void push_front(const T &theData); void insertPosition(int pos, const T &theData); void clear(); void pop_front(); void pop_back(); void deleteSpecific(int delValue); bool search(const T &x); }; template <class T> SingleLinkedList<T>::SingleLinkedList(SingleLinkedList<T> const &source) { for(Node* loop = source.head.get(); loop != nullptr; loop = loop->next.get()) { push_back(loop->data); } } template <class T> SingleLinkedList<T>::SingleLinkedList(SingleLinkedList<T>&& move) noexcept { move.swap(*this); } template <class T> SingleLinkedList<T>& SingleLinkedList<T>::operator=(SingleLinkedList<T> &&move) noexcept { move.swap(*this); return *this; } template <class T> SingleLinkedList<T>::~SingleLinkedList() { clear(); } template <class T> void SingleLinkedList<T>::clear() { while (head) { do_pop_front(); } } template <class T> SingleLinkedList<T>& SingleLinkedList<T>::operator=(SingleLinkedList const &rhs) { SingleLinkedList copy{ rhs }; swap(copy); return *this; } template <class T> void SingleLinkedList<T>::swap(SingleLinkedList &other) noexcept { using std::swap; swap(head, other.head); swap(tail, other.tail); } template <class T> int SingleLinkedList<T>::size() const { int size = 0; for (auto current = head.get(); current != nullptr; current = current->next.get()) { size++; } return size; } template <class T> void SingleLinkedList<T>::push_back(const T &theData) { std::unique_ptr<Node> newNode = std::make_unique<Node>(theData); if (!head) { head = std::move(newNode); tail = head.get(); } else { tail->next = std::move(newNode); tail = tail->next.get(); } } template <class T> void SingleLinkedList<T>::push_back(T &&thedata) { std::unique_ptr<Node> newnode = std::make_unique<Node>(std::move(thedata)); if (!head) { head = std::move(newnode); tail = head.get(); } else { tail->next = std::move(newnode); tail = tail->next.get(); } } template <class T> void SingleLinkedList<T>::push_front(const T &theData) { std::unique_ptr<Node> newNode = std::make_unique<Node>(theData); newNode->next = std::move(head); head = std::move(newNode); } template <class T> void SingleLinkedList<T>::insertPosition(int pos, const T &theData) { if (pos > size() || pos < 0) { throw std::out_of_range("The insert location is invalid."); } auto node = head.get(); int i = 0; for (; node && node->next && i < pos; node = node->next.get(), i++); if (i != pos) { throw std::out_of_range("Parameter 'pos' is out of range."); } auto newNode = std::make_unique<Node>(theData); if (node) { newNode->next = std::move(node->next); node->next = std::move(newNode); } else { head = std::move(newNode); } } template <class T> void SingleLinkedList<T>::pop_front() { if (empty()) { throw std::out_of_range("List is Empty!!! Deletion is not possible."); } do_pop_front(); } template <class T> void SingleLinkedList<T>::pop_back() { if (!head.get()) { throw std::out_of_range("List is Empty!!! Deletion is not possible."); } auto current = head.get(); Node* previous = nullptr; while (current->next != nullptr) { previous = current; current = current->next.get(); } tail = previous; previous->next = nullptr; } template <class T> void SingleLinkedList<T>::deleteSpecific(int delValue) { if (!head.get()) { throw std::out_of_range("List is Empty!!! Deletion is not possible."); } auto temp1 = head.get(); Node* temp2 = nullptr; while (temp1->data != delValue) { if (temp1->next == nullptr) { throw std::invalid_argument("Given node not found in the list!!!"); } temp2 = temp1; temp1 = temp1->next.get(); } temp2->next = std::move(temp1->next); } template <class T> bool SingleLinkedList<T>::search(const T &x) { auto current = head.get(); while (current) { if (current->data == x) { return true; } current = current->next.get(); } return false; } #endif /* SingleLinkedList_h*/ ``` Here is the main.cpp file: ``` // // main.cpp // Data Structure - LinkedList // // Created by Morgan Weiss on 7/24/2018 // Copyright © 2018 Morgan Weiss. All rights reserved. // #include <algorithm> #include <cassert> #include <iostream> #include <memory> #include <utility> #include <stdexcept> #include <ostream> #include <iosfwd> #include <stdexcept> #include "SingleLinkedList.h" int main(int argc, const char * argv[]) { /////////////////////////////////////////////////////////////////////// ///////////////////////////// Single Linked List ////////////////////// /////////////////////////////////////////////////////////////////////// SingleLinkedList<int> obj; obj.push_back(2); obj.push_back(4); obj.push_back(6); obj.push_back(8); obj.push_back(10); std::cout<<"\n--------------------------------------------------\n"; std::cout<<"---------------displaying all nodes---------------"; std::cout<<"\n--------------------------------------------------\n"; std::cout << obj << "\n"; std::cout<<"\n--------------------------------------------------\n"; std::cout<<"----------------Inserting At Start----------------"; std::cout<<"\n--------------------------------------------------\n"; obj.push_front(50); std::cout << obj << "\n"; std::cout<<"\n--------------------------------------------------\n"; std::cout<<"-------------inserting at particular--------------"; std::cout<<"\n--------------------------------------------------\n"; obj.insertPosition(5,60); std::cout << obj << "\n"; std::cout << "\n--------------------------------------------------\n"; std::cout << "-------------Get current size ---=--------------------"; std::cout << "\n--------------------------------------------------\n"; std::cout << obj.size() << "\n"; std::cout<<"\n--------------------------------------------------\n"; std::cout<<"----------------deleting at start-----------------"; std::cout<<"\n--------------------------------------------------\n"; obj.pop_front(); std::cout << obj << "\n"; std::cout<<"\n--------------------------------------------------\n"; std::cout<<"----------------deleting at end-----------------------"; std::cout<<"\n--------------------------------------------------\n"; obj.pop_back(); std::cout << obj << "\n"; std::cout<<"\n--------------------------------------------------\n"; std::cout<<"--------------Deleting At Particular--------------"; std::cout<<"\n--------------------------------------------------\n"; obj.deleteSpecific(4); std::cout << obj << "\n"; obj.search(8) ? printf("yes"):printf("no"); std::cout << "\n--------------------------------------------------\n"; std::cout << "--------------Testing copy----------------------------"; std::cout << "\n--------------------------------------------------\n"; SingleLinkedList<int> obj1 = obj; std::cout << obj1 << "\n"; //std::cout << "\n-------------------------------------------------------------------------\n"; //std::cout << "--------------Testing to insert in an empty list----------------------------"; //std::cout << "\n-------------------------------------------------------------------------\n"; //SingleLinkedList<int> obj2; //obj2.insertPosition(5, 60); //std::cout << obj2 << "\n"; std::cin.get(); } ```
2018/08/05
[ "https://codereview.stackexchange.com/questions/201042", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/150820/" ]
### Move `public` section of the class to the top I prefer, and suggest others, to put the `public` section of a class before the `protected` and `private` sections. The rationale for it is that users of the class want to see the `public` section of the class. It is less important to them to see what's in the `protected` and `private` sections. It does not make sense that they will have to wade through less important sections of the class before they get to the most important section. ``` template <class T> class SingleLinkedList { public: // Constructors SingleLinkedList() = default; // empty constructor ... protected: private: struct Node { ... }; ... }; ``` ### Remove `display(std::ostream &str)` I understand that you need the function at the moment to display the contents of an object. However, it's too tightly coupled with the class. Different users may want to display an object of the class differently. You can't support that easily if `display` is the only function the user has access to. This should be motivation for you to implement the iterator class. When you have the iterator class ready, the `operator<<(std::ostream&, SingleLinkedList const&)` function can be moved out of the class and the `friend`-ship won't be necessary. The current functionality can be moved to a non-member function. Also note that the list object should be a `const&`. ``` template <typename T> std::ostream& operator<<(std::ostream &str, SingleLinkedList<T> const& list) { // This will work as soon as you have begin() and end() member functions for ( auto const& item : list ) { str << item << "\t"; } return str; } ``` ### `insertPosition` needs a better name You are not inserting a position. You are inserting an item at a position. For that reason, I think `insert_at_position` is more appropriate and follows the naming convention of other functions. If `insert_at_position` is too verbose, the simpler name, `insert` will be better than `insertPosition`, IMO. ### `deleteSpecific` needs a better name I think the simpler name `remove()` will be better. If you decide to keep `deleteSpecific`, I would suggest changing it to `delete_specific` to keep the function names consistent.
473,683
I am looking for a word or phrase which can be used in the sentence: > > It is a rather old, but \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ technology. > > > The word or phrase should address a technology that is totally investigated, researched in detail, and thoroughly optimised, so there is nothing more to find out or improve.
2018/11/19
[ "https://english.stackexchange.com/questions/473683", "https://english.stackexchange.com", "https://english.stackexchange.com/users/324928/" ]
I don't know of a technology that cannot be improved, but we often use the term ***mature*** to describe technology that's deemed developed enough to be left alone: > > A **[mature technology](https://en.wikipedia.org/wiki/Mature_technology)** is a technology that has been in use for long enough that most of its initial faults and inherent problems have been removed or reduced by further development. In some contexts, it may also refer to technology that has not seen widespread use, but whose scientific background is well understood. > > *Wikipedia* > > > > > **[mature](https://www.thefreedictionary.com/mature)** > > 6. No longer subject to great expansion or development. Used of an industry, market, or product. > > *American Heritage® Dictionary* > > >
54,322,336
I have installed my PWA from Chrome and Firefox on Android, and from Safari on iOS. When I update my code on the website, I see quite different behaviour in the PWAs in terms of using older cached versions vs the newest one - Firefox-created PWA seems to require about 2-3 kill and restarts of the PWA, Chrome takes 5-6, and I couldn't get Safari-based PWA to start showing the newest version without deleting the PWA and re-adding to Home Screen from browser. Is there a spec that defines the conditions under which a newer, non-cached version is fetched? After much reading, I disabled the registering of my service worker, which should have made the PWAs network-only (no service-worker cache) but I continue to get old versions of the site served up in the PWAs. A normal browser window also seems to require multiple deep refreshes to get the new version, so I assume there is something besides the service worker that determines this?
2019/01/23
[ "https://Stackoverflow.com/questions/54322336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1275803/" ]
Some actions like `.Add()` are producing output. To prevent this, pipe the output into the `[void]` by adding `| Out-Null` at the end of the line or `[void]` directly infront of the variable that is used, like: ``` $foo.SomethingThatGeneratesOutput() | Out-Null ``` or ``` [void]$foo = SomethingThatGeneratesOutput ```
395,882
Let $A$ be a ring. Prove that the following conditions are equivalent: $i)$ All ideals $I \subsetneq A$ are prime. $ii)$ The set of all ideals of $A$ is totally ordered by inclusion and all ideals of $A$ are idempotent. Please give me a hint. I dont see the relation between these two statemens.
2013/05/18
[ "https://math.stackexchange.com/questions/395882", "https://math.stackexchange.com", "https://math.stackexchange.com/users/70628/" ]
First suppose the ideals are linearly ordered and they are all idempotent. We will show that a proper ideal $C\lhd R$ is prime: Let $A,B$ be two other ideals such that $AB\subseteq C$. By way of contradiction, suppose that neither $A$ nor $B$ are contained in $C$. By the linear order, the three form a chain with $C$ at the bottom, so, without loss of generality, we suppose $C\subseteq B\subseteq A$. But then $C\supseteq AB\supseteq BB=B$. This contradicts the statement that $B$ is not contained in $C$. Thus, $C$ is prime. --- The other direction is easy of course! Suppose all proper ideals of $R$ are prime. Firstly, for any ideal $A$, $A^2$ is prime. But then by primeness $A\subseteq A^2$, so that $A=A^2$. Secondly, given two ideals $A,B$, the product $AB$ is a prime ideal. But by primeness, either $A\subseteq AB$ or $B \subseteq AB$. In the first case, $A\subseteq AB\subseteq B$ and in the second, $B\subseteq AB\subseteq A$. --- Considering the classic commutative theory result (A commutative ring in which all proper ideals are prime is a field."), this exercise shows that the direct noncommutative analogue ("All ideals prime implies division ring???") is not going to hold." Of course, any full square matrix ring $M\_n(F)$ over a field ($n>1$) has only one proper ideal, which is prime, and this shows that such a ring does not have to be a division ring. But with a suitable definition of a prime right ideal the result can be saved! In Lam and Reyes's excellent paper [*A one-sided prime ideal principle for noncommutative rings*](http://arxiv.org/pdf/0903.5295v4.pdf) such a definition of "prime right ideal" is given, and it's an elementary result shown there that a ring whose right ideals are all prime in this way is a division ring. (Actually the paper is full of much more interesting results, and I just can't resist plugging it here.)
52,210,302
I tried to install a Shopware plugin via the backend (plugin page). After clicking on download and entering my Shopware login data, the following error message appears immediately: ``` An error has occurred on the SBP server. Error code: OrdersException-2 ``` I wanted to install it again and change my last input. But now the same error message appears immediately and ends my attempt immediately. It is not listed in the backend (plugin page). **How do I get this plugin uninstalled completely clean?** *I have FTP access.* *I using shopware Version 5.4.6* [DSGVO Kit Lite](https://store.shopware.com/sysg961328677932f/dsgvo-kit-lite-datenschutzhinweise-mit-checkboxen.html "Plugin DSGVO Kit Lite")
2018/09/06
[ "https://Stackoverflow.com/questions/52210302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2891692/" ]
I gess you deleted it after deinstallation, so it isn't on your server any more (and therefore not listed in the plugin-manager). In this case you need the zip file of the plugin. It can be downloaded via your shopware account (account.shopware.com) and you can upload the zipfile directly to your plugin-manager. This would be the easiest way if the login issues persists in your plugin-manager.
61,799,543
I have been trying to figure out how to plot this data but can't figure out my mistake: ``` Month Year Sales January 2020 43 feburary 2020 23 March 2020 13 April 2020 11 May 2020 7 June 2020 2 July 2020 1 August 2020 2 September 2020 22 October 2020 11 November 2020 6 December 2020 3 January 2019 3 feburary 2019 11 March 2019 65 April 2019 22 May 2019 33 June 2019 88 July 2019 44 August 2019 12 September 2019 32 October 2019 54 November 2019 76 December 2019 23 January 2018 12 feburary 2018 32 March 2018 234 April 2018 2432 May 2018 432 June 2018 324 July 2018 12 August 2018 324 September 2018 89 October 2018 6 November 2018 46 December 2018 765 ``` I tried the following ``` y = df["sales"] x = df["Month"] plt.plot(x,y) plt.show() ``` Which gives the following plot(The exact values are different as my data values posted here is changed): [![enter image description here](https://i.stack.imgur.com/TfIQ0.png)](https://i.stack.imgur.com/TfIQ0.png) How do I correct it so that my plot breaks off each time at december and plots a new line for a separate year?
2020/05/14
[ "https://Stackoverflow.com/questions/61799543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8499442/" ]
If you have a pandas DataFrame that looks like: ``` year month sales 0 2020 January 43.0 1 2020 feburary 23.0 2 2020 March 13.0 3 2020 April 11.0 4 2020 May 7.0 5 2020 June 2.0 6 2020 July 1.0 7 2020 August 2.0 8 2020 September 22.0 9 2020 October 11.0 10 2020 November 6.0 11 2020 December 3.0 12 2019 January 3.0 13 2019 feburary 11.0 14 2019 March 65.0 15 2019 April 22.0 16 2019 May 33.0 17 2019 June 88.0 18 2019 July 44.0 19 2019 August 12.0 20 2019 September 32.0 21 2019 October 54.0 22 2019 November 76.0 23 2019 December 23.0 24 2018 January 12.0 25 2018 feburary 32.0 26 2018 March 234.0 27 2018 April 2432.0 28 2018 May 432.0 29 2018 June 324.0 30 2018 July 12.0 31 2018 August 324.0 32 2018 September 89.0 33 2018 October 6.0 34 2018 November 46.0 35 2018 December 765.0 ``` We can use `df.groupby('year')` to generate the kind of parsing that you're looking for: ``` fig, ax = plt.subplots() ax.set_xticklabels(df['month'].unique(), rotation=90) for name, group in df.groupby('year'): ax.plot(group['month'], group['sales'], label=name) ax.legend() plt.tight_layout() plt.show() ``` [![enter image description here](https://i.stack.imgur.com/AsLbG.png)](https://i.stack.imgur.com/AsLbG.png)
6,098,446
What git command will display a list of all committed modifications, one modified file per line, with the file's path?
2011/05/23
[ "https://Stackoverflow.com/questions/6098446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
I think ``` git log --stat ``` is what you're after.
4,247,113
I have to process spatial data which are nodes in a graph.What data type /variable type /data structure allows me to access the values of i-th node's x value and i-th node's y value.
2010/11/22
[ "https://Stackoverflow.com/questions/4247113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/509505/" ]
There are two algorithms called "Fibonacci search". [The article you linked](http://en.wikipedia.org/wiki/Golden_section_search) is about a numerical algorithm for finding the maximum or minimum of certain functions. It is the optimal algorithm for this problem. This problem is just different enough from the binary search problem that it should be obvious for any given case which is appropriate. [The other kind of Fibonacci search](http://en.wikipedia.org/wiki/Fibonacci_search) does attack the same problem as binary search. Binary search is essentially always better. Knuth writes that Fibonacci search "is preferable on some computers, because it involves only addition and subtraction, not division by 2." But almost all computers use binary arithmetic, in which division by 2 is *simpler* than addition and subtraction. (The Wikipedia article currently claims that Fibonacci search could have better locality of reference, a claim Knuth does *not* make. It *could*, perhaps, but this is misleading. The tests done by a Fibonacci search are closer together precisely to the extent that they are less helpful in narrowing down the range; on average this would result in more reads from more parts of the table, not fewer. If the records are actually stored on tape, so that seek times dominate, then Fibonacci search might beat binary search—but in that case both algorithms are far from optimal.)