The implode() function returns a string from the elements of an array.
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>
Output: Hello World! Beautiful Day!
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode("|",$arr);
?>
Output: Hello|World!|Beautiful|Day!
If you'd like to initialize the array to values other than 0, with gcc
you can do:
int array[1024] = { [ 0 ... 1023 ] = -1 };
This is a GNU extension of C99 Designated Initializers. In older GCC, you may need to use -std=gnu99
to compile your code.
There are two types of drop down lists available (I am not sure since which version).
ActiveX Drop Down
You can set the column widths, so your hidden column can be set to 0.
Form Drop Down
You could set the drop down range to a hidden sheet and reference the cell adjacent to the selected item. This would also work with the ActiveX type control.
You haven't properly cased your onchange
prop in the input
. It needs to be onChange
in JSX.
<input
type="text"
value={this.props.searchString}
ref="searchStringInput"
onchange={this.handleChange} <--[should be onChange]
/>
The topic of passing a value
prop to an <input>
, and then somehow changing the value passed in response to user interaction using an onChange
handler is pretty well-considered in the docs.
They refer to such inputs as Controlled Components, and refer to inputs that instead let the DOM natively handle the input's value and subsequent changes from the user as Uncontrolled Components.
Whenever you set the value
prop of an input
to some variable, you have a Controlled Component. This means you must change the value of the variable by some programmatic means or else the input will always hold that value and will never change, even when you type -- the native behaviour of the input, to update its value on typing, is overridden by React here.
So, you're correctly taking that variable from state, and have a handler to update the state all set up fine. The problem was because you have onchange
and not the correct onChange
the handler was never being called and so the value
was never being updated when you type into the input. When you do use onChange
the handler is called, the value
is updated when you type, and you see your changes.
If there is no vertical scrolling then you can use position:absolute
and height:100%
declared on html and body elements.
Another option is to use viewport height units, see Make div 100% height of browser window
Absolute position Example:
html, body {_x000D_
height:100%;_x000D_
position: absolute;_x000D_
background-color:red;_x000D_
}_x000D_
.button{_x000D_
height:50%;_x000D_
background-color:white;_x000D_
}
_x000D_
<div class="button">BUTTON</div>
_x000D_
html, body {min-height:100vh;background:gray;_x000D_
}_x000D_
.col-100vh {_x000D_
height:100vh;_x000D_
}_x000D_
.col-50vh {_x000D_
height:50vh;_x000D_
}_x000D_
#mmenu_screen--information{_x000D_
background:teal;_x000D_
}_x000D_
#mmenu_screen--book{_x000D_
background:blue;_x000D_
}_x000D_
.mmenu_screen--direktaction{_x000D_
background:red;_x000D_
}
_x000D_
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>_x000D_
<div id="mmenu_screen" class="col-100vh container-fluid main_container">_x000D_
_x000D_
<div class="row col-100vh">_x000D_
<div class="col-xs-6 col-100vh">_x000D_
_x000D_
<div class="col-50vh col-xs-12" id="mmenu_screen--book">_x000D_
BOOKING BUTTON_x000D_
</div>_x000D_
_x000D_
<div class="col-50vh col-xs-12" id="mmenu_screen--information">_x000D_
INFO BUTTON_x000D_
</div>_x000D_
_x000D_
</div>_x000D_
<div class="col-100vh col-xs-6 mmenu_screen--direktaction">_x000D_
DIRECT ACTION BUTTON_x000D_
</div>_x000D_
</div>_x000D_
_x000D_
</div>
_x000D_
As detailed by other answers here, the best solution I found is using OpenSSL. It is built into PHP and you don't need any external library. Here are simple examples:
To encrypt:
function encrypt($key, $payload) {
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($payload, 'aes-256-cbc', $key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
To decrypt:
function decrypt($key, $garble) {
list($encrypted_data, $iv) = explode('::', base64_decode($garble), 2);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $key, 0, $iv);
}
Reference link: https://www.shift8web.ca/2017/04/how-to-encrypt-and-execute-your-php-code-with-mcrypt/
@Adrian Cornish's answer is correct. However, there is another caveat to dropping an existing primary key. If that primary key is being used as a foreign key by another table you will get an error when trying to drop it. In some versions of mysql the error message there was malformed (as of 5.5.17, this error message is still
alter table parent drop column id;
ERROR 1025 (HY000): Error on rename of
'./test/#sql-a04_b' to './test/parent' (errno: 150).
If you want to drop a primary key that's being referenced by another table, you will have to drop the foreign key in that other table first. You can recreate that foreign key if you still want it after you recreate the primary key.
Also, when using composite keys, order is important. These
1) ALTER TABLE provider ADD PRIMARY KEY(person,place,thing);
and
2) ALTER TABLE provider ADD PRIMARY KEY(person,thing,place);
are not the the same thing. They both enforce uniqueness on that set of three fields, however from an indexing standpoint there is a difference. The fields are indexed from left to right. For example, consider the following queries:
A) SELECT person, place, thing FROM provider WHERE person = 'foo' AND thing = 'bar';
B) SELECT person, place, thing FROM provider WHERE person = 'foo' AND place = 'baz';
C) SELECT person, place, thing FROM provider WHERE person = 'foo' AND place = 'baz' AND thing = 'bar';
D) SELECT person, place, thing FROM provider WHERE place = 'baz' AND thing = 'bar';
B can use the primary key index in ALTER statement 1
A can use the primary key index in ALTER statement 2
C can use either index
D can't use either index
A uses the first two fields in index 2 as a partial index. A can't use index 1 because it doesn't know the intermediate place portion of the index. It might still be able to use a partial index on just person though.
D can't use either index because it doesn't know person.
See the mysql docs here for more information.
I tried from ubuntu terminal and I don't know why the GUI didn't show up according to tttthomasssss answer. So I followed the comment from KLDavenport and it worked. Here is the summary:
Open your terminal/command-line and type python then
>>> import nltk
.>>> nltk.download("stopwords")
This will store the stopwords corpus under the nltk_data. For my case it was /home/myusername/nltk_data/corpora/stopwords
.
If you need another corpus then visit nltk data and find the corpus with their ID. Then use the ID to download like we did for stopwords.
using the link method, the stylesheets are loaded parallel (faster and better), and nearly all browsers support link
import loads any extra css files one-by-one (slower), and could give you Flash Of Unstyled Content
Related to importing, if you are having issues importing a file with bulk inserts and you're getting MYSQL GONE AWAY, lost connection or similar error, open your my.cnf / my.ini and temporarily set your max_allowed_packet to something large like 400M
Remember to set it back again after your import!
I was trying out my hands on Akka (Java api). What I tried was to compare Akka's actor based concurrency model with that of plain Java concurrency model (java.util.concurrent classes).
The use case was a simple canonical map reduce implementation of character count. The dataset was a collection of randomly generated strings (400 chars in length), and calculate the number of vowels in them.
For Akka I used a BalancedDispatcher(for load balancing amongst threads) and RoundRobinRouter (to keep a limit on my function actors). For Java, I used simple fork join technique (implemented without any work stealing algorithm) that would fork map/reduce executions and join the results. Intermediate results were held in blocking queues to make even the joining as parallel as possible. Probably, if I am not wrong, that would mimic somehow the "mailbox" concept of Akka actors, where they receive messages.
Observation: Till medium loads (~50000 string input) the results were comparable, varying slightly in different iterations. However, as I increased my load to ~100000 it would hang the Java solution. I configured the Java solution with 20-30 threads under this condition and it failed in all iterations.
Increasing the load to 1000000, was fatal for Akka as well. I can share the code with anyone interested to have a cross check.
So for me, it seems Akka scales out better than traditional Java multithreaded solution. And probably the reason is the under the hood magic of Scala.
If I can model a problem domain as an event driven message passing one, I think Akka is a good choice for the JVM.
Test performed on: Java version:1.6 IDE: Eclipse 3.7 Windows Vista 32 bit. 3GB ram. Intel Core i5 processor, 2.5 GHz clock speed
Please note, the problem domain used for the test can be debated and I tried to be as much fair as my Java knowledge allowed :-)
Please try this in your linear layout
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
Use a function in place of MidpointRounding.AwayFromZero
:
myRound(1.11125,4)
Answer:- 1.1114
public static Double myRound(Double Value, int places = 1000)
{
Double myvalue = (Double)Value;
if (places == 1000)
{
if (myvalue - (int)myvalue == 0.5)
{
myvalue = myvalue + 0.1;
return (Double)Math.Round(myvalue);
}
return (Double)Math.Round(myvalue);
places = myvalue.ToString().Substring(myvalue.ToString().IndexOf(".") + 1).Length - 1;
} if ((myvalue * Math.Pow(10, places)) - (int)(myvalue * Math.Pow(10, places)) > 0.49)
{
myvalue = (myvalue * Math.Pow(10, places + 1)) + 1;
myvalue = (myvalue / Math.Pow(10, places + 1));
}
return (Double)Math.Round(myvalue, places);
}
Although the question is answered and is older, In exploring some options to overcome the the styling of check boxes issue I encountered this awesome set of CSS3 only styling of check boxes and radio buttons controlling background colors and other appearances. Thought this might be right up the alley of this question.
body {_x000D_
background: #555;_x000D_
}_x000D_
_x000D_
h1 {_x000D_
color: #eee;_x000D_
font: 30px Arial, sans-serif;_x000D_
-webkit-font-smoothing: antialiased;_x000D_
text-shadow: 0px 1px black;_x000D_
text-align: center;_x000D_
margin-bottom: 50px;_x000D_
}_x000D_
_x000D_
input[type=checkbox] {_x000D_
visibility: hidden;_x000D_
}_x000D_
_x000D_
/* SLIDE ONE */_x000D_
.slideOne {_x000D_
width: 50px;_x000D_
height: 10px;_x000D_
background: #333;_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
position: relative;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
}_x000D_
_x000D_
.slideOne label {_x000D_
display: block;_x000D_
width: 16px;_x000D_
height: 16px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
_x000D_
-webkit-transition: all .4s ease;_x000D_
-moz-transition: all .4s ease;_x000D_
-o-transition: all .4s ease;_x000D_
-ms-transition: all .4s ease;_x000D_
transition: all .4s ease;_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
top: -3px;_x000D_
left: -3px;_x000D_
_x000D_
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
}_x000D_
_x000D_
.slideOne input[type=checkbox]:checked + label {_x000D_
left: 37px;_x000D_
}_x000D_
_x000D_
/* SLIDE TWO */_x000D_
.slideTwo {_x000D_
width: 80px;_x000D_
height: 30px;_x000D_
background: #333;_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
position: relative;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
}_x000D_
_x000D_
.slideTwo:after {_x000D_
content: '';_x000D_
position: absolute;_x000D_
top: 14px;_x000D_
left: 14px;_x000D_
height: 2px;_x000D_
width: 52px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
background: #111;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
}_x000D_
_x000D_
.slideTwo label {_x000D_
display: block;_x000D_
width: 22px;_x000D_
height: 22px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
_x000D_
-webkit-transition: all .4s ease;_x000D_
-moz-transition: all .4s ease;_x000D_
-o-transition: all .4s ease;_x000D_
-ms-transition: all .4s ease;_x000D_
transition: all .4s ease;_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
top: 4px;_x000D_
z-index: 1;_x000D_
left: 4px;_x000D_
_x000D_
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
}_x000D_
_x000D_
.slideTwo label:after {_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 10px;_x000D_
height: 10px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
background: #333;_x000D_
left: 6px;_x000D_
top: 6px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,1), 0px 1px 0px rgba(255,255,255,0.9);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,1), 0px 1px 0px rgba(255,255,255,0.9);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,1), 0px 1px 0px rgba(255,255,255,0.9);_x000D_
}_x000D_
_x000D_
.slideTwo input[type=checkbox]:checked + label {_x000D_
left: 54px;_x000D_
}_x000D_
_x000D_
.slideTwo input[type=checkbox]:checked + label:after {_x000D_
background: #00bf00;_x000D_
}_x000D_
_x000D_
/* SLIDE THREE */_x000D_
.slideThree {_x000D_
width: 80px;_x000D_
height: 26px;_x000D_
background: #333;_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
position: relative;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);_x000D_
}_x000D_
_x000D_
.slideThree:after {_x000D_
content: 'OFF';_x000D_
font: 12px/26px Arial, sans-serif;_x000D_
color: #000;_x000D_
position: absolute;_x000D_
right: 10px;_x000D_
z-index: 0;_x000D_
font-weight: bold;_x000D_
text-shadow: 1px 1px 0px rgba(255,255,255,.15);_x000D_
}_x000D_
_x000D_
.slideThree:before {_x000D_
content: 'ON';_x000D_
font: 12px/26px Arial, sans-serif;_x000D_
color: #00bf00;_x000D_
position: absolute;_x000D_
left: 10px;_x000D_
z-index: 0;_x000D_
font-weight: bold;_x000D_
}_x000D_
_x000D_
.slideThree label {_x000D_
display: block;_x000D_
width: 34px;_x000D_
height: 20px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
_x000D_
-webkit-transition: all .4s ease;_x000D_
-moz-transition: all .4s ease;_x000D_
-o-transition: all .4s ease;_x000D_
-ms-transition: all .4s ease;_x000D_
transition: all .4s ease;_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
top: 3px;_x000D_
left: 3px;_x000D_
z-index: 1;_x000D_
_x000D_
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
}_x000D_
_x000D_
.slideThree input[type=checkbox]:checked + label {_x000D_
left: 43px;_x000D_
}_x000D_
_x000D_
/* ROUNDED ONE */_x000D_
.roundedOne {_x000D_
width: 28px;_x000D_
height: 28px;_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.roundedOne label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
left: 4px;_x000D_
top: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
_x000D_
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -o-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: linear-gradient(top, #222 0%, #45484d 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );_x000D_
}_x000D_
_x000D_
.roundedOne label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 16px;_x000D_
height: 16px;_x000D_
background: #00bf00;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -o-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -ms-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
top: 2px;_x000D_
left: 2px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
}_x000D_
_x000D_
.roundedOne label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.3;_x000D_
}_x000D_
_x000D_
.roundedOne input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}_x000D_
_x000D_
/* ROUNDED TWO */_x000D_
.roundedTwo {_x000D_
width: 28px;_x000D_
height: 28px;_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.roundedTwo label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
_x000D_
-webkit-border-radius: 50px;_x000D_
-moz-border-radius: 50px;_x000D_
border-radius: 50px;_x000D_
left: 4px;_x000D_
top: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
_x000D_
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -o-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: linear-gradient(top, #222 0%, #45484d 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );_x000D_
}_x000D_
_x000D_
.roundedTwo label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 9px;_x000D_
height: 5px;_x000D_
background: transparent;_x000D_
top: 5px;_x000D_
left: 4px;_x000D_
border: 3px solid #fcfff4;_x000D_
border-top: none;_x000D_
border-right: none;_x000D_
_x000D_
-webkit-transform: rotate(-45deg);_x000D_
-moz-transform: rotate(-45deg);_x000D_
-o-transform: rotate(-45deg);_x000D_
-ms-transform: rotate(-45deg);_x000D_
transform: rotate(-45deg);_x000D_
}_x000D_
_x000D_
.roundedTwo label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.3;_x000D_
}_x000D_
_x000D_
.roundedTwo input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}_x000D_
_x000D_
/* SQUARED ONE */_x000D_
.squaredOne {_x000D_
width: 28px;_x000D_
height: 28px;_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
margin: 20px auto;_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.squaredOne label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
left: 4px;_x000D_
top: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
_x000D_
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -o-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: linear-gradient(top, #222 0%, #45484d 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );_x000D_
}_x000D_
_x000D_
.squaredOne label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 16px;_x000D_
height: 16px;_x000D_
background: #00bf00;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -moz-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -o-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: -ms-linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
background: linear-gradient(top, #00bf00 0%, #009400 100%);_x000D_
_x000D_
top: 2px;_x000D_
left: 2px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
}_x000D_
_x000D_
.squaredOne label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.3;_x000D_
}_x000D_
_x000D_
.squaredOne input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}_x000D_
_x000D_
/* SQUARED TWO */_x000D_
.squaredTwo {_x000D_
width: 28px;_x000D_
height: 28px;_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
margin: 20px auto;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.squaredTwo label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
left: 4px;_x000D_
top: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);_x000D_
_x000D_
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -o-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: linear-gradient(top, #222 0%, #45484d 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );_x000D_
}_x000D_
_x000D_
.squaredTwo label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 9px;_x000D_
height: 5px;_x000D_
background: transparent;_x000D_
top: 4px;_x000D_
left: 4px;_x000D_
border: 3px solid #fcfff4;_x000D_
border-top: none;_x000D_
border-right: none;_x000D_
_x000D_
-webkit-transform: rotate(-45deg);_x000D_
-moz-transform: rotate(-45deg);_x000D_
-o-transform: rotate(-45deg);_x000D_
-ms-transform: rotate(-45deg);_x000D_
transform: rotate(-45deg);_x000D_
}_x000D_
_x000D_
.squaredTwo label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.3;_x000D_
}_x000D_
_x000D_
.squaredTwo input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}_x000D_
_x000D_
_x000D_
/* SQUARED THREE */_x000D_
.squaredThree {_x000D_
width: 20px; _x000D_
margin: 20px auto;_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.squaredThree label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
top: 0;_x000D_
border-radius: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);_x000D_
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);_x000D_
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,.4);_x000D_
_x000D_
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -o-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);_x000D_
background: linear-gradient(top, #222 0%, #45484d 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );_x000D_
}_x000D_
_x000D_
.squaredThree label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 9px;_x000D_
height: 5px;_x000D_
background: transparent;_x000D_
top: 4px;_x000D_
left: 4px;_x000D_
border: 3px solid #fcfff4;_x000D_
border-top: none;_x000D_
border-right: none;_x000D_
_x000D_
-webkit-transform: rotate(-45deg);_x000D_
-moz-transform: rotate(-45deg);_x000D_
-o-transform: rotate(-45deg);_x000D_
-ms-transform: rotate(-45deg);_x000D_
transform: rotate(-45deg);_x000D_
}_x000D_
_x000D_
.squaredThree label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.3;_x000D_
}_x000D_
_x000D_
.squaredThree input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}_x000D_
_x000D_
/* SQUARED FOUR */_x000D_
.squaredFour {_x000D_
width: 20px; _x000D_
margin: 20px auto;_x000D_
position: relative;_x000D_
}_x000D_
_x000D_
.squaredFour label {_x000D_
cursor: pointer;_x000D_
position: absolute;_x000D_
width: 20px;_x000D_
height: 20px;_x000D_
top: 0;_x000D_
border-radius: 4px;_x000D_
_x000D_
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);_x000D_
background: #fcfff4;_x000D_
_x000D_
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);_x000D_
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );_x000D_
}_x000D_
_x000D_
.squaredFour label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
filter: alpha(opacity=0);_x000D_
opacity: 0;_x000D_
content: '';_x000D_
position: absolute;_x000D_
width: 9px;_x000D_
height: 5px;_x000D_
background: transparent;_x000D_
top: 4px;_x000D_
left: 4px;_x000D_
border: 3px solid #333;_x000D_
border-top: none;_x000D_
border-right: none;_x000D_
_x000D_
-webkit-transform: rotate(-45deg);_x000D_
-moz-transform: rotate(-45deg);_x000D_
-o-transform: rotate(-45deg);_x000D_
-ms-transform: rotate(-45deg);_x000D_
transform: rotate(-45deg);_x000D_
}_x000D_
_x000D_
.squaredFour label:hover::after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";_x000D_
filter: alpha(opacity=30);_x000D_
opacity: 0.5;_x000D_
}_x000D_
_x000D_
.squaredFour input[type=checkbox]:checked + label:after {_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";_x000D_
filter: alpha(opacity=100);_x000D_
opacity: 1;_x000D_
}
_x000D_
<h1>CSS3 Checkbox Styles</h1>_x000D_
_x000D_
<!-- Slide ONE -->_x000D_
<div class="slideOne"> _x000D_
<input type="checkbox" value="None" id="slideOne" name="check" />_x000D_
<label for="slideOne"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Slide TWO -->_x000D_
<div class="slideTwo"> _x000D_
<input type="checkbox" value="None" id="slideTwo" name="check" />_x000D_
<label for="slideTwo"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Slide THREE -->_x000D_
<div class="slideThree"> _x000D_
<input type="checkbox" value="None" id="slideThree" name="check" />_x000D_
<label for="slideThree"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Rounded ONE -->_x000D_
<div class="roundedOne">_x000D_
<input type="checkbox" value="None" id="roundedOne" name="check" />_x000D_
<label for="roundedOne"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Rounded TWO -->_x000D_
<div class="roundedTwo">_x000D_
<input type="checkbox" value="None" id="roundedTwo" name="check" />_x000D_
<label for="roundedTwo"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Squared ONE -->_x000D_
<div class="squaredOne">_x000D_
<input type="checkbox" value="None" id="squaredOne" name="check" />_x000D_
<label for="squaredOne"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Squared TWO -->_x000D_
<div class="squaredTwo">_x000D_
<input type="checkbox" value="None" id="squaredTwo" name="check" />_x000D_
<label for="squaredTwo"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Squared THREE -->_x000D_
<div class="squaredThree">_x000D_
<input type="checkbox" value="None" id="squaredThree" name="check" />_x000D_
<label for="squaredThree"></label>_x000D_
</div>_x000D_
_x000D_
<!-- Squared FOUR -->_x000D_
<div class="squaredFour">_x000D_
<input type="checkbox" value="None" id="squaredFour" name="check" />_x000D_
<label for="squaredFour"></label>_x000D_
</div>
_x000D_
Six Dependency scopes:
src/main
and src/test
src/test
<dependencyManagement/>
, only available in Maven 2.0.9 or later (like java import
)This kind of worked for me. Though FAB doesn't float independently, but now it isn't getting pushed down.
Observe the weights given inside the LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/andsanddkasd">
<android.support.v7.widget.RecyclerView
android:id="@+id/sharedResourcesRecyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="bottom|right"
android:src="@android:drawable/ic_input_add"
android:layout_weight="1"/>
</LinearLayout>
Hope this helps :)
You should check for permissions in the following way (as described here Android permissions):
int result = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_PHONE_STATE);
then, compare your result to either:
result == PackageManager.PERMISSION_DENIED
or:
result == PackageManager.PERMISSION_GRANTED
set termout off
doesn't work from the command line, so create a file e.g. termout_off.sql
containing the line:
set termout off
and call this from the SQL prompt:
SQL> @termout_off
I used to use bvi.
I am developing hexvi to overcome :%!xxd
and bvi
's limitations.
Features
hexvirc
Cons
Features
Cons
:wq
, but understands :w
and :q
)Try This Code. here we have two longitude and latitude values and selected_location.distanceTo(near_locations) function returns the distance between those places in meters.
Location selected_location = new Location("locationA");
selected_location.setLatitude(17.372102);
selected_location.setLongitude(78.484196);
Location near_locations = new Location("locationB");
near_locations.setLatitude(17.375775);
near_locations.setLongitude(78.469218);
double distance = selected_location.distanceTo(near_locations);
here "distance" is distance between locationA & locationB (in Meters
)
I found this neat piece of code in the book "Python For Data Analysis" by O'reily. It uses lazy implementation and int comparison and i presume it can be modified for other denominations using decimals. Let me know how it works for you!
def make_change(amount, coins=[1, 5, 10, 25], hand=None):_x000D_
hand = [] if hand is None else hand_x000D_
if amount == 0:_x000D_
yield hand_x000D_
for coin in coins:_x000D_
# ensures we don't give too much change, and combinations are unique_x000D_
if coin > amount or (len(hand) > 0 and hand[-1] < coin):_x000D_
continue_x000D_
for result in make_change(amount - coin, coins=coins,_x000D_
hand=hand + [coin]):_x000D_
yield result
_x000D_
And here's how without jquery (UPDATE: see other answers where you can now do this with CSS only)
var startProductBarPos=-1;_x000D_
window.onscroll=function(){_x000D_
var bar = document.getElementById('nav');_x000D_
if(startProductBarPos<0)startProductBarPos=findPosY(bar);_x000D_
_x000D_
if(pageYOffset>startProductBarPos){_x000D_
bar.style.position='fixed';_x000D_
bar.style.top=0;_x000D_
}else{_x000D_
bar.style.position='relative';_x000D_
}_x000D_
_x000D_
};_x000D_
_x000D_
function findPosY(obj) {_x000D_
var curtop = 0;_x000D_
if (typeof (obj.offsetParent) != 'undefined' && obj.offsetParent) {_x000D_
while (obj.offsetParent) {_x000D_
curtop += obj.offsetTop;_x000D_
obj = obj.offsetParent;_x000D_
}_x000D_
curtop += obj.offsetTop;_x000D_
}_x000D_
else if (obj.y)_x000D_
curtop += obj.y;_x000D_
return curtop;_x000D_
}
_x000D_
* {margin:0;padding:0;}_x000D_
.nav {_x000D_
border: 1px red dashed;_x000D_
background: #00ffff;_x000D_
text-align:center;_x000D_
padding: 21px 0;_x000D_
_x000D_
margin: 0 auto;_x000D_
z-index:10; _x000D_
width:100%;_x000D_
left:0;_x000D_
right:0;_x000D_
}_x000D_
_x000D_
.header {_x000D_
text-align:center;_x000D_
padding: 65px 0;_x000D_
border: 1px red dashed;_x000D_
}_x000D_
_x000D_
.content {_x000D_
padding: 500px 0;_x000D_
text-align:center;_x000D_
border: 1px red dashed;_x000D_
}_x000D_
.footer {_x000D_
padding: 100px 0;_x000D_
text-align:center;_x000D_
background: #777;_x000D_
border: 1px red dashed;_x000D_
}
_x000D_
<header class="header">This is a Header</header>_x000D_
<div id="nav" class="nav">Main Navigation</div>_x000D_
<div class="content">Hello World!</div>_x000D_
<footer class="footer">This is a Footer</footer>
_x000D_
You can use gererics to work for any class
public class FileUtils<T> {
public String createReport(String filePath, List<T> t) {
if (t.isEmpty()) {
return null;
}
List<String> reportData = new ArrayList<String>();
addDataToReport(t.get(0), reportData, 0);
for (T k : t) {
addDataToReport(k, reportData, 1);
}
return !dumpReport(filePath, reportData) ? null : filePath;
}
public static Boolean dumpReport(String filePath, List<String> lines) {
Boolean isFileCreated = false;
String[] dirs = filePath.split(File.separator);
String baseDir = "";
for (int i = 0; i < dirs.length - 1; i++) {
baseDir += " " + dirs[i];
}
baseDir = baseDir.replace(" ", "/");
File base = new File(baseDir);
base.mkdirs();
File file = new File(filePath);
try {
if (!file.exists())
file.createNewFile();
} catch (Exception e) {
e.printStackTrace();
return isFileCreated;
}
try (BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(file), System.getProperty("file.encoding")))) {
for (String line : lines) {
writer.write(line + System.lineSeparator());
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
void addDataToReport(T t, List<String> reportData, int index) {
String[] jsonObjectAsArray = new Gson().toJson(t).replace("{", "").replace("}", "").split(",\"");
StringBuilder row = new StringBuilder();
for (int i = 0; i < jsonObjectAsArray.length; i++) {
String str = jsonObjectAsArray[i];
str = str.replaceFirst(":", "_").split("_")[index];
if (i == 0) {
if (str != null) {
row.append(str.replace("\"", ""));
} else {
row.append("N/A");
}
} else {
if (str != null) {
row.append(", " + str.replace("\"", ""));
} else {
row.append(", N/A");
}
}
}
reportData.add(row.toString());
}
It's used to make std::string
interoperable with C code that requires a null terminated char*
.
You can use npm i y-websockets-server
and then use the below command
y-websockets-server --port 11000
and here in my case, the port No is 11000.
You can use case in update and SWAP as many as you want
update Table SET column=(case when is_row_1 then value_2 else value_1 end) where rule_to_match_swap_columns
Not sure if it helps, but it looks like there might be a library for async iteration in node hosted here:
https://github.com/caolan/async
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with node.js, it can also be used directly in the browser.
Async provides around 20 functions that include the usual 'functional' suspects (map, reduce, filter, forEach…) as well as some common patterns for asynchronous control flow (parallel, series, waterfall…). All these functions assume you follow the node.js convention of providing a single callback as the last argument of your async function.
You can edit the page in SharePoint designer, convert the List View web part to an XSLT Data View. (by right click + "Convert to XSLT Data View").
Then you can edit the XSLT - find the A
tag and add an attribute target="_blank"
EDIT: Use this Solution here: https://stackoverflow.com/a/20559175/2033223 Works perfect!
First of, thank for your solution @luizfelipetx
I changed your solution a little bit. This works for me:
public static String getRealPathFromDocumentUri(Context context, Uri uri){
String filePath = "";
Pattern p = Pattern.compile("(\\d+)$");
Matcher m = p.matcher(uri.toString());
if (!m.find()) {
Log.e(ImageConverter.class.getSimpleName(), "ID for requested image not found: " + uri.toString());
return filePath;
}
String imgId = m.group();
String[] column = { MediaStore.Images.Media.DATA };
String sel = MediaStore.Images.Media._ID + "=?";
Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
column, sel, new String[]{ imgId }, null);
int columnIndex = cursor.getColumnIndex(column[0]);
if (cursor.moveToFirst()) {
filePath = cursor.getString(columnIndex);
}
cursor.close();
return filePath;
}
Note: So we got documents and image, depending, if the image comes from 'recents', 'gallery' or what ever. So I extract the image ID first before looking it up.
I do it like this, to launch the SendFreeTextActivity from a (custom) menu fragment that appears in multiple activities:
In the MenuFragment class:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_menu, container, false);
final Button sendFreeTextButton = (Button) view.findViewById(R.id.sendFreeTextButton);
sendFreeTextButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.d(TAG, "sendFreeTextButton clicked");
Intent intent = new Intent(getActivity(), SendFreeTextActivity.class);
MenuFragment.this.startActivity(intent);
}
});
...
easy way is:
a = [1,2]
d = {}
for i in a:
d[i]=[i, ]
print(d)
{'1': [1, ], '2':[2, ]}
I found this link to be useful: css-tricks fade-in fade-out css.
Here's a summary of the csstricks post:
CSS classes:
.m-fadeOut {
visibility: hidden;
opacity: 0;
transition: visibility 0s linear 300ms, opacity 300ms;
}
.m-fadeIn {
visibility: visible;
opacity: 1;
transition: visibility 0s linear 0s, opacity 300ms;
}
In React:
toggle(){
if(true condition){
this.setState({toggleClass: "m-fadeIn"});
}else{
this.setState({toggleClass: "m-fadeOut"});
}
}
render(){
return (<div className={this.state.toggleClass}>Element to be toggled</div>)
}
As well as find
listed in other answers, better shells allow both recurvsive globs and filtering of glob matches, so in zsh
for example...
ls -lad **/*(/)
...lists all directories while keeping all the "-l" details that you want, which you'd otherwise need to recreate using something like...
find . -type d -exec ls -ld {} \;
(not quite as easy as the other answers suggest)
The benefit of find is that it's more independent of the shell - more portable, even for system()
calls from within a C/C++ program etc..
{{ data.0 }}
should work.
Let's say you wrote data.obj
django tries data.obj
and data.obj()
. If they don't work it tries data["obj"]
. In your case data[0]
can be written as {{ data.0 }}
. But I recommend you to pull data[0]
in the view and send it as separate variable.
The spring data JPA query needs the "%" chars as well as a space char following like
in your query, as in
@Query("Select c from Registration c where c.place like %:place%")
.
Cf. http://docs.spring.io/spring-data/jpa/docs/current/reference/html.
You may want to get rid of the @Query
annotation alltogether, as it seems to resemble the standard query (automatically implemented by the spring data proxies); i.e. using the single line
List<Registration> findByPlaceContaining(String place);
is sufficient.
Requires PHP5.3:
$begin = new DateTime('2010-05-01');
$end = new DateTime('2010-05-10');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
foreach ($period as $dt) {
echo $dt->format("l Y-m-d H:i:s\n");
}
This will output all days in the defined period between $start
and $end
. If you want to include the 10th, set $end
to 11th. You can adjust format to your liking. See the PHP Manual for DatePeriod.
While you asked how to kill a window resp. pane, I often wouldn't want to kill it but simply to get it back to a working state (the layout of panes is of importance to me, killing a pane destroys it so I must recreate it); tmux provides the respawn
commands to that effect: respawn-pane
resp. respawn-window
. Just that people like me may find this solution here.
When you use mysql_fetch_object
, you get an object (of class stdClass) with all fields for the row inside of it.
Use mysql_fetch_field
instead of mysql_fetch_object
, that will give you the first field of the result set (id
in your case). The docs are here
An abstract function has no implemention and it can only be declared on an abstract class. This forces the derived class to provide an implementation.
A virtual function provides a default implementation and it can exist on either an abstract class or a non-abstract class.
So for example:
public abstract class myBase
{
//If you derive from this class you must implement this method. notice we have no method body here either
public abstract void YouMustImplement();
//If you derive from this class you can change the behavior but are not required to
public virtual void YouCanOverride()
{
}
}
public class MyBase
{
//This will not compile because you cannot have an abstract method in a non-abstract class
public abstract void YouMustImplement();
}
The best way I have found to get a feel for things like this is to try them out:
import java.io.File;
public class PathTesting {
public static void main(String [] args) {
File f = new File("test/.././file.txt");
System.out.println(f.getPath());
System.out.println(f.getAbsolutePath());
try {
System.out.println(f.getCanonicalPath());
}
catch(Exception e) {}
}
}
Your output will be something like:
test\..\.\file.txt
C:\projects\sandbox\trunk\test\..\.\file.txt
C:\projects\sandbox\trunk\file.txt
So, getPath()
gives you the path based on the File object, which may or may not be relative; getAbsolutePath()
gives you an absolute path to the file; and getCanonicalPath()
gives you the unique absolute path to the file. Notice that there are a huge number of absolute paths that point to the same file, but only one canonical path.
When to use each? Depends on what you're trying to accomplish, but if you were trying to see if two Files
are pointing at the same file on disk, you could compare their canonical paths. Just one example.
Thanks for this code :) I really appreciate it. Works for me.
public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
So if you have diff version of Excel file, get the file name, if its extension is .xlsx, use this:
Private Const connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
and if it is .xls, use:
Private Const connstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + path + ";Extended Properties=""Excel 8.0;HDR=YES;"""
First - most classes will never need to be thread-safe. Use YAGNI: only apply thread-safety when you know you actually are going to use it (and test it).
For the method-level stuff, there is [MethodImpl]
:
[MethodImpl(MethodImplOptions.Synchronized)]
public void SomeMethod() {/* code */}
This can also be used on accessors (properties and events):
private int i;
public int SomeProperty
{
[MethodImpl(MethodImplOptions.Synchronized)]
get { return i; }
[MethodImpl(MethodImplOptions.Synchronized)]
set { i = value; }
}
Note that field-like events are synchronized by default, while auto-implemented properties are not:
public int SomeProperty {get;set;} // not synchronized
public event EventHandler SomeEvent; // synchronized
Personally, I don't like the implementation of MethodImpl
as it locks this
or typeof(Foo)
- which is against best practice. The preferred option is to use your own locks:
private readonly object syncLock = new object();
public void SomeMethod() {
lock(syncLock) { /* code */ }
}
Note that for field-like events, the locking implementation is dependent on the compiler; in older Microsoft compilers it is a lock(this)
/ lock(Type)
- however, in more recent compilers it uses Interlocked
updates - so thread-safe without the nasty parts.
This allows more granular usage, and allows use of Monitor.Wait
/Monitor.Pulse
etc to communicate between threads.
A related blog entry (later revisited).
Use curly braces around the variable name:
`tail -1 ${filepath}_newstap.sh`
I suppose you have imported math.h with #include <math.h>
So the only other reason I can see is a missing linking information. You must link your code with the -lm
option.
If you're simply trying to compile one file with gcc, just add -lm
to your command line, otherwise, give some informations about your building process.
There is a library for this BarCode PHP. You just need to include a few files:
require_once('class/BCGFontFile.php');
require_once('class/BCGColor.php');
require_once('class/BCGDrawing.php');
You can generate many types of barcodes, namely 1D or 2D. Add the required library:
require_once('class/BCGcode39.barcode.php');
Generate the colours:
// The arguments are R, G, and B for color.
$colorFront = new BCGColor(0, 0, 0);
$colorBack = new BCGColor(255, 255, 255);
After you have added all the codes, you will get this way:
Example
Since several have asked for an example here is what I was able to do to get it done
require_once('class/BCGFontFile.php');
require_once('class/BCGColor.php');
require_once('class/BCGDrawing.php');
require_once('class/BCGcode128.barcode.php');
header('Content-Type: image/png');
$color_white = new BCGColor(255, 255, 255);
$code = new BCGcode128();
$code->parse('HELLO');
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code);
$drawing->draw();
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
If you want to actually create the image file so you can save it then change
$drawing = new BCGDrawing('', $color_white);
to
$drawing = new BCGDrawing('image.png', $color_white);
I know this post was about 11g, but a bug in the 12c client with how it encrypts passwords may be to blame for this error if you decide to use that one and you:
ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE
and resetting the password and still doesn't work),ORACLE_HOME
, PATH
, TNS_ADMIN
), and the TNS_ADMIN
registry string at HKLM\Software\Oracle\KEY_OraClient12Home
is in place,All the basic checks.
Fix: Try setting HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled
to 0
in the registry (regedit) to disable FIPS.
Oracle.ManagedDataAccess and ORA-01017: invalid username/password; logon denied
ORA-01005 error connecting with ODP.Net
https://community.oracle.com/thread/2557592?start=0&tstart=0
This was tagged as a bootstrap 3, but maybe this will be helpful: In Bootstrap 4.0.0 (non beta) : Inside the col class, use
<div class="col text-center text-md-left">
"text-center" centers the text for all window sizes, then adding the "text-md-left" or "text-md-right" to change it above sm. You could make it "text-sm-left", "text-lg-left" or whatever. But having it set to center always first sets up it up.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<body>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 text-center text-md-left">
<p>
© 2015 example.com. All rights reserved.
</p>
</div>
<div class="col-xs-12 col-sm-6 text-center text-md-right">
<p>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-google-plus"></i></a>
</p>
</div>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
Here is a trick with what you want to achieve. I was also having problem like you.
Its hard to get selected row and data key in RowDeleting Event But it is very easy to get selected row and datakeys in SelectedIndexChanged event. Here's an example-
protected void gv_SelectedIndexChanged(object sender, EventArgs e)
{
int index = gv.SelectedIndex;
int vehicleId = Convert.ToInt32(gv.DataKeys[index].Value);
SqlConnection con = new SqlConnection("-----");
SqlCommand com = new SqlCommand("DELETE FROM tbl WHERE vId = @vId", con);
com.Parameters.AddWithValue("@vId", vehicleId);
con.Open();
com.ExecuteNonQuery();
}
Simply Follow as below URL
https://graph.facebook.com/facebook_user_id/picture?type=square
type may be normal,small,medium,large. Or square (f you want to get square picture, the square size is limited to 50x50).
HTML
<form id="some_form">
<!-- some form elements -->
</form>
and jquery
$("#some_form").reset();
This work for me in MYSQL:
FUNCTION leadingZero(format VARCHAR(255), num VARCHAR(255))
RETURNS varchar(255) CHARSET utf8
BEGIN
return CONCAT(SUBSTRING(format,1,LENGTH(format)-LENGTH(num)),num);
END
For example:
leadingZero('000',999); returns '999'
leadingZero('0000',999); returns '0999'
leadingZero('xxxx',999); returns 'x999'
Hope this will help. Best regards
Upgrade the version of node without installing any package, not even nvm itself:
sudo npx n stable
Explanations:
This approach is similar to Johan Dettmar
's answer. The only difference is here the package n is not installed glabally in the local machine.
I think you are asking for something like the code below:
public interface A
{
void foo()
throws AException;
}
public class B
implements A
{
@Overrides
public void foo()
throws AException,
BException
{
}
}
This will not work unless BException is a subclass of AException. When you override a method you must conform to the signature that the parent provides, and exceptions are part of the signature.
The solution is to declare the the interface also throws a BException.
The reason for this is you do not want code like:
public class Main
{
public static void main(final String[] argv)
{
A a;
a = new B();
try
{
a.foo();
}
catch(final AException ex)
{
}
// compiler will not let you write a catch BException if the A interface
// doesn't say that it is thrown.
}
}
What would happen if B::foo threw a BException? The program would have to exit as there could be no catch for it. To avoid situations like this child classes cannot alter the types of exceptions thrown (except that they can remove exceptions from the list).
When you create a new CMS block named block_identifier from the admin panel you can use the following code to call it from your .phtml file:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml();
?>
Then clear the cache and reload your browser.
Another alternative can be to execute the Keydown or KeyUp in the tag of the Form
<form name="nameForm" [formGroup]="groupForm" (keydown.enter)="executeFunction()" >
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.insertFront(1);
list.insertFront(2);
list.insertFront(3);
System.out.println(list.toString());
}
String toString() {
String result = "";
LinkedListNode current = head;
while(current.getNext() != null){
result += current.getData();
if(current.getNext() != null){
result += ", ";
}
current = current.getNext();
}
return "List: " + result;
}
<xs:element name="price" type="decimal">
<xs:attribute name="currency" type="xs:string" value="(euros|pounds|dollars)" />
</element>
This would eliminate the need for enumeration completely. You could change type to double if required.
Try this:
function submitForm () {
// your code
$('form :input').attr('value', '');
}
The accepted answer neglects to set a parent attribute for each node inserted, without which one cannot implement a successor
method which finds the successor in an in-order tree walk in O(h) time, where h is the height of the tree (as opposed to the O(n) time needed for the walk).
Here is an implementation based on the pseudocode given in Cormen et al., Introduction to Algorithms, including assignment of a parent
attribute and a successor
method:
class Node(object):
def __init__(self, key):
self.key = key
self.left = None
self.right = None
self.parent = None
class Tree(object):
def __init__(self, root=None):
self.root = root
def insert(self, z):
y = None
x = self.root
while x is not None:
y = x
if z.key < x.key:
x = x.left
else:
x = x.right
z.parent = y
if y is None:
self.root = z # Tree was empty
elif z.key < y.key:
y.left = z
else:
y.right = z
@staticmethod
def minimum(x):
while x.left is not None:
x = x.left
return x
@staticmethod
def successor(x):
if x.right is not None:
return Tree.minimum(x.right)
y = x.parent
while y is not None and x == y.right:
x = y
y = y.parent
return y
Here are some tests to show that the tree behaves as expected for the example given by DTing:
import pytest
@pytest.fixture
def tree():
t = Tree()
t.insert(Node(3))
t.insert(Node(1))
t.insert(Node(7))
t.insert(Node(5))
return t
def test_tree_insert(tree):
assert tree.root.key == 3
assert tree.root.left.key == 1
assert tree.root.right.key == 7
assert tree.root.right.left.key == 5
def test_tree_successor(tree):
assert Tree.successor(tree.root.left).key == 3
assert Tree.successor(tree.root.right.left).key == 7
if __name__ == "__main__":
pytest.main([__file__])
Here is the way for plain JS, which onchange
and onclick
events are combined (onchange
for checking while onclick
for unchecking).
document.querySelector("input").onchange = function() {
this.onclick = function() {
this.checked = false;
this.onclick = null;
}
};
Drop the quotes:
List<Object> bugs = JsonPath.read(githubIssues, "$..labels[?(@.name==bug)]");
See also this Json Path Example page
You cant set links to "disabled" just system elements like input, textfield etc.
But you can disable links with jQuery/JavaScript
$('.disabled').click(function(e){
e.preventDefault();
});
Just wrap the above code in whatever event you want to disable the links.
<nav class="navbar navbar-expand-lg navbar-light fixed-top bg-transparent">
<a class="navbar-brand" href="#">Navbar w/ text</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
</ul>
<span class="navbar-text">
Navbar text with an inline element
</span>
</div>
</nav>
_x000D_
As a Ruby and Perl developer and learning-Python guy, I haven't found easy_install or pip to be the equivalent to RubyGems or CPAN.
I tend to keep my development systems running the latest versions of modules as the developers update them, and freeze my production systems at set versions. Both RubyGems and CPAN make it easy to find modules by listing what's available, then install and later update them individually or in bulk if desired.
easy_install and pip make it easy to install a module ONCE I located it via a browser search or learned about it by some other means, but they won't tell me what is available. I can explicitly name the module to be updated, but the apps won't tell me what has been updated nor will they update everything in bulk if I want.
So, the basic functionality is there in pip and easy_install but there are features missing that I'd like to see that would make them friendlier and easier to use and on par with CPAN and RubyGems.
Sorry I can't add comments as my reputation is not high enough :-/, so this will have to be an answer.
As several have commented, the code you have posted contains several (5) syntax errors (twice = instead of == and three ':' missing).
Once the syntax errors corrected I do not have any issue, be it indentation or else; of course it's impossible to see if you have mixed tabs and spaces as somebody else has suggested, which is likely your problem.
But the real point I wanted to underline is that: tabnanny IS NOT REALIABLE: you might be getting an 'indentation' error when it's actually just a syntax error.
Eg. I got it when I had added one closed parenthesis more than necessary ;-)
i += [func(a, b, [c] if True else None))]
would provoke a warning from tabnanny for the next line.
Hope this helps!
It might be not totally related, but since the question mentioned react uses case (and I keep bumping into this SO thread): There is one important aspect of the double arrow function which is not explicitly mentioned here. Only the 'first' arrow(function) gets named (and thus 'distinguishable' by the run-time), any following arrows are anonymous and from React point of view count as a 'new' object on every render.
Thus double arrow function will cause any PureComponent to rerender all the time.
Example
You have a parent component with a change handler as:
handleChange = task => event => { ... operations which uses both task and event... };
and with a render like:
{
tasks.map(task => <MyTask handleChange={this.handleChange(task)}/>
}
handleChange then used on an input or click. And this all works and looks very nice. BUT it means that any change that will cause the parent to rerender (like a completely unrelated state change) will also re-render ALL of your MyTask as well even though they are PureComponents.
This can be alleviated many ways such as passing the 'outmost' arrow and the object you would feed it with or writing a custom shouldUpdate function or going back to basics such as writing named functions (and binding the this manually...)
DiffUtil can the best choice for updating the data in the RecyclerView Adapter which you can find in the android framework. DiffUtil is a utility class that can calculate the difference between two lists and output a list of update operations that converts the first list into the second one.
Most of the time our list changes completely and we set new list to RecyclerView Adapter. And we call notifyDataSetChanged to update adapter. NotifyDataSetChanged is costly. DiffUtil class solves that problem now. It does its job perfectly!
Join the same table back to itself. Use an inner join so that rows that don't match are discarded. In the joined set, there will be rows that have a matching ARIDNR in another row in the table with a different LIEFNR. Allow those ARIDNR to appear in the final set.
SELECT * FROM YourTable WHERE ARIDNR IN (
SELECT a.ARIDNR FROM YourTable a
JOIN YourTable b on b.ARIDNR = a.ARIDNR AND b.LIEFNR <> a.LIEFNR
)
Chrome 36.0.1985.125 WEDNESDAY, JULY 16, 2014 Release note
From my observation, this update fixed the issue on using window.close()
to close the popup window. You will see this in the console when it fail, "Scripts may close only the windows that were opened by it.". That means The hacky workarounds (Brock Adams's answer) may not work in the latest release.
So, in the previous Chrome released builds, the below code block may worked but not with this update.
window.open('', '_self', '');
window.close();
For this update, you have to update your code accordingly to close the popup window. One of the solution is to grab the popup window id and use
chrome.windows.remove(integer windowId, function callback)
method to remove it. Chrome extension windows API can be found at chrome.windows.
Actually my chrome extension MarkView was facing this issue and I had to update my code to make it work for this Chrome Update. By the way, MarkView is tool to read and write Awesome Markdown Files, it provides features including Content Outline, Sortable Tables and code block syntax highlight with line number.
I also created this post, any comments are welcome.
Add following codesnippet in your cofig file
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
A couple of notes first: when you use Data/data1.txt
as an argument, should it really be /Data/data1.txt
(with a leading slash)? Also, should the outer loop scan only for .txt files, or all files in /Data? Here's an answer, assuming /Data/data1.txt
and .txt files only:
#!/bin/bash
for filename in /Data/*.txt; do
for ((i=0; i<=3; i++)); do
./MyProgram.exe "$filename" "Logs/$(basename "$filename" .txt)_Log$i.txt"
done
done
Notes:
/Data/*.txt
expands to the paths of the text files in /Data (including the /Data/ part)$( ... )
runs a shell command and inserts its output at that point in the command linebasename somepath .txt
outputs the base part of somepath, with .txt removed from the end (e.g. /Data/file.txt
-> file
)If you needed to run MyProgram with Data/file.txt
instead of /Data/file.txt
, use "${filename#/}"
to remove the leading slash. On the other hand, if it's really Data
not /Data
you want to scan, just use for filename in Data/*.txt
.
I know this isn't the best way to do it, but right click the button in question, events, key, key typed. This is a simple way to do it, but reacts to any key
This allows for parallel execution on all android versions with API 4+ (Android 1.6+):
@TargetApi(Build.VERSION_CODES.HONEYCOMB) // API 11
void startMyTask(AsyncTask asyncTask) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
else
asyncTask.execute(params);
}
This is a summary of Arhimed's excellent answer.
Please make sure you use API level 11 or higher as your project build target. In Eclipse, that is Project > Properties > Android > Project Build Target
. This will not break backward compatibility to lower API levels. Don't worry, you will get Lint errors if your accidentally use features introduced later than minSdkVersion
. If you really want to use features introduced later than minSdkVersion
, you can suppress those errors using annotations, but in that case, you need take care about compatibility yourself. This is exactly what happened in the code snippet above.
Hi, try this solution. Simple use php array map
function myfunction($value)
{
return strtolower($value);
}
$new_array = ["Value1","Value2","Value3" ];
print_r(array_map("myfunction",$new_array ));
Output Array ( [0] => value1 [1] => value2 [2] => value3 )
When you create any activity in android file you have to specify it in AndroidManifest.xml like
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MyCreativityActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OrderScreen"></activity>
</application>
function ConvertDateFromDiv(divTimeStr) {
//eg:-divTimeStr=18/03/2013 12:53:00
var tmstr = divTimeStr.toString().split(' '); //'21-01-2013 PM 3:20:24'
var dt = tmstr[0].split('/');
var str = dt[2] + "/" + dt[1] + "/" + dt[0] + " " + tmstr[1]; //+ " " + tmstr[1]//'2013/01/20 3:20:24 pm'
var time = new Date(str);
if (time == "Invalid Date") {
time = new Date(divTimeStr);
}
return time;
}
This should work :
curl -i -H "Accept: application/json" 'server:5050/a/c/getName{"param0":"pradeep"}'
use option -i instead of x.
You need to invoke CreateInstanceAndUnwrap
before your proxy object will execute in the foreign application domain.
class Program
{
static void Main(string[] args)
{
AppDomainSetup domaininfo = new AppDomainSetup();
domaininfo.ApplicationBase = System.Environment.CurrentDirectory;
Evidence adevidence = AppDomain.CurrentDomain.Evidence;
AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);
Type type = typeof(Proxy);
var value = (Proxy)domain.CreateInstanceAndUnwrap(
type.Assembly.FullName,
type.FullName);
var assembly = value.GetAssembly(args[0]);
// AppDomain.Unload(domain);
}
}
public class Proxy : MarshalByRefObject
{
public Assembly GetAssembly(string assemblyPath)
{
try
{
return Assembly.LoadFile(assemblyPath);
}
catch (Exception)
{
return null;
// throw new InvalidOperationException(ex);
}
}
}
Also, note that if you use LoadFrom
you'll likely get a FileNotFound
exception because the Assembly resolver will attempt to find the assembly you're loading in the GAC or the current application's bin folder. Use LoadFile
to load an arbitrary assembly file instead--but note that if you do this you'll need to load any dependencies yourself.
Please change
con = (HttpURLConnection) new URL("http://localhost:8080/myapp/service/generate").openConnection();
To
con = (HttpURLConnection) new URL("http://YOUR_IP:8080/myapp/service/generate").openConnection();
I'm sure you are using a old version. You must use the last version available at master branch:
Bootstrap 3 dropped native support for nested collapsing menus, but there's a way to re-enable it with a 3rd party script. It's called SmartMenus. It means adding three new resources to your page, but it seamlessly supports Bootstrap 3.x with multiple levels of menus for nested <ul>/<li>
elements with class="dropdown-menu"
. It automatically displays the proper caret indicator as well.
<head>
...
<script src=".../jquery.smartmenus.min.js"></script>
<script src=".../jquery.smartmenus.bootstrap.min.js"></script>
...
<link rel="stylesheet" href=".../jquery.smartmenus.bootstrap.min.css"/>
...
</head>
Here's a demo page: http://vadikom.github.io/smartmenus/src/demo/bootstrap-navbar-fixed-top.html
BigDecimal test = new BigDecimal(0);
System.out.println(test);
test = test.add(new BigDecimal(30));
System.out.println(test);
test = test.add(new BigDecimal(45));
System.out.println(test);
Using the GNU datamash
util:
seq 10 | datamash sum 1
Output:
55
If the input data is irregular, with spaces and tabs at odd places, this may confuse datamash
, then either use the -W
switch:
<commands...> | datamash -W sum 1
...or use tr
to clean up the whitespace:
<commands...> | tr -d '[[:blank:]]' | datamash sum 1
I solved the problem by adding dispatcher in UserControl_Loaded event
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() =>
{
combobox.SelectedIndex = 0;
}));
When you make your URL /about-us/
(with the trailing slash), it's easy to start with a single file index.html
and then later expand it and add more files (e.g. our-CEO-john-doe.jpg
) or even build a hierarchy under it (e.g. /about-us/company/
, /about-us/products/
, etc.) as needed, without changing the published URL. This gives you a great flexibility.
In Excel for Mac 2016 at least,if you place the labels in any spot on the graph and are looking to move them anywhere else (in this case above the bars), select:
Chart Design->Add Chart Element->Data Labels -> More Data Label Options
then you can grab each individual label and pull it where you would like it.
"simple solution is here"
1 .Create a folder named libs under the app directory for that matter any directory within the project..
2 .Copy Paste your Library to libs folder
3.You simply copy the JAR to your libs/ directory and then from inside Android Studio, right click the Jar that shows up under libs/ > Add As Library..
Peace!
The simplest way is to just redirect the output, like so:
Compare-Object $(Get-Content c:\user\documents\List1.txt) $(Get-Content c:\user\documents\List2.txt) > c:\user\documents\diff_output.txt
>
will cause the output file to be overwritten if it already exists.
>>
will append new text to the end of the output file if it already exists.
For a flexible method that works even when formatting complicated string, you probably should use the string-formatting mini-language, using either the str.format()
method
>>> '{0: <16} StackOverflow!'.format('Hi') # Python >=2.6
'Hi StackOverflow!'
of f-strings
>>> f'{"Hi": <16} StackOverflow!' # Python >= 3.6
'Hi StackOverflow!'
Working code from my sources:
HTML WORLD
<select name="select_from" disabled>...</select>
JS WORLD
var from = jQuery('select[name=select_from]');
//add disabled
from.attr('disabled', 'disabled');
//remove it
from.removeAttr("disabled");
In my case, the Google Services gradle plugin wasn't generating the required values.xml
file from the google-services.json
file. The Firebase library uses this generated values file to initialize itself and it appears that it doesn't throw an error if the values file can't be found. Check that the values file exists at the following location and is populated with the appropriate strings from your google-sevices.json
file:
app/build/generated/res/google-services/{build_type}/values/values.xml
and/or
app/build/generated/res/google-services/{flavor}/{build_type}/xml/global_tracker.xml
For more detail see: https://developers.google.com/android/guides/google-services-plugin
My particular case was caused by using a gradle tools version that was too advanced for the version of Android Studio that I was running (ie ensure you run grade tools v3.2.X-YYY with Android Studio v3.2).
Fileformat.info is a pretty good reference for this stuff. In your case, it's already in hex, so the hex value is f066
. So you'd do:
content: "\f066";
use typeid(class).name
// illustratory code assuming all includes/namespaces etc
#include <iostream>
#include <typeinfo>
using namespace std;
struct A{};
int main(){
cout << typeid(A).name();
}
It is important to remember that this gives an implementation defined names.
As far as I know, there is no way to get the name of the object at run time reliably e.g. 'A' in your code.
EDIT 2:
#include <typeinfo>
#include <iostream>
#include <map>
using namespace std;
struct A{
};
struct B{
};
map<const type_info*, string> m;
int main(){
m[&typeid(A)] = "A"; // Registration here
m[&typeid(B)] = "B"; // Registration here
A a;
cout << m[&typeid(a)];
}
This is because you are reading a cursor, not an array. This means that you are reading sequentially through the results and when you get to the end you would need to reset the cursor to the beginning of the results to read them again.
If you did want to read over the results multiple times, you could use fetchAll to read the results into a true array and then it would work as you are expecting.
My preferred method for implementing this is to write a method called Throws, and use it just like any other Assert method. Unfortunately, .NET doesn't allow you to write a static extension method, so you can't use this method as if it actually belongs to the build in Assert class; just make another called MyAssert or something similar. The class looks like this:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace YourProject.Tests
{
public static class MyAssert
{
public static void Throws<T>( Action func ) where T : Exception
{
var exceptionThrown = false;
try
{
func.Invoke();
}
catch ( T )
{
exceptionThrown = true;
}
if ( !exceptionThrown )
{
throw new AssertFailedException(
String.Format("An exception of type {0} was expected, but not thrown", typeof(T))
);
}
}
}
}
That means that your unit test looks like this:
[TestMethod()]
public void ExceptionTest()
{
String testStr = null;
MyAssert.Throws<NullReferenceException>(() => testStr.ToUpper());
}
Which looks and behaves much more like the rest of your unit test syntaxes.
This is based on Jim's answer,
SELECT
@field_text + SPACE(@pad_length - LEN(@field_text)) AS RightPad
,SPACE(@pad_length - LEN(@field_text)) + @field_text AS LeftPad
Advantages
Disadvantages
You can use * operator to unpack dict_values:
>>> d = {1: "a", 2: "b"}
>>> [*d.values()]
['a', 'b']
or list object
>>> d = {1: "a", 2: "b"}
>>> list(d.values())
['a', 'b']
Nicely explained above!
For all those who may suffer like me to get this working in a localized Windows (mine is XP in Slovak), you may try to replace the %
with a !
So:
SET TEXT=Hello World
SET SUBSTRING=!TEXT:~3,5!
ECHO !SUBSTRING!
I have also been looking for a solution, and just found this code on another site:
<td style="cursor:pointer" onclick="location.href='mylink.html'">link</td>
If you're happy not not supporting IE or pre-Chromium Edge (which might be fine if you are using this for progressive enhancement), you can use :placeholder-shown
as Berend has said. Note that for Chrome and Safari you actually need a non-empty placeholder for this to work, though a space works.
*,_x000D_
::after,_x000D_
::before {_x000D_
box-sizing: border-box;_x000D_
}_x000D_
_x000D_
label.floating-label {_x000D_
display: block;_x000D_
position: relative;_x000D_
height: 2.2em;_x000D_
margin-bottom: 1em;_x000D_
}_x000D_
_x000D_
label.floating-label input {_x000D_
font-size: 1em;_x000D_
height: 2.2em;_x000D_
padding-top: 0.7em;_x000D_
line-height: 1.5;_x000D_
color: #495057;_x000D_
background-color: #fff;_x000D_
background-clip: padding-box;_x000D_
border: 1px solid #ced4da;_x000D_
border-radius: 0.25rem;_x000D_
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;_x000D_
}_x000D_
_x000D_
label.floating-label input:focus {_x000D_
color: #495057;_x000D_
background-color: #fff;_x000D_
border-color: #80bdff;_x000D_
outline: 0;_x000D_
box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);_x000D_
}_x000D_
_x000D_
label.floating-label input+span {_x000D_
position: absolute;_x000D_
top: 0em;_x000D_
left: 0;_x000D_
display: block;_x000D_
width: 100%;_x000D_
font-size: 0.66em;_x000D_
line-height: 1.5;_x000D_
color: #495057;_x000D_
border: 1px solid transparent;_x000D_
border-radius: 0.25rem;_x000D_
transition: font-size 0.1s ease-in-out, top 0.1s ease-in-out;_x000D_
}_x000D_
_x000D_
label.floating-label input:placeholder-shown {_x000D_
padding-top: 0;_x000D_
font-size: 1em;_x000D_
}_x000D_
_x000D_
label.floating-label input:placeholder-shown+span {_x000D_
top: 0.3em;_x000D_
font-size: 1em;_x000D_
}
_x000D_
<fieldset>_x000D_
<legend>_x000D_
Floating labels example (no-JS)_x000D_
</legend>_x000D_
<label class="floating-label">_x000D_
<input type="text" placeholder=" ">_x000D_
<span>Username</span>_x000D_
</label>_x000D_
<label class="floating-label">_x000D_
<input type="Password" placeholder=" ">_x000D_
<span>Password</span>_x000D_
</label>_x000D_
</fieldset>_x000D_
<p>_x000D_
Inspired by Bootstrap's <a href="https://getbootstrap.com/docs/4.0/examples/floating-labels/">floating labels</a>._x000D_
</p>
_x000D_
This is working for me in Angular 7. It is based on the --main option of the ng command. I am not sure if this option is undocumented and possibly subject to change, but it works for me. I put a line in my package.json file in scripts section. There using the --main option of with the ng test command, I specify the path to the .spec.ts file I want to execute. For example
"test 1": "ng test --main E:/WebRxAngularClient/src/app/test/shared/my-date-utils.spec.ts",
You can run the script as you run any such script. I run it in Webstorm by clicking on "test 1" in the npm section.
1. for error: unescaped apostrophe in string
what I found is that AAPT2 tool points to wrong row in xml, sometimes. So you should correct whole strings.xml file
In Android Studio, in problem file use :
Edit->find->replace
Then write in first field \' (or \&,>,\<,\")
in second put '(or &,>,<,")
then replace each if needed.(or "reptlace all" in case with ')
Then in first field again put '(or &,>,<,")
and in second write \'
then replace each if needed.(or "replace all" in case with ')
2. for other problematic symbols
I use to comment each next half part +rebuild
until i won't find the wrong sign.
E.g. an escaped word "\update" unexpectedly drops such error :)
I guess best way to do this is ...
int main()
{
char str[100];
scanf("[^EOF]",str);
printf("%s",str);
return 0;
}
Or you can do this alternatively with "forEach()":
var cubes = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
cubes.forEach(function each(item) {
if (Array.isArray(item)) {
// If is array, continue repeat loop
item.forEach(each);
} else {
console.log(item);
}
});
If you need array's index, please try this code:
var i = 0; j = 0;
cubes.forEach(function each(item) {
if (Array.isArray(item)) {
// If is array, continue repeat loop
item.forEach(each);
i++;
j = 0;
} else {
console.log("[" + i + "][" + j + "] = " + item);
j++;
}
});
And the result will look like this:
[0][0] = 1
[0][1] = 2
[0][2] = 3
[1][0] = 4
[1][1] = 5
[1][2] = 6
[2][0] = 7
[2][1] = 8
[2][2] = 9
Yes. If memory serves me, that should work. Our you could use:
DELETE FROM table WHERE id <> 2
The following is works best in my opinion:
Get-Item Env:PATH
Get-ChildItem
. There's no hierarchy with environment variables.Set-Item -Path env:SomeVariable -Value "Some Value"
)Get-Item Env:
)I found the syntax odd at first, but things started making more sense after I understood the notion of Providers. Essentially PowerShell let's you navigate disparate components of the system in a way that's analogous to a file system.
What's the point of the trailing colon in Env:
? Try listing all of the "drives" available through Providers like this:
PS> Get-PSDrive
I only see a few results... (Alias, C, Cert, D, Env, Function, HKCU, HKLM, Variable, WSMan). It becomes obvious that Env
is simply another "drive" and the colon is a familiar syntax to anyone who's worked in Windows.
You can navigate the drives and pick out specific values:
Get-ChildItem C:\Windows
Get-Item C:
Get-Item Env:
Get-Item HKLM:
Get-ChildItem HKLM:SYSTEM
You can get detail error by using responseText property.
$.ajaxSetup({
error: function(xhr, status, error) {
alert("An AJAX error occured: " + status + "\nError: " + error + "\nError detail: " + xhr.responseText);
}
});
Since the aggregates string can be longer than 4000 bytes, you can't use the LISTAGG
function. You could potentially create a user-defined aggregate function that returns a CLOB
rather than a VARCHAR2
. There is an example of a user-defined aggregate that returns a CLOB
in the original askTom discussion that Tim links to from that first discussion.
I usually go with varchar(255) (255 being the maximum length of a varchar type in MySQL).
If this was working before, it means the PATH
isn't correct anymore.
That can happen when the PATH
becomes too long and gets truncated.
All posts (like this one) suggest updating the PATH
, which you can test first in a separate DOS session, by setting a minimal path and see if java works again there.
Finally the OP Highland Mark concludes:
Finally fixed by uninstalling java, removing all references to it from the registry, and then re-installing.
scary ;)
dict((k, v) for k, v in points.items() if all(x < 5 for x in v))
You could choose to call .iteritems()
instead of .items()
if you're in Python 2 and points
may have a lot of entries.
all(x < 5 for x in v)
may be overkill if you know for sure each point will always be 2D only (in that case you might express the same constraint with an and
) but it will work fine;-).
From http://www.sqlite.org/lang_createtable.html:
CREATE TABLE IF NOT EXISTS some_table (id INTEGER PRIMARY KEY AUTOINCREMENT, ...);
I assume from db
that this is LINQ-to-SQL / Entity Framework / similar (not LINQ-to-Objects);
Generally, you do better with the conditional syntax ( a ? b : c) - however, I don't know if it will work with your different queries like that (after all, how would your write the TSQL?).
For a trivial example of the type of thing you can do:
select new {p.PriceID, Type = p.Price > 0 ? "debit" : "credit" };
You can do much richer things, but I really doubt you can pick the table in the conditional. You're welcome to try, of course...
The top answer is flawed in my opinion. Hopefully, no one is mass importing all of pandas into their namespace with from pandas import *
. Also, the map
method should be reserved for those times when passing it a dictionary or Series. It can take a function but this is what apply
is used for.
So, if you must use the above approach, I would write it like this
df["A1"], df["A2"] = zip(*df["a"].apply(calculate))
There's actually no reason to use zip here. You can simply do this:
df["A1"], df["A2"] = calculate(df['a'])
This second method is also much faster on larger DataFrames
df = pd.DataFrame({'a': [1,2,3] * 100000, 'b': [2,3,4] * 100000})
DataFrame created with 300,000 rows
%timeit df["A1"], df["A2"] = calculate(df['a'])
2.65 ms ± 92.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit df["A1"], df["A2"] = zip(*df["a"].apply(calculate))
159 ms ± 5.24 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
60x faster than zip
Apply is generally not much faster than iterating over a Python list. Let's test the performance of a for-loop to do the same thing as above
%%timeit
A1, A2 = [], []
for val in df['a']:
A1.append(val**2)
A2.append(val**3)
df['A1'] = A1
df['A2'] = A2
298 ms ± 7.14 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
So this is twice as slow which isn't a terrible performance regression, but if we cythonize the above, we get much better performance. Assuming, you are using ipython:
%load_ext cython
%%cython
cpdef power(vals):
A1, A2 = [], []
cdef double val
for val in vals:
A1.append(val**2)
A2.append(val**3)
return A1, A2
%timeit df['A1'], df['A2'] = power(df['a'])
72.7 ms ± 2.16 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
You can get even greater speed improvements if you use the direct vectorized operations.
%timeit df['A1'], df['A2'] = df['a'] ** 2, df['a'] ** 3
5.13 ms ± 320 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
This takes advantage of NumPy's extremely fast vectorized operations instead of our loops. We now have a 30x speedup over the original.
apply
The above example should clearly show how slow apply
can be, but just so its extra clear let's look at the most basic example. Let's square a Series of 10 million numbers with and without apply
s = pd.Series(np.random.rand(10000000))
%timeit s.apply(calc)
3.3 s ± 57.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Without apply is 50x faster
%timeit s ** 2
66 ms ± 2 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
My experience and advice: Install Eclipse Juno on C: drive.
After download the zip, put it on C:, click the right mouse button -> extract here. Then a folder called eclipse will be created in C: drive.
Then go to Eclipse executable, run it, and all will be ok.
SomeVal=ActiveWorkbook.worksheets("Sheet2").cells(aRow,aCol).Value
did not work. However the following code only worked for me.
SomeVal = ThisWorkbook.Sheets(2).cells(aRow,aCol).Value
Sample 3 would be the worst performer out of them all because you are hitting up the database countless times for no apparent reason.
Loading the data into a temp table and then joining on that would be by far the fastest. After that the IN should work slightly faster than the group of ORs.
A thread is something like some branch. Multi-branched means when there are at least two branches. If the branches are reduced, then the minimum remains one. This one is although like the branches removed, but in general we do not consider it branch.
Similarly when there are at least two threads we call it multi-threaded program. If the threads are reduced, the minimum remains one. Hello program is a single threaded program, but no one needs to know multi-threading to write or run it.
In simple words when a program is not said to be having threads, it means that the program is not a multi-threaded program, more over in true sense it is a single threaded program, in which YOU CAN put your code as if it is multi-threaded.
Below a useless code is given, but it will suffice to do away with your some confusions about Runnable
. It will print "Hello World".
class NamedRunnable implements Runnable {
public void run() { // The run method prints a message to standard output.
System.out.println("Hello World");
}
public static void main(String[]arg){
NamedRunnable namedRunnable = new NamedRunnable( );
namedRunnable.run();
}
}
Add the following under @NgModule({})
in 'app.module.ts' :
import {CUSTOM_ELEMENTS_SCHEMA} from `@angular/core`;
and then
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
Your 'app.module.ts' should look like this:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@NgModule({
declarations: [],
imports: [],
schemas: [ CUSTOM_ELEMENTS_SCHEMA],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
To successfully track click events and on what graph element the user clicked, I did the following in my .js file I set up the following variables:
vm.chartOptions = {
onClick: function(event, array) {
let element = this.getElementAtEvent(event);
if (element.length > 0) {
var series= element[0]._model.datasetLabel;
var label = element[0]._model.label;
var value = this.data.datasets[element[0]._datasetIndex].data[element[0]._index];
}
}
};
vm.graphSeries = ["Series 1", "Serries 2"];
vm.chartLabels = ["07:00", "08:00", "09:00", "10:00"];
vm.chartData = [ [ 20, 30, 25, 15 ], [ 5, 10, 100, 20 ] ];
Then in my .html file I setup the graph as follows:
<canvas id="releaseByHourBar"
class="chart chart-bar"
chart-data="vm.graphData"
chart-labels="vm.graphLabels"
chart-series="vm.graphSeries"
chart-options="vm.chartOptions">
</canvas>
I also had problem with refused connection on port 80. I didn't use localhost.
curl --data-binary "@/textfile.txt" "http://www.myserver.com/123.php"
Problem was that I had umlauts äåö in my textfile.txt.
Add the following line in style.xml
<style name="Base.Theme.AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme" parent="Base.Theme.AppTheme">
</style>
Now add the following line in style-v21,
<style name="AppTheme" parent="Base.Theme.AppTheme">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
and set the theme as android:theme="@style/AppTheme"
It will make the status bar transparent.
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {
JTable source = (JTable)evt.getSource();
int row = source.rowAtPoint( evt.getPoint() );
int column = source.columnAtPoint( evt.getPoint() );
String s=source.getModel().getValueAt(row, column)+"";
JOptionPane.showMessageDialog(null, s);
}
if you want click cell or row in jtable use this way
Suppose you want to load RegistrationComponent on load and then ConfirmationComponent on some event click on RegistrationComponent.
So in appModule.ts
, you can write like this.
RouterModule.forRoot([
{
path: '',
redirectTo: 'registration',
pathMatch: 'full'
},
{
path: 'registration',
component: RegistrationComponent
},
{
path : 'confirmation',
component: ConfirmationComponent
}
])
OR
RouterModule.forRoot([
{
path: '',
component: RegistrationComponent
},
{
path : 'confirmation',
component: ConfirmationComponent
}
])
is also fine. Choose whatever you like.
Swift 3:
let escapedString = originalString.addingPercentEncoding(withAllowedCharacters:NSCharacterSet.urlQueryAllowed)
If you put this on your row, all of the columns inside will be centered:
.row-centered {
display: flex;
justify-content: space-between;
}
You should convert the string to an enumeration value before comparing.
Enum.TryParse("Retailer", out AccountType accountType);
Then
if (userProfile?.AccountType == accountType)
{
//your code
}
Below code works for me
first I defined the partnerTypesMap
like below in the server side,
Map<String, String> partnerTypes = new HashMap<>();
after adding values to it I added the object to model
,
model.addAttribute("partnerTypesMap", partnerTypes);
When rendering the page I use below foreach
to print them one by one.
<c:forEach items="${partnerTypesMap}" var="partnerTypesMap">
<form:option value="${partnerTypesMap['value']}">${partnerTypesMap['key']}</form:option>
</c:forEach>
The technique I use frequently to simulate a random connection timeout is to use ssh local port forwarding.
ssh -L 12345:realserver.com:80 localhost
This will forward traffic on localhost:12345 to realserver.com:80 You can loop this around in your own local machine as well, if you want:
ssh -L 12345:localhost:8080 localhost
So you can point your application at your localhost and custom port, and the traffic will get routed to the target host:port. Then you can exit out of this shell (you may also need to ctrl+c the shell after you exit) and it will kill the forwarding which causes your app to see a connection loss.
Get First Day of Last Month
Select ADDDATE(LAST_DAY(ADDDATE(now(), INTERVAL -2 MONTH)), INTERVAL 1 DAY);
Get Last Day of Last Month
Select LAST_DAY(ADDDATE(now(), INTERVAL -1 MONTH));
If you use "hg remove b"
against a file with "A" status, which means it has been added but not commited, Mercurial will respond:
not removing b: file has been marked for add (use forget to undo)
This response is a very clear explication of the difference between remove and forget.
My understanding is that "hg forget"
is for undoing an added but not committed file so that it is not tracked by version control; while "hg remove"
is for taking out a committed file from version control.
This thread has a example for using hg remove
against files of 7 different types of status.
You could use my tool uhubctl to control USB power per port for compatible USB hubs.
This:
<select style="width: XXXpx;">
XXX = Any Number
Works great in Google Chrome v70.0.3538.110
Using conda install scipy instead of pip solved the problem for me!
~dp0
: d=drive, p=path, %0=full path\name of this batch-file.
cd /d %~dp0
will change the path to the same, where the batch file resides.
See for /?
or call /
for more details about the %~...
modifiers.
See cd /?
about the /d
switch.
tosh's answer gets to the heart of the question nicely. Here's some additional information....
ng-bind
and ng-model
both have the concept of transforming data before outputting it for the user. To that end, ng-bind
uses filters, while ng-model
uses formatters.
With ng-bind
, you can use a filter to transform your data. For example,
<div ng-bind="mystring | uppercase"></div>
,
or more simply:
<div>{{mystring | uppercase}}</div>
Note that uppercase
is a built-in angular filter, although you can also build your own filter.
To create an ng-model formatter, you create a directive that does require: 'ngModel'
, which allows that directive to gain access to ngModel's controller
. For example:
app.directive('myModelFormatter', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, controller) {
controller.$formatters.push(function(value) {
return value.toUpperCase();
});
}
}
}
Then in your partial:
<input ngModel="mystring" my-model-formatter />
This is essentially the ng-model
equivalent of what the uppercase
filter is doing in the ng-bind
example above.
Now, what if you plan to allow the user to change the value of mystring
? ng-bind
only has one way binding, from model-->view. However, ng-model
can bind from view-->model which means that you may allow the user to change the model's data, and using a parser you can format the user's data in a streamlined manner. Here's what that looks like:
app.directive('myModelFormatter', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, controller) {
controller.$parsers.push(function(value) {
return value.toLowerCase();
});
}
}
}
Play with a live plunker of the ng-model
formatter/parser examples
ng-model
also has built-in validation. Simply modify your $parsers
or $formatters
function to call ngModel's controller.$setValidity(validationErrorKey, isValid)
function.
Angular 1.3 has a new $validators array which you can use for validation instead of $parsers
or $formatters
.
What you could do is creating an instance of a GregorianCalendar
and then set the Date
as a start time:
Date date;
Calendar myCal = new GregorianCalendar();
myCal.setTime(date);
However, another approach is to not use Date
at all. You could use an approach like this:
private Calendar startTime;
private long duration;
private long startNanos; //Nano-second precision, could be less precise
...
this.startTime = Calendar.getInstance();
this.duration = 0;
this.startNanos = System.nanoTime();
public void setEndTime() {
this.duration = System.nanoTime() - this.startNanos;
}
public Calendar getStartTime() {
return this.startTime;
}
public long getDuration() {
return this.duration;
}
In this way you can access both the start time and get the duration from start to stop. The precision is up to you of course.
Use this simple code for DataTables custom sorting. Its 100% work
<script>
$(document).ready(function() {
$('#myTable').DataTable( {
"order": [[ 0, "desc" ]] // "0" means First column and "desc" is order type;
} );
} );
</script>
See in Datatables website
https://datatables.net/examples/basic_init/table_sorting.html
For anyone completely new to Qt Creator like me, you can modify your project's .pro file from within Qt Creator:
Just double-click on "your project name".pro in the Projects window and add the include path at the bottom of the .pro file like I've done.
Try using this code for v3:
gMap = new google.maps.Map(document.getElementById('map'));
gMap.setZoom(13); // This will trigger a zoom_changed on the map
gMap.setCenter(new google.maps.LatLng(37.4419, -122.1419));
gMap.setMapTypeId(google.maps.MapTypeId.ROADMAP);
Project -> Build Path -> Configure Build Path
Select Java Build path on the left menu, and select "Source"
click on Excluded and then Include(All) and then click OK
Cause : The issue might because u might have deleted the CLASS files
or dependencies on the project
For maven users:
Right click on the project
Maven
Update Project
Python doesn't have the quite the extensive range of "built-in" data structures as Java does. However, because Python is dynamic, a general tree is easy to create. For example, a binary tree might be:
class Tree:
def __init__(self):
self.left = None
self.right = None
self.data = None
You can use it like this:
root = Tree()
root.data = "root"
root.left = Tree()
root.left.data = "left"
root.right = Tree()
root.right.data = "right"
If you need an arbitrary number of children per node, then use a list of children:
class Tree:
def __init__(self, data):
self.children = []
self.data = data
left = Tree("left")
middle = Tree("middle")
right = Tree("right")
root = Tree("root")
root.children = [left, middle, right]
You are looking for the update method
dic0.update( dic1 )
print( dic0 )
gives
{'dic0': 0, 'dic1': 1}
Use phpinfo()
function to find php.ini
file path,
open php.ini file. Here search extension=php_intl.dll
then remove semi-colon (;
) beginning of that line.
After removing semi-colon (;
) restart you webserver (apache).
If the other solutions didn't work and you know the correct jars are in your repository then:
The problem is that eclipse caches the errors for some reason.
I solved this problem by deleting the errors in the Problems tab and then I refreshed the project explorer and all the exclamation points and errors never returned.
I used to use curly brackets for "if, else" conditions. However, I found "if(xxx): endif;" is more semantic if the code is heavily wrapped and easier to read in any editors.
Of course, lots editors are capable of recognise and highlight chunks of code when curly brackets are selected. Some also do well on "if(xxx): endif" pair (eg, NetBeans)
Personally, I would recommend "if(xxx): endif", but for small condition check (eg, only one line of code), there are not much differences.
The three ways are:
//NSArray
NSArray *arrData = @[@1,@2,@3,@4];
// 1.Classical
for (int i=0; i< [arrData count]; i++){
NSLog(@"[%d]:%@",i,arrData[i]);
}
// 2.Fast iteration
for (id element in arrData){
NSLog(@"%@",element);
}
// 3.Blocks
[arrData enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSLog(@"[%lu]:%@",idx,obj);
// Set stop to YES in case you want to break the iteration
}];
This works for me :
$scope.array1 = $scope.array1.concat(array2)
In your case it would be :
$scope.actions.data = $scope.actions.data.concat(data)
Here's an example of using text-overflow:
.text {_x000D_
display: block;_x000D_
width: 100px;_x000D_
overflow: hidden;_x000D_
white-space: nowrap;_x000D_
text-overflow: ellipsis;_x000D_
}
_x000D_
<span class="text">Hello world this is a long sentence</span>
_x000D_
char[] ch = ?
new String(ch).getBytes();
or
new String(ch).getBytes("UTF-8");
to get non-default charset.
Update: Since Java 7: new String(ch).getBytes(StandardCharsets.UTF_8);
Use block level buttons, those that span the full width of a parent
You can achieve this by adding btn-block
class your button element.
Documentation here
You need to re-factor the code into pieces. This doesn't stop execution, it just puts a delay in between the parts.
function partA() {
...
window.setTimeout(partB,1000);
}
function partB() {
...
}
I found this answer when searching for how to find the form of an input element. I wanted to add a note because there is now a better way than using:
var form = $(this).parents('form:first');
I'm not sure when it was added to jQuery but the closest() method does exactly what's needed more cleanly than using parents(). With closest the code can be changed to this:
var form = $(this).closest('form');
It traverses up and finds the first element which matches what you are looking for and stops there, so there's no need to specify :first.
If you use alternatives to manage multiple java versions, you can set the JAVA_HOME
based on the symlinked java (or javac) like this:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
Wrong syntax. Here you are:
insert into user_by_category (game_category,customer_id) VALUES ('Goku','12');
or:
insert into user_by_category ("game_category","customer_id") VALUES ('Kakarot','12');
The second one is normally used for case-sensitive column names.
“C:\Users\admin\Downloads\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf” is misleading, it’s not the file which sets the Java Home variable. The actually file used is”%AppData%\sqldeveloper{PRODUCT_VERSION}\product.conf” [in my case it is "%AppData%\sqldeveloper\1.0.0.0.0\product.conf"]
Gmail started basic support for style tags in the head area. Found nothing official yet but you can easily try it yourself.
It seems to ignore class and id selectors but basic element selectors work.
<!doctype html>
<html>
<head>
<style type="text/css">
p{font-family:Tahoma,sans-serif;font-size:12px;margin:0}
</style>
</head>
<body>
<p>Email content here</p>
</body>
</html>
it will create a style tag in its own head area limited to the div containing the mail body
<style>div.m14623dcb877eef15 p{font-family:Tahoma,sans-serif;font-size:12px;margin:0}</style>
Simple tabulation of the output:
a = 0.3333333
b = 200/3
print("variable a variable b")
print("%10.2f %10.2f" % (a, b))
output:
variable a variable b
0.33 66.67
%10.2f: 10 is the minimum length and 2 is the number of decimal places.
I originally used the solution that @Mrchief for years (it works great). But when when I added Swagger to my project for API documentation my end point was NOT showing up.
It took me a while, but this is what I came up with. It works with Swagger, and your API method signatures look cleaner:
In the end you can do:
// GET: /api/values/1,2,3,4
[Route("api/values/{ids}")]
public IHttpActionResult GetIds(int[] ids)
{
return Ok(ids);
}
WebApiConfig.cs
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Allow WebApi to Use a Custom Parameter Binding
config.ParameterBindingRules.Add(descriptor => descriptor.ParameterType == typeof(int[]) && descriptor.ActionDescriptor.SupportedHttpMethods.Contains(HttpMethod.Get)
? new CommaDelimitedArrayParameterBinder(descriptor)
: null);
// Allow ApiExplorer to understand this type (Swagger uses ApiExplorer under the hood)
TypeDescriptor.AddAttributes(typeof(int[]), new TypeConverterAttribute(typeof(StringToIntArrayConverter)));
// Any existing Code ..
}
}
Create a new class: CommaDelimitedArrayParameterBinder.cs
public class CommaDelimitedArrayParameterBinder : HttpParameterBinding, IValueProviderParameterBinding
{
public CommaDelimitedArrayParameterBinder(HttpParameterDescriptor desc)
: base(desc)
{
}
/// <summary>
/// Handles Binding (Converts a comma delimited string into an array of integers)
/// </summary>
public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider,
HttpActionContext actionContext,
CancellationToken cancellationToken)
{
var queryString = actionContext.ControllerContext.RouteData.Values[Descriptor.ParameterName] as string;
var ints = queryString?.Split(',').Select(int.Parse).ToArray();
SetValue(actionContext, ints);
return Task.CompletedTask;
}
public IEnumerable<ValueProviderFactory> ValueProviderFactories { get; } = new[] { new QueryStringValueProviderFactory() };
}
Create a new class: StringToIntArrayConverter.cs
public class StringToIntArrayConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
}
Notes:
I know this is way too late to help the OP with his problem, but to all of us who is just encountering this problem, I had solved this issue by removing the constructor with parameters of my Class which was meant to hold the json data.
func viewDidLoad(){
let homeBtn: UIButton = UIButton(type: UIButtonType.custom)
homeBtn.setImage(UIImage(named: "Home.png"), for: [])
homeBtn.addTarget(self, action: #selector(homeAction), for: UIControlEvents.touchUpInside)
homeBtn.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
let homeButton = UIBarButtonItem(customView: homeBtn)
let backBtn: UIButton = UIButton(type: UIButtonType.custom)
backBtn.setImage(UIImage(named: "back.png"), for: [])
backBtn.addTarget(self, action: #selector(backAction), for: UIControlEvents.touchUpInside)
backBtn.frame = CGRect(x: -10, y: 0, width: 30, height: 30)
let backButton = UIBarButtonItem(customView: backBtn)
self.navigationItem.setLeftBarButtonItems([backButton,homeButton], animated: true)
}
}
Cause you need to add jQuery library to your file:
jQuery UI is just an addon to jQuery which means that
first you need to include the jQuery library → and then the UI.
<script src="path/to/your/jquery.min.js"></script>
<script src="path/to/your/jquery.ui.min.js"></script>
Had the same problem with different casing.
Did a checkout to development (or master) then changed the name (the wrong name) to something else like test.
then change the name back to the right name
then checkout to the right-name branch
then it worked to push to the remote branch
You need the change those double quotation marks into singles.
ie. if (answer == 'y')
returns true
;
Here is some info on String Literals in C++: http://msdn.microsoft.com/en-us/library/69ze775t%28VS.80%29.aspx
dplyr
definitely does things that data.table
can not.Your point #3
dplyr abstracts (or will) potential DB interactions
is a direct answer to your own question but isn't elevated to a high enough level. dplyr
is truly an extendable front-end to multiple data storage mechanisms where as data.table
is an extension to a single one.
Look at dplyr
as a back-end agnostic interface, with all of the targets using the same grammer, where you can extend the targets and handlers at will. data.table
is, from the dplyr
perspective, one of those targets.
You will never (I hope) see a day that data.table
attempts to translate your queries to create SQL statements that operate with on-disk or networked data stores.
dplyr
can possibly do things data.table
will not or might not do as well.Based on the design of working in-memory, data.table
could have a much more difficult time extending itself into parallel processing of queries than dplyr
.
Are there analytical tasks that are a lot easier to code with one or the other package for people familiar with the packages (i.e. some combination of keystrokes required vs. required level of esotericism, where less of each is a good thing).
This may seem like a punt but the real answer is no. People familiar with tools seem to use the either the one most familiar to them or the one that is actually the right one for the job at hand. With that being said, sometimes you want to present a particular readability, sometimes a level of performance, and when you have need for a high enough level of both you may just need another tool to go along with what you already have to make clearer abstractions.
Are there analytical tasks that are performed substantially (i.e. more than 2x) more efficiently in one package vs. another.
Again, no. data.table
excels at being efficient in everything it does where dplyr
gets the burden of being limited in some respects to the underlying data store and registered handlers.
This means when you run into a performance issue with data.table
you can be pretty sure it is in your query function and if it is actually a bottleneck with data.table
then you've won yourself the joy of filing a report. This is also true when dplyr
is using data.table
as the back-end; you may see some overhead from dplyr
but odds are it is your query.
When dplyr
has performance issues with back-ends you can get around them by registering a function for hybrid evaluation or (in the case of databases) manipulating the generated query prior to execution.
Also see the accepted answer to when is plyr better than data.table?
Sometimes you don't even need php for this in certain instances (List items each are in their own generic tag on render for example) You can always add commas to all elements but last-child via css if they are separate elements after being rendered from the script.
I use this a lot in backbone apps actually to trim some arbitrary code fat:
.likers a:not(:last-child):after { content: ","; }
Basically looks at the element, targets all except it's last element, and after each item it adds a comma. Just an alternative way to not have to use script at all if the case applies.
I have http_proxy
and https_proxy
are defined. I don't want to unset and set again those environments but --noproxy '*'
works perfectly for me.
curl --noproxy '*' -XGET 172.17.0.2:9200
{
"status" : 200,
"name" : "Medusa",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.5.0",
"build_hash" : "544816042d40151d3ce4ba4f95399d7860dc2e92",
"build_timestamp" : "2015-03-23T14:30:58Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
The problem lays here:
--This result set has 3 columns
select LOC_id,LOC_locatie,LOC_deelVan_LOC_id from tblLocatie t
where t.LOC_id = 1 -- 1 represents an example
union all
--This result set has 1 columns
select t.LOC_locatie + '>' from tblLocatie t
inner join q parent on parent.LOC_id = t.LOC_deelVan_LOC_id
In order to use union
or union all
number of columns and their types should be identical cross all result sets.
I guess you should just add the column LOC_deelVan_LOC_id
to your second result set
You can't, you either need to keep the index separately:
int index = 0;
for(Element song : question) {
System.out.println("Current index is: " + (index++));
}
or use a normal for loop:
for(int i = 0; i < question.length; i++) {
System.out.println("Current index is: " + i);
}
The reason is you can use the condensed for syntax to loop over any Iterable, and it's not guaranteed that the values actually have an "index"
The pack() method is defined in Window class in Java and it sizes the frame so that all its contents are at or above their preferred sizes.
HashMap<String, Object> map1 = new HashMap<String, Object>();
Map<String, Object> map2 = new HashMap<String, Object>();
First of all Map
is an interface it has different implementation like - HashMap
, TreeHashMap
, LinkedHashMap
etc. Interface works like a super class for the implementing class. So according to OOP's rule any concrete class that implements Map
is a Map
also. That means we can assign/put any HashMap
type variable to a Map
type variable without any type of casting.
In this case we can assign map1
to map2
without any casting or any losing of data -
map2 = map1
I created Lodash to provide more consistent cross-environment iteration support for arrays, strings, objects, and arguments
objects1. It has since become a superset of Underscore.js, providing more consistent API behavior, more features (like AMD support, deep clone, and deep merge), more thorough documentation and unit tests (tests which run in Node.js, RingoJS, Rhino, Narwhal, PhantomJS, and browsers), better overall performance and optimizations for large arrays/object iteration, and more flexibility with custom builds and template pre-compilation utilities.
Because Lodash is updated more frequently than Underscore.js, a lodash underscore
build is provided to ensure compatibility with the latest stable version of Underscore.js.
At one point I was even given push access to Underscore.js, in part because Lodash is responsible for raising more than 30 issues; landing bug fixes, new features, and performance gains in Underscore.js v1.4.x+.
In addition, there are at least three Backbone.js boilerplates that include Lodash by default and Lodash is now mentioned in Backbone.js’s official documentation.
Check out Kit Cambridge's post, Say "Hello" to Lo-Dash, for a deeper breakdown on the differences between Lodash and Underscore.js.
Footnotes:
arguments
objects. In newer browsers, Underscore.js methods ignore holes in arrays, "Objects" methods iterate arguments
objects, strings are treated as array-like, and methods correctly iterate functions (ignoring their "prototype" property) and objects (iterating shadowed properties like "toString" and "valueOf"), while in older browsers they will not. Also, Underscore.js methods, like _.clone
, preserve holes in arrays, while others like _.flatten
don't.There is a pseudocolumn called %%physloc%% that shows the physical address of the row.
The Best Command for changing branch
git branch -M YOUR_BRANCH
I experienced the same error after upgrading my java to 1.8.0_101. Try this: i. Remove the mysql.jar fro your buildpath. ii. Clean the server and project iii. Add the jar file back to the build path.
Worked for me.
I solved it moving the file spring-context.xml in a src folder. ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
Here is one without using JQuery with pure JavaScript. I used javascript promises and XMLHttpRequest You can try it here on this fiddle
HTML
<div id="result" style="color:red"></div>
JavaScript
var getJSON = function(url) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status == 200) {
resolve(xhr.response);
} else {
reject(status);
}
};
xhr.send();
});
};
getJSON('https://www.googleapis.com/freebase/v1/text/en/bob_dylan').then(function(data) {
alert('Your Json result is: ' + data.result); //you can comment this, i used it to debug
result.innerText = data.result; //display the result in an HTML element
}, function(status) { //error detection....
alert('Something went wrong.');
});
I found another possibility that may cause the issue.
When using "initWithNibName" method with the wrong xib name, it will lead to this kind of crash too.
Such as you choose to change a xib file's name, and then foget to change the name used in "initWithNibName" method to the same name.
If you want to concatenate int or floats to a string you must use this:
i = 123
a = "foobar"
s = a + str(i)
You could use the 'isActive' prop like so:
const { router } = this.context;
if (router.isActive('/login')) {
router.push('/');
}
isActive will return a true or false.
Tested with react-router 2.7
In Firefox, any invalid Date is returned as a Date object as Date 1899-11-29T19:00:00.000Z
, therefore check if browser is Firefox then get Date object of string "1899-11-29T19:00:00.000Z".getDate()
. Finally compare it with the date.
If you get the error "Unrecognized attribute 'enableSsl'" when following the advice to add that parameter to your web.config. I found that I was able to workaround the error by adding it to my code file instead in this format:
SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = true;
try
{
smtp.Send(mm);
}
catch (Exception ex)
{
MsgBox("Message not emailed: " + ex.ToString());
}
This is the system.net section of my web.config:
<system.net>
<mailSettings>
<smtp from="<from_email>">
<network host="smtp.gmail.com"
port="587"
userName="<your_email>"
password="<your_app_password>" />
</smtp>
</mailSettings>
</system.net>
if you want to add directly to input as attribute, use this
onclick="return false;"
<input id = "btnPlay" type="button" onclick="return false;" value="play" />
this will prevent form submit behaviour
Using Guava library, another option is to convert the Iterable
to a List
.
List list = Lists.newArrayList(some_iterator);
int count = list.size();
Use this if you need also to access the elements of the iterator after getting its size. By using Iterators.size()
you no longer can access the iterated elements.
if($query)
{
// try to export to excel the whole data ---
//initialize php excel first
ob_end_clean();
//--- create php excel object ---
$objPHPExcel = new PHPExcel();
//define cachemethod
ini_set('memory_limit', '3500M');
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
$cacheSettings = array('memoryCacheSize' => '800MB');
//set php excel settings
PHPExcel_Settings::setCacheStorageMethod(
$cacheMethod,$cacheSettings
);
$objPHPExcel->getProperties()->setTitle("export")->setDescription("none");
$objPHPExcel->setActiveSheetIndex(0);
// Field names in the first row
$fields = $query->list_fields();
$col = 0;
foreach ($fields as $field)
{
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, 1, $field);
$col++;
}
// Fetching the table data
$row = 2;
foreach($query->result() as $data)
{
$col = 0;
foreach ($fields as $field)
{
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $data->$field);
$col++;
}
$row++;
}
$objPHPExcel->setActiveSheetIndex(0);
//redirect to cleint browser
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename=Provinces.xlsx');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
}
Most of the answers are/were valid. The new JAVA API modification for Date handling made sure that some earlier ambiguity in java date handling is reduced.
You will get a deprecated message for similar calls.
new Date() // deprecated
The above call had the developer to assume that a new Date object will give the Date object with current timestamp. This behavior is not consistent across other Java API classes.
The new way of doing this is using the Calendar Instance.
new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()
Here too the naming convention is not perfect but this is much organised. For a person like me who has a hard time mugging up things but would never forget something if it sounds/appears logical, this is a good approach.
This is more synonymous to real life
One more way to do this is using Joda time API
new DateTime().toString("yyyy-MM-dd")
or the much obvious
new DateTime(Calendar.getInstance().getTime()).toString("yyyy-MM-dd")
both will return the same result.
sorted()
returns a new sorted list, leaving the original list unaffected. list.sort()
sorts the list in-place, mutating the list indices, and returns None
(like all in-place operations).
sorted()
works on any iterable, not just lists. Strings, tuples, dictionaries (you'll get the keys), generators, etc., returning a list containing all elements, sorted.
Use list.sort()
when you want to mutate the list, sorted()
when you want a new sorted object back. Use sorted()
when you want to sort something that is an iterable, not a list yet.
For lists, list.sort()
is faster than sorted()
because it doesn't have to create a copy. For any other iterable, you have no choice.
No, you cannot retrieve the original positions. Once you called list.sort()
the original order is gone.
This is a simple dialog feed that Facebook offer's. Read here for more detail link
Using the div
trick with tab_index="0"
or tabIndex="-1"
works, but any time the user is focusing a view that's not an element, you get an ugly focus-outline on the entire website. This can be fixed by setting the CSS for the div to use outline: none
in the focus.
Here's the implementation with styled components:
import styled from "styled-components"
const KeyReceiver = styled.div`
&:focus {
outline: none;
}
`
and in the App class:
render() {
return (
<KeyReceiver onKeyDown={this.handleKeyPress} tabIndex={-1}>
Display stuff...
</KeyReceiver>
)
You can also do it in one row:
if (MessageBox.Show("Text", "Title", MessageBoxButtons.YesNo) == DialogResult.Yes)
And if you want to show a messagebox on top:
if (MessageBox.Show(new Form() { TopMost = true }, "Text", "Text", MessageBoxButtons.YesNo) == DialogResult.Yes)
As per the Django Project Skeleton, the proper directory structure that could be followed is :
[projectname]/ <- project root
+-- [projectname]/ <- Django root
¦ +-- __init__.py
¦ +-- settings/
¦ ¦ +-- common.py
¦ ¦ +-- development.py
¦ ¦ +-- i18n.py
¦ ¦ +-- __init__.py
¦ ¦ +-- production.py
¦ +-- urls.py
¦ +-- wsgi.py
+-- apps/
¦ +-- __init__.py
+-- configs/
¦ +-- apache2_vhost.sample
¦ +-- README
+-- doc/
¦ +-- Makefile
¦ +-- source/
¦ +-- *snap*
+-- manage.py
+-- README.rst
+-- run/
¦ +-- media/
¦ ¦ +-- README
¦ +-- README
¦ +-- static/
¦ +-- README
+-- static/
¦ +-- README
+-- templates/
+-- base.html
+-- core
¦ +-- login.html
+-- README
Refer https://django-project-skeleton.readthedocs.io/en/latest/structure.html for the latest directory structure.
One reason to have both is so that authentication can be done by the database server, but authorization can be scoped to the database. That way, if you move your database to another server, you can always remap the user-login relationship on the database server, but your database doesn't have to change.
If you don't want to use a DateTime or TimeSpan, and just want to store the time of day, you could just store the seconds since midnight in an Int32, or (if you don't even want seconds) the minutes since midnight would fit into an Int16. It would be trivial to write the few methods required to access the Hour, Minute and Second from such a value.
The only reason I can think of to avoid DateTime/TimeSpan would be if the size of the structure is critical.
(Of course, if you use a simple scheme like the above wrapped in a class, then it would also be trivial to replace the storage with a TimeSpan in future if you suddenly realise that would give you an advantage)
remove the connect .jar file if you added the multiple version connector jar file only add the connector jar file that match with your sql version.
Give KineticJS a try - you can define a Spline with an array of points. Here's an example:
Old url: http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-spline-tutorial/
See archive url: https://web.archive.org/web/20141204030628/http://www.html5canvastutorials.com/kineticjs/html5-canvas-kineticjs-spline-tutorial/