小编Car*_*man的帖子

在使用共享文件夹的vagrant ubuntu中,npm安装依赖项失败

主机操作系统:Ubuntu 14.04.

在进行npm安装时,我收到以下错误.

npm WARN optional dep failed, continuing imagemin-pngquant@4.0.0
npm WARN optional dep failed, continuing imagemin-optipng@4.0.0
npm WARN optional dep failed, continuing imagemin-jpegtran@4.0.0
npm WARN optional dep failed, continuing imagemin-gifsicle@4.0.0
npm ERR! EEXIST, open '/home/vagrant/.npm/bc688003--npm-gulp-util-3-0-2-package-tgz.lock'
File exists: /home/vagrant/.npm/bc688003--npm-gulp-util-3-0-2-package-tgz.lock
Move it away, and try again. 

npm ERR! System Linux 3.13.0-34-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-link"
npm ERR! cwd /home/vagrant/tixif/telmo-web
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /home/vagrant/.npm/bc688003--npm-gulp-util-3-0-2-package-tgz.lock
npm ERR! code EEXIST
npm …
Run Code Online (Sandbox Code Playgroud)

ubuntu virtualbox node.js vagrant

5
推荐指数
1
解决办法
549
查看次数

如何检查GPS是否启用Ionic2(地理定位)?

我使用插件cordova Geolocation for ionic 2但我需要知道GPS是启用还是禁用.我不知道怎么做到这一点.

请帮助我;)谢谢!

validation gps android geolocation ionic2

4
推荐指数
1
解决办法
5098
查看次数

如何从另一个ts文件更新component.ts文件中的vaiable

最初我的app.component.ts文件被加载然后我有两个变量,nameemail从API获取调用更新,为了进行此api调用我需要用户名如果​​我没有用户名我将无法更新此名称和电子邮件.

一旦我获得了用户名,我就可以拨打api电话,但我的用户名只有在登录成功后才可用.

我的app.html有这个,下面的代码是我的sidemenu的一部分

<ion-item class="profile-info">
  <ion-icon name="person" item-left></ion-icon>
  <h2>{{name}}</h2>
  <p class="se-email">{{email}}</p>
</ion-item>
Run Code Online (Sandbox Code Playgroud)

我的app.component.ts文件有这个

name 
 email

 if(localStorage.getItem("username")){
   //here it is invoking 2nd time because i have stored the username after login so no problem
    this.getUserDetails();//this function call the same api 
  }else{
    //at first thime i am not able update the name and email because i dont have username 
    //so i am trying to update the name with set and get method where it will return my data …
Run Code Online (Sandbox Code Playgroud)

ionic2 ionic3 angular

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

Python:列表索引必须是整数,而不是str?

所以我的代码看起来像这样:

with open(completeCSV, 'r') as csvfile:
    test = csv.reader(csvfile, delimiter=';')
    for line in test:
        print(line)
        i = i + 1  # on the first line, i will equal 1
        count = line[0]
        if count == '1':
            for prof in proflist:  # vertex1=prof
                if line[1].lower() == proflist[prof]:
                    # if vertex1 is a professor, you want to keep the edge.
                    lines_to_keep.append(i)
                    break  # breaks and doesn't check the rest of profs
Run Code Online (Sandbox Code Playgroud)

它基本上读取CSV,并检查来自csv的值是否等于列表中的另一个值proflist.

我收到这个错误:

回溯(最近一次调用最后一次):文件"C:/Users/sskadamb/PycharmProjects/BetterDelimiter/filter.py",第50行,如果行[1] .lower()== proflist [prof]:TypeError:list indices必须是整数,而不是str

是因为proflist[prof] …

python csv list

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