All posts by Social marketing master

is it possible to change the childPosition id of the expandablelistview?

just want to know if it is possible to change the childPosition id of the expandablelistview?

because i want to change the childPosition id to my category id..

this is my DataChild, i already get categories name but i also want to get the categories id. how do i do that?

List<String> CATEGORY = new ArrayList<String>();
            for(int i=0;i<categories.length();i++){
                JSONObject c = categories.getJSONObject(i);
                String categories_name = c.getString(TAG_NAME);
                String categories_id = c.getString(TAG_ID);

                CATEGORY.add(categories_name);
            }

this is my setOnChildClickListener where i get the childPosition.

// Listview on child click listener
                expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

                    @Override
                    public boolean onChildClick(ExpandableListView parent, View v,
                                                int groupPosition, int childPosition, long id) {
                        // TODO Auto-generated method stub
                        Toast.makeText(
                                getActivity(),
                                listDataHeader.get(groupPosition)
                                        + " : "
                                        + listDataChild.get(
                                        listDataHeader.get(groupPosition)).get(
                                        childPosition), Toast.LENGTH_SHORT)
                                .show();
                        return false;
                    }
                }); 

read more

Yii2 ajax update row status and hide row after status change

I am using Yii2 gridview with custom action button. On click custom button i want to update status of that record and hide that row from gridview.
Also want to show success message.

[  
    'class' => 'yii\grid\ActionColumn',
    'header'=>'Actions',
    'template' => '{confirm}',
    'buttons' => [

        //view button
        'confirm' => function ($url, $model) {
            return Html::a('Confirm', $url, [
                'title' => Yii::t('app', 'Confirm Address'),
                'class'=>'btn btn-success',                                  
            ]);
        },
    ],

    'urlCreator' => function ($action, $model, $key, $index) {
        if ($action === 'confirm') {
            return Url::to(['customers/confirmaddress','id'=>$model->id]);

        }
    }
]

read more

Yii2 ajax update row status and hide row after status change

I am using Yii2 gridview with custom action button. On click custom button i want to update status of that record and hide that row from gridview.
Also want to show success message.

[  
    'class' => 'yii\grid\ActionColumn',
    'header'=>'Actions',
    'template' => '{confirm}',
    'buttons' => [

        //view button
        'confirm' => function ($url, $model) {
            return Html::a('Confirm', $url, [
                'title' => Yii::t('app', 'Confirm Address'),
                'class'=>'btn btn-success',                                  
            ]);
        },
    ],

    'urlCreator' => function ($action, $model, $key, $index) {
        if ($action === 'confirm') {
            return Url::to(['customers/confirmaddress','id'=>$model->id]);

        }
    }
]

read more

Alternative in python to subprocess

I am trying to write a script which has to make a lot of calls to some bash commands, parse and process the outputs and finally give some output.

I was using subprocess.Popen and subprocess.call

If I understand correct these methods spawn a bah process, run the command, get the output and then kill the process.

Is there a way to have a bash process running in the background continuously and then the python calls could just go directly to that process? This would be something like bash running as a server and python calls going to it.

read more

Alternative in python to subprocess

I am trying to write a script which has to make a lot of calls to some bash commands, parse and process the outputs and finally give some output.

I was using subprocess.Popen and subprocess.call

If I understand correct these methods spawn a bah process, run the command, get the output and then kill the process.

Is there a way to have a bash process running in the background continuously and then the python calls could just go directly to that process? This would be something like bash running as a server and python calls going to it.

read more