185
Points
Questions
35
Answers
39
-
Asked on July 16, 2020 in CSS.
This will work!
CSS:
animation: slideWithBlur 2s infinite normal ease-out; @keyframes slideWithBlur { 0% { top:500px; filter: blur(0px); -webkit-filter: blur(0px); } 10% { top:450px; filter: blur(3px); -webkit-filter: blur(3px); } 20% { top:400px; filter: blur(6px); -webkit-filter: blur(6px); } 30% { top:350px; filter: blur(9px); -webkit-filter: blur(9px); } 40% { top:300px; filter: blur(12px); -webkit-filter: blur(12px); } 50% { top:250px; filter: blur(15px); -webkit-filter: blur(15px); } 60% { top:200px; filter: blur(18px); -webkit-filter: blur(18px); } 70% { top:150px; filter: blur(21px); -webkit-filter: blur(21px); } 80% { top:100px; filter: blur(24px); -webkit-filter: blur(24px); } 90% { top:50px; filter: blur(27px); -webkit-filter: blur(27px); } 100% { top: 0px; filter: blur(30px); -webkit-filter: blur(30px); } }
- 326 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in CSS.
You can use the bootstrap grid system to resize each of the box’s sizes. You can refer the code below –
<head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> </head> <div class="row"> <div class="col-2 p-3 mb-2 bg-primary text-white">.bg-primary</div> <div class="col-2 p-3 mb-2 bg-secondary text-white">.bg-secondary</div> <div class="col-2 p-3 mb-2 bg-success text-white">.bg-success</div> <div class="col-2 p-3 mb-2 bg-danger text-white">.bg-danger</div> <div class="col-2 p-3 mb-2 bg-warning text-dark">.bg-warning</div> <div class="col-2 p-3 mb-2 bg-info text-white">.bg-info</div> <div class="col-2 p-3 mb-2 bg-light text-dark">.bg-light</div> <div class="col-2 p-3 mb-2 bg-dark text-white">.bg-dark</div> <div class="col-2 p-3 mb-2 bg-white text-dark">.bg-white</div> </div>
And for having blocks as squares, use the following –
.row{ display:flex; justify-content:center; } .row>*{ display:flex; height:200px ; width:200px ; justify-content:center; align-items:center; border: 1px solid black; margin: 10px; } *{ background-color: CornSilk; }
<head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> </head> <div class="row m-2"> <div class="bg-primary text-white">.bg-primary</div> <div class="bg-secondary text-white">.bg-secondary</div> <div class="bg-success text-white">.bg-success</div> <div class="bg-danger text-white">.bg-danger</div> <div class="bg-warning text-dark">.bg-warning</div> <div class="bg-info text-white">.bg-info</div> <div class="bg-light text-dark">.bg-light</div> <div class="bg-dark text-white">.bg-dark</div> <div class="bg-white text-dark">.bg-white</div> </div>
If you were looking for something different, do let me know. Hope this helps !
- 276 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in CSS.
This is possible with not only webkit (latest chrome or safari) but also in latest firefox.
Here is the example: http://codepen.io/jonathan/pen/pgioE
HTML:
<div id="someid"> <img src="image url" /> <div/>
CSS (webkit):
#someid { /* need some space for the reflection */ margin-bottom: 120px; /* the gradient makes the reflection fade out */ -webkit-box-reflect: below 0px -webkit-linear-gradient(bottom, rgba(255,255,255,0.3) 0%, transparent 40%, transparent 100%); }
CSS (Firefox – Gecko):
#someid { position: relative; /* need some space for the reflection */ margin-bottom: 120px; } #someid:before { content:""; /* needed or nothing will be shown */ background: -moz-linear-gradient(top, white, white 30%, rgba(255,255,255,0.9) 65%, rgba(255,255,255,0.7)) 0px 0px, -moz-element(#someid) 0px -127px no-repeat; -moz-transform: scaleY(-1); /* flip the image vertically */ position:relative; height:140px; width: 360px; /* should be > image width + margin + shadow */ top: 247px; left:0px; }
Firefox uses
-moz-element
to do the reflections (https://developer.mozilla.org/en-US/docs/CSS/element), whereas webkit uses a proprietary vendor prefix for reflections.I hope this helps!
- 275 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Java.
What you are looking for is a custom rendered.
To do that, take your
JTree
and call thesetCellRenderer()
method passin your renderer.A basic renderer is an inheritance of
DefaultTreeCellRenderer
. The method that returns the rendering isgetTreeCellRendererComponent()
.Unfortunately, your question is very vague, so I can’t give a more specific example, so a generic example would be:
JTree paintedTree = new JTree(); paintedTree.setCellRenderer(new DefaultTreeCellRenderer() { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component renderedItem = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (((YourClass)value).getTime() > 60) { renderedItem.setBackground(Color.GREEN); } return renderedItem; } });
Note that this answer is strictly from the rendering of colors’ point of view. The code for determining if the process is running was simplified by
(((YourClass)value).getTime() > 60)
to keep the answer in focus.Also, check this page. It might help you with your pursuit.
- 382 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Java.
wordsArray = s.split("-"); List<String> wordsList = new Arrays.asList(wordsArray); Set<String> wordsSet = new LinkedHashSet<String>(wordsList); String[] noDuplicates = new String[wordsSet.size()]; wordsSet.toArray(noDuplicates);
- 633 views
- 14 answers
- 0 votes
-
Asked on July 16, 2020 in Java.
For hints, look closer at the class name name that throws an error and the line number, example: Compilation failure [ERROR] \applications\xxxxx.java:[44,30] error: cannot find symbol
One other cause is unsupported method of for java version say jdk7 vs 8. Check your %JAVA_HOME%
- 687 views
- 14 answers
- 0 votes
-
Asked on July 16, 2020 in Java.
Double.toString produces the exact result (0.1), how does it do that, is it always produces the result that mathematically equal to the double literal?
Double.toString(XXX)
will always produce a numeral equal toXXX
ifXXX
is a decimal numeral with 15 or fewer significant digits and it is within the range of theDouble
format.There are two reasons for this:
- The
Double
format (IEEE-754 binary64) has enough precision so that 15-digit decimal numerals can always be distinguished. Double.toString
does not display the exactDouble
value but instead produces the fewest significant digits needed to distinguish the number from nearbyDouble
values.
For example, the literal
0.1
in source text is converted to theDouble
value 0.1000000000000000055511151231257827021181583404541015625. ButDouble.toString
will not produce all those digits by default. The algorithm it uses produces “0.1” because that is enough to uniquely distinguish 0.1000000000000000055511151231257827021181583404541015625 from its two neighbors, which are 0.09999999999999999167332731531132594682276248931884765625 and 0.10000000000000001942890293094023945741355419158935546875. Both of those are farther from 0.1.Thus,
Double.toString(1.234)
,Double.toString(123.4e-2)
, andDouble.toString(.0001234e4)
will all produce “1.234”—a numeral whose value equals all of the original decimal numerals (before they are converted toDouble
), although it differs in form from some of them.When use Apache POI to read excel file,
XSSFCell.getNumericCellValue
can only returndouble
, if I useBigDecimal.valueOf
to convert it toBigDecimal
, is that always safe, and why?If the cell value being retrieved is not representable as a
Double
, thenXSSFCell.getNumericCellValue
must change it. From memory, I thinkBigDecimal.valueOf
will produce the exact value of theDouble
returned, but I cannot speak authoritatively to this. That is a separate question from howDouble
andDouble.toString
behave, so you might ask it as a separate question.- 386 views
- 4 answers
- 0 votes
- The
-
Asked on July 16, 2020 in Python.
As per the post linked, the feature you are asking has been implemented. I just tried it on my Spyder IDE version 4.1.3 and it works by using an increasing number of
%
. For instance#%% Section 1 some code #%%% Sub-Section 1.1 some more code #%% Section 2 and so on
- 418 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Java.
For the first question: You first want to check that there are no digits after the decimal point when just displaying 1 instead of 1.00. To do so you can check that this actually is the case with this if statement:
if(number % 1.0f == 0)
next, you want to convert this number into a string that just displays the number without the decimal points, to do so you can cast number to an int and then convert it into a string with:
String.valueOf((int) number)
For the second question: To append a new digit to the number I would suggest generating a string with the number the user enters using StringBuilder. In practice it would look something like:
StringBuilder sb = new StringBuilder(); // when user presses "2" button for example: sb.append("2");
In the end you want to convert this generated String into a float in order to perform calculations on it, which you can do with:
float value = Float.valueOf(sb.toString());
- 360 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Java Script.
Use the
open
method to open any modal:$('#modal1').modal('open');
- 313 views
- 1 answers
- 0 votes