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
79,891
I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like: ``` <a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a> ``` But I don't know how to write / format that properly.
2013/01/09
[ "https://wordpress.stackexchange.com/questions/79891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24421/" ]
This block of code will add a button right next to the "Insert into post" one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML: ``` var wpMediaFramePost = wp.media.view.MediaFrame.Post; wp.media.view.MediaFrame.Post = wpMediaFramePost.extend( { mainInsertToolbar: fun...
Write a small plugin, use the follow example source to add a item in the list of the left sidebar in the media manager inside the overlay popup. Result of the source below: ![enter image description here](https://i.stack.imgur.com/D1aLT.png) ``` add_action( 'admin_footer-post-new.php', 'wpse_78881_script' ); add_acti...
79,891
I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like: ``` <a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a> ``` But I don't know how to write / format that properly.
2013/01/09
[ "https://wordpress.stackexchange.com/questions/79891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24421/" ]
Write a small plugin, use the follow example source to add a item in the list of the left sidebar in the media manager inside the overlay popup. Result of the source below: ![enter image description here](https://i.stack.imgur.com/D1aLT.png) ``` add_action( 'admin_footer-post-new.php', 'wpse_78881_script' ); add_acti...
I've just encountered a case in WP 3.6 where aesqe's (very useful) answer results in images being inserted twice due to backbone's `state.get("selection")._byId` including both `id` and `cid` for each image selected. Changing `state.get("selection")._byId` to `state.get("selection").models` fixed this for me while pr...
79,891
I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like: ``` <a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a> ``` But I don't know how to write / format that properly.
2013/01/09
[ "https://wordpress.stackexchange.com/questions/79891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24421/" ]
This block of code will add a button right next to the "Insert into post" one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML: ``` var wpMediaFramePost = wp.media.view.MediaFrame.Post; wp.media.view.MediaFrame.Post = wpMediaFramePost.extend( { mainInsertToolbar: fun...
I do not have a full answer to your question, but here is a good start. To customize the new Media Manager, you should study the javascript Backbone code in `wp-includes/js/media-views.js`. For exemple, here is a small plugin that adds a "Select All" button to the "Insert from URL" Toolbar : `custom.php`: ``` add_ac...
79,891
I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like: ``` <a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a> ``` But I don't know how to write / format that properly.
2013/01/09
[ "https://wordpress.stackexchange.com/questions/79891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/24421/" ]
This block of code will add a button right next to the "Insert into post" one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML: ``` var wpMediaFramePost = wp.media.view.MediaFrame.Post; wp.media.view.MediaFrame.Post = wpMediaFramePost.extend( { mainInsertToolbar: fun...
I've just encountered a case in WP 3.6 where aesqe's (very useful) answer results in images being inserted twice due to backbone's `state.get("selection")._byId` including both `id` and `cid` for each image selected. Changing `state.get("selection")._byId` to `state.get("selection").models` fixed this for me while pr...
11,916,704
I've been trying to play with Phonegap and created a small application in HTML/Javascript to send an SMS. I tried this code `window.location.href = 'sms:XXXXXXXX06?body=Testing'` which opens up a screen to manually send the sms which I want to automate. Please note that I create an android app by uploading my project...
2012/08/11
[ "https://Stackoverflow.com/questions/11916704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415057/" ]
See the [Phonegap SMS Plugin](https://github.com/phonegap/phonegap-plugins/tree/master/Android/SMSPlugin) to send SMS messages.
here is the [phonegap-sms-plugin](https://github.com/javatechig/phonegap-sms-plugin)
11,916,704
I've been trying to play with Phonegap and created a small application in HTML/Javascript to send an SMS. I tried this code `window.location.href = 'sms:XXXXXXXX06?body=Testing'` which opens up a screen to manually send the sms which I want to automate. Please note that I create an android app by uploading my project...
2012/08/11
[ "https://Stackoverflow.com/questions/11916704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415057/" ]
See the [Phonegap SMS Plugin](https://github.com/phonegap/phonegap-plugins/tree/master/Android/SMSPlugin) to send SMS messages.
try to make somthing like this: ``` <a href="smsto:000000000"> sms number</a> ``` it works for me on Android device.
11,916,704
I've been trying to play with Phonegap and created a small application in HTML/Javascript to send an SMS. I tried this code `window.location.href = 'sms:XXXXXXXX06?body=Testing'` which opens up a screen to manually send the sms which I want to automate. Please note that I create an android app by uploading my project...
2012/08/11
[ "https://Stackoverflow.com/questions/11916704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/415057/" ]
here is the [phonegap-sms-plugin](https://github.com/javatechig/phonegap-sms-plugin)
try to make somthing like this: ``` <a href="smsto:000000000"> sms number</a> ``` it works for me on Android device.
29,412,776
I am trying to display a series of numbers(table field name = "tag number" from a MySQL database table called milk in a combo-box. It is inside of an input table. However i am not sure what the problem is. Here is my code: ``` <form name="test_form" id="test_form" method="post" action="InputBase.php"> <tbody> ...
2015/04/02
[ "https://Stackoverflow.com/questions/29412776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4335329/" ]
I took your list of names `ls` and made it a `data.frame` with the same `name` name. I then used `left_join` from `dplyr` ``` ls<-c("c","b","d") df2<-data.frame(name=ls) df2 %>% left_join(df,by="name")->new_df > new_df name age 1 c 30 2 b 20 3 d NA ``` Or, if you're unfamiliar with the dplyr/magrit...
This can be done in a single line in base R with the `match` function: ``` data.frame(name=names, age=df$age[match(names, df$name)]) # name age # 1 c 30 # 2 b 20 # 3 d NA ``` Data: ``` names <- c("c", "b", "d") df <- data.frame(name=c("a", "b", "c"), age=c(10, 20, 30)) ```
6,205
What does mean 는 when it comes after a verb and how do you use it in sentences? I know it comes after nouns but what does it mean when 는 comes AFTER verbs and how do you use it? Can you provide example sentences (like as many as you can, seriously?) I see this 있는 thing being used all the time but it is so damn confusi...
2020/11/11
[ "https://korean.stackexchange.com/questions/6205", "https://korean.stackexchange.com", "https://korean.stackexchange.com/users/3188/" ]
The 은/는 that comes after a noun is a completely different ending than the 는 (and 은) that come after verbs. Consider them as homonyms, like English can (I **can** do it / tin **can**). After a verb, 는 is a present *present participle* ending, like the -ing in an English phrase like 'the dripping faucet' - basically, it...
Fwiw these are some examples I made 사랑하는 사람 => the person I love * 사랑하는 사람에게 편지를 보냈다. => I sent a mail to the person I love. 아끼는 장난감 => my favorite toy * 아끼는 장난감을 잃어 버렸다. => I lost my favorite toy. 맛있는 요리 => food that tastes good => nice dish * 맛있는 요리였다. => That was a nice dish. 있는 => existing/being 집에 있는 사람 =>...
6,205
What does mean 는 when it comes after a verb and how do you use it in sentences? I know it comes after nouns but what does it mean when 는 comes AFTER verbs and how do you use it? Can you provide example sentences (like as many as you can, seriously?) I see this 있는 thing being used all the time but it is so damn confusi...
2020/11/11
[ "https://korean.stackexchange.com/questions/6205", "https://korean.stackexchange.com", "https://korean.stackexchange.com/users/3188/" ]
Fwiw these are some examples I made 사랑하는 사람 => the person I love * 사랑하는 사람에게 편지를 보냈다. => I sent a mail to the person I love. 아끼는 장난감 => my favorite toy * 아끼는 장난감을 잃어 버렸다. => I lost my favorite toy. 맛있는 요리 => food that tastes good => nice dish * 맛있는 요리였다. => That was a nice dish. 있는 => existing/being 집에 있는 사람 =>...
“는” is mostly attached to verb and adjective, and following by a noun. E.g. 내가 사랑하(verb)는 오빠(noun)가 너무 잘생겼다. The man whom I love is so handsome. You can see that “사랑하는 오빠” where “는” is added to “사랑하(다)” which is a verb. “사랑하는 오빠” here means “man whom I love”. By this explanation, you can see that “는” is used when you...
6,205
What does mean 는 when it comes after a verb and how do you use it in sentences? I know it comes after nouns but what does it mean when 는 comes AFTER verbs and how do you use it? Can you provide example sentences (like as many as you can, seriously?) I see this 있는 thing being used all the time but it is so damn confusi...
2020/11/11
[ "https://korean.stackexchange.com/questions/6205", "https://korean.stackexchange.com", "https://korean.stackexchange.com/users/3188/" ]
The 은/는 that comes after a noun is a completely different ending than the 는 (and 은) that come after verbs. Consider them as homonyms, like English can (I **can** do it / tin **can**). After a verb, 는 is a present *present participle* ending, like the -ing in an English phrase like 'the dripping faucet' - basically, it...
“는” is mostly attached to verb and adjective, and following by a noun. E.g. 내가 사랑하(verb)는 오빠(noun)가 너무 잘생겼다. The man whom I love is so handsome. You can see that “사랑하는 오빠” where “는” is added to “사랑하(다)” which is a verb. “사랑하는 오빠” here means “man whom I love”. By this explanation, you can see that “는” is used when you...
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
**It's probably the line rate (speed) of the first network link, the one which attaches your server to the hosting providers network.** It matches the ubiquitous 100 Mbit/s and 1 Gbit/s Ethernet standards; and hosting providers have a habit of mentioning this link speed, as it gives such a nice high number to show. Th...
1 gigabit/s network is ten times faster, and therefore more capable, than 100 megabit/s - so 1 Gbit/s should be better than 100 Mbit/s - that said, if your server doesn't use this extra capacity, it may not be worth going for the 1 Gbit/s. What's the price difference?
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
1 gigabit/s network is ten times faster, and therefore more capable, than 100 megabit/s - so 1 Gbit/s should be better than 100 Mbit/s - that said, if your server doesn't use this extra capacity, it may not be worth going for the 1 Gbit/s. What's the price difference?
The main thing you need to understand is many hosts will sell you 100 Mbit/s hosting even very cheaply in the USA. Gbit/s hosting in the USA is a little harder to find, outside of the US there are lots of hosting proivders that offer Gbit/s hosting for 100~ euros a month. Now that you have 100 Mbit/s or 1 Gbit/s you h...
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
1 gigabit/s network is ten times faster, and therefore more capable, than 100 megabit/s - so 1 Gbit/s should be better than 100 Mbit/s - that said, if your server doesn't use this extra capacity, it may not be worth going for the 1 Gbit/s. What's the price difference?
I don't think people here gives you clear picture which leads me to believe they don't have real experience. The point behind overselling is, that most servers will never need true 100 Mbit/s or 1 Gbit/s. The same at home, you don't buy fiber for downloading 24 hours a day at 50 Mbit/s, but for convenience - when you d...
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
**It's probably the line rate (speed) of the first network link, the one which attaches your server to the hosting providers network.** It matches the ubiquitous 100 Mbit/s and 1 Gbit/s Ethernet standards; and hosting providers have a habit of mentioning this link speed, as it gives such a nice high number to show. Th...
The main thing you need to understand is many hosts will sell you 100 Mbit/s hosting even very cheaply in the USA. Gbit/s hosting in the USA is a little harder to find, outside of the US there are lots of hosting proivders that offer Gbit/s hosting for 100~ euros a month. Now that you have 100 Mbit/s or 1 Gbit/s you h...
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
**It's probably the line rate (speed) of the first network link, the one which attaches your server to the hosting providers network.** It matches the ubiquitous 100 Mbit/s and 1 Gbit/s Ethernet standards; and hosting providers have a habit of mentioning this link speed, as it gives such a nice high number to show. Th...
I don't think people here gives you clear picture which leads me to believe they don't have real experience. The point behind overselling is, that most servers will never need true 100 Mbit/s or 1 Gbit/s. The same at home, you don't buy fiber for downloading 24 hours a day at 50 Mbit/s, but for convenience - when you d...
68,022
What is the difference between 100 Mbit/s and 1 Gbit/s? What are the advantages of a 1 Gbit/s network and pricing?
2009/09/23
[ "https://serverfault.com/questions/68022", "https://serverfault.com", "https://serverfault.com/users/20996/" ]
The main thing you need to understand is many hosts will sell you 100 Mbit/s hosting even very cheaply in the USA. Gbit/s hosting in the USA is a little harder to find, outside of the US there are lots of hosting proivders that offer Gbit/s hosting for 100~ euros a month. Now that you have 100 Mbit/s or 1 Gbit/s you h...
I don't think people here gives you clear picture which leads me to believe they don't have real experience. The point behind overselling is, that most servers will never need true 100 Mbit/s or 1 Gbit/s. The same at home, you don't buy fiber for downloading 24 hours a day at 50 Mbit/s, but for convenience - when you d...
64,147
I'm considering running a game, in which characters take on a role of courtiers in a sovereign ruler's court. The idea is that these courtiers all serve as spies, diplomats, enforcers etc. to some factions, domestic or foreign, to further their causes through intrigue and conspiracy. The PCs would not (initially) be or...
2015/06/29
[ "https://rpg.stackexchange.com/questions/64147", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/14670/" ]
Let me recommend [Polaris](http://www.tao-games.com/polaris/), which is a very odd game but potentially just what you're looking for. It's also potentially not at all what you're looking for, because Polaris is *weird*, but nothing ventured nothing gained eh? By default in Polaris, you are knights under the command of...
There is a P&P system for Game of Thrones. You might want to look into that. More intriguing and backstabing than that isn't possible I guess. <https://greenronin.com/sifrp/> There is a quickstart PDF as well, if you want to see if it may fit your needs. I haven't played it myself, but my Gamemaster has told me a li...
46,629
I was trying to analyze one stock, where there was a link called Fibonacci value, which shows different prices of stock as bellow: > > Trading :: Fibonacci Values Stock Code ANDPRA Exchange NSE 1st > Fibonacci Value 343.00 2nd Fibonacci Value 338.89 3rd Fibonacci > Value 337.63 4th Fibonacci Value 336.36 5th Fibona...
2015/04/09
[ "https://money.stackexchange.com/questions/46629", "https://money.stackexchange.com", "https://money.stackexchange.com/users/26635/" ]
Usually when a stock is up-trending or down-trending the price does not go up or down in a straight line. In an uptrend the price may go up over a couple of days then it could go down the next day or two, but the general direction would be up over the medium term. The opposite for a downtrend. So if the stock has been...
This is how I've understood this concept. Fibonacci nos/levels/ratios/%s is based on concept of sequential increment. You may find lot of info about Fibonacci on net. In stock market this concept is used to predict psychological level. While a trend is form, usually price tend to accumulate/consolidate at these level. ...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
[Online Etymology Dictionary](http://www.etymonline.com/index.php?term=fail) says: > > Fail: > > > The noun (e.g. *without fail*) is from > **late 13c.**, from O.Fr. *faile* "deficiency," from *falir*. The > Anglo-French form of the verb, > *failer*, came to be used as a noun, hence *[failure](http://www.etymonl...
Fail has been used as a noun with a quite different meaning by Rev John Davidson,DD in his book 'Old Aberdeenshire Ministers and their people' 1895. He describes a parish school built in a day with dry-stone walls topped with FAIL or divot and a roof of open rafters covered by thatch.
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
The recent uprise in incidences of non-verb *fail* is due to its being an internet meme, possibly from a Japanese video game with poor translation to English. [Know your meme](http://knowyourmeme.com/memes/fail).
The correct answer is.... The exact date when the explosion of FAILs noun usage began probably cant be pin pointed. But where and why is absolutely and unquestionably....... The online game WORLD OF WARCRAFT. And more specifically it applied to RAIDs in WOW. In a raid you gather 15 or 30 online players at a specific lo...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
[Online Etymology Dictionary](http://www.etymonline.com/index.php?term=fail) says: > > Fail: > > > The noun (e.g. *without fail*) is from > **late 13c.**, from O.Fr. *faile* "deficiency," from *falir*. The > Anglo-French form of the verb, > *failer*, came to be used as a noun, hence *[failure](http://www.etymonl...
My answer focuses on the emergence not of "fail" as a noun but of the phrase "a fail" in the sense of "a failure." The earliest instance I've found in a Google Books search is from testimony given by Stian Finne—"a clerk with a stock sales house"—in May 1927 in [Duncan v. Stoneham](https://books.google.com/books?id=ft...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
"Fail" has existed as a noun and has been part of our lexicon [for a long time](http://www.etymonline.com/index.php?term=fail), such as in the phrase "without fail." However, it gained a new meaning in the recent years with the fail Internet meme, where it started as an interjection first, capable of standing on alone ...
Although "fail" has been used sparingly in the past as a noun (e.g. "without fail"), there is evidence that the word is creeping toward ordinary usage as a noun to replace the word "failure." I just read the following headline in Bloomberg Businessweek (6/6/11-6/12/11 issue): "How Stephen Elop is trying to lead Nokia p...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
"Fail" has existed as a noun and has been part of our lexicon [for a long time](http://www.etymonline.com/index.php?term=fail), such as in the phrase "without fail." However, it gained a new meaning in the recent years with the fail Internet meme, where it started as an interjection first, capable of standing on alone ...
My answer focuses on the emergence not of "fail" as a noun but of the phrase "a fail" in the sense of "a failure." The earliest instance I've found in a Google Books search is from testimony given by Stian Finne—"a clerk with a stock sales house"—in May 1927 in [Duncan v. Stoneham](https://books.google.com/books?id=ft...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
[Online Etymology Dictionary](http://www.etymonline.com/index.php?term=fail) says: > > Fail: > > > The noun (e.g. *without fail*) is from > **late 13c.**, from O.Fr. *faile* "deficiency," from *falir*. The > Anglo-French form of the verb, > *failer*, came to be used as a noun, hence *[failure](http://www.etymonl...
The correct answer is.... The exact date when the explosion of FAILs noun usage began probably cant be pin pointed. But where and why is absolutely and unquestionably....... The online game WORLD OF WARCRAFT. And more specifically it applied to RAIDs in WOW. In a raid you gather 15 or 30 online players at a specific lo...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
"Fail" has existed as a noun and has been part of our lexicon [for a long time](http://www.etymonline.com/index.php?term=fail), such as in the phrase "without fail." However, it gained a new meaning in the recent years with the fail Internet meme, where it started as an interjection first, capable of standing on alone ...
The recent uprise in incidences of non-verb *fail* is due to its being an internet meme, possibly from a Japanese video game with poor translation to English. [Know your meme](http://knowyourmeme.com/memes/fail).
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
Fail has been used as a noun with a quite different meaning by Rev John Davidson,DD in his book 'Old Aberdeenshire Ministers and their people' 1895. He describes a parish school built in a day with dry-stone walls topped with FAIL or divot and a roof of open rafters covered by thatch.
The correct answer is.... The exact date when the explosion of FAILs noun usage began probably cant be pin pointed. But where and why is absolutely and unquestionably....... The online game WORLD OF WARCRAFT. And more specifically it applied to RAIDs in WOW. In a raid you gather 15 or 30 online players at a specific lo...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
Although "fail" has been used sparingly in the past as a noun (e.g. "without fail"), there is evidence that the word is creeping toward ordinary usage as a noun to replace the word "failure." I just read the following headline in Bloomberg Businessweek (6/6/11-6/12/11 issue): "How Stephen Elop is trying to lead Nokia p...
My answer focuses on the emergence not of "fail" as a noun but of the phrase "a fail" in the sense of "a failure." The earliest instance I've found in a Google Books search is from testimony given by Stian Finne—"a clerk with a stock sales house"—in May 1927 in [Duncan v. Stoneham](https://books.google.com/books?id=ft...
9,657
Does anyone know when and how *fail* became a noun? I'd love to see one of those charts that shows the date of origin and subsequent growth of this usage.
2011/01/23
[ "https://english.stackexchange.com/questions/9657", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1778/" ]
Although "fail" has been used sparingly in the past as a noun (e.g. "without fail"), there is evidence that the word is creeping toward ordinary usage as a noun to replace the word "failure." I just read the following headline in Bloomberg Businessweek (6/6/11-6/12/11 issue): "How Stephen Elop is trying to lead Nokia p...
The correct answer is.... The exact date when the explosion of FAILs noun usage began probably cant be pin pointed. But where and why is absolutely and unquestionably....... The online game WORLD OF WARCRAFT. And more specifically it applied to RAIDs in WOW. In a raid you gather 15 or 30 online players at a specific lo...
22,140,591
I am familiar with [**Jquery AJAX call**](http://api.jquery.com/jQuery.ajax/), which has different callbacks like beforeSend, success, complete, etc. This is the example AJAX call with Jquery: ``` $.ajax({ url: 'register.php', type: 'POST', data: {name:name, email:email}, beforeSend: function() { // sh...
2014/03/03
[ "https://Stackoverflow.com/questions/22140591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/386579/" ]
By default Angular does not provide beforeSend and complete but you can implement them by using interceptors. Here is my implementation: ``` (function() { var app = angular.module("app"); app.factory("interceptors", [function() { return { // if beforeSend is defined call it '...
You can use `interceptors`. Search for the word `interceptor` into the Angular [$http documentation](http://docs.angularjs.org/api/ng/service/$http) > > **As the documentation says** : *For purposes of global error handling, >authentication, or any kind of synchronous or asynchronous pre-processing of >request or po...
20,268,016
i have following while ``` while($rs=mysqli_fetch_array($row)) { } ``` in each while execution there is one column which will have some ID lik 5 , 6 7, 8 ``` ID Name Intake division_no 1 5 1 2 2 6 4 5 ``` i have some varible name like txtin5, txtin6 while looping in...
2013/11/28
[ "https://Stackoverflow.com/questions/20268016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1907895/" ]
Here's how you do variable variables in PHP: ``` ${$spvar.$i} = $rs['Intake']; ``` However, I recommend that you avoid the need for this. Instead of variables `$txtin5` and `$txtin6`, why not make `$txtin` be an array, so you can use `$txtin[$i]`?
You can use arrays instead of what you did. Handling array is quite simple and easy. SO your code will look like: ``` while { $spvar[] = rs['Intake']; } ``` ANd if you want to have a associative array you can use: ``` $i=5; while { $spvar[$i] = rs['Intake']; $i++; } ```
14,489
If acceleration of something $= - 10 \text{ m s}^{-2}$ And forwards is define as north. Does that mean the object is getting slower (decelerating) or accelerating in the reverse direction (south) How can you tell the difference?
2011/09/09
[ "https://physics.stackexchange.com/questions/14489", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/4/" ]
> > Does that mean the object is getting slower (decelerating) or accelerating in the reverse direction (south) > > > It *really* doesn't matter. Basic kinematic formulas are designed to work just as well in either case, which is why physicists don't generally use the word "decelerating." It's just another kind of...
The answer depends entirely on what you define as stopped{\*}. Moreover, physics must be the same in all inertial reference frames{+}, which means that it can not depend on the distinction you are trying to make. Accordingly there is no physical difference, just a linguistic one that relies on a common understanding ...
628,863
The Riemann tensor is a function of the metric tensor when the Levi-Civita connection is used. Most tensor notation based texts give the Riemann tensor in terms of the Christoffel symbols, which are give in terms of the partial derivatives of the metric, but I have not seen the Riemann tensor given directly in terms of...
2014/01/06
[ "https://math.stackexchange.com/questions/628863", "https://math.stackexchange.com", "https://math.stackexchange.com/users/66696/" ]
If you look [here](http://en.wikipedia.org/wiki/List_of_formulas_in_Riemannian_geometry#Riemann_curvature_tensor), you will see an equation expressing the Riemann curvature tensor in terms of the second partial derivatives of the metric and some of the Christoffel symbols, which can then be written in terms of the firs...
$R\_{ σuv}^{ρ}=(1/2)[∂\_{u}(g^{ρd}[g\_{dv,σ}+g\_{dσ,v}-g\_{vσ,d}])-∂\_{v}(g^{ρe}[g\_{eu,σ}+g\_{eσ,u}-g\_{uσ,e}])+(1/2)(g^{ρf}[g\_{fu,λ}+g\_{fλ,u}-g\_{uλ,f}])(g^{λh}[g\_{hv,σ}+g\_{hσ,v}-g\_{vσ,h}])-(1/2)(g^{ρi}[g\_{iv,λ}+g\_{iλ,v}-g\_{vλ,i}])(g^{λk}[g\_{ku,σ}+g\_{kσ,u}-g\_{uσ,k}])]$. and by using the notation $X\_{[a,b...
41,173,856
I’m using Rails 4.2.7 with Nokogiri. How do I create a new Nokogiri node to add to my document? I thought I could do this ``` general = doc.xpath("//lomimscc:general") title = Nokogiri::XML::Node.new "lomimscc:title" string = Nokogiri::XML::Node.new "lomimscc:string" string.content = scenario.title string.language = '...
2016/12/15
[ "https://Stackoverflow.com/questions/41173856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1235929/" ]
An interface describes the methods that must be implemented, but has no say in *how* they are implemented or what the implementation must actually do. An abstract class, however, allows you to define behavior while still using abstract methods as points of extensibility. A combination of non-abstract public methods an...
This sounds like a job for unit testing. Your compiler isn't going to enforce it for you, but if the rule exists, then it should be tested accordingly. The below uses Moq. ``` [TestFixture] public class EmailReportSenderTests { [Test] public void EmailReportSender_Send_CallsValidateContent() { var ...
41,173,856
I’m using Rails 4.2.7 with Nokogiri. How do I create a new Nokogiri node to add to my document? I thought I could do this ``` general = doc.xpath("//lomimscc:general") title = Nokogiri::XML::Node.new "lomimscc:title" string = Nokogiri::XML::Node.new "lomimscc:string" string.content = scenario.title string.language = '...
2016/12/15
[ "https://Stackoverflow.com/questions/41173856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1235929/" ]
you can't do that in an interface. What you would do is flip the logic upside down, and use the template pattern. Have one base method that defined the 'algorithm' that needs to happen, and defer points that need to be unique to subclasses: ``` public abstract class SenderBase { public void Send() { Va...
This sounds like a job for unit testing. Your compiler isn't going to enforce it for you, but if the rule exists, then it should be tested accordingly. The below uses Moq. ``` [TestFixture] public class EmailReportSenderTests { [Test] public void EmailReportSender_Send_CallsValidateContent() { var ...
1,621,521
Is there a program which I can run like this: ``` py2py.py < orig.py > smaller.py ``` Where orig.py contains python source code with comments and doc strings, and smaller.py contains identical, runnable source code but without the comments and doc strings? Code which originally looked like this: ``` #/usr/bin/pyth...
2009/10/25
[ "https://Stackoverflow.com/questions/1621521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/196255/" ]
[This Python minifier](https://pypi.python.org/pypi/pyminifier) looks like it does what you need.
I recommend [minipy](https://github.com/gareth-rees/minipy). The most compelling reason is that it does proper analysis of the source code abstract syntax tree so the minified code is much more accurate. I've found that the more well known [pyminifier](https://pypi.python.org/pypi/pyminifier) tends to generate code wit...
25,805,443
i'm new in android. i made an app with service and thread to show a Toast every 5 seconds: ``` import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.util.Log; import android.widget.Toast; public class MyService e...
2014/09/12
[ "https://Stackoverflow.com/questions/25805443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3925802/" ]
call `Thread.sleep` inside while loop as: ``` boolean isThreadRunning=true; new Thread() { public void run() { try { while(isThreadRunning){ mHandler.postDelayed(RunnableUpdateResults); sleep(5000); ...
Use a `Timer` with a `TimerTask` ``` new Timer().schedule(new TimerTask() { @Override public void run() { mHandler.post(RunnableUpdateResults); } }, 0, 5000); ```
6,478,901
I am in the process of building an application for the iMac and iPhone. The goal of the application is to encrypt plain text messages, e-mails, passwords, dates, etc. I have done some research and found that 3DES would work great and is very secure. Does anyone know how to implement 3DES in Objective-C for the iPhone o...
2011/06/25
[ "https://Stackoverflow.com/questions/6478901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814730/" ]
DES is an old standard that is not secure anymore because of its short key length; 3DES is one way to get it safer (uses three times more key bits). But the new standard is AES, which you could try if you don't find (or don't like) any DES libraries out there that suits your needs. You could, for example, use [OpenSSL]...
It probably doesn't make a lot of sense to try to re-implement DES or any other encryption algorithm in Objective-C when there are well-known versions implemented in C and/or C++. You can simply call any of those from your Objective-C program.
6,478,901
I am in the process of building an application for the iMac and iPhone. The goal of the application is to encrypt plain text messages, e-mails, passwords, dates, etc. I have done some research and found that 3DES would work great and is very secure. Does anyone know how to implement 3DES in Objective-C for the iPhone o...
2011/06/25
[ "https://Stackoverflow.com/questions/6478901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814730/" ]
Both iOS and OS X have the [`CommonCrypto`](http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man3/CCCrypt.3cc.html) library, which provides implementations of AES, 3DES, and DES, among others. Writing your own crypto library is difficult, error prone, and likely to cause bugs. Besides whi...
It probably doesn't make a lot of sense to try to re-implement DES or any other encryption algorithm in Objective-C when there are well-known versions implemented in C and/or C++. You can simply call any of those from your Objective-C program.
26,438
In the *Breaking Bad* episode "Breakage" (S02E05) one of *Jesse*'s dealers gets robbed by some junkies. When *Walt* comes to know this, he gives *Jesse* a gun and urges him to *"handle it"* in order for them not to lose their respect on the streets (which then leads to *Jesse*'s unpleasant experiences with a junkie fam...
2014/10/20
[ "https://movies.stackexchange.com/questions/26438", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/49/" ]
My Personal Interpretation: **Walt cares for Jesse** Walt cares for Jesse, I mean, in the previous episodes when Tuco beats Jesse badly, Walt gets so worked up and goes to Tuco with full rage and destroys the place and gets the money (may be he wouldn't have gone to a place full of gangsters if it's just for the mone...
Walt is aware of the possibility that Jesse decides to disobey him, given what he already knows about Jesse's personality and their complex relationship. Therefore, when Walt pulls out his order, he is using what is called "reverse psychology". He really aims to get Jesse to do it.
12,466,057
I have two optimization question about the function include. 1. Is it better to use a single php file and include it or use several little files and include them? Which one will be faster? 2. For example, I use a PHP file with `mysql_connect` and all the db connection stuff. Then I include it when I need it. But will ...
2012/09/17
[ "https://Stackoverflow.com/questions/12466057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1648791/" ]
1. The differences will be trivial. 2. [Don't repeat yourself.](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) Do not put connection information in each file over and over again. Including sounds fine in your case. 3. Stop making use of `mysql_*()`. Use [PDO](http://php.net/manual/en/book.pdo.php) or [MySQLi](ht...
PHP include()'s are processed server side, not by the browser or anywhere else so the difference in performance would be negligible. If it helps you keep your code more organized you should include your DB connection info, there won't be a noticeable speed difference.
12,466,057
I have two optimization question about the function include. 1. Is it better to use a single php file and include it or use several little files and include them? Which one will be faster? 2. For example, I use a PHP file with `mysql_connect` and all the db connection stuff. Then I include it when I need it. But will ...
2012/09/17
[ "https://Stackoverflow.com/questions/12466057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1648791/" ]
1. The differences will be trivial. 2. [Don't repeat yourself.](http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) Do not put connection information in each file over and over again. Including sounds fine in your case. 3. Stop making use of `mysql_*()`. Use [PDO](http://php.net/manual/en/book.pdo.php) or [MySQLi](ht...
Pick any decent-sized open source project. Like WordPress, Joomla, Drupal for instance. Now check if they have a single gigantic-everything-goes-in-there file or if they have split it into small, maintainable components. Answer: favor maintainability first. When you hit a bottleneck, you'll be able to find it and addr...
12,466,057
I have two optimization question about the function include. 1. Is it better to use a single php file and include it or use several little files and include them? Which one will be faster? 2. For example, I use a PHP file with `mysql_connect` and all the db connection stuff. Then I include it when I need it. But will ...
2012/09/17
[ "https://Stackoverflow.com/questions/12466057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1648791/" ]
Pick any decent-sized open source project. Like WordPress, Joomla, Drupal for instance. Now check if they have a single gigantic-everything-goes-in-there file or if they have split it into small, maintainable components. Answer: favor maintainability first. When you hit a bottleneck, you'll be able to find it and addr...
PHP include()'s are processed server side, not by the browser or anywhere else so the difference in performance would be negligible. If it helps you keep your code more organized you should include your DB connection info, there won't be a noticeable speed difference.
649,672
While studying Rotation of Rigid Bodies, I came across the following situation: > > ![1](https://i.stack.imgur.com/8tjtD.png) > > > Consider a rigid body in pure rotational motion about a fixed axis (for example the z-axis). For any particle in the object, its linear velocity is given by $$ v=r \omega=R \sin \theta...
2021/07/05
[ "https://physics.stackexchange.com/questions/649672", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/306253/" ]
![1](https://i.stack.imgur.com/eUS1L.png) Look at this figure. The plane formed by $\boldsymbol{\omega}$ and $\mathbf{R}$ is perpendicular to y’ axis, thus $\vec e\_{y’}\cdot \vec e\_R=0$.
The vector representing (ω) is defined as being along the axis of rotation (z). The angle (θ) is measured in the plane defined by (ω) and (R). Looking at the sketch, I would say that the (x) axis is perpendicular to that plane. In any case, such a statement requires that both the (x) and (y) axes are rotating with the ...
64,331,934
I want to add two classes to a div, the first class should always apply but the second class only applies when the condition is true else it is not applied. I tried the piece of code below but I don't seem to get the desired result. something could be wrong with my approach. `<div className={[style.carousalItem, pics....
2020/10/13
[ "https://Stackoverflow.com/questions/64331934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11976106/" ]
We were not able to reproduce in another application from scratch. Therefore we add to proceed the other way around: strip our current application until the problem wasn't here anymore. First step was to tear down to only an AppDelegate and a simple piece of code but the problem was still here. We removed all the depen...
System Font Symbols have been changed since their introduction, so they can be referred as SF Symbols 1 and SF Symbols 2, where SF Symbols 1 are part of SF Symbols 2 (which support multicolor symbols) and some have also been changed in detail. Some symbols (actually a lot of them) have been available even before iOS 1...
64,331,934
I want to add two classes to a div, the first class should always apply but the second class only applies when the condition is true else it is not applied. I tried the piece of code below but I don't seem to get the desired result. something could be wrong with my approach. `<div className={[style.carousalItem, pics....
2020/10/13
[ "https://Stackoverflow.com/questions/64331934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11976106/" ]
We were not able to reproduce in another application from scratch. Therefore we add to proceed the other way around: strip our current application until the problem wasn't here anymore. First step was to tear down to only an AppDelegate and a simple piece of code but the problem was still here. We removed all the depen...
This issue might occur when you set title text attribute `foregroundColor` of the `UIBarButtonItem` to `UIColor.clear`. You could do this directly, eg.: ```swift navigationItem.rightBarButtonItem?.setTitleTextAttributes([.foregroundColor: UIColor.clear], for: .normal) ``` or by modifying the appearance of the `UIBa...
34,681,973
I'm just beginner at Ruby & Rails. I make a instance with Amazon Linux. and someone talks "Use Vim". but I want to use Atom editor. Can I use Atom on Amazon Linux? Or I just make new instance with Ubuntu Server? and one more things! Can I control only with Command Line??
2016/01/08
[ "https://Stackoverflow.com/questions/34681973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5476400/" ]
1) You can X forward over SSH to use the Atom GUI. Typically all you need to do is `ssh -X yourserver.com`, and then run atom from the command line. I don't know your setup enough to determine if just that will work, or if you need to enable XForwarding, or even install X, etc. This might help: <https://unix.stackex...
I am running Amazon Linux 2 and it has a GUI. I followed these instructions and I can run Atom from my Amazon Linux 2 desktop: <https://www.linuxhelp.com/how-to-install-atom-text-editor-on-centos-7-6>
24,070
1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 Bc5 5. Nxf7 Bxf2+ 6. Kf1 Qe7 1) Chess.com computer at Level 10 plays 5. Nxf7. Theory recommends 5. Bxf7. Which line to follow in my game in tournaments? Please advice as I am confused now. 2) After analyzing the game with computer of chess.com it suggests 4. ... Bc5 as Blunder. T...
2019/03/30
[ "https://chess.stackexchange.com/questions/24070", "https://chess.stackexchange.com", "https://chess.stackexchange.com/users/11904/" ]
Bxf7+ is definitely the way to go in practice in my opinion. I have done quite a lot of analysis with stockfish on Nxf7 and am not at all sure it is better for white despite the computer evaluation early on. Bxf7+ almost certainly is a lot better for white and is a lot simpler to learn which is important for a reperto...
As previously suggested by Hamish, Bxf7 instead of Nxf7 is a safe way for white to gain an edge, though Nxf7 is unsound anyways. In my opinion, if you want a swashbuckling defense against the fried liver, e4 e5 Nf3 Nc6 Bc4 Nf6 Ng5 **Nxe4!?** This move is much less known than traxler counter gambit and full of tricks...
34,054,632
If I use the .get method in Selenium, How do I block all elements except the ones I want to load from this website to make the loading process alot faster? This is what I have done: ``` System.setProperty("dir/chromedriver"); ChromeDriver driver = new ChromeDriver(); driver.get("url"); driver.findElementByCssSelec...
2015/12/02
[ "https://Stackoverflow.com/questions/34054632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5632631/" ]
You can keep only @user instance variable in the controller, and in partials use: @user.tasks instead of @tasks, @user.tasks.new instead of @task etc. Note also, that you can pass parameters to partials ([3.4.4 Passing Local Variables](http://guides.rubyonrails.org/layouts_and_rendering.html)) For sample: ``` <%= ren...
I would suggest to use caching techniques for your views: <http://edgeguides.rubyonrails.org/caching_with_rails.html#fragment-caching> <http://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching> In the extreme scenario where performance is still an issue for you, I would recommend to start denorm...
46,291,486
I am using the Wikidata Query Service (<https://query.wikidata.org>) to get details about movies and Tv shows. I know I can query for genre of all items that are instance of film (query below) but I want to look for just specific movies. ``` SELECT ?item ?itemLabel ?genreLabel WHERE { ?item wdt:P31 wd:Q11424 . ...
2017/09/19
[ "https://Stackoverflow.com/questions/46291486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8630353/" ]
There are (at least) two ways of specifying multiple items in SPARQL. `FILTER (?item IN (...list...))`: [SPARQL definition](https://www.w3.org/TR/sparql11-query/#func-in) ``` SELECT ?item ?itemLabel ?genreLabel WHERE { ?item wdt:P31 wd:Q11424 . FILTER (?item IN (wd:Q17738, wd:Q181795)) OPTIONAL { ...
Yes, you can get properties using QID, see [answer to my similar question](https://stackoverflow.com/a/41536933/240564), using filtering by URI. Example for your item Q17738: ``` SELECT DISTINCT ?item ?itemLabel ?itemDescription (SAMPLE(?article) AS ?articleSample) WHERE { ?article schema:about ?item ; ...
46,291,486
I am using the Wikidata Query Service (<https://query.wikidata.org>) to get details about movies and Tv shows. I know I can query for genre of all items that are instance of film (query below) but I want to look for just specific movies. ``` SELECT ?item ?itemLabel ?genreLabel WHERE { ?item wdt:P31 wd:Q11424 . ...
2017/09/19
[ "https://Stackoverflow.com/questions/46291486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8630353/" ]
There are (at least) two ways of specifying multiple items in SPARQL. `FILTER (?item IN (...list...))`: [SPARQL definition](https://www.w3.org/TR/sparql11-query/#func-in) ``` SELECT ?item ?itemLabel ?genreLabel WHERE { ?item wdt:P31 wd:Q11424 . FILTER (?item IN (wd:Q17738, wd:Q181795)) OPTIONAL { ...
You could get properties about a given entity from the SPARQL endpoint, but you are probably better off querying the [`wbgetentities`](https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities) Wikidata API module. Ex: <https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q17738&languages=en|de|fr&fo...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Under the documentation for [OutOfMemoryError](http://java.sun.com/javase/6/docs/api/java/lang/OutOfMemoryError.html) it declares that it will not be thrown unless the VM has failed to reclaim memory following a full garbage collection. So if you keep allocating memory until you get the error, you will have already for...
You can trigger a GC from the command line. This is useful for batch/crontab: ``` jdk1.7.0/bin/jcmd <pid> GC.run ``` See : * <https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html>
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The best (if not only) way to force a GC would be to write a custom JVM. I believe the Garbage collectors are pluggable so you could probably just pick one of the available implementations and tweak it. Note: This is NOT an easy answer.
.gc is a candidate for elimination in future releases - a Sun Engineer once commented that maybe fewer than twenty people in the world actually know how to use .gc() - I did some work last night for a few hours on a central / critical data-structure using SecureRandom generated data, at somewhere just past 40,000 objec...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How to Force Java GC -------------------- Okay, here are a few different ways to *force* Java GC. 1. Click JConsole's `Perform GC` button 2. Use JMap's `jmap -histo:live 7544` command where 7544 is the pid 3. Call the Java Diagnostic Console's `jcmd 7544 GC.run` command 4. Call `System.gc();` in your code 5. Call `Ru...
> > Really, I don't get you. But to be > clear about "Infinite Object Creation" > I meant that there is some piece of > code at my big system do creation of > objects whom handles and alive in > memory, I could not get this piece of > code actually, just gesture!! > > > This is correct, only gesture. You hav...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Using the [*Java™ Virtual Machine Tool Interface (JVM TI)*](http://docs.oracle.com/javase/7/docs/technotes/guides/jvmti/), the function ``` jvmtiError ForceGarbageCollection(jvmtiEnv* env) ``` will "Force the VM to perform a garbage collection." The JVM TI is part of the [*JavaTM Platform Debugger Architecture (JPDA...
You can trigger a GC from the command line. This is useful for batch/crontab: ``` jdk1.7.0/bin/jcmd <pid> GC.run ``` See : * <https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html>
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Under the documentation for [OutOfMemoryError](http://java.sun.com/javase/6/docs/api/java/lang/OutOfMemoryError.html) it declares that it will not be thrown unless the VM has failed to reclaim memory following a full garbage collection. So if you keep allocating memory until you get the error, you will have already for...
If you are using JUnit and Spring, try adding this in every test class: ``` @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) ```
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To manually Request GC (not from System.gc()) : 1. Go To : bin folder in JDK eg.-C:\Program Files\Java\jdk1.6.0\_31\bin 2. Open jconsole.exe 3. Connect to the desired local Process. 4. Go To memory tab and click perform GC.
> > Really, I don't get you. But to be > clear about "Infinite Object Creation" > I meant that there is some piece of > code at my big system do creation of > objects whom handles and alive in > memory, I could not get this piece of > code actually, just gesture!! > > > This is correct, only gesture. You hav...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To manually Request GC (not from System.gc()) : 1. Go To : bin folder in JDK eg.-C:\Program Files\Java\jdk1.6.0\_31\bin 2. Open jconsole.exe 3. Connect to the desired local Process. 4. Go To memory tab and click perform GC.
We can trigger `jmap -histo:live <pid>` using the java runtime. This will force a full GC on heap to mark all the live objects. ``` public static void triggerFullGC() throws IOException, InterruptedException { String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; Process process = Runtime....
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Under the documentation for [OutOfMemoryError](http://java.sun.com/javase/6/docs/api/java/lang/OutOfMemoryError.html) it declares that it will not be thrown unless the VM has failed to reclaim memory following a full garbage collection. So if you keep allocating memory until you get the error, you will have already for...
JVM specification doesn't say anything specific about garbage collection. Due to this, vendors are free to implement GC in their way. So this vagueness causes uncertainty in garbage collection behavior. You should check your JVM details to know about the garbage collection approaches/algorithms. Also there are options...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you need to force garbage collection, perhaps you should consider how you're managing resources. Are you creating large objects that persist in memory? Are you creating large objects (e.g., graphics classes) that have a `Disposable` interface and not calling `dispose()` when done with it? Are you declaring something...
I wanted to force gc, because my code was frozen for a long time when it happened. The aim is to smooth the charge, by regularly cause gc. The solutions listed doesnt forced anything in my environment. So: * I request the memory for temporary variable, * simply, by increments, * and monitor the memory and stop the op...
1,481,178
Is it possible to force garbage collection in Java, even if it is tricky to do? I know about `System.gc();` and `Runtime.gc();` but they only suggest to do GC. How can I force GC?
2009/09/26
[ "https://Stackoverflow.com/questions/1481178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can trigger a GC from the command line. This is useful for batch/crontab: ``` jdk1.7.0/bin/jcmd <pid> GC.run ``` See : * <https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html>
I would like to add some thing here. Please not that Java runs on Virtual Machine and not actual Machine. The virtual machine has its own way of communication with the machine. It may varry from system to system. Now When we call the GC we ask the Virtual Machine of Java to call the Garbage Collector. Since the Garba...
806,095
I have a class that is marked with DataContract attributes and I would like to create an `XDocument` from objects of that class. Whats the best way of doing this? I can do it by going via an `XmlDocument` but this seems like an unnecessary step.
2009/04/30
[ "https://Stackoverflow.com/questions/806095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
You can create an XmlWriter directly into the XDocument: ``` XDocument doc = new XDocument(); using (var writer = doc.CreateWriter()) { // write xml into the writer var serializer = new DataContractSerializer(objectToSerialize.GetType()); serializer.WriteObject(writer, objectToSerialize); } Console.WriteLi...
this is how i do it, which gives clean xml without all the namespace stuff in it, ``` XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes")); using (var writer = xdoc.CreateWriter()) { System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.Xml...
14,579,481
I have a `TreeView` and manually add two items (`TreeViewItem`) to it. And I want to apply `ItemTemplate` to those two items but it seems like the `ItemTemplate` is not applied to them. Actually I have deeper levels in the tree (so item1 and item2 each has a collection as `ItemsSource`, and there are more `Hierarchical...
2013/01/29
[ "https://Stackoverflow.com/questions/14579481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2020971/" ]
Since you are adding a list of `TreeViewItem` objects to your `TreeView`, My\_Template will not be applied to it. If you check your output window, you would be getting an error as shown below ``` System.Windows.Data Error: 26 : ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's c...
The `ItemTemplate` is for data objects. Check the remarks for [ItemTemplate on MSDN](http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplate.aspx). `TreeViewItem` is container generated for each data item and is styled thru `ItemContainerTemplate`. [ItemContainerTemplate on MSDN](http...
684,890
So I got the mathematical aspects down of what it means for a vector field to not be conservative, but I'm trying to make sense of the physical intuition. Why are so many vector fields found in nature conservative? What can be said about vector fields found in nature that are not conservative, for example, an induced e...
2021/12/23
[ "https://physics.stackexchange.com/questions/684890", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/323589/" ]
A vector fields is conservative if it is the gradient of a scalar field. In static cases we can use the the scalar Coulomb and the Newton potentials. The force fields are then conservative. In the more general case they are not. The Coulomb and 'magnetic' vector potential form a Lorentz vector. For gravity you have to ...
Your description gives the impression that most of the fields in nature are conservative which is not true and quite the opposite in classical applications and open systems. Force fields and systems where for example friction or drag is found are not overall conservative. Many confuse the law of conservation of energy ...
73,383,168
what are the test cases for capture screenshot in manual testing? > > Capture screenshot > > >
2022/08/17
[ "https://Stackoverflow.com/questions/73383168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19781151/" ]
You can get the latest version of the state in the setState Method, where you then can add your object. ```js const [data, setData] = useState({ name: "", desc: "", sections: [], }); const newSection = { sectionName: "Hello", sectionDesc: "Desc", question: [], }; const handleClick = () => { ...
The answer to you Updated Problem is: ```js import "./styles.css"; import React, { useState } from "react"; export const CreateStepper = () => { const [data, setData] = useState({ name: "", desc: "", sections: [] }); const SecondStep = (data: any) => { const [addSection, setAddSection] = useSta...
73,383,168
what are the test cases for capture screenshot in manual testing? > > Capture screenshot > > >
2022/08/17
[ "https://Stackoverflow.com/questions/73383168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19781151/" ]
You have to clone the object and then push the elements into the array, here is the example below, ``` import "./styles.css"; import React, {useState} from 'react' export default function App() { const [data, setData] = useState({ name: "", desc: "", sections: [], }); const newSection = { sectio...
The answer to you Updated Problem is: ```js import "./styles.css"; import React, { useState } from "react"; export const CreateStepper = () => { const [data, setData] = useState({ name: "", desc: "", sections: [] }); const SecondStep = (data: any) => { const [addSection, setAddSection] = useSta...
57,529,665
I want to have automated tests for testing import commands from datasource A (oracle) to datasource B (postgres). Both datasources should be created with testcontainers. The basic setup is done but the problem is: **testcontainers** *oracleContainer* starts before the entrypoint defined in the Dokerfile has a change ...
2019/08/16
[ "https://Stackoverflow.com/questions/57529665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592686/" ]
Iterate through the list of dictionaries: ```py res = {} for d in d_list: id_ = d.pop('id') for k, v in d.items(): res[(k, id_)] = v ``` or with a dict comprehension, slightly more concise: ```py res = {} for d in d_list: id_ = d.pop('id') res.update({(k, id_): v for k, v in d.items()}) ```
Using dict comprehension ``` {(k,d['id']):d[k] for k in d for d in my_lis if k!='id'} ``` Output: ``` {('2013-01', 1): 0.4, ('2013-01', 2): 0.1, ('2013-02', 1): 0.5, ('2013-02', 2): 0.4} ```
57,529,665
I want to have automated tests for testing import commands from datasource A (oracle) to datasource B (postgres). Both datasources should be created with testcontainers. The basic setup is done but the problem is: **testcontainers** *oracleContainer* starts before the entrypoint defined in the Dokerfile has a change ...
2019/08/16
[ "https://Stackoverflow.com/questions/57529665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592686/" ]
Iterate through the list of dictionaries: ```py res = {} for d in d_list: id_ = d.pop('id') for k, v in d.items(): res[(k, id_)] = v ``` or with a dict comprehension, slightly more concise: ```py res = {} for d in d_list: id_ = d.pop('id') res.update({(k, id_): v for k, v in d.items()}) ```
We can use list comprehension here: ``` { (k, subd['id']): v for subd in data for k, v in subd.items() if k != 'id' } ``` this produces: ``` >>> { ... (k, subd['id']): v ... for subd in data ... for k, v in subd.items() ... if k != 'id' ... } {('2013-01', 1): 0.4, ('2013-02', 1): 0.5...
57,529,665
I want to have automated tests for testing import commands from datasource A (oracle) to datasource B (postgres). Both datasources should be created with testcontainers. The basic setup is done but the problem is: **testcontainers** *oracleContainer* starts before the entrypoint defined in the Dokerfile has a change ...
2019/08/16
[ "https://Stackoverflow.com/questions/57529665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592686/" ]
Iterate through the list of dictionaries: ```py res = {} for d in d_list: id_ = d.pop('id') for k, v in d.items(): res[(k, id_)] = v ``` or with a dict comprehension, slightly more concise: ```py res = {} for d in d_list: id_ = d.pop('id') res.update({(k, id_): v for k, v in d.items()}) ```
Honestly there are a plenty of ways of accomplishing this task, I have provided to you very high-level solution: ``` myList = [{'2013-01': 0.4, '2013-02': 0.5, '2016-05': 0.4, 'id': 1}, {'2013-05': 0.1, '2013-02': 0.4, '2017-05': 0.4, 'id': 2}, {'2013-06': 0.1, '2014-05': 0.4, '2018-05': 0.4, 'id': 3} ]; d...
57,529,665
I want to have automated tests for testing import commands from datasource A (oracle) to datasource B (postgres). Both datasources should be created with testcontainers. The basic setup is done but the problem is: **testcontainers** *oracleContainer* starts before the entrypoint defined in the Dokerfile has a change ...
2019/08/16
[ "https://Stackoverflow.com/questions/57529665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592686/" ]
Using dict comprehension ``` {(k,d['id']):d[k] for k in d for d in my_lis if k!='id'} ``` Output: ``` {('2013-01', 1): 0.4, ('2013-01', 2): 0.1, ('2013-02', 1): 0.5, ('2013-02', 2): 0.4} ```
We can use list comprehension here: ``` { (k, subd['id']): v for subd in data for k, v in subd.items() if k != 'id' } ``` this produces: ``` >>> { ... (k, subd['id']): v ... for subd in data ... for k, v in subd.items() ... if k != 'id' ... } {('2013-01', 1): 0.4, ('2013-02', 1): 0.5...
57,529,665
I want to have automated tests for testing import commands from datasource A (oracle) to datasource B (postgres). Both datasources should be created with testcontainers. The basic setup is done but the problem is: **testcontainers** *oracleContainer* starts before the entrypoint defined in the Dokerfile has a change ...
2019/08/16
[ "https://Stackoverflow.com/questions/57529665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592686/" ]
Honestly there are a plenty of ways of accomplishing this task, I have provided to you very high-level solution: ``` myList = [{'2013-01': 0.4, '2013-02': 0.5, '2016-05': 0.4, 'id': 1}, {'2013-05': 0.1, '2013-02': 0.4, '2017-05': 0.4, 'id': 2}, {'2013-06': 0.1, '2014-05': 0.4, '2018-05': 0.4, 'id': 3} ]; d...
We can use list comprehension here: ``` { (k, subd['id']): v for subd in data for k, v in subd.items() if k != 'id' } ``` this produces: ``` >>> { ... (k, subd['id']): v ... for subd in data ... for k, v in subd.items() ... if k != 'id' ... } {('2013-01', 1): 0.4, ('2013-02', 1): 0.5...
49,098,753
I am trying to create an image with my binary file (written in Rust) but I get different errors. This is my `Dockerfile`: ``` FROM scratch COPY binary / COPY .env / COPY cert.pem /etc/ssl/ ENV RUST_BACKTRACE 1 CMD /binary ``` Building finishes fine but when I try to run it I get this: ```none $ docker run binary do...
2018/03/04
[ "https://Stackoverflow.com/questions/49098753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1750757/" ]
As @Oleg Sklyar pointed out, the problem is that the Rust binary is dynamically-linked. This may be a bit confusing because many people who have heard of Rust have also heard that Rust binaries are statically-linked, but this refers to the Rust code in crates: crates are linked statically because they are all known a...
In my case, the issue was that I was passing an invalid executable name: ```sh CMD ["liquidator"] ``` `liquidator` was the name of the Docker image, but I needed this: ```sh CMD ["hifi-liquidator"] ``` Basically the CMD must be the same as the "name" field in the `Cargo.toml` file.
64,459,019
I am trying to list all the `EC2` instances that are of `t2.micro` type, `running` in `Sydney` region. I have written a Lambda function in Python (`Python 3.6`). Below is my code: ``` import json import boto3 from pprint import pprint def lambda_handler(event, context): client = boto3.client("ec2") response =...
2020/10/21
[ "https://Stackoverflow.com/questions/64459019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6144148/" ]
Not sure what the problem is on how you add a new column to your view, as you already have added the new column `cum_kWh` to your view. When you want to have the value `IF(unit = 'Wh', value/1000, value)` as a new column you simply add it to your view the same way: ``` CREATE VIEW kWhcharging AS SELECT t.transacti...
As already provided you the [Reference](https://stackoverflow.com/questions/57613990/how-to-get-the-difference-between-consecutive-rows-in-mysql/57617753#57617753). But for your problem you can use two user defined variable. * First set both variable to zero. * Now if `transaction_pk` is same for current and old recor...
19,333,812
i have json as input ``` $page = file_get_contents('http://example.com/products.html'); $items = json_decode($page, true); ``` if i put echo $page; i get smth like this ``` { "productlist":[ { "id":"1", "cat":"milk", "prod_name":"happy milk", "img_url":"http://example.com/milk.jpg"}, { "id":"2", "cat":"bread", "pro...
2013/10/12
[ "https://Stackoverflow.com/questions/19333812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596867/" ]
What you initialize `$mac` with `'test'`, is what you are doing is assigning a string (PHP recognizes anything inside `''` or `""` as a string) to `$mac`. The value of this string is `test`. So you still need to surround the value in the query with `''`: ``` $db->exec("INSERT INTO wifinTb (mac,ssid,lat,lon) VALUES ('$...
``` $result = $db->query('SELECT * FROM wifinTb WHERE mac=$mac'); ``` Is currently being seen as one long string. You could get around this quickly by changing it to: ``` $result = $db->query("SELECT * FROM wifinTb WHERE mac='" . $mac . "'"); ``` However, you'd be better reading up on PDO or mysqli bind functions ...
19,333,812
i have json as input ``` $page = file_get_contents('http://example.com/products.html'); $items = json_decode($page, true); ``` if i put echo $page; i get smth like this ``` { "productlist":[ { "id":"1", "cat":"milk", "prod_name":"happy milk", "img_url":"http://example.com/milk.jpg"}, { "id":"2", "cat":"bread", "pro...
2013/10/12
[ "https://Stackoverflow.com/questions/19333812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596867/" ]
Never ever use string concatenation or replacement to put values into SQL statements; this will give you formatting problems (as you've seen) and allow [SQL injection attacks](http://xkcd.com/327/). Instead, use parameters: ``` $stmt = $db->prepare('INSERT INTO wifinTb(mac,ssid,lat,lon) VALUES (?,?,?,?)'); $stmt->bin...
``` $result = $db->query('SELECT * FROM wifinTb WHERE mac=$mac'); ``` Is currently being seen as one long string. You could get around this quickly by changing it to: ``` $result = $db->query("SELECT * FROM wifinTb WHERE mac='" . $mac . "'"); ``` However, you'd be better reading up on PDO or mysqli bind functions ...
19,333,812
i have json as input ``` $page = file_get_contents('http://example.com/products.html'); $items = json_decode($page, true); ``` if i put echo $page; i get smth like this ``` { "productlist":[ { "id":"1", "cat":"milk", "prod_name":"happy milk", "img_url":"http://example.com/milk.jpg"}, { "id":"2", "cat":"bread", "pro...
2013/10/12
[ "https://Stackoverflow.com/questions/19333812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596867/" ]
Never ever use string concatenation or replacement to put values into SQL statements; this will give you formatting problems (as you've seen) and allow [SQL injection attacks](http://xkcd.com/327/). Instead, use parameters: ``` $stmt = $db->prepare('INSERT INTO wifinTb(mac,ssid,lat,lon) VALUES (?,?,?,?)'); $stmt->bin...
What you initialize `$mac` with `'test'`, is what you are doing is assigning a string (PHP recognizes anything inside `''` or `""` as a string) to `$mac`. The value of this string is `test`. So you still need to surround the value in the query with `''`: ``` $db->exec("INSERT INTO wifinTb (mac,ssid,lat,lon) VALUES ('$...
57,882,108
I have a button with an onPress event in React Native. I want to get the entire class this Here's my code: ``` <TouchableOpacity onPress={this.onFBLoginButtonPress}> <View> <Text>Sign In with Facebook</Text> <Image source={FBImg} /> </View> </TouchableOpaci...
2019/09/11
[ "https://Stackoverflow.com/questions/57882108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/756566/" ]
`onPress={() => this.onFBLoginButtonPress}` is missing the trailing parentheses so it's not actually invoking the method. Should be `onPress={() => this.onFBLoginButtonPress()}` > > I didn't know you needed the parenthesis when you used an arrow function, as you don't without it > > > You're passing a function to...
Not sure if this is the best way, but this seems to work: ``` <TouchableOpacity self={this} onPress={this.onFBLoginButtonPress}> ```
57,882,108
I have a button with an onPress event in React Native. I want to get the entire class this Here's my code: ``` <TouchableOpacity onPress={this.onFBLoginButtonPress}> <View> <Text>Sign In with Facebook</Text> <Image source={FBImg} /> </View> </TouchableOpaci...
2019/09/11
[ "https://Stackoverflow.com/questions/57882108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/756566/" ]
Not sure if this is the best way, but this seems to work: ``` <TouchableOpacity self={this} onPress={this.onFBLoginButtonPress}> ```
Ther are two ways to call/invoke `methods/functions` in react native. > > Way-1: Binding the function in constructor. > > > ``` export default class yourClassName extends React.Component { constructor(props) { super(props); this.onFBLoginButtonPress = this.onFBLoginButtonPress.bind(this); //->This will ...
57,882,108
I have a button with an onPress event in React Native. I want to get the entire class this Here's my code: ``` <TouchableOpacity onPress={this.onFBLoginButtonPress}> <View> <Text>Sign In with Facebook</Text> <Image source={FBImg} /> </View> </TouchableOpaci...
2019/09/11
[ "https://Stackoverflow.com/questions/57882108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/756566/" ]
`onPress={() => this.onFBLoginButtonPress}` is missing the trailing parentheses so it's not actually invoking the method. Should be `onPress={() => this.onFBLoginButtonPress()}` > > I didn't know you needed the parenthesis when you used an arrow function, as you don't without it > > > You're passing a function to...
Ther are two ways to call/invoke `methods/functions` in react native. > > Way-1: Binding the function in constructor. > > > ``` export default class yourClassName extends React.Component { constructor(props) { super(props); this.onFBLoginButtonPress = this.onFBLoginButtonPress.bind(this); //->This will ...
26,607,732
I have a column in my data frame `df` called `Ratio` which comprises of two positive integers `x` and `y` separated by a `/` [That is, format the is `x/y`]. I would like to replace each row in this column by `integer((x/y)*10)` (rounded off to the nearest integer) Example, if that value of an element in `Ratio` is `14...
2014/10/28
[ "https://Stackoverflow.com/questions/26607732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4167113/" ]
``` df$Ratio<-as.character(df$Ratio) df$resRatio[df$Ratio!="0/0"]<-sapply(df$Ratio[df$Ratio!="0/0"], function(expr) { round(eval(parse(text=expr))*10,0)}) df$resRatio[df$Ratio=="0/0"]<-5 ```
Have you tried to use `as.integer`? ``` > as.integer(14.001/20.01*10) [1] 7 ```
26,607,732
I have a column in my data frame `df` called `Ratio` which comprises of two positive integers `x` and `y` separated by a `/` [That is, format the is `x/y`]. I would like to replace each row in this column by `integer((x/y)*10)` (rounded off to the nearest integer) Example, if that value of an element in `Ratio` is `14...
2014/10/28
[ "https://Stackoverflow.com/questions/26607732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4167113/" ]
Here's an approach: ``` # an example data frame > dat <- data.frame(Ratio = c("0/0", "14/20")) transform(dat, Ratio2 = sapply(strsplit(as.character(Ratio), "/"), function(x) if (x[2] == "0") 5 else round(Reduce("/", as.integer(x)) * 10))) # Ratio Ratio2 # 1 0/0 5 # 2 14/20 7 ```
Have you tried to use `as.integer`? ``` > as.integer(14.001/20.01*10) [1] 7 ```
26,607,732
I have a column in my data frame `df` called `Ratio` which comprises of two positive integers `x` and `y` separated by a `/` [That is, format the is `x/y`]. I would like to replace each row in this column by `integer((x/y)*10)` (rounded off to the nearest integer) Example, if that value of an element in `Ratio` is `14...
2014/10/28
[ "https://Stackoverflow.com/questions/26607732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4167113/" ]
Here's an approach: ``` # an example data frame > dat <- data.frame(Ratio = c("0/0", "14/20")) transform(dat, Ratio2 = sapply(strsplit(as.character(Ratio), "/"), function(x) if (x[2] == "0") 5 else round(Reduce("/", as.integer(x)) * 10))) # Ratio Ratio2 # 1 0/0 5 # 2 14/20 7 ```
``` df$Ratio<-as.character(df$Ratio) df$resRatio[df$Ratio!="0/0"]<-sapply(df$Ratio[df$Ratio!="0/0"], function(expr) { round(eval(parse(text=expr))*10,0)}) df$resRatio[df$Ratio=="0/0"]<-5 ```
47,054,377
I am stuck on a point where I have two array variables like this `$name = @("A","B","C")` `$roll = @("1","2","3")` and I am trying to make a csv file with this data. I am using this code ``` $name = @("A","B","C") $roll = @("1","2","3") $report = New-Object psobject $report | Add-Member -MemberType NoteProperty -Na...
2017/11/01
[ "https://Stackoverflow.com/questions/47054377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8867926/" ]
You current code is creating the object, and adding the arrays `$name` and `$roll` as *single entries*. It sounds like you want an entry for each value in your array. Assuming the arrays are the same length, you could iterate over the values: ``` $name = @("A","B","C") $roll = @("1","2","3") foreach($i in 0..($name....
try this: ``` $name = "A","B","C" $roll = "1","2","3" $index = 0 $name | %{[pscustomobject]@{Name=$_;Roll=$roll[$index++]}} |Export-csv "C:\Users\Abby\Desktop\r.csv" -NoType ```
25,402,748
I have to parse dates in formats: ``` HH:mm dd MMM dd MMM yyyy ``` I've managed to handle the last two of them: ``` val dateParsers = Array( DateTimeFormat.forPattern("dd MMM").getParser, DateTimeFormat.forPattern("dd MMM yyyy").getParser, ISODateTimeFormat.timeParser().getParser ) val formatter = ne...
2014/08/20
[ "https://Stackoverflow.com/questions/25402748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1003491/" ]
Joda-Time-Formatter only supports `withDefaultYear()`, not things like `withDefaultDate()`. Instead you can do this: ``` DateTimeFormatter timeParser = DateTimeFormat.forPattern("HH:mm"); LocalTime time = timeParser.parseLocalTime("05:40"); DateTimeZone tz = DateTimeZone.getDefault(); // Or DateTimeZone.UTC or DateTim...
`Date` and `Time` are completely different, without subclassing `DateTimeFormatter` and implementing your special "time at todays' date"-algorithm you wont get very far. Either subclass or maybe inject your current date into the string if it matches some regular expression
25,402,748
I have to parse dates in formats: ``` HH:mm dd MMM dd MMM yyyy ``` I've managed to handle the last two of them: ``` val dateParsers = Array( DateTimeFormat.forPattern("dd MMM").getParser, DateTimeFormat.forPattern("dd MMM yyyy").getParser, ISODateTimeFormat.timeParser().getParser ) val formatter = ne...
2014/08/20
[ "https://Stackoverflow.com/questions/25402748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1003491/" ]
`Date` and `Time` are completely different, without subclassing `DateTimeFormatter` and implementing your special "time at todays' date"-algorithm you wont get very far. Either subclass or maybe inject your current date into the string if it matches some regular expression
I'd use withDate() ``` private static final DateTimeFormatter FORMATTER = DateTimeFormat.forPattern("HH:mm"); @Test public void test() { DateTime dateTime = FORMATTER.parseDateTime("05:40"); DateTime now = new DateTime(); dateTime = dateTime.withDate(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth()...
25,402,748
I have to parse dates in formats: ``` HH:mm dd MMM dd MMM yyyy ``` I've managed to handle the last two of them: ``` val dateParsers = Array( DateTimeFormat.forPattern("dd MMM").getParser, DateTimeFormat.forPattern("dd MMM yyyy").getParser, ISODateTimeFormat.timeParser().getParser ) val formatter = ne...
2014/08/20
[ "https://Stackoverflow.com/questions/25402748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1003491/" ]
Joda-Time-Formatter only supports `withDefaultYear()`, not things like `withDefaultDate()`. Instead you can do this: ``` DateTimeFormatter timeParser = DateTimeFormat.forPattern("HH:mm"); LocalTime time = timeParser.parseLocalTime("05:40"); DateTimeZone tz = DateTimeZone.getDefault(); // Or DateTimeZone.UTC or DateTim...
I'd use withDate() ``` private static final DateTimeFormatter FORMATTER = DateTimeFormat.forPattern("HH:mm"); @Test public void test() { DateTime dateTime = FORMATTER.parseDateTime("05:40"); DateTime now = new DateTime(); dateTime = dateTime.withDate(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth()...
2,359,773
There are $2n-1$ two-element subsets of set $\{1,2,...,n\}$. Prove that one can choose $n$ out of these such that their union contains no more than $\frac{2}{3}n+1$ elements. --- I was trying this one too and with no success. Then I read [the official solution](https://imomath.com/srb/zadaci/2016_smo_booklet.pdf) (pa...
2017/07/15
[ "https://math.stackexchange.com/questions/2359773", "https://math.stackexchange.com", "https://math.stackexchange.com/users/463553/" ]
We are given a graph $G = (V, E)$ where $V = \{v\_1,\dots,v\_n\}$ and $|E| = 2n - 1$. What we are trying to do is to remove as few edges as possible to leave as many isolated vertices as possible. To do this, we try to find a vertex of least degree and remove its edges. The [degree formula](https://en.wikipedia.org/wi...
Finishing the previous proof as requested. First lets summarize the main argument of that proof. Initialize $G\_0=G$. From any $G\_k$ you can form $G\_{k+1}$ by removing: * $1$ node $v \in G\_k$ of degree $d\_v \le 3$, and of course all its $d\_v$ associated edges [Note: the degree is measured in $G\_k$, not the ori...
45,351,314
I'm currently facing an issue in updating a value in the DOM. To explain it quickly and as simple as possible, I currently have two components (A and B). B inherits from A, uses A's view as template but also inject its template into A (ng-content) so B's view is like: ``` <A> <template> <div *ngFor="let item...
2017/07/27
[ "https://Stackoverflow.com/questions/45351314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6951213/" ]
Few things. Which operating system are you using **32-bit** or **64-bit**? 1. make sure the driver (gecko or chrome any other) you have downloaded is as per your operating system. 2. Try to run them from command line to see what's happening. 3. if you are using linux, make sure driver has proper permission
For Google Chrome, you may try this code: ``` public class FSO_CheckCase { WebDriver driver; @BeforeTest public void setup () { System.setProperty("webdriver.chrome.driver", "*path*\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("test-type"); options.addArgume...
45,351,314
I'm currently facing an issue in updating a value in the DOM. To explain it quickly and as simple as possible, I currently have two components (A and B). B inherits from A, uses A's view as template but also inject its template into A (ng-content) so B's view is like: ``` <A> <template> <div *ngFor="let item...
2017/07/27
[ "https://Stackoverflow.com/questions/45351314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6951213/" ]
Few things. Which operating system are you using **32-bit** or **64-bit**? 1. make sure the driver (gecko or chrome any other) you have downloaded is as per your operating system. 2. Try to run them from command line to see what's happening. 3. if you are using linux, make sure driver has proper permission
1- download latest firefox or chrome driver 2- please update your selenium server dependency, it seems your selenium stand-alone.jar is not compatible with your browser version. download selenium server latest jar from [here](http://www.seleniumhq.org/download/) or add below maven dependency in your POM ``` <depend...
45,351,314
I'm currently facing an issue in updating a value in the DOM. To explain it quickly and as simple as possible, I currently have two components (A and B). B inherits from A, uses A's view as template but also inject its template into A (ng-content) so B's view is like: ``` <A> <template> <div *ngFor="let item...
2017/07/27
[ "https://Stackoverflow.com/questions/45351314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6951213/" ]
1- download latest firefox or chrome driver 2- please update your selenium server dependency, it seems your selenium stand-alone.jar is not compatible with your browser version. download selenium server latest jar from [here](http://www.seleniumhq.org/download/) or add below maven dependency in your POM ``` <depend...
For Google Chrome, you may try this code: ``` public class FSO_CheckCase { WebDriver driver; @BeforeTest public void setup () { System.setProperty("webdriver.chrome.driver", "*path*\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("test-type"); options.addArgume...
441,503
Consider the following fixed-point equation: \begin{equation} x = (1-x)^{1-\frac{2}{a+1}} - 1, \end{equation} where $x \in [0,1]$ and $a \in [0,1]$. If we write the solution of $x$ in terms of $a$ as $x(a)$, then, would it be possible to compute $\lim\_{a \rightarrow 1} x(a)$ ? Since there is no closed-form solution ...
2013/07/11
[ "https://math.stackexchange.com/questions/441503", "https://math.stackexchange.com", "https://math.stackexchange.com/users/62354/" ]
Moving -1 to the other side and taking logs yields $$ \begin{split} \ln(x+1) &= \left(1-\frac{2}{a+1}\right)\ln(1-x) \\ \frac{\ln(x+1)}{\ln(1-x)} &= 1-\frac{2}{a+1} \to 0 \text{ as } a \to 1 \end{split} $$ so you are seeking the value of $x$ that will make the left-hand side $0$. One options is to send the numerator t...
If you isolate $a$ in terms of $X$, the only possible solution as $\lim\_{a\to 1} x(a)$ appears to be $x=0$...
58,874,537
I have a button on a Webpage that needs to be pressed so that a data file can be rebuilt to then dowload this file. I don't know any HTML, so I am unsure which variables are needed to get the driver.find\_element\_by\_xpath() to correctly locate the button on the Webpage The HTML code of the website is the following: ...
2019/11/15
[ "https://Stackoverflow.com/questions/58874537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12113520/" ]
Xpath helps you navigate to any element in the html You can use either of the following xpaths: * `//input[@value='Rebuild Data File']` * `//input[@name='Export']` * `//input[@name='Export' and @value='Rebuild Data File']` More info on: <https://www.guru99.com/xpath-selenium.html>
Can you please try below xpath : ``` WebElement element = (new WebDriverWait(driver, 10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@type='button'][@value='Rebuild Data File']"))); element.click(); ``` \*\*Don forget to import \*\* ``` import org.openqa.selenium.By; import org.openqa.sel...
3,022,285
I want to install a logger so that I can dump all executed SQL of my rails application. Problem is, such logger is associated with AbstractAdapter which initialized very soon under test mode, and thus cannot be set by my initializer code. I try to put ``` ActiveRecord::Base.logger = MyCustomLogger.new(STDOUT) ``` i...
2010/06/11
[ "https://Stackoverflow.com/questions/3022285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/244000/" ]
Creating the logger in `config/environment.rb` should work. I get SQL logging on standard output when I run unit tests if I put the following line in either `config/environment.rb` or `config/environments/test.rb`: ``` ActiveRecord::Base.logger = Logger.new(STDOUT) ``` Does your `MyCustomLogger` class do anything sp...
In test/test\_helper.rb, before loading config/environment.rb, add: ``` RAILS_DEFAULT_LOGGER = MyCustomLogger.new(STDOUT) ``` Relevant code in railties for 2.3 [railties/lib/initializer.rb#L35](http://github.com/rails/rails/blob/2-3-stable/railties/lib/initializer.rb#L35). Not sure how to do it with Rails 3.0 yet. I...
3,022,285
I want to install a logger so that I can dump all executed SQL of my rails application. Problem is, such logger is associated with AbstractAdapter which initialized very soon under test mode, and thus cannot be set by my initializer code. I try to put ``` ActiveRecord::Base.logger = MyCustomLogger.new(STDOUT) ``` i...
2010/06/11
[ "https://Stackoverflow.com/questions/3022285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/244000/" ]
Creating the logger in `config/environment.rb` should work. I get SQL logging on standard output when I run unit tests if I put the following line in either `config/environment.rb` or `config/environments/test.rb`: ``` ActiveRecord::Base.logger = Logger.new(STDOUT) ``` Does your `MyCustomLogger` class do anything sp...
The best way as far as I can found is to put such code in initializers folder. This way, regardless of the running environment, the logger is always properly installed. And no, on my mac osx Rails 2.3.2 on ruby 1.8.7, if I put `ActiveRecord::Base.logger=...` inside environment.rb then the logger is not properly install...
3,022,285
I want to install a logger so that I can dump all executed SQL of my rails application. Problem is, such logger is associated with AbstractAdapter which initialized very soon under test mode, and thus cannot be set by my initializer code. I try to put ``` ActiveRecord::Base.logger = MyCustomLogger.new(STDOUT) ``` i...
2010/06/11
[ "https://Stackoverflow.com/questions/3022285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/244000/" ]
The best way as far as I can found is to put such code in initializers folder. This way, regardless of the running environment, the logger is always properly installed. And no, on my mac osx Rails 2.3.2 on ruby 1.8.7, if I put `ActiveRecord::Base.logger=...` inside environment.rb then the logger is not properly install...
In test/test\_helper.rb, before loading config/environment.rb, add: ``` RAILS_DEFAULT_LOGGER = MyCustomLogger.new(STDOUT) ``` Relevant code in railties for 2.3 [railties/lib/initializer.rb#L35](http://github.com/rails/rails/blob/2-3-stable/railties/lib/initializer.rb#L35). Not sure how to do it with Rails 3.0 yet. I...
9,429,665
I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?
2012/02/24
[ "https://Stackoverflow.com/questions/9429665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563189/" ]
How about something like this: * Do a `fgets` and find out how long one line is * Find the size of the file using `fseek` and `ftell` ``` fseek(fp, 0, SEEK_END); size = ftell(fp); ``` * Divide by the size of the line You can also use `fseeko` and `ftello` which work with `off_t`.
Read one line, `stat()` the file to [get the total size](https://stackoverflow.com/questions/238603/how-can-i-get-a-files-size-in-c), divide the total size by the length of the first line. Instead of using `stat()` you could also `fseek()` to the end of the file and then use `ftell()` to get the size.
9,429,665
I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?
2012/02/24
[ "https://Stackoverflow.com/questions/9429665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563189/" ]
If it is safe to assume that all lines are of equal length, you can simply read in the first line, get its length, then get the file size, and divide file size by line length. This will only work with fixed-width encodings (ASCII-7, the various 8-bit ANSI encodings, UTF-32); with variable-width encodings (e.g. UTF-8),...
Read one line, `stat()` the file to [get the total size](https://stackoverflow.com/questions/238603/how-can-i-get-a-files-size-in-c), divide the total size by the length of the first line. Instead of using `stat()` you could also `fseek()` to the end of the file and then use `ftell()` to get the size.
9,429,665
I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?
2012/02/24
[ "https://Stackoverflow.com/questions/9429665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563189/" ]
How about something like this: * Do a `fgets` and find out how long one line is * Find the size of the file using `fseek` and `ftell` ``` fseek(fp, 0, SEEK_END); size = ftell(fp); ``` * Divide by the size of the line You can also use `fseeko` and `ftello` which work with `off_t`.
Take `ftell()` and divide by the length of the line.
9,429,665
I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?
2012/02/24
[ "https://Stackoverflow.com/questions/9429665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563189/" ]
How about something like this: * Do a `fgets` and find out how long one line is * Find the size of the file using `fseek` and `ftell` ``` fseek(fp, 0, SEEK_END); size = ftell(fp); ``` * Divide by the size of the line You can also use `fseeko` and `ftello` which work with `off_t`.
If it is safe to assume that all lines are of equal length, you can simply read in the first line, get its length, then get the file size, and divide file size by line length. This will only work with fixed-width encodings (ASCII-7, the various 8-bit ANSI encodings, UTF-32); with variable-width encodings (e.g. UTF-8),...
9,429,665
I have a file stream in C and I want to know how many lines are in it without iterating through the file. Each line is the same length. How might I go about this?
2012/02/24
[ "https://Stackoverflow.com/questions/9429665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563189/" ]
If it is safe to assume that all lines are of equal length, you can simply read in the first line, get its length, then get the file size, and divide file size by line length. This will only work with fixed-width encodings (ASCII-7, the various 8-bit ANSI encodings, UTF-32); with variable-width encodings (e.g. UTF-8),...
Take `ftell()` and divide by the length of the line.