qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
Use table alias in subquery: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SELECT MAX( customer_id ) FROM customers C) +1, 'jim', 'sock') ```
You can't do it in a single query, but you could do it within a transaction. Do the initial MAX() select and lock the table, then do the insert. The transaction ensures that nothing will interrupt the two queries, and the lock ensures that nothing else can try doing the same thing elsewhere at the same time.
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
Use table alias in subquery: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SELECT MAX( customer_id ) FROM customers C) +1, 'jim', 'sock') ```
This is select come insert sequel. I am trying to get serial\_no maximum +1 value and its giving correct value. ``` SELECT MAX(serial_no)+1 into @var FROM sample.kettle; Insert into kettle(serial_no,name,age,salary) values (@var,'aaa',23,2000); ```
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
You can use the [`INSERT ... SELECT`](https://dev.mysql.com/doc/refman/5.7/en/insert-select.html) statement to get the `MAX()+1` value and insert at the same time: ``` INSERT INTO customers( customer_id, firstname, surname ) SELECT MAX( customer_id ) + 1, 'jim', 'sock' FROM customers; ``` **Note:** You need to drop...
Use table alias in subquery: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SELECT MAX( customer_id ) FROM customers C) +1, 'jim', 'sock') ```
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
You can use the [`INSERT ... SELECT`](https://dev.mysql.com/doc/refman/5.7/en/insert-select.html) statement to get the `MAX()+1` value and insert at the same time: ``` INSERT INTO customers( customer_id, firstname, surname ) SELECT MAX( customer_id ) + 1, 'jim', 'sock' FROM customers; ``` **Note:** You need to drop...
Correct, you can not modify and select from the same table in the same query. You would have to perform the above in two separate queries. The best way is to use a transaction but if your not using innodb tables then next best is [locking the tables](http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html) and then p...
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
You can use the [`INSERT ... SELECT`](https://dev.mysql.com/doc/refman/5.7/en/insert-select.html) statement to get the `MAX()+1` value and insert at the same time: ``` INSERT INTO customers( customer_id, firstname, surname ) SELECT MAX( customer_id ) + 1, 'jim', 'sock' FROM customers; ``` **Note:** You need to drop...
We declare a variable 'a' ``` SET **@a** = (SELECT MAX( customer_id ) FROM customers) +1; INSERT INTO customers ( customer_id, firstname, surname ) VALUES (**@a**, 'jim', 'sock') ```
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
None of the about answers works for my case. I got the answer from [here](https://stackoverflow.com/questions/4429319/you-cant-specify-target-table-for-update-in-from-clause), and my SQL is: ``` INSERT INTO product (id, catalog_id, status_id, name, measure_unit_id, description, create_time) VALUES ( (SELECT id FROM ...
You can't do it in a single query, but you could do it within a transaction. Do the initial MAX() select and lock the table, then do the insert. The transaction ensures that nothing will interrupt the two queries, and the lock ensures that nothing else can try doing the same thing elsewhere at the same time.
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
Correct, you can not modify and select from the same table in the same query. You would have to perform the above in two separate queries. The best way is to use a transaction but if your not using innodb tables then next best is [locking the tables](http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html) and then p...
Your sub-query is just incomplete, that's all. See the query below with my additions: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SELECT MAX( customer_id ) FROM customers) +1), 'jim', 'sock') ```
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
Correct, you can not modify and select from the same table in the same query. You would have to perform the above in two separate queries. The best way is to use a transaction but if your not using innodb tables then next best is [locking the tables](http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html) and then p...
None of the about answers works for my case. I got the answer from [here](https://stackoverflow.com/questions/4429319/you-cant-specify-target-table-for-update-in-from-clause), and my SQL is: ``` INSERT INTO product (id, catalog_id, status_id, name, measure_unit_id, description, create_time) VALUES ( (SELECT id FROM ...
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
Correct, you can not modify and select from the same table in the same query. You would have to perform the above in two separate queries. The best way is to use a transaction but if your not using innodb tables then next best is [locking the tables](http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html) and then p...
You can't do it in a single query, but you could do it within a transaction. Do the initial MAX() select and lock the table, then do the insert. The transaction ensures that nothing will interrupt the two queries, and the lock ensures that nothing else can try doing the same thing elsewhere at the same time.
5,360,117
I am trying to insert a new row and set the customer\_id with max()+1. The reason for this is the table already has a auto\_increatment on another column named id and the table will have multiple rows with the same customer\_id. With this: ``` INSERT INTO customers ( customer_id, firstname, surname ) VALUES ((SE...
2011/03/19
[ "https://Stackoverflow.com/questions/5360117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/666992/" ]
`SELECT MAX(col) +1` is not safe -- it does not ensure that you aren't inserting more than one customer with the same `customer_id` value, regardless if selecting from the same table or any others. The [proper way to ensure a unique integer value is assigned on insertion into your table in MySQL is to use AUTO\_INCREME...
We declare a variable 'a' ``` SET **@a** = (SELECT MAX( customer_id ) FROM customers) +1; INSERT INTO customers ( customer_id, firstname, surname ) VALUES (**@a**, 'jim', 'sock') ```
62,242,308
I wrote a javascript code like this: ``` var var1 = 1; window.var2 = 2; ``` Now on the chrome console, I typed `window` and looked through it, but I cannot find the first variable and only the second one showed up. I suppose both of these variables should exist on global window object. Can someone clarify why is thi...
2020/06/07
[ "https://Stackoverflow.com/questions/62242308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11654712/" ]
Both variables are visible in the windows object: ```js var var1 = 1; window.var2 = 2; console.log(Object.keys(window).filter(k=>k.substr(0,3)=='var')); ``` This will produce: ``` [ "var1", "var2" ] ```
It seems it was due the fact that I put `type="module"` attribute inside `script` tag. Removing that, I am able to see it on global window object. ``` <script type="module" src="js/app.js"></script> ```
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
[2019 Manual for Courts-Martial](https://jsc.defense.gov/Portals/99/Documents/2019%20MCM%20(Final)%20(20190108).pdf?ver=2019-01-11-115724-610), Rule 916(h): > > (h) Coercion or duress. It is a defense to any offense > except killing an innocent person that the accused’s > participation in the offense was caused by a ...
[uk](/questions/tagged/uk "show questions tagged 'uk'") As I understand it, in the UK, there is no specific defence of 'duress' under law against the charge of *Assisting the Enemy* (e.g. in contravention of the [Armed Forces Act 2006](https://www.legislation.gov.uk/ukpga/2006/52/pdfs/ukpga_20060052_en.pdf)). > > 1....
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
[2019 Manual for Courts-Martial](https://jsc.defense.gov/Portals/99/Documents/2019%20MCM%20(Final)%20(20190108).pdf?ver=2019-01-11-115724-610), Rule 916(h): > > (h) Coercion or duress. It is a defense to any offense > except killing an innocent person that the accused’s > participation in the offense was caused by a ...
While the basic answer has already been given it's worth noting the Constitution [says](https://constitution.congress.gov/browse/essay/artIII_S3_C1_1_2/) the following about treason: > > Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid...
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
[2019 Manual for Courts-Martial](https://jsc.defense.gov/Portals/99/Documents/2019%20MCM%20(Final)%20(20190108).pdf?ver=2019-01-11-115724-610), Rule 916(h): > > (h) Coercion or duress. It is a defense to any offense > except killing an innocent person that the accused’s > participation in the offense was caused by a ...
Convictions are automatic if intelligence is shared, but courts-martial tend to take a dim view of soldiers who succumb to duress. The case of [Bowe Bergdahl](https://en.wikipedia.org/wiki/Bowe_Bergdahl), a U.S. soldiers captured and tortured by the Taliban, and then convicted in a court martial after he was returned t...
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
[uk](/questions/tagged/uk "show questions tagged 'uk'") As I understand it, in the UK, there is no specific defence of 'duress' under law against the charge of *Assisting the Enemy* (e.g. in contravention of the [Armed Forces Act 2006](https://www.legislation.gov.uk/ukpga/2006/52/pdfs/ukpga_20060052_en.pdf)). > > 1....
While the basic answer has already been given it's worth noting the Constitution [says](https://constitution.congress.gov/browse/essay/artIII_S3_C1_1_2/) the following about treason: > > Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid...
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
[uk](/questions/tagged/uk "show questions tagged 'uk'") As I understand it, in the UK, there is no specific defence of 'duress' under law against the charge of *Assisting the Enemy* (e.g. in contravention of the [Armed Forces Act 2006](https://www.legislation.gov.uk/ukpga/2006/52/pdfs/ukpga_20060052_en.pdf)). > > 1....
Convictions are automatic if intelligence is shared, but courts-martial tend to take a dim view of soldiers who succumb to duress. The case of [Bowe Bergdahl](https://en.wikipedia.org/wiki/Bowe_Bergdahl), a U.S. soldiers captured and tortured by the Taliban, and then convicted in a court martial after he was returned t...
67,830
Can a soldier be court-martialed for revealing intelligence while in duress? Let's say a soldier is captured and then tortured by Russian agents to reveal critical top-secret intelligence to the Russian government. Can the soldier be then court-martialed in the U.S. for treason or some other crime?
2021/07/18
[ "https://law.stackexchange.com/questions/67830", "https://law.stackexchange.com", "https://law.stackexchange.com/users/38666/" ]
While the basic answer has already been given it's worth noting the Constitution [says](https://constitution.congress.gov/browse/essay/artIII_S3_C1_1_2/) the following about treason: > > Treason against the United States, shall consist only in levying War against them, or in adhering to their Enemies, giving them Aid...
Convictions are automatic if intelligence is shared, but courts-martial tend to take a dim view of soldiers who succumb to duress. The case of [Bowe Bergdahl](https://en.wikipedia.org/wiki/Bowe_Bergdahl), a U.S. soldiers captured and tortured by the Taliban, and then convicted in a court martial after he was returned t...
19,763,193
I have been developing an application that allows for multiple people to concurrently modify data and automatically propagate the changes real time. In the processes of doing so some questions about the nature of $watch arose. One of them was: ***What happens if the data model being watched changes while the watch c...
2013/11/04
[ "https://Stackoverflow.com/questions/19763193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2429160/" ]
For you first question I suggest reading Angular's runtime concepts in the [developer guide](http://docs.angularjs.org/guide/concepts). Basically it is only natural that data might change while `$digest` phase in progress because multiple `$watchers` could modify it. The catch here is that angular expects the model to ...
Have you looked into Firebase and Angular fire? <http://angularfire.com/> I'm pretty new to this, but it seems like the best choice for real time apps atm.
25,211,796
I am working on loading a template part into my theme. The get\_template\_part(); function works the way it is supposed to be, but it always inserts an empty line before itself. Here is how it looks in the firebug: ![Firebug view](https://i.stack.imgur.com/5ouBa.png) This is how it's coded in php: ![Server-side vie...
2014/08/08
[ "https://Stackoverflow.com/questions/25211796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3401253/" ]
I've found the solution. DaveChen's idea with BOM was good, I simply changed the charset for one file only, istead of doing it for both of them. Thank you, now it works. Answer: Set encoding to UTF-8 without BOM for every file involved.
Try this: ``` <div class="homepageright"><?php get_template_part('polecane'); ?></div> ```
37,624,473
Some maven plugin can generate additional source code e.g., jaxb2. I want to skip generating javadocs from `target/generated-sources` directory. How to configure `maven-javadoc-plugin` to achieve this? Maybe there is some other way?
2016/06/03
[ "https://Stackoverflow.com/questions/37624473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149528/" ]
There is: ``` <sourceFileExcludes> <sourceFileExclude>**/dir_name/*.java</sourceFileExclude> </sourceFileExcludes> ```
I'm not sure if you can exclude based on directory, but you can use the `<excludePackageNames>` tag to exclude based on the package. (See [documentation](https://maven.apache.org/plugins/maven-javadoc-plugin/examples/exclude-package-names.html).) Does you autogenerated code all have the same Java package?
37,624,473
Some maven plugin can generate additional source code e.g., jaxb2. I want to skip generating javadocs from `target/generated-sources` directory. How to configure `maven-javadoc-plugin` to achieve this? Maybe there is some other way?
2016/06/03
[ "https://Stackoverflow.com/questions/37624473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149528/" ]
I'm not sure if you can exclude based on directory, but you can use the `<excludePackageNames>` tag to exclude based on the package. (See [documentation](https://maven.apache.org/plugins/maven-javadoc-plugin/examples/exclude-package-names.html).) Does you autogenerated code all have the same Java package?
And another possible solution is to set `<sourceFileIncludes>`, e.g: ``` <sourceFileIncludes>**/com/pany/different/package/**/*.java</sourceFileIncludes> ``` Works only if your main source dirs ends differently from generated sources.
37,624,473
Some maven plugin can generate additional source code e.g., jaxb2. I want to skip generating javadocs from `target/generated-sources` directory. How to configure `maven-javadoc-plugin` to achieve this? Maybe there is some other way?
2016/06/03
[ "https://Stackoverflow.com/questions/37624473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149528/" ]
There is: ``` <sourceFileExcludes> <sourceFileExclude>**/dir_name/*.java</sourceFileExclude> </sourceFileExcludes> ```
A simple and effective solution is to generate the code to a new package (for example: using ANTLR, move the grammars one layer deeper, from a `your.package.here` into a new `your.package.here.antlr` package). Then, using Andrew Rueckert's suggestion, add `<excludePackageNames>*.antlr</excludePackageNames>` in the mav...
37,624,473
Some maven plugin can generate additional source code e.g., jaxb2. I want to skip generating javadocs from `target/generated-sources` directory. How to configure `maven-javadoc-plugin` to achieve this? Maybe there is some other way?
2016/06/03
[ "https://Stackoverflow.com/questions/37624473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149528/" ]
There is: ``` <sourceFileExcludes> <sourceFileExclude>**/dir_name/*.java</sourceFileExclude> </sourceFileExcludes> ```
And another possible solution is to set `<sourceFileIncludes>`, e.g: ``` <sourceFileIncludes>**/com/pany/different/package/**/*.java</sourceFileIncludes> ``` Works only if your main source dirs ends differently from generated sources.
37,624,473
Some maven plugin can generate additional source code e.g., jaxb2. I want to skip generating javadocs from `target/generated-sources` directory. How to configure `maven-javadoc-plugin` to achieve this? Maybe there is some other way?
2016/06/03
[ "https://Stackoverflow.com/questions/37624473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3149528/" ]
A simple and effective solution is to generate the code to a new package (for example: using ANTLR, move the grammars one layer deeper, from a `your.package.here` into a new `your.package.here.antlr` package). Then, using Andrew Rueckert's suggestion, add `<excludePackageNames>*.antlr</excludePackageNames>` in the mav...
And another possible solution is to set `<sourceFileIncludes>`, e.g: ``` <sourceFileIncludes>**/com/pany/different/package/**/*.java</sourceFileIncludes> ``` Works only if your main source dirs ends differently from generated sources.
33,235,851
I already asked on [answers.unity3d](http://answers.unity3d.com/questions/1081843/www-window-81-missing-first-line-http-header.html) but as there is no response I'll ask on SO too.. I'm not able to retrieve the http status of a response on the [WWW](http://docs.unity3d.com/ScriptReference/WWW.html) object on Windows P...
2015/10/20
[ "https://Stackoverflow.com/questions/33235851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2538473/" ]
Your network server is probably responding with a different (unexpected) response to each device. For various reasons such as the user agent string, which could lead the WWW class to not get the STATUS. Firstly, I would install a proxy so you can see exactly what the phone sends and what the server raw response is. Ei...
Try reading the www.error before looking for the STATUS header. ``` // Construct the response object string error = www.error; if (error == null) { if (www.responseHeaders.ContainsKey("STATUS")) { string [] status=www.responseHeaders["STATUS"].Split(' '); if (status.Length>2 && status[2] != "OK") {...
1,344,687
every example I seen shows how to do a update query in linq to sql by doing this. ``` // grab entity you want to update entity.UserId = "123"; // update the fields you want to update. entity.Name = "bob"; Dbcontext.SubmitChanges(); ``` I am wondering can you juse pass in a new object and have it figure it out? Li...
2009/08/28
[ "https://Stackoverflow.com/questions/1344687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
Depending on what exactly you want to do you either need the `InsertOnSubmit` method, or the `Attach` method of the respective table (i.e. dbContext.Entities). InsertOnSubmit is used to add a record, while Attach can be used if you want to affect an `UPDATE` without having to first `SELECT` the record (you already know...
If you want to do this for performance reasons then you shouldn't worry about it. Linq to Sql will cache objects locally so that just grabbing an entity by ID to modify some fields is very cheap.
1,344,687
every example I seen shows how to do a update query in linq to sql by doing this. ``` // grab entity you want to update entity.UserId = "123"; // update the fields you want to update. entity.Name = "bob"; Dbcontext.SubmitChanges(); ``` I am wondering can you juse pass in a new object and have it figure it out? Li...
2009/08/28
[ "https://Stackoverflow.com/questions/1344687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
Depending on what exactly you want to do you either need the `InsertOnSubmit` method, or the `Attach` method of the respective table (i.e. dbContext.Entities). InsertOnSubmit is used to add a record, while Attach can be used if you want to affect an `UPDATE` without having to first `SELECT` the record (you already know...
It's possible to attach and persist it to the database, however you may want to set a field to check for concurrency (ie LastModified). If you are going to use the Attach method on the data context, **you need to set the primary/composite keys** before you attach the entity (so you don't trigger **INotifyPropertyChang...
1,344,687
every example I seen shows how to do a update query in linq to sql by doing this. ``` // grab entity you want to update entity.UserId = "123"; // update the fields you want to update. entity.Name = "bob"; Dbcontext.SubmitChanges(); ``` I am wondering can you juse pass in a new object and have it figure it out? Li...
2009/08/28
[ "https://Stackoverflow.com/questions/1344687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
Depending on what exactly you want to do you either need the `InsertOnSubmit` method, or the `Attach` method of the respective table (i.e. dbContext.Entities). InsertOnSubmit is used to add a record, while Attach can be used if you want to affect an `UPDATE` without having to first `SELECT` the record (you already know...
In the case you have the dbContext available and ready, just add *InsertOnSubmit*: ``` Entity myEntity = new Entity(); myEntity.UserId = "123"; myEntity.Name = bob: Dbcontext.InsertOnSubmit(myEntity); Dbcontext.SubmitChanges(); ``` As the name of the method implies, this will insert your new entity into the databa...
1,344,687
every example I seen shows how to do a update query in linq to sql by doing this. ``` // grab entity you want to update entity.UserId = "123"; // update the fields you want to update. entity.Name = "bob"; Dbcontext.SubmitChanges(); ``` I am wondering can you juse pass in a new object and have it figure it out? Li...
2009/08/28
[ "https://Stackoverflow.com/questions/1344687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
In the case you have the dbContext available and ready, just add *InsertOnSubmit*: ``` Entity myEntity = new Entity(); myEntity.UserId = "123"; myEntity.Name = bob: Dbcontext.InsertOnSubmit(myEntity); Dbcontext.SubmitChanges(); ``` As the name of the method implies, this will insert your new entity into the databa...
If you want to do this for performance reasons then you shouldn't worry about it. Linq to Sql will cache objects locally so that just grabbing an entity by ID to modify some fields is very cheap.
1,344,687
every example I seen shows how to do a update query in linq to sql by doing this. ``` // grab entity you want to update entity.UserId = "123"; // update the fields you want to update. entity.Name = "bob"; Dbcontext.SubmitChanges(); ``` I am wondering can you juse pass in a new object and have it figure it out? Li...
2009/08/28
[ "https://Stackoverflow.com/questions/1344687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
In the case you have the dbContext available and ready, just add *InsertOnSubmit*: ``` Entity myEntity = new Entity(); myEntity.UserId = "123"; myEntity.Name = bob: Dbcontext.InsertOnSubmit(myEntity); Dbcontext.SubmitChanges(); ``` As the name of the method implies, this will insert your new entity into the databa...
It's possible to attach and persist it to the database, however you may want to set a field to check for concurrency (ie LastModified). If you are going to use the Attach method on the data context, **you need to set the primary/composite keys** before you attach the entity (so you don't trigger **INotifyPropertyChang...
669,022
when i use the gun wget (version 1.13) to fetch a file list like this: ``` cat url.txt | xargs wget -c -P ../data/ ``` Then, I get the exit code 123, what does it means? thx:)
2013/11/02
[ "https://superuser.com/questions/669022", "https://superuser.com", "https://superuser.com/users/-1/" ]
`123` is an exit code from `xargs` - one or more invocation of the command failed with an error code in the range 1-125. It means your `wget` command failed, but doesn't tell you why.
Try something like this just to see the lines that pose a problem : ``` while read; do wget -c -P ../data/ "$REPLY"; done < url.txt ```
61,334,469
I can use a SemaphoreSlim to wait for an even to fire like this: ``` public class MyClass { private SemaphoreSlim _signal; private ObjectThatHasEvent _object; public MyClass() { _signal = new SemaphoreSlim(0, 1); _object = new ObjectThatHasEvent(); _object.OnEventFired += _obje...
2020/04/21
[ "https://Stackoverflow.com/questions/61334469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1589728/" ]
Using `SemaphoreSlim` for a signal is possible, but the [more common pattern is to use `TaskCompletionSource<T>`](https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/interop-with-other-asynchronous-patterns-and-types#tasks-and-the-event-based-asynchronous-pattern-eap) to make the events ...
As per my comment, would something like this work? ``` public class MyClass { private SemaphoreSlim _signal; private ObjectThatHasEvent _object; public MyClass() { _signal = new SemaphoreSlim(2, 2); _object = new ObjectThatHasEvent(); _object.OnConnected += _object_OnConnected;...
30,911,592
**Info** Why is there different behaviour of Recursive Descent operator between ● template's match attribute where it is ignored and only children are selected ignoring their descendants ● for-each's select attribute where it works properly Two examples of test.xsl are given which both operate on the following tes...
2015/06/18
[ "https://Stackoverflow.com/questions/30911592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5023303/" ]
There's a comma missing after `pg.kompetensi` and you haven't included all of the required columns in your `GROUP BY`: ``` SELECT pg.id_pkg , pg.id_guru , g.nama_guru , g.mapel_diampu , pg.id_penilai , p.nama_penilai , pg.tahun , pg.sem , pg.kompetensi ,...
You missed comma after `pkg_guru.kompetensi` at the third line. And `pkg_guru.tahun,pkg_guru.sem,pkg_guru.kompetensi` in `GROUP BY` section.
820,693
I am having the problem that most times that I plug in a USB device, my wi-fi in the [Asus Zenbook UX31E](http://www.asus.com/us/Notebooks_Ultrabooks/ASUS_ZENBOOK_UX31E/) will turn off (not disconnect, but turn off with the red x over the wireless icon in the task bar), as per the diagram after step 7 in the diagram be...
2014/10/04
[ "https://superuser.com/questions/820693", "https://superuser.com", "https://superuser.com/users/-1/" ]
The root cause of the problem is as follows! Believe you are currently running Windows 7 64-Bit system on an Asus Zenbook UX31E . On the ASUS download page for the UX31E their is a list of Utilities that comes installed on your computer. One of these is called "Wireless Console 3" here is a link to the utility downloa...
Update USB Drivers or reinstall , and uninstall the WiFi driver and reinstall it at worst, it is just conflict between drivers in the registry. If it does not work, respond to me under this answer with more details about what happens and I will try to help you.
820,693
I am having the problem that most times that I plug in a USB device, my wi-fi in the [Asus Zenbook UX31E](http://www.asus.com/us/Notebooks_Ultrabooks/ASUS_ZENBOOK_UX31E/) will turn off (not disconnect, but turn off with the red x over the wireless icon in the task bar), as per the diagram after step 7 in the diagram be...
2014/10/04
[ "https://superuser.com/questions/820693", "https://superuser.com", "https://superuser.com/users/-1/" ]
As of this post, two people have posted some great possible solutions. If those don't work, or you want to try something else first, try attaching only one very low power USB device into the port (such as a USB flash drive, but not a mechanical drive). See if your Wifi still works. If it does, that would indicate that...
Update USB Drivers or reinstall , and uninstall the WiFi driver and reinstall it at worst, it is just conflict between drivers in the registry. If it does not work, respond to me under this answer with more details about what happens and I will try to help you.
820,693
I am having the problem that most times that I plug in a USB device, my wi-fi in the [Asus Zenbook UX31E](http://www.asus.com/us/Notebooks_Ultrabooks/ASUS_ZENBOOK_UX31E/) will turn off (not disconnect, but turn off with the red x over the wireless icon in the task bar), as per the diagram after step 7 in the diagram be...
2014/10/04
[ "https://superuser.com/questions/820693", "https://superuser.com", "https://superuser.com/users/-1/" ]
As of this post, two people have posted some great possible solutions. If those don't work, or you want to try something else first, try attaching only one very low power USB device into the port (such as a USB flash drive, but not a mechanical drive). See if your Wifi still works. If it does, that would indicate that...
The root cause of the problem is as follows! Believe you are currently running Windows 7 64-Bit system on an Asus Zenbook UX31E . On the ASUS download page for the UX31E their is a list of Utilities that comes installed on your computer. One of these is called "Wireless Console 3" here is a link to the utility downloa...
820,693
I am having the problem that most times that I plug in a USB device, my wi-fi in the [Asus Zenbook UX31E](http://www.asus.com/us/Notebooks_Ultrabooks/ASUS_ZENBOOK_UX31E/) will turn off (not disconnect, but turn off with the red x over the wireless icon in the task bar), as per the diagram after step 7 in the diagram be...
2014/10/04
[ "https://superuser.com/questions/820693", "https://superuser.com", "https://superuser.com/users/-1/" ]
The root cause of the problem is as follows! Believe you are currently running Windows 7 64-Bit system on an Asus Zenbook UX31E . On the ASUS download page for the UX31E their is a list of Utilities that comes installed on your computer. One of these is called "Wireless Console 3" here is a link to the utility downloa...
Had a very similar issue. When I plugged in my phone through USB, the wifi would disable. This issue was that the computer was detecting the phone as a network connection. I disabled the "Disable Wireless when wired connection" and now no longer lose connection. This or checking AutoPlay options may also wo...
820,693
I am having the problem that most times that I plug in a USB device, my wi-fi in the [Asus Zenbook UX31E](http://www.asus.com/us/Notebooks_Ultrabooks/ASUS_ZENBOOK_UX31E/) will turn off (not disconnect, but turn off with the red x over the wireless icon in the task bar), as per the diagram after step 7 in the diagram be...
2014/10/04
[ "https://superuser.com/questions/820693", "https://superuser.com", "https://superuser.com/users/-1/" ]
As of this post, two people have posted some great possible solutions. If those don't work, or you want to try something else first, try attaching only one very low power USB device into the port (such as a USB flash drive, but not a mechanical drive). See if your Wifi still works. If it does, that would indicate that...
Had a very similar issue. When I plugged in my phone through USB, the wifi would disable. This issue was that the computer was detecting the phone as a network connection. I disabled the "Disable Wireless when wired connection" and now no longer lose connection. This or checking AutoPlay options may also wo...
69,542,343
I'm trying to calculate values with an arrayformula, based on the last 14 days (the last 14 rows, since every row is 1 day). I want N110:N to have the values (in example: sum) from, let's say, I96:I110. Means, the values in N110 should be sum(I96:I110). For N111 it should be sum(I97:I111) etc. I have something l...
2021/10/12
[ "https://Stackoverflow.com/questions/69542343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9038724/" ]
try: ``` =INDEX(IFNA(VLOOKUP(ROW(A1:A), QUERY(SPLIT(FLATTEN(ROW(A1:A)&"×"&ARRAY_CONSTRAIN( SPLIT(FLATTEN(QUERY(TRANSPOSE(IF(ROW(A1:A)<=TRANSPOSE(ROW(A1:A))=TRUE, TRANSPOSE(A1:A)&"×", )),,9^9)), "×"), 9^9, 14 +N("14 day window"))), "×"), "select Col1,sum(Col2) where Col2 is not null group by Col1"), 2, ))) `...
Make sure that N110:N is empty, and then place the following formula in N110: `=ArrayFormula(IF(I110:I="",,SUMIF(ROW(I96:I),"<="&ROW(I110:I),I96:I)-SUMIF(ROW(I96:I),"<="&ROW(I110:I)-15,I96:I)))` This formula assumes that there are no blank cells interspersed between numbers in I96:I (though there may be blank cells a...
63,075,088
I have to generate a report with dynamic content passed by parameters. The problem is that they ask me to adjust different margins according to whether the page is odd or even. I've seen some workarounds to this, where they use `$V {PAGE_NUMBER}% 2 == 1`, but in my case, as the content may vary, I don't think it's poss...
2020/07/24
[ "https://Stackoverflow.com/questions/63075088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6261556/" ]
The typical pattern would be: ``` [pscustomobject]@{ colLabel='MyLabel' a='a2' b='b2' } | Out-GridView ``` or ``` get-process | select-object name,id,ws | Out-GridView ``` Here's 1 example of a calculated property: ``` 1 | select-object @{ n='Num'; e={$_} } Num --- 1 ```
Sure, use a temporary CSV file: ``` [string] $colLabel = 'MyLabel' [string] $a = 'a' [string] $b = 'b' @" $($colLabel)`, $($a)`, $($b) "@ | Set-Content temp.csv Import-Csv temp.csv | Out-GridView Remove-Item temp.csv ``` First it creates a temporary csv file, then imports and passes to grid view and then deletes it.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
use svn revert
Worst case, delete the contents of your working copy (excluding the .svn folder) and do an update.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
Use "Revert" instead.
Worst case, delete the contents of your working copy (excluding the .svn folder) and do an update.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I have this problem occasionally on OSX (10.6, currently using svn 1.6.16). A workaround is to do this: ``` svn update `svn ls -R` ``` It can be slow though. Ref: <http://code.google.com/p/support/issues/detail?id=3192>
By the way, that's actually a feature of SVN. It will never overwrite any of your modifications when updating (unless you explicitly throw them away using `revert`.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I just wanted to add a little to what diyism posted. I didn't see the `.` next to the `;` in the line ``` svn revert -R .; svn up ``` and it confused me. I don't know why you need to explicitly use `.` for all files when using **revert** and you don't using **update** but that seems to be the way it is. So, in ...
You have to revert your modifications, and if necessary do an update after that.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I have this problem occasionally on OSX (10.6, currently using svn 1.6.16). A workaround is to do this: ``` svn update `svn ls -R` ``` It can be slow though. Ref: <http://code.google.com/p/support/issues/detail?id=3192>
Use "Revert" instead.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
You have to revert your modifications, and if necessary do an update after that.
Worst case, delete the contents of your working copy (excluding the .svn folder) and do an update.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
Use this line: ``` svn revert -R .;svn up ```
Worst case, delete the contents of your working copy (excluding the .svn folder) and do an update.
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I have this problem occasionally on OSX (10.6, currently using svn 1.6.16). A workaround is to do this: ``` svn update `svn ls -R` ``` It can be slow though. Ref: <http://code.google.com/p/support/issues/detail?id=3192>
Use this line: ``` svn revert -R .;svn up ```
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I have this problem occasionally on OSX (10.6, currently using svn 1.6.16). A workaround is to do this: ``` svn update `svn ls -R` ``` It can be slow though. Ref: <http://code.google.com/p/support/issues/detail?id=3192>
use svn revert
840,509
I want svn update to overwrite my local file with the files from the server, even if my local files have modifications, I want to throw them away and use the version that's on the remote repository. How do I do that? I tried `svn update --force` but it doesn't work. ### Update: Thanks for the answers, so I'm using r...
2009/05/08
[ "https://Stackoverflow.com/questions/840509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
I just wanted to add a little to what diyism posted. I didn't see the `.` next to the `;` in the line ``` svn revert -R .; svn up ``` and it confused me. I don't know why you need to explicitly use `.` for all files when using **revert** and you don't using **update** but that seems to be the way it is. So, in ...
Worst case, delete the contents of your working copy (excluding the .svn folder) and do an update.
5,941,631
I have a set-up with multiple variables that users can alter that effect a visual representation of an element. All of this is controlled by jquery scripts. It would be cool if there was a way to save the resultant image as per what the browser renders. It'd be no different than a screencapture from a user perspective,...
2011/05/09
[ "https://Stackoverflow.com/questions/5941631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698379/" ]
Edit : This method only works in Firefox extensions. You can use [HTML5 canvas](http://www.w3.org/TR/html5/the-canvas-element.html), Firefox' [drawWindow](https://developer.mozilla.org/en-US/docs/DOM/CanvasRenderingContext2D#drawWindow()) and the [toDataURL](http://www.w3.org/TR/html5/the-canvas-element.html#dom-canva...
There is no JS functionality built into browsers that would allow you turn an image into HTML sadly. So you would need something like a browser plugin or extension installed that has a JS API that you can call into. But even then, it would obviously require that plugin be installed on that persons browser.
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
If you are trying to count how many times appears the word "count", this will work: ``` my $count=0; open(INPUT,"<terrible.pl"); while (<INPUT>) { $count++ while ($_ =~ /count/g); } close(INPUT); print "$count times\n"; ```
I'm not actually sure what your example code is but you're almost there: perl -e '$text = "lol wut foo wut bar wut"; $count = 0; $count++ while $text =~ /wut/g; print "$count\n";' You can use the /g modifier to continue searching the string for matches. In the example above, it will return all instances of the word '...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
Here's a complete solution. If this is homework, you learn more by explaining this to your teacher than by rolling your own: ``` perl -0777ne "print+(@@=/count/g)+0" terrible.pl ```
I'm not actually sure what your example code is but you're almost there: perl -e '$text = "lol wut foo wut bar wut"; $count = 0; $count++ while $text =~ /wut/g; print "$count\n";' You can use the /g modifier to continue searching the string for matches. In the example above, it will return all instances of the word '...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
If you are trying to count how many times appears the word "count", this will work: ``` my $count=0; open(INPUT,"<terrible.pl"); while (<INPUT>) { $count++ while ($_ =~ /count/g); } close(INPUT); print "$count times\n"; ```
You can probably use something like so: ``` my $fh = IO::File->new('test.txt', 'r') or die "$!\n"; my %words; while (<$fh>) { for my $word (split / /) { $words{$word}++; } } ``` That will give you an accurate count of every "word" (defined as a group of characters separated by a space), and store it in a has...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
Here's a complete solution. If this is homework, you learn more by explaining this to your teacher than by rolling your own: ``` perl -0777ne "print+(@@=/count/g)+0" terrible.pl ```
You can probably use something like so: ``` my $fh = IO::File->new('test.txt', 'r') or die "$!\n"; my %words; while (<$fh>) { for my $word (split / /) { $words{$word}++; } } ``` That will give you an accurate count of every "word" (defined as a group of characters separated by a space), and store it in a has...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
If you are trying to count how many times appears the word "count", this will work: ``` my $count=0; open(INPUT,"<terrible.pl"); while (<INPUT>) { $count++ while ($_ =~ /count/g); } close(INPUT); print "$count times\n"; ```
perdoc perlrequick has an answer. The term you want in that document is "scalar context". Given that this appears to be a homework question, I'll point you at the documentation instead.
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
Here's a complete solution. If this is homework, you learn more by explaining this to your teacher than by rolling your own: ``` perl -0777ne "print+(@@=/count/g)+0" terrible.pl ```
perdoc perlrequick has an answer. The term you want in that document is "scalar context". Given that this appears to be a homework question, I'll point you at the documentation instead.
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
If you are trying to count how many times appears the word "count", this will work: ``` my $count=0; open(INPUT,"<terrible.pl"); while (<INPUT>) { $count++ while ($_ =~ /count/g); } close(INPUT); print "$count times\n"; ```
So, what are you trying to do? You want the number of times something appears in a block of text. You can use the Perl [grep](http://perldoc.perl.org/functions/grep.html) function. That will go through a block of text without needing to loop. If you want an odd/even return value, you can use the [modulo](http://perldo...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
Here's a complete solution. If this is homework, you learn more by explaining this to your teacher than by rolling your own: ``` perl -0777ne "print+(@@=/count/g)+0" terrible.pl ```
So, what are you trying to do? You want the number of times something appears in a block of text. You can use the Perl [grep](http://perldoc.perl.org/functions/grep.html) function. That will go through a block of text without needing to loop. If you want an odd/even return value, you can use the [modulo](http://perldo...
5,317,461
How can I find the number of times a word is in a block of text in Perl? For example my text file is this: ``` #! /usr/bin/perl -w # The 'terrible' program - a poorly formatted 'oddeven'. use constant HOWMANY => 4; $count = 0; while ( $count < HOWMANY ) { $count++; if ( $count == 1 ) { print "odd\n"; } els...
2011/03/15
[ "https://Stackoverflow.com/questions/5317461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453596/" ]
Here's a complete solution. If this is homework, you learn more by explaining this to your teacher than by rolling your own: ``` perl -0777ne "print+(@@=/count/g)+0" terrible.pl ```
If you are trying to count how many times appears the word "count", this will work: ``` my $count=0; open(INPUT,"<terrible.pl"); while (<INPUT>) { $count++ while ($_ =~ /count/g); } close(INPUT); print "$count times\n"; ```
61,630,546
I am trying to make a form where if you click on the submit button, whatever you have written on the text field would be stored in the database. I have created a page as create.php and have written down this code: ``` <html> <head> <title>adding info</title> </head> <body> <h1>insert information</h1> <form method=”p...
2020/05/06
[ "https://Stackoverflow.com/questions/61630546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12377259/" ]
Double-check all of the quotes in your HTML. You seem to have some typographic quotes instead of straight quotes; ``` <form method=”post” action = ""> ``` should be ``` <form method="post" action=""> ``` and having the wrong quotes may confuse your browser to not send the request variables with the names you expe...
You define your $link twice - maybe that's the problem. And there is a space ``` $query = "INSERT INTO info('name', 'age', 'email') VALUES ('$name', '$age' , '$email' )"; ``` between '$age' and the ,. Does the "works" get printed? And don't forget to bind the data - it's not a solution to your problem, but your co...
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Try this, you are enclosing into array improperly ``` $records = $dbh->find(array("email" => array('$ne' => null)))->limit(2000); ```
Ok, I just figured out a decent way, and will post it for any other "noob" like me who's having the same problem :) I used '$nin' with an array and it fixed the problem. Here's my query now: `$records = $dbh->find(array("email" => array('$nin' => array(' ','',null))))->limit(2000);`
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Try this, you are enclosing into array improperly ``` $records = $dbh->find(array("email" => array('$ne' => null)))->limit(2000); ```
After 3 hours of failing, I managed to do it in a tricky way: find('field' => array('$regex' => '.\*'))
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Try this, you are enclosing into array improperly ``` $records = $dbh->find(array("email" => array('$ne' => null)))->limit(2000); ```
``` $records = $dbh->find('$or'=>array( array('email'=>array('$exists' => false)), array('email'=>array('$ne' => null)), array('email'=>array('$ne' => '')) )); ```
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Try this, you are enclosing into array improperly ``` $records = $dbh->find(array("email" => array('$ne' => null)))->limit(2000); ```
You could also do this like ``` $records = $dbh->find(array('$where' => 'this.email && this.email.length'))->limit(2000); ```
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Ok, I just figured out a decent way, and will post it for any other "noob" like me who's having the same problem :) I used '$nin' with an array and it fixed the problem. Here's my query now: `$records = $dbh->find(array("email" => array('$nin' => array(' ','',null))))->limit(2000);`
After 3 hours of failing, I managed to do it in a tricky way: find('field' => array('$regex' => '.\*'))
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Ok, I just figured out a decent way, and will post it for any other "noob" like me who's having the same problem :) I used '$nin' with an array and it fixed the problem. Here's my query now: `$records = $dbh->find(array("email" => array('$nin' => array(' ','',null))))->limit(2000);`
``` $records = $dbh->find('$or'=>array( array('email'=>array('$exists' => false)), array('email'=>array('$ne' => null)), array('email'=>array('$ne' => '')) )); ```
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
Ok, I just figured out a decent way, and will post it for any other "noob" like me who's having the same problem :) I used '$nin' with an array and it fixed the problem. Here's my query now: `$records = $dbh->find(array("email" => array('$nin' => array(' ','',null))))->limit(2000);`
You could also do this like ``` $records = $dbh->find(array('$where' => 'this.email && this.email.length'))->limit(2000); ```
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
After 3 hours of failing, I managed to do it in a tricky way: find('field' => array('$regex' => '.\*'))
``` $records = $dbh->find('$or'=>array( array('email'=>array('$exists' => false)), array('email'=>array('$ne' => null)), array('email'=>array('$ne' => '')) )); ```
16,160,016
This may be a very easy thing to do, but I'm pretty new to MongoDB and am having trouble making this word right. I'm pulling leads from a database, and I only want it to pull records where the email field is not empty. I've tried putting in the statement to skip the record if it's not null, but there are many fields t...
2013/04/23
[ "https://Stackoverflow.com/questions/16160016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1650771/" ]
After 3 hours of failing, I managed to do it in a tricky way: find('field' => array('$regex' => '.\*'))
You could also do this like ``` $records = $dbh->find(array('$where' => 'this.email && this.email.length'))->limit(2000); ```
12,019,447
1. Why do we write \*bufp = buf since both are arrays so in my opinion it should be: ``` static char bufp = buf; ``` 2. How does \*bufp "know" from which position to start displaying ? It is not initialized to zero in any way. After assigning `buf` to `bufp` I'd expect that in return line it starts with the last ente...
2012/08/18
[ "https://Stackoverflow.com/questions/12019447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1596018/" ]
Either use an HTTP POST request, which can't be done just by entering a URL. (Though it can spoofed, or done via a form) Or: How about generating a kind of token on the server, getting it to the ajax code somehow, then passing it back in the ajax request. Obviously they could still forge the request manually if they...
Do you want to prevent any unauthorized users to run the script or do you want to make sure that the script only can be run via AJAX calls? For the first, you can just check if the user is logged in. The AJAX request uses the same session as the ordinary requests. ``` if (Auth::instance()->logged_in()) ``` For the ...
71,680,335
I have a data set with student names, their student ID, and the date they took an exam taken. It looks a bit like this: | Student ID | Student Name | Date Taken | | --- | --- | --- | | 01 | Christian | 2009-09-24 | | 01 | Christian | 2015-06-16 | | 01 | Christian | 2014-05-14 | | 12 | Laura | 2017-01-04 | | 12 | Laura...
2022/03/30
[ "https://Stackoverflow.com/questions/71680335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18165527/" ]
If you are worried about computational power here it should not be a problem. No matter what you would need to define two different variables, maximum and minimum, so the way you did it is fine. If you really do not want to use min, then something like this could work but it is already more complex than what you did: ...
Mathematically `min(a,b)` is the same as `a+b-max(a,b)`. Whether this is an improvement is debatable.
71,680,335
I have a data set with student names, their student ID, and the date they took an exam taken. It looks a bit like this: | Student ID | Student Name | Date Taken | | --- | --- | --- | | 01 | Christian | 2009-09-24 | | 01 | Christian | 2015-06-16 | | 01 | Christian | 2014-05-14 | | 12 | Laura | 2017-01-04 | | 12 | Laura...
2022/03/30
[ "https://Stackoverflow.com/questions/71680335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18165527/" ]
If you are worried about computational power here it should not be a problem. No matter what you would need to define two different variables, maximum and minimum, so the way you did it is fine. If you really do not want to use min, then something like this could work but it is already more complex than what you did: ...
I've ran this code with your suggestions (all very clever ones, thank you!!) to try and see what's faster. The differences are actually quite impressive: ``` import time def whosfaster(a, b): start_time = time.time() maximum = max(a, b) minimum = min(a, b) method0 = time.time() - start_time start...
71,680,335
I have a data set with student names, their student ID, and the date they took an exam taken. It looks a bit like this: | Student ID | Student Name | Date Taken | | --- | --- | --- | | 01 | Christian | 2009-09-24 | | 01 | Christian | 2015-06-16 | | 01 | Christian | 2014-05-14 | | 12 | Laura | 2017-01-04 | | 12 | Laura...
2022/03/30
[ "https://Stackoverflow.com/questions/71680335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18165527/" ]
This would rather depend on what data types *a* and *b* are. If they are simple types (e.g., numeric) then: ``` if a > b: maximum, minimum = a, b else: maximum, minimum = b, a ``` ...might be faster than calling the min and max functions. Or, if you like one-liners: ``` maximum, minimum = (a, b) if a > b else ...
Mathematically `min(a,b)` is the same as `a+b-max(a,b)`. Whether this is an improvement is debatable.
71,680,335
I have a data set with student names, their student ID, and the date they took an exam taken. It looks a bit like this: | Student ID | Student Name | Date Taken | | --- | --- | --- | | 01 | Christian | 2009-09-24 | | 01 | Christian | 2015-06-16 | | 01 | Christian | 2014-05-14 | | 12 | Laura | 2017-01-04 | | 12 | Laura...
2022/03/30
[ "https://Stackoverflow.com/questions/71680335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18165527/" ]
This would rather depend on what data types *a* and *b* are. If they are simple types (e.g., numeric) then: ``` if a > b: maximum, minimum = a, b else: maximum, minimum = b, a ``` ...might be faster than calling the min and max functions. Or, if you like one-liners: ``` maximum, minimum = (a, b) if a > b else ...
I've ran this code with your suggestions (all very clever ones, thank you!!) to try and see what's faster. The differences are actually quite impressive: ``` import time def whosfaster(a, b): start_time = time.time() maximum = max(a, b) minimum = min(a, b) method0 = time.time() - start_time start...
26,656,462
I have following table in mysql: ``` ship_id| start time | plus time | ---------------------------------------------- shp_01 | 14:00:00 | 00:30:00 | shp_02 | 02:00:00 | 00:30:00 | ``` I want to SUM start time and plus time. I need the following output: ``` shp_01 | shp_02 | 14:30:00 | 02:30:00 ...
2014/10/30
[ "https://Stackoverflow.com/questions/26656462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2468529/" ]
This answer is just going to be advice, there is no real right or wrong answer here. Advice is necessarily opinionated and not applicable to all situations, if you don't agree with it, or it doesn't apply to your situation, just ignore it. Sorry for the length, but the question is open-ended and the potential answer ...
From oracle, the Path class represents a simple shape and provides facilities required for basic construction and management of a geometric path while Canvas is an image that can be drawn on using a set of graphics commands provided by a GraphicsContext. Which means the user can use canvas to draw the required shapes ...
26,656,462
I have following table in mysql: ``` ship_id| start time | plus time | ---------------------------------------------- shp_01 | 14:00:00 | 00:30:00 | shp_02 | 02:00:00 | 00:30:00 | ``` I want to SUM start time and plus time. I need the following output: ``` shp_01 | shp_02 | 14:30:00 | 02:30:00 ...
2014/10/30
[ "https://Stackoverflow.com/questions/26656462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2468529/" ]
This answer is just going to be advice, there is no real right or wrong answer here. Advice is necessarily opinionated and not applicable to all situations, if you don't agree with it, or it doesn't apply to your situation, just ignore it. Sorry for the length, but the question is open-ended and the potential answer ...
This is my advice, you can use the control prototype.Or an application or design tool which can provide you the targeted control or a icon with circle shape, a rectangular shape and arrows. I don't know how my advice work. You can try it.
54,541,923
This question could be rephrased to, "Using a programmatically generated range in FILTER()" depending on the approach one takes to answer it. This question is asked for the sake of understanding how to pass a variable range into a filter function (if it's possible). I am currently filtering using the following functi...
2019/02/05
[ "https://Stackoverflow.com/questions/54541923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5153347/" ]
once again, maybe this is what you want: ``` =FILTER('Data Import'!1:100000, INDIRECT("'Data Import'!"& ADDRESS(1, MATCH("student.grade", 'Data Import'!1:1, 0), 4)&":"& ADDRESS(1000000, MATCH("student.grade", 'Data Import'!1:1, 0), 4)) < 12) ``` [![](https://i.stack.imgur.com/ujHjU.png)](https://i.stack.im...
I have no idea what you want to achieve but take a look at this: [![](https://i.stack.imgur.com/HYvSp.png)](https://i.stack.imgur.com/HYvSp.png) ``` ={'Data Import'!1:1; FILTER('Data Import'!1:10000, 'Data Import'!D:D < 12)} ``` [![](https://i.stack.imgur.com/SyAKK.png)](https://i.stack.imgur.com/SyAKK.png) or: ...
54,541,923
This question could be rephrased to, "Using a programmatically generated range in FILTER()" depending on the approach one takes to answer it. This question is asked for the sake of understanding how to pass a variable range into a filter function (if it's possible). I am currently filtering using the following functi...
2019/02/05
[ "https://Stackoverflow.com/questions/54541923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5153347/" ]
once again, maybe this is what you want: ``` =FILTER('Data Import'!1:100000, INDIRECT("'Data Import'!"& ADDRESS(1, MATCH("student.grade", 'Data Import'!1:1, 0), 4)&":"& ADDRESS(1000000, MATCH("student.grade", 'Data Import'!1:1, 0), 4)) < 12) ``` [![](https://i.stack.imgur.com/ujHjU.png)](https://i.stack.im...
The OP's existing solution is based on Filter command. The challenge is that the column containing "student.grade" is not fixed, however player0 has provided an excellent formula-based solution. An alternative *might* be to make use of a named range. The following code finds "student.grades" in the header (row 1) and ...
28,566,071
I'm trying to create a group Route for the admin section and apply the middleware to all paths except for login and logout. What I have so far is: ``` Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'authAdmin'], function() { Route::resource('page', 'PageController'); Route::resour...
2015/02/17
[ "https://Stackoverflow.com/questions/28566071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3677259/" ]
Simply nest groups and then you can exclude specific routes: ``` Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function() { Route::get('login', 'AuthController@login'); Route::get('logout', 'AuthController@logout'); Route::group(['middleware' => 'authAdmin'], function(){ Route::reso...
You can also use laravel's withoutMiddleware method as below; ``` Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'authAdmin'], function() { Route::resource('page', 'PageController'); Route::resource('article', 'ArticleController'); Route::resource('gallery', 'GalleryController'); R...
53,519,620
I have a complex Dictionary that I want to unpack into a single DataFrame but I cannot figure it out. I want to unpack the data contained in 'rows' (ie all of is contained within []) into a single DataFrame ('rows') I have tried lots of combinations of accessing inside the Dictionary to no avail. Here's the data: ```...
2018/11/28
[ "https://Stackoverflow.com/questions/53519620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10011212/" ]
Assuming your dictionary is named 'd', this should get the list of nested dicts, with one dict per record (per row): ``` d[None]['transfers']['1']['rows'] ``` You should be able to pass that into the DataFrame constructor: ``` df = pd.DataFrame(d[None]['transfers']['1']['rows']) ``` If that works, you will end up...
from\_dict function should work in your case. following documentation is pretty good: <https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.from_dict.html>
45,790,779
Cypher query: ``` MATCH (x) WHERE x.uuid = "41f64ab1-6009-4e95-b22b-c833525f6edb" MATCH p = (o)-[:CONTAINS|:HAVING*]->(x) WHERE labels(o) IN ['Box', 'Package'] RETURN p ``` Running it in Neo4j browser results in a warning: ``` **WARNING: This feature is deprecated and will be removed in future versions.** The sem...
2017/08/21
[ "https://Stackoverflow.com/questions/45790779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1482530/" ]
This deprecation is not about inability of using relationship type alternatives but about its syntax – see [cypher deprecations in version 3.2](https://neo4j.com/docs/developer-manual/current/cypher/deprecations-additions-removals-compatibility/#cypher-deprecations-additions-removals-3.2). Only first type has colon now...
This might do it : ``` MATCH (x) WHERE x.uuid = "41f64ab1-6009-4e95-b22b-c833525f6edb" MATCH p = (o)-[*]->(x) WHERE labels(o) IN ['Box', 'Package'] AND ALL (rs IN relationships(p) WHERE type(rs) IN ['CONTAINS','HAVING']) RETURN p ``` Hope this helps.
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
From the description of [material design specs](https://www.google.com/design/spec/components/grid-lists.html#): > > Grid Lists are an alternative to standard list views. Grid lists are > distinct from grids used for layouts and other visual presentations. > > > If you are looking for a much lightweight Grid com...
I hope this is not too late to give a response. I was also looking for a simple, robust, flexible and highly customizable bootstrap like react grid system to use in my projects. The best I know of is `react-pure-grid` <https://www.npmjs.com/package/react-pure-grid> `react-pure-grid` gives you the power to customize...
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
Material UI have implemented their own Flexbox layout via the [Grid component](https://material-ui.com/components/grid/). It appears they [initially wanted](https://github.com/callemall/material-ui/issues/3614#issuecomment-193119929) to keep themselves as purely a 'components' library. But one of the core developers ...
I hope this is not too late to give a response. I was also looking for a simple, robust, flexible and highly customizable bootstrap like react grid system to use in my projects. The best I know of is `react-pure-grid` <https://www.npmjs.com/package/react-pure-grid> `react-pure-grid` gives you the power to customize...
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
From the description of [material design specs](https://www.google.com/design/spec/components/grid-lists.html#): > > Grid Lists are an alternative to standard list views. Grid lists are > distinct from grids used for layouts and other visual presentations. > > > If you are looking for a much lightweight Grid com...
The way I do is go to <http://getbootstrap.com/customize/> and only check "grid system" to download. There are `bootstrap-theme.css` and `bootstrap.css` in downloaded files, and I only need the latter. In this way, I can use the grid system of Bootstrap, with everything else from Material UI.
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
I looked around for an answer to this and the best way I found was to use Flex and inline styling on different components. For example, to make two paper components divide my full screen in 2 vertical components (in ration of 1:4), the following code works fine. ``` const styles = { div:{ display: 'flex', ...
The way I do is go to <http://getbootstrap.com/customize/> and only check "grid system" to download. There are `bootstrap-theme.css` and `bootstrap.css` in downloaded files, and I only need the latter. In this way, I can use the grid system of Bootstrap, with everything else from Material UI.
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
Material UI have implemented their own Flexbox layout via the [Grid component](https://material-ui.com/components/grid/). It appears they [initially wanted](https://github.com/callemall/material-ui/issues/3614#issuecomment-193119929) to keep themselves as purely a 'components' library. But one of the core developers ...
I looked around for an answer to this and the best way I found was to use Flex and inline styling on different components. For example, to make two paper components divide my full screen in 2 vertical components (in ration of 1:4), the following code works fine. ``` const styles = { div:{ display: 'flex', ...
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
Material UI have implemented their own Flexbox layout via the [Grid component](https://material-ui.com/components/grid/). It appears they [initially wanted](https://github.com/callemall/material-ui/issues/3614#issuecomment-193119929) to keep themselves as purely a 'components' library. But one of the core developers ...
Below is made by purely [MUI Grid system](https://material-ui.com/components/grid/), [![MUI - Grid Layout](https://i.stack.imgur.com/7MRI9.png)](https://i.stack.imgur.com/7MRI9.png) With the code below, ``` // MuiGrid.js import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import Paper ...
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
The way I do is go to <http://getbootstrap.com/customize/> and only check "grid system" to download. There are `bootstrap-theme.css` and `bootstrap.css` in downloaded files, and I only need the latter. In this way, I can use the grid system of Bootstrap, with everything else from Material UI.
Below is made by purely [MUI Grid system](https://material-ui.com/components/grid/), [![MUI - Grid Layout](https://i.stack.imgur.com/7MRI9.png)](https://i.stack.imgur.com/7MRI9.png) With the code below, ``` // MuiGrid.js import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import Paper ...
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
Below is made by purely [MUI Grid system](https://material-ui.com/components/grid/), [![MUI - Grid Layout](https://i.stack.imgur.com/7MRI9.png)](https://i.stack.imgur.com/7MRI9.png) With the code below, ``` // MuiGrid.js import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import Paper ...
Here is example of grid system with material-ui which is similar to bootstrap: ``` <Grid container> <Grid item xs={12} sm={4} md={4} lg={4}> </Grid> <Grid item xs={12} sm={4} md={4} lg={4}> </Grid> </Grid> ```
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
I hope this is not too late to give a response. I was also looking for a simple, robust, flexible and highly customizable bootstrap like react grid system to use in my projects. The best I know of is `react-pure-grid` <https://www.npmjs.com/package/react-pure-grid> `react-pure-grid` gives you the power to customize...
The way I do is go to <http://getbootstrap.com/customize/> and only check "grid system" to download. There are `bootstrap-theme.css` and `bootstrap.css` in downloaded files, and I only need the latter. In this way, I can use the grid system of Bootstrap, with everything else from Material UI.
33,671,507
Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with `optimize: "none"`).
2015/11/12
[ "https://Stackoverflow.com/questions/33671507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2663572/" ]
Material UI have implemented their own Flexbox layout via the [Grid component](https://material-ui.com/components/grid/). It appears they [initially wanted](https://github.com/callemall/material-ui/issues/3614#issuecomment-193119929) to keep themselves as purely a 'components' library. But one of the core developers ...
From the description of [material design specs](https://www.google.com/design/spec/components/grid-lists.html#): > > Grid Lists are an alternative to standard list views. Grid lists are > distinct from grids used for layouts and other visual presentations. > > > If you are looking for a much lightweight Grid com...
47,177,639
Many topics exist to sum an array based on another array indexes but i couldn't find what i am looking for. I have an array `[1,1,1,1,2,3,3,0,0,2,4]` and i would like to get indexes by which the sum until now is greater or equal to `4`. So I would get: `[3, 5, 9, 10]` because: ``` Sum([1,1,1,1]) >= 4 Sum([2,3]) >= ...
2017/11/08
[ "https://Stackoverflow.com/questions/47177639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190830/" ]
You can use `np.where` in conjunction with `np.cumsum`: ``` import numpy as np li = [1,1,1,1,2,2,3,0,0,1,4] print(np.where(np.cumsum(li) % 4 == 0)) # (array([ 3, 5, 9, 10], dtype=int32),) ``` The gotcha here of course is that it will also find indexes where the sum is 8, 12, 16, 20 etc. Unfortunately I'm not su...
``` array =[1,1,1,1,2,2,3,0,0,1,4] print(np.where(np.cumsum(array)%4==0)) ``` now, if you change your array then you can check whenever sum goes beyond 4 then u can take the last index and proceed further.
16,791
My lease is up this summer and I'm planning on moving apartments. The problem is that I also have a 3-day trip scheduled to start the day my lease ends (cannot be changed). My cat will be a little over a year old at that point and has always lived indoors at my current apartment. When I go on trips, I usually have a c...
2017/04/05
[ "https://pets.stackexchange.com/questions/16791", "https://pets.stackexchange.com", "https://pets.stackexchange.com/users/7988/" ]
I would move a week early. Going to a new place is traumatic for most cats, they need time to adjust and scent mark. As you said, boarding then new apartment would be doubly traumatic. If there is not enough time to get used to her to get used to the apartment, why would it be any better with boarding? In a boarding ...
I agree with the cat whisperer. Take it there at least a week early. If you can't, then bring it for short sessions to get used to the house daily, and confirm with the current resident. If you can't cancel the trip, get a family member or someone the cat knows well and is used to to replace you and introduce it.
16,791
My lease is up this summer and I'm planning on moving apartments. The problem is that I also have a 3-day trip scheduled to start the day my lease ends (cannot be changed). My cat will be a little over a year old at that point and has always lived indoors at my current apartment. When I go on trips, I usually have a c...
2017/04/05
[ "https://pets.stackexchange.com/questions/16791", "https://pets.stackexchange.com", "https://pets.stackexchange.com/users/7988/" ]
I would move a week early. Going to a new place is traumatic for most cats, they need time to adjust and scent mark. As you said, boarding then new apartment would be doubly traumatic. If there is not enough time to get used to her to get used to the apartment, why would it be any better with boarding? In a boarding ...
I did the exact same thing once, I moved out to a new apartment with my cat and there was an emergency at the day I was moving so I had to leave for a couple of days. What I did was; I confined her to a smaller room full of her favourite things & furnitures. This included my bed (she always sleeps with me), her toy co...
16,791
My lease is up this summer and I'm planning on moving apartments. The problem is that I also have a 3-day trip scheduled to start the day my lease ends (cannot be changed). My cat will be a little over a year old at that point and has always lived indoors at my current apartment. When I go on trips, I usually have a c...
2017/04/05
[ "https://pets.stackexchange.com/questions/16791", "https://pets.stackexchange.com", "https://pets.stackexchange.com/users/7988/" ]
I did the exact same thing once, I moved out to a new apartment with my cat and there was an emergency at the day I was moving so I had to leave for a couple of days. What I did was; I confined her to a smaller room full of her favourite things & furnitures. This included my bed (she always sleeps with me), her toy co...
I agree with the cat whisperer. Take it there at least a week early. If you can't, then bring it for short sessions to get used to the house daily, and confirm with the current resident. If you can't cancel the trip, get a family member or someone the cat knows well and is used to to replace you and introduce it.
4,895,157
So my function should open a file and count the word length and give the output. For example, many('sample.txt') Words of length 1: 2 Words of length 2: 6 Words of length 3: 7 Words of length 4: 6 My sample.txt file contains: This is a test file. How many words are of length one? How many words are of length thre...
2011/02/04
[ "https://Stackoverflow.com/questions/4895157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582457/" ]
Since this is homework, I'll post a short solution here, and leave it as exercise to figure out what it does and why it works :) ``` >>> from collections import Counter >>> text = open("sample.txt").read() >>> counts = Counter([len(word.strip('?!,.')) for word in text.split()]) >>> counts[3] 7 ```
What do you expect here ``` if item == 1: ``` and here ``` L.count(item) ``` And what does actually happen? Use a debugger and have a look at the variable values or just print them to the screen.
4,895,157
So my function should open a file and count the word length and give the output. For example, many('sample.txt') Words of length 1: 2 Words of length 2: 6 Words of length 3: 7 Words of length 4: 6 My sample.txt file contains: This is a test file. How many words are of length one? How many words are of length thre...
2011/02/04
[ "https://Stackoverflow.com/questions/4895157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582457/" ]
Maybe also this: ``` >>> s 'This is a test file. How many words are of length one? How many words are of length three? We should figure it out! Can a function do this?' >>> {x:[len([c for c in w ]) for w in s.split()].count(x) for x in [len([c for c in w ]) for w in s.split()] } {1: 2, 2: 6, 3: 5, 4: 6, 5: 4, 6: 5, 8...
The regular expression library might also be helpful, if being somewhat overkill. A simple word matching re might be something like: ``` import re f = open("sample.txt") text = f.read() words = re.findall("\w+", text) ``` Words is then a list of... words :) This however will not properly match words like 'isn't' an...
4,895,157
So my function should open a file and count the word length and give the output. For example, many('sample.txt') Words of length 1: 2 Words of length 2: 6 Words of length 3: 7 Words of length 4: 6 My sample.txt file contains: This is a test file. How many words are of length one? How many words are of length thre...
2011/02/04
[ "https://Stackoverflow.com/questions/4895157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582457/" ]
You want to obtain a list of lengths (1, 2, 3, 4,... characters) and a number of occurrences of words with this length in the file. So until `L = text.split()` it was a good approach. Now have a look at *dictionaries* in Python, that will allow you to store the data structure mentioned above and iterate over the list ...
What do you expect here ``` if item == 1: ``` and here ``` L.count(item) ``` And what does actually happen? Use a debugger and have a look at the variable values or just print them to the screen.
4,895,157
So my function should open a file and count the word length and give the output. For example, many('sample.txt') Words of length 1: 2 Words of length 2: 6 Words of length 3: 7 Words of length 4: 6 My sample.txt file contains: This is a test file. How many words are of length one? How many words are of length thre...
2011/02/04
[ "https://Stackoverflow.com/questions/4895157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/582457/" ]
Maybe also this: ``` >>> s 'This is a test file. How many words are of length one? How many words are of length three? We should figure it out! Can a function do this?' >>> {x:[len([c for c in w ]) for w in s.split()].count(x) for x in [len([c for c in w ]) for w in s.split()] } {1: 2, 2: 6, 3: 5, 4: 6, 5: 4, 6: 5, 8...
Let's analyze your problem step-by-step. You need to: 1. Retrieve all the words from a file 2. Iterate over all the words 3. Increment the counter `N` every time you find a word of length `N` 4. Output the result You already did the step 1: ``` def many(fname): infile = open(fname,'r') text = infile.read()...