小编Was*_*lil的帖子

来自json的脚本输出的scrapy

scrapy在python脚本中运行

def setup_crawler(domain):
    dispatcher.connect(stop_reactor, signal=signals.spider_closed)
    spider = ArgosSpider(domain=domain)
    settings = get_project_settings()
    crawler = Crawler(settings)
    crawler.configure()
    crawler.crawl(spider)
    crawler.start()
    reactor.run()
Run Code Online (Sandbox Code Playgroud)

它成功运行并停止但结果在哪里?我希望结果采用json格式,我该怎么做?

result = responseInJSON
Run Code Online (Sandbox Code Playgroud)

就像我们使用命令一样

scrapy crawl argos -o result.json -t json
Run Code Online (Sandbox Code Playgroud)

python json scrapy web-scraping scrapy-spider

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

CodeIgniter上的SMTP显示成功,但电子邮件未传递到Gmail帐户

我正在尝试在CodeIgniter上设置SMTP.一切正常,我在页面上收到成功消息,发送的电子邮件没有错误.但是,电子邮件未送达.

这是我使用的代码:

$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'my-email@gmail.com', 
'smtp_pass' => '***', 
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);

$this->email->from('my-email@gmail.com', 'Explendid Videos');
$this->email->to('my-email@gmail.com');
$this->email->reply_to('my-email@gmail.com', 'Explendid Videos');


$this->email->subject('Explendid Video - Contact form');

$message = "Contact form\n\n";
$message .= "Name: ". $_POST['name'] . "\n";
$message .= "Phone: ". $_POST['phone'] . "\n";
$message .= "Email: ". $_POST['email'] . "\n";

$this->email->message($message);

$this->email->send();
Run Code Online (Sandbox Code Playgroud)

可能是什么原因,电子邮件实际上没有交付.

email gmail smtp codeigniter

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

Android Studio 1.0.1添加外部库

我刚下载了Android Studio 1.0.1,这是新的项目结构

在此输入图像描述

当我在资源管理器中看到它时,有一个空的libs文件夹 在此输入图像描述

我想导入我想要使用的3个外部库.

build.gradle已经定义了这个

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Run Code Online (Sandbox Code Playgroud)

但是当我在libs文件夹中复制我的库时,我的项目仍然不认识它,我如何利用libs文件夹并将我的库复制到这个文件夹中并使用它?任何帮助?

编辑:这是一个简单的问题,如何像在eclipse中那样在Android Studio中添加库,例如我有一个库项目(文件夹,而不是jar!).在我的情况下,我有一个库项目'viewPagerIndicator'(再次是一个库文件夹,而不是一个jar!)我必须将它添加到我的项目,就像我用eclipse通过导入项目,右键单击 - > properties-> android - >库 - > add->选择库项目

PS:我现在找到了答案.假设我的库项目名称为'viewPagerIndicator' - 在我的Android Studio项目的根目录下复制库项目 - 在build.gradle下(在您的Android Studio项目文件夹下)在依赖项下编写项目编译项目(':viewPagerIndicator') - 将其包含在设置中.gradle,write:include':viewPagerIndicator' - 使用gradle文件同步项目

这就是项目结构现在的样子:

在此输入图像描述

很抱歉,管理员在不理解的情况下停止了这个问题.

android libs android-studio

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

Next.js 在 router.push 时保持状态或发送 props

我是 Next.js 的新手,我正在使用以下命令将用户重定向到下一页router.push

router.push("/terminal_summary");
Run Code Online (Sandbox Code Playgroud)

我的 Redux 状态在下一页上为空,但我需要该状态中的数据。我如何保留它或者至少如何发送一些道具router.state

我尝试过router.push("/terminal_summary", undefined, { shallow: true });,但没有成功。

我也尝试过:

router.push({
  pathname: '/terminal_summary',
  query: props.terminalPayload
})
Run Code Online (Sandbox Code Playgroud)

但它在查询参数中发送数据。

最好的办法是将所有数据保持在状态,或者至少我希望能够使用 props 进行重定向。

编辑:

在下一页上,我尝试使用以下命令访问 Redux 状态mapStateToProps

function mapStateToProps(state) {
  return {
    terminalPayload: state.terminalPayload,
  };
}
Run Code Online (Sandbox Code Playgroud)

但显示的是重定向后的状态,initialState而不是我在上一页上所做的更改。

所以该值是,{}但它应该是一个如下所示的对象。

{
   merchant: [{ /*multiple objects*/ }],
   products: [{ /* multiple products*/}],
   // other data
}
Run Code Online (Sandbox Code Playgroud)

请注意,当前未保存在数据库中,应该保存在下一页上,我想在下一页上显示摘要,然后要求用户保存。

另请注意,我可以在 Chrome 中看到 Redux DevTools 的数据,但当我在页面上访问时,它是{}.

编辑2:

这是完整的 redux 代码:

配置Store.js

export default …
Run Code Online (Sandbox Code Playgroud)

reactjs react-redux next.js

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

Android获取listView中所有选中复选框的文本

你好我已经创建了一个带有复选框的列表视图...但我不知道如何获取所选的复选框文本..这里是activity_main.xml的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="top"
    android:orientation="vertical"
    tools:context=".MygamesActivity" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="20dp" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

另一个布局,其中包含要在listview main.list_item.xml中显示的复选框

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="CheckBox"
         />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是扩展arrayadapter的类

package com.wasiff.listview;

import android.content.Context;
import android.content.res.TypedArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;


public class CheckboxAdapter extends ArrayAdapter<String> {
    private LayoutInflater mInflater;

    private String[] mStrings;
    private TypedArray mIcons;
    private int mViewResourceId;

    public CheckboxAdapter(Context ctx,int viewResourceId,String[] strings){
        super(ctx,viewResourceId,strings);

        mInflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); …
Run Code Online (Sandbox Code Playgroud)

checkbox android listview android-listview

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

已定义资源条目ic_launcher

可以任何身体PLZ帮助他解决这个问题我想在我的android工作室项目中使用这个库

https://github.com/daimajia/AndroidImageSlider
Run Code Online (Sandbox Code Playgroud)

当我把它放在我的gradle文件中时它会显示这些错误

Information:Gradle tasks [:app:generateDebugSources]
Information:res\drawable-mdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-mdpi\ic_launcher.png:0: Originally defined here.
Information:res\drawable-xhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-xhdpi\ic_launcher.png:0: Originally defined here.
Information:res\drawable-xxhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-xxhdpi\ic_launcher.png:0: Originally defined here.
Information:1 error
Information:0 warnings
Information:See complete output in console
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\Razi\AppData\Local\Android\android-studio\sdk\build-tools\19.1.0\aapt.exe package -f --no-crunch -I C:\Users\Razi\AppData\Local\Android\android-studio\sdk\platforms\android-19\android.jar -M C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\manifests\debug\AndroidManifest.xml -S C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\res\all\debug -A C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\assets\debug -m -J C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\source\r\debug -F C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\libs\app-debug.ap_ --debug-mode …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

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

CocoaPods - 无法找到`GoogleMaps`的规范

我是新来的iOS,我已经AlamofireMarqueeLabelPodfile现在尝试添加GoogleMaps,它不断出现这条消息,

[!] Unable to find a specification for `GoogleMaps`
Run Code Online (Sandbox Code Playgroud)

Podfile看起来像这样

# Uncomment the next line to define a global platform for your project

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'Migapixel' do

  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

    pod 'GoogleMaps'

    pod 'Alamofire',
        :git => 'https://github.com/Alamofire/Alamofire.git',
    :branch => 'master',
      :tag => '4.0.0'

    pod 'MarqueeLabel/Swift',
    :git => 'https://github.com/cbpowell/MarqueeLabel.git'



  # Pods for …
Run Code Online (Sandbox Code Playgroud)

google-maps ios cocoapods

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

保留viewpager片段android的状态

我在一个片段中有一个viewpager,我在其中显示3个片段,但是当我第一次打开片段时它打开正常,当我移动到另一个片段并返回到viewpager片段时,它不显示视图寻呼机中的片段然后我必须更改手机的方向或继续滑动viewpager以显示隐藏的片段.

我用google搜索它,现在我知道我必须将标记设置为每个片段并使用findfragmentbytag方法检索片段但问题是当我尝试将标记设置为片段时

getSupportFragmentManager().beginTransaction().add(myFragment, "Some Tag").commit();
Run Code Online (Sandbox Code Playgroud)

上面的行崩溃我的应用程序和logcat显示"不能将标签设置为片段",我知道我在做一些愚蠢的错误

这是我片段的完整代码.如果能指导我在哪里编写用于设置片段标记的代码,我将非常感激.提前致谢.

public class MatchesListingFragment extends Fragment implements ActionBar.TabListener {

    Context context;
    SectionsPagerAdapter mSectionsPagerAdapter;
    ViewPager mViewPager;
    ActionBar actionBar;
    Matchlistings db;
    Bundle savedInstanceState;

    Fragment livescore,fixture,results;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        this.savedInstanceState = savedInstanceState;
        db = new Matchlistings(getActivity());
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_matches, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        context = getActivity().getApplicationContext();

        if(savedInstanceState == null){
            livescore = new …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-viewpager

5
推荐指数
3
解决办法
6466
查看次数

Angular 4动态表单组

我正在尝试创建一个动态表单组,我试图实现这一目标

在此输入图像描述

在添加更多点击添加2动态字段我调用此功能:

onAddSurgeries(){
    const control = new FormGroup({
        'surgery': new FormControl(null),
        'illness': new FormControl(null)
    });
      (<FormArray>this.form.get('surgeries')).push(control);
}
Run Code Online (Sandbox Code Playgroud)

这就是我的html的样子:

<tr *ngFor="let ctrl of form.get('surgeries')['controls']; let i = index">
   <td><input type="text" class="form-control" [formControlName]="ctrl['controls'].surgery"></td>
   <td><input type="text" class="form-control" [formControlName]="ctrl['controls'].illness"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)

我知道我正在做的错误,formControlName不应该是" ctrl['controls'].surgery"我应该把"我" formcontrolname当我只有一个formcontrol而不是2个控件formgroup,但在这种情况下我不知道我应该输入什么formControlName因为当我提交表单时,两个输入的值都是空的,因为它没有与formgroup控件同步

typescript angular

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

Pulltorefresh加入gradle

任何人都可以帮我在build.gradle Android Studio中添加此库.

https://github.com/chrisbanes/Android-PullToRefresh
Run Code Online (Sandbox Code Playgroud)

我知道它已被弃用但我想使用它,如果有人能帮助我,我将不胜感激

写些什么

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:+'
compile '????'
}
Run Code Online (Sandbox Code Playgroud)

如上所述,我想使用已弃用的库而不是新的Actionbar-Pulltorefresh.试图谷歌它,但找不到任何帮助.

gradle pull-to-refresh android-studio build.gradle android-gradle-plugin

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