HTML
<div class="container-fluid">
<div class="row">
<div class="page-header header_site">
<h1><font>ABC Company</font></h1>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS代码:
.header_site {
background-color: darkblue;
}
font {
color: white;
margin: auto 160px auto 160px;
}
Run Code Online (Sandbox Code Playgroud)
我想删除上边距,如下图所示.
我看到了一些类似的问题.但我的方法不同,这些都不适合我.这就是我发布这个的原因.我想改变背景图像的不透明度而不改变子元素的不透明度,其中background-image被加载到body标签内.
HTML:
<body>
<div id = "background-div">
<div class = "header">
<div class = "ham-icon">
<img src = "images/ham-icon.png">
</div>
<div class = "logo">
<span class = "google-logo">Google</span><span class = "hangouts-logo"> Hangouts</span>
</div>
<div class = "profile-data">
</div>
</div>
<div class = "body">
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
CSS:
body
{
position: relative;
background: url(../images/back1.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Run Code Online (Sandbox Code Playgroud) 我想实时收听推文,这意味着当有人发推文时我想看到该推文。
不过,我可以使用 twitter4j 库从我的新闻提要中获取推文。这是代码。
package twitteroperation;
import java.util.List;
import twitter4j.Status;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.conf.ConfigurationBuilder;
public class TwitterOperation {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws TwitterException {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("")
.setOAuthConsumerSecret("")
.setOAuthAccessToken("")
.setOAuthAccessTokenSecret("");
TwitterFactory tf=new TwitterFactory(cb.build());
twitter4j.Twitter tw=tf.getInstance();
List<Status> statuses= tw.getHomeTimeline();
for (Status status1 : statuses) {
System.out.println(status1.getUser().getName() + ":" + status1.getText());
}
}
}
Run Code Online (Sandbox Code Playgroud)
我发现我必须使用 Streaming API 来实时访问推文。但我在 java 中找不到任何用于访问实时推文的示例代码。
我正在尝试使用Stanford Core NLP获得实时推文的感性分数。目前,我正在获取实时推文。但是,当我将其提供给Stanford Core NLP程序时,出现了错误。
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.neural.rnn.RNNCoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.sentiment.SentimentCoreAnnotations;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.util.CoreMap;
public class NLP {
static StanfordCoreNLP pipeline;
public static void init() {
pipeline = new StanfordCoreNLP("MyPropFile.properties");
}
public static int findSentiment(String tweet) {
int mainSentiment = 0;
if (tweet != null && tweet.length() > 0) {
int longest = 0;
Annotation annotation = pipeline.process(tweet);
for (CoreMap sentence : annotation
.get(CoreAnnotations.SentencesAnnotation.class)) {
Tree tree = sentence
.get(SentimentCoreAnnotations.AnnotatedTree.class);
int sentiment = RNNCoreAnnotations.getPredictedClass(tree);
String …Run Code Online (Sandbox Code Playgroud)