小编Lal*_*ath的帖子

在bootstrap中删除标题的上边距

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)

我想删除上边距,如下图所示.

在此输入图像描述

html css html5 css3 twitter-bootstrap-3

7
推荐指数
2
解决办法
2万
查看次数

在css中更改背景图像的不透明度

我看到了一些类似的问题.但我的方法不同,这些都不适合我.这就是我发布这个的原因.我想改变背景图像的不透明度而不改变子元素的不透明度,其中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)

html css html5 css3

3
推荐指数
1
解决办法
1万
查看次数

实时收听推文

我想实时收听推文,这意味着当有人发推文时我想看到该推文。

不过,我可以使用 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 中找不到任何用于访问实时推文的示例代码。

java twitter twitter4j twitter-oauth

2
推荐指数
1
解决办法
2584
查看次数

SentimentCoreAnnotations.AnnotatedTree无法解析为一种类型

我正在尝试使用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)

java twitter nlp compiler-errors stanford-nlp

0
推荐指数
1
解决办法
1045
查看次数