text:
Q: MySQL Bug? "SHOW TABLE STATUS" Reports Fluxuating Number of Rows During Import I'm importing 4.1mil records into an offline system to do some analysis on a subset of our database.  As I'm running the import, I'm trying to check its progress by using:
SHOW TABLE STATUS LIKE 'MailIssueElement'

What's odd...at different times, I'm seeing higher AND lower values for Rows.  I would expect it to only go up.  Here is a sample of the output:
mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
           Name: MailIssueElement
         Engine: MyISAM
        Version: 10
     Row_format: Dynamic
           Rows: 2818307
 Avg_row_length: 120
    Data_length: 338392232
Max_data_length: 281474976710655
   Index_length: 158029824
      Data_free: 0
 Auto_increment: 10248973
    Create_time: 2010-02-03 10:58:41
    Update_time: 2010-02-03 11:04:06
     Check_time: 2010-02-03 10:58:53
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.60 sec)

mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
           Name: MailIssueElement
         Engine: MyISAM
        Version: 10
     Row_format: Dynamic
           Rows: 1870294
 Avg_row_length: 119
    Data_length: 223251912
Max_data_length: 281474976710655
   Index_length: 107688960
      Data_free: 0
 Auto_increment: 10248973
    Create_time: 2010-02-03 10:58:41
    Update_time: 2010-02-03 11:04:13
     Check_time: 2010-02-03 10:58:53
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.35 sec)

mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
           Name: MailIssueElement
         Engine: MyISAM
        Version: 10
     Row_format: Dynamic
           Rows: 3074205
 Avg_row_length: 120
    Data_length: 369507112
Max_data_length: 281474976710655
   Index_length: 171537408
      Data_free: 0
 Auto_increment: 10248973
    Create_time: 2010-02-03 10:58:41
    Update_time: 2010-02-03 11:04:36
     Check_time: 2010-02-03 10:58:53
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.01 sec)

mysql> show table status like 'MailIssueElement' \G
*************************** 1. row ***************************
           Name: MailIssueElement
         Engine: MyISAM
        Version: 10
     Row_format: Dynamic
           Rows: 1870294
 Avg_row_length: 119
    Data_length: 223251912
Max_data_length: 281474976710655
   Index_length: 107688960
      Data_free: 0
 Auto_increment: 10248973
    Create_time: 2010-02-03 10:58:41
    Update_time: 2010-02-03 11:04:40
     Check_time: 2010-02-03 10:58:53
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.00 sec)

Is there an explanation for this behavior?  Is there a better way to check the progress of my import?
Running the following version:  Server version: 5.0.32-Debian_7etch11-log Debian etch distribution

EDIT:
Here is the DDL.  It is a MyISAM table:
mysql> show create table MailIssueElement \G
*************************** 1. row ***************************
       Table: MailIssueElement
Create Table: CREATE TABLE `MailIssueElement` (
  `Id` int(11) NOT NULL auto_increment,
  `IssueId` int(11) NOT NULL default '0',
  `Date` datetime NOT NULL default '0000-00-00 00:00:00',
  `Direction` enum('inbound','outbound') NOT NULL default 'inbound',
  `ToAddr` varchar(255) NOT NULL default '',
  `FromAddr` varchar(255) NOT NULL default '',
  `CCAddrs` varchar(255) NOT NULL default '',
  `Subject` text NOT NULL,
  `ParentIssueElementId` int(11) default NULL,
  `ParentIssueElementType` enum('mail','phone') default 'mail',
  `AgentId` int(11) NOT NULL default '0',
  PRIMARY KEY  (`Id`),
  KEY `date_idx` (`Date`),
  KEY `IssueId` (`IssueId`),
  KEY `idx_agent_id` (`AgentId`)
) ENGINE=MyISAM AUTO_INCREMENT=15099881 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Thanks in advance,
-aj

A: In regards to the number of rows

Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%.

Taken from MySQL :: MySQL 5.1 Reference Manual - SHOW TABLE STATUS Syntax

A: The table must be InnoDB.
From SHOW STATUS Doc
Rows
The number of rows. Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count.

A: OK, it looks like it was a bug reported and fixed.  Guess I need to finally upgrade from Etch to Lenny and get those newer packages...thanks for trying all.

A: In case you are using InnoDB, Rows seems to be calculated by dividing "Data_length" by "Avg_row_length" (which fluctuates heavily).


text:
Q: Taking as input only numbers and letters with getch() in c what I'm trying to accomplish is a simultaneous research by using the fuction getch. I know that this fuction returns a integer value, which represents the ASCII code of a key. Is there any wroten fuction that allows the user to write only certain characters, such as: letters, numbers, and apostrophe.

A: char c;
int temp = 0;
while((c= getch()) !='\r')
{
    if ((temp == -32) || (temp == 0))
    {
    }
    else
    {
        if(isalnum((char)c) == 0)
        {
            if((c == '\'') || (c == -118) || (c == -115) || (c == -107) || (c == -123) || (c == -105))
            {
                printf("true: %c\n",c);
            }
            else
                printf("false: %d\n",c);
        }
        else
        {
            printf("true: %c\n",c);
        }
    }
    temp = c;
}

For anyone else who's trying to accomplish the same result, this works fine for me.

A:
Is there any write function that allows the user to write only certain characters, such as: letters, numbers, and apostrophe. (?)

Code can instead selectivity write
#include <ctype.h>
#include <stdio.h>

int c; // use type `int` here to distinguish all (256) characters from EOF
while((c = getch()) != '\r' && c != '\n'  && c != EOF) {
  if (isalnum(c) || '\'') {
    putchar(c);
  }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Не обрабатывается OnTriggerEnter при смене родителя Unity3d, SetParent Существует объект пуля и когда она является дочерним объектом ее спавнера, то при достижении нужного объекта функция OnTriggerEnter выполняется корректно и выводит лог, но если прописать строчку SetParen(null) для пули, то тригер больше не обрабатывается.
В чем может быть проблема?
using System.Collections.Generic;
using UnityEngine;

public class SimpleBullet : MonoBehaviour
{
    private GameObject Player;

    private void Start()
    {
        transform.SetParent(null);
        // gameObject.transform.parent = null;
        Player = GameObject.Find("PlayerPers");

    }
    void FixedUpdate()
    {
        // Debug.Log(transform.position);
        transform.position = Vector3.Lerp(transform.position, Player.GetComponent<Control>().TargetPos.transform.position, 0.03f);
        Destroy(this.gameObject, 7f);
    }

    private void OnTriggerEnter(Collider other)
    {
        Debug.Log(other.name);
        if (other.gameObject.tag == "EnemyBody")
        {
            //other.GetComponent<EnemyHp>().Hp();
            Debug.Log("Collison");
            Destroy(this.gameObject);
        }

    }
}


text:
Q: Change document.getElementsByClassName("parent")[0].children in React I have a code in vanilla JS (javascript). I searched a lot of tutorial documents and videos for changing this code to React.
Following is the code in simple javascript
const Children = document.getElementsByClassName("parent")[0].children;
Array.from(sliderChildren).forEach((child) => {
  });

Can anyone please help me how do this in react?

A: Generally, you just would not use DOM methods like getElementsByClassName in React.
By design, React doesn't "know" about the DOM elements at all, it only knows about its state, then renders the DOM elements from the state, and then "forgets" about the DOM elements again.
You may think this way:
you do not develop vanilla JS and HTML anymore, instead you develop React.
Anyway, if you really need it for some reason, you need to find a way to "manually" tell react that the DOM node is ready to be accessed. There is no way to "automatically" make React aware of the current state of DOM elements.
Note that you can not use something like window.onload for that, because that again is a methond from the DOM world as well.
e.g.:
export const SomeList = (props)=>{
    const list = [1,2,3,4,5,6];
    return (

        { list.map((item)=>
number { item }
) }

);
};

export const AccessDom = (props)=>{

    const accessDomNodes = function(){
        const Children = document.getElementsByClassName("someParent")[0].children;
        console.log('Children:', Children);
    };

    return (

        <SomeList />
        <button type="button" onClick={ accessDomNodes }>
            I'm sure the DOM node exists now
        </button>

);
};

If you want to do something with the DOM elements in React, you need to pass it over into the React world by setting some React state:
export const AccessDom = (props)=>{
    const [ childsList, setChildsList ] = useState([]); // <-- a React state

    const accessDomNodes = function(){
        const Children = document.getElementsByClassName("someParent")[0].children;
        setChildsList( Array.from( Children ) );  // <-- set a React state
        console.log('Children:', Children);
    };

    return (

        <SomeList />
        <button type="button" onClick={ accessDomNodes }>
            I'm sure the DOM node exists now
        </button>

found children: { childsList.length }

);
};


text:
Q: Extracting links with regex from source code; Python I have a dataset of links to newspaper articles that I want to do some research on. However, the links in the dataset end with .ece extension (which is a problem for me because of some api restrictions)
http://www.telegraaf.nl/telesport/voetbal/buitenlands/article22178882.ece

and
http://www.telegraaf.nl/telesport/voetbal/buitenlands/22178882/__Wenger_vreest_het_ergste__.html

are links to the same page.
Now I need to convert all the .ece links into .html links. I didn't find an easier way to do it, but to parse the page and find the original .html link. The problem is that the link is buried inside an html meta element, and I can't get to it using tree.xpath.
<meta content="http://www.telegraaf.nl/telesport/voetbal/buitenlands/22178882/__Wenger_vreest_het_ergste__.html"

Unfortunately, I am not well acquainted with regex, and don't know how to extract a link using it.
Basically, every link I need will starts with:
<meta content="http://www.telegraaf.nl/

I need the full link (i.e., http://www.telegraaf.nl/THE_REST_OF_THE_LINK).
Also, I'm using BeautifulSoup for parsing. Thanks.

A: Here is a really simple regex to get you started.
This one will extract all links
\<meta content="(http:\/\/www\.telegraaf\.nl.*)"

This one will match all html links
\<meta content="(http:\/\/www\.telegraaf\.nl.*\.html)"

To use this with what you have, you can do the following:
import urllib2
import re

replacements = dict()
for url in ece_url_list:
    response = urllib2.urlopen(url)
    html = response.read()
    replacements[url] = re.findall('\<meta content="(http:\/\/www\.telegraaf\.nl.*\.html)"', html)[0]

Note: This assumes that each source code page always includes an html link in this meta tag. It expects one and only one.

A: Use BeautifulSoup to find matching content attributes, then replace as such:
from bs4 import BeautifulSoup
import re

html = """
    <meta content="http://www.telegraaf.nl/telesport/voetbal/buitenlands/article22178882.ece" />
    <meta content="http://www.telegraaf.nl/telesport/voetbal/buitenlands/22178882/__Wenger_vreest_het_ergste__.html" />
"""

soup = BeautifulSoup(html)
# reference table of url prefixes to full html link
html_links = {
    el['content'].rpartition('/')[0]: el['content']
    for el in soup.find_all('meta', content=re.compile('.html$'))
}
# find all ece links, strip the end of to match links, then adjust
# meta content with looked up element
for el in soup.find_all('meta', content=re.compile('.ece$')):
    url = re.sub('(?:article(\d+).ece$)', r'\1', el['content'])
    el['content'] = html_links[url]

print soup
# <meta content="http://www.telegraaf.nl/telesport/voetbal/buitenlands/22178882/__Wenger_vreest_het_ergste__.html"/>

A: (.*?)(http:\/\/.*\/.*?\.)(ece)

Try this.Replace by $2html.
See demo.
http://regex101.com/r/nA6hN9/24


text:
Q: Showing ViewController's View when animating upper ViewController I have ViewController(1) presented over another ViewController(2), I want to accomplish the effect that when I dismiss viewController1 I perform a reduction of size through CGAffineTransform and I dismiss it.
The effect I want to accomplish though is that when I reduce the size of ViewController1's view I want to see also the view of ViewController2 behind it, while now I'm only seeing a black background.
The code I'm using is really simple:
UIView.animate(withDuration: 2, animations: {
        self.view.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
    }) { (_) in
        self.dismiss(animated: true, completion: nil)
    }

I don't know how to reach that effect

A: Make sure to set this presentation for the top animated vc
vc.modalPresentationStyle = .overCurrentContext

This will guarantee transparency behind when you change frame / transform the view of that top vc


text:
Q: Windows update fails My PC is showing below updates since last 10-15 days but whenever I try to install, it fails. I have tried using Troubleshoot ==> Windows Update but still no luck. Please advise.

A: Have you tried repairing Office? You can do this by going to the control panel, uninstall a program, click Microsoft Office XXX and clicking change at the top. I would suggest you do an "Online repair" after reboot and try to update.
If you still get the same error try to remove Office with all its updates O15CTRRemove.diagcab. You can get it from this link https://support.office.com/en-us/article/Uninstall-Office-2013-Office-2016-or-Office-365-from-a-Windows-computer-9dd49b83-264a-477a-8fcc-2fdf5dbf61d8
Let me know if this works!

A: Method 1: Reinstall Office updates

*

*Click the Start button, type Windows Explorer in the search box.

*Click the Windows Explorer from the pop-up Programs menu

*Navigate to C:\Users\All Users\Microsoft\Office\data path, find opa12.dat file and rename it to opa12old.dat.

*When you restart Windows Office and open one file, it will prompt you to activate Windows Office, then activate it online.

*Reinstall Windows Office updates and restart computer.

Method 2: Reset Windows Update components
If the issue is with the Windows update components, this method will resolve the issue by repairing all the components associated with it. Click on the link below and follow the article on the same.
How do I reset Windows Update Components?


text:
Q: How to fix this RecyclerView code? Here is the RecyclerView code with some errors .
Please help me to make it a working code.
I don't know anything about RecyclerView so a good explanation regarding this will also be very useful.
All I need is a working RecyclerView out of this .
MainActivity.java
package com.slack.weeklychallengeone;

import android.app.AlertDialog; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView;

import com.slack.weeklychallengeone.Utils.Model; import com.slack.weeklychallengeone.Utils.MyAdapter;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private ArrayList<Model> mArrayList;
    private MyAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initViews();
        loadData();

    }

    private void initViews(){
        RecyclerView mRecyclerView = findViewById(R.id.recyler_view);
        mRecyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(layoutManager);
    }

    private void loadData(){

        mArrayList = new ArrayList<>();

        mArrayList.add(new Model("Constraint Layout"));
        mArrayList.add(new Model("Linear Layout"));
        mArrayList.add(new Model("Relative Layout"));
        mArrayList.add(new Model("Card View"));
        mArrayList.add(new Model("Scroll Views"));
        mArrayList.add(new Model("Grid View"));

        mAdapter = new MyAdapter(mArrayList);
        //mRecyclerViews.setAdapter(mAdapter);

    }

}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyler_view"
        android:layout_width="match_parent"
        android:scrollbars="vertical"
        android:layout_height="match_parent">

    </android.support.v7.widget.RecyclerView>

</RelativeLayout>

MyAdapter.java
package com.slack.weeklychallengeone.Utils;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.slack.weeklychallengeone.R;

import java.util.ArrayList;

public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {

    private ArrayList<Model> mArrayList;

    public MyAdapter(ArrayList<Model> mArrayList) {
        this.mArrayList = mArrayList;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_layout, parent, false);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        holder.tv_name.setText(mArrayList.get(position).getName());
    }

    @Override
    public int getItemCount() {
        return mArrayList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder{
        private TextView tv_name;
        MyViewHolder(View view) {
            super(view);

            tv_name = view.findViewById(R.id.tv_name);

        }
    }

}

row_layout.xml
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

        <TextView
            android:layout_marginBottom="4dp"
            android:layout_marginTop="4dp"
            android:padding="6dp"
            android:gravity="center_horizontal"
            android:id="@+id/tv_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:textColor="@android:color/primary_text_light"
            android:textSize="18sp"
            android:text="Name or Title"/>

</LinearLayout>

Model.java
package com.slack.weeklychallengeone.Utils;

public class Model {
    private String name;

    public Model(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

}

A: You just forgot to set Adapter to your mRecyclerViews
check in your loadData() method
check this line //mRecyclerViews.setAdapter(mAdapter);
Try this
private void loadData(){

        mArrayList = new ArrayList<>();

        mArrayList.add(new Model("Constraint Layout"));
        mArrayList.add(new Model("Linear Layout"));
        mArrayList.add(new Model("Relative Layout"));
        mArrayList.add(new Model("Card View"));
        mArrayList.add(new Model("Scroll Views"));
        mArrayList.add(new Model("Grid View"));

        mAdapter = new MyAdapter(mArrayList);
        mRecyclerViews.setAdapter(mAdapter);

    }

EDIT
You need to Declare your mRecyclerView; global like your mArrayList and mAdapter
private ArrayList<Model> mArrayList;
private MyAdapter mAdapter;
RecyclerView mRecyclerView;

A: In your code mRecyclerView not globally declared. Please check my code. Hope this will help.
package com.slack.weeklychallengeone;

import android.app.AlertDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.slack.weeklychallengeone.Utils.Model;
import com.slack.weeklychallengeone.Utils.MyAdapter;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private ArrayList<Model> mArrayList;
    private MyAdapter mAdapter;
    RecyclerView mRecyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initViews();
        loadData();
    }

    private void initViews(){
        mArrayList = new ArrayList<>();
        mRecyclerView = findViewById(R.id.recyler_view);
        mRecyclerView.setHasFixedSize(true);
        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(layoutManager);
        mAdapter = new MyAdapter(mArrayList);
        mRecyclerViews.setAdapter(mAdapter);

    }

    private void loadData(){

        mArrayList = new ArrayList<>();

        mArrayList.add(new Model("Constraint Layout"));
        mArrayList.add(new Model("Linear Layout"));
        mArrayList.add(new Model("Relative Layout"));
        mArrayList.add(new Model("Card View"));
        mArrayList.add(new Model("Scroll Views"));
        mArrayList.add(new Model("Grid View"));

       mAdapter.notifyDataSetChanged()

    }
}


text:
Q: extending ejabberd with modules for custom mysql schema? Instead of ejabberd.sql,I am using a custom MySQL schema(because of legacy reasons).
I will be doing some DB operations on certain activities like Ping,Pong,Msg deliverd,Msg read and most importantly getting/setting roster list and announcing presence(all of these on my own schema).
However,ejabberd seems to use ejabberd.sql all throughout and its source code is pretty much dependent on it.Fiddling with the source code is the last thing I would do since I am not aware of its dependencies.
Possible ideas :
Lets say if I extend ejabberd by writing my own modules,then what use will mod_roster_odbc be?I simply dont want to loose on all functionality of ejabberd but I have no other option than using custom schema here.
OR
Do I need to modify each and every query in odbc_queries and ejabberd_odbc.If there is a certain centralized module which can allow me to modify queries,reflecting it everywhere without disturbing the harmony of ejabberd,it would be great.
All in all,I want to avoid tackling dependencies and getting my work done in smartest way possible.But I am pretty vague about what the best approach might be?

A: EDIT Changing this answer after learning more about the OP's situation.
The use-case you have in mind calls for strong separation between your core business data and the chat service. Chat must be thought of as an external service, not something integral to the overall system (even if it is a "core" service from a user perspective, chat should never be hard-wired into, say, account management).
Use the existing infrastructure as a place where authentication takes place, and set chat up using ejabberd independently and configure it to make external authentication calls to your core service.
If you require persistence or inclusion of your legacy chat data, you can import it to the ejabberd schema (not so great), or leave the legacy chat system in "read only mode" and make all new chat go through ejabberd (better, especially if you take the time to make the interface seamless to users). If you need the legacy data for analytical purposes, then you should export it to an analytics schema and extract (batched, clumsy) or reflect (live, much better) the ejabberd data to the same schema for analysis.
Whatever you do, don't burden the core system with chat duties, and don't burden the chat system with analytical duties. These are things that should be strongly independent, even running on different hardware if your system is either very large or has significant robustness requirements (and your budget fits).


text:
Q: Get error when try to start workflow with PowerShell We are using SharePoint 2016 on-premise. I setup a list workflow (Designer 2010 workflow) to send email to "assigned to" field in the item. Then I prepared a PowerShell script to loop through the list and start workflow on each item if the status=Active.
However, whenever I tried the same PowerShell error returned.

Exception calling "StartWorkflow" with "3" argument(s): "Unable to
  synchronously deliver start event via a manual-start workflow."

Here is part of my PowerShell script:
$web = Get-SPWeb $weburl -AssignmentCollection $spAssignment
$site = Get-SPSite $siteurl
$listToloop = "Issues";
$web.AllowUnsafeUpdates = $true;
$wfToStart= "sendemail"
$list = $web.Lists[$listToloop];

$manager=$site.WorkFlowManager
$association=$list.WorkFlowAssociations | where {$_.Name -eq $wfToStart}
$association.AllowAsyncManualStart = $true
$association.AllowManual = $true

foreach ($item in $list.Items) {
$Lookup = new-object Microsoft.SharePoint.SPFieldLookupValue($Item["Status"])
    if ($Lookup.LookupValue -eq "Active") {
        $data=$association.AssociationData
        $wf=$manager.StartWorkFlow($item,$association,$data)
        Write-Output "$wftoStart started on " $item.Name | Out-File $outFile -Append
            }
        else {
        Write-Output $item.Name " - is completed " | Out-File $outFile -Append
        }
    }

If all the items status are not equal to "Active", no error. For each item with status = "Active", the same error will throw repeatedly.

A: Start Updating your workflow association after setting:
$association.AllowAsyncManualStart = $true
$association.AllowManual = $true

Using:
$list.UpdateWorkflowAssociation($association)

Or
$list.WorkflowAssociations.Update($association)

About StartWorkFlow() Method:
The boolean parameter shows the property isAutoStart.

This method comes with two overloads. The first overload takes an SPListItem
  object, an SPWorkflowAssociation object, a string, and a Boolean as its arguments and creates a
  workflow instance on the SharePoint list item or document represented by the SPListItem object
  from the workflow association represented by the SPWorkflowAssociation object.
The method
  starts the workflow instance if the Boolean parameter is true. The method returns an
  SPWorkflow object that represents the workflow instance.
The second overload takes
  an SPListItem object, an SPWorkflowAssociation object, and a string as its arguments and
  creates a workflow instance on the SharePoint list item or document represented by the
  SPListItem object from the workflow association represented by the SPWorkflowAssociation
  object. This overload automatically starts the workflow instance.

Hope this helps you.
Reference:

*

*SPWorkflowManager.StartWorkflow Method.

*Microsoft SharePoint 2007
Workflow Programming - Page No. 339


text:
Q: Best way to present data from a big excel file on a website I have a big excel file and I want to show the data on my website. I have made a matlab and a Java program(script) that can extract the information I want from the excel file. How do I get the data to the website?
Should I have the matlab or java script running on a server and then make a javascript that in some way connects to the server? How would i do this?
Or should a make a javascript that directly reads the excel file?
I am a beginner in web development so I dont really know where to start...

A: I happened to do something like this while I had to analyze the grades I gave. What I did was export the Excel sheet as a CSV, and then put that in a website where I used JavaScript to first convert it to a JSON. This is the function I used to perform the conversion:
function csvJSON(csv){
    var lines=csv.split("\n");

    var result = [];

    var headers=lines[0].split(",");

    for(var i=1;i<lines.length;i++){

        var obj = {};
        var currentline=lines[i].split(",");

        for(var j=0;j<headers.length;j++){
            obj[headers[j]] = currentline[j];
        }
        result.push(obj);
    }

    //return result; //JavaScript object
    return JSON.stringify(result); //JSON
}

And then it was simple. to use. Let's say I put in a textarea the exported CSV, for instance:
Name,Grade1,Grade2
Bobby,87,12
Rakesh,9,3
//...

Then I called csvJSON() with this data to get:
[{"Name":"Bobby","Grade1":87,"Grade2":12},{"Name":"Rakesh","Grade1":9,"Grade2":3},/*...*/]

Which is especially easy to use. For instance:
var csv = ""; // get it from somewhere
var json = JSON.parse(csvJSON(csv));
for (int i = 0; i < json.length; i++)
{
    var obj = json[i];
    var name = obj.Name, Grade1 = obj.Grade1, Grade2 = obj.Grade2;
    //Do something
}


text:
Q: Python3 inherit class variable without inheriting value I have a set of classes which should all keep track of which instance they are. For this purpose I have a class variable in the parent class, which is copied and incremented at initialization of each object. Here's a minimal example which seems to work just fine:
class Parent:
    counter = 0
    def __init__(self):
        self.name = self.__class__.__name__ + "_" + str(self.__class__.counter)
        self.__class__.counter += 1

    def __repr__(self):
        return self.name

mother = Parent()
father = Parent()
print(mother)
print(father)

Parent_0
Parent_1

So far so good. Now I'd like to use make some subclasses that have the same behavior without rewriting the code. So I do this:
class Child(Parent):
    # counter = 0
    pass

son = Child()
daughter = Child()
stepfather = Parent()

print(son)
print(daughter)
print(stepfather)

Child_2
Child_3
Parent_2

This behavior is not what I intended. When the first instance of a child is created it inherits whichever value the parent counter has at that moment, however after this the classes each maintain their own counter. I can avoid this by putting the line counter = 0 into every single subclass, but this strikes me as redundant. Is there some more elegant way that I can inherit the behavior from the parent without having to redeclare the same variable every time?

A: No idea why you want this behavior, but ... instead of an counter int, create a counter dict:str->int in Parent. Use a key of self.__class__.__name__ to acces the running counter of each seperate class in it. With assign it with dict.setdefault(self.__class__.__name__,0) and increment it inside __init__.
 class Parent:
    counter = dict()

    def __init__(self):
        Parent.counter.setdefault(self.__class__.__name__,0)
        self.name = f'{self.__class__.__name__}_{Parent.counter[self.__class__.__name__]}'
        Parent.counter[self.__class__.__name__] += 1

    def __repr__(self):
        return self.name

mother = Parent()
father = Parent()
print(mother)
print(father)

class Child(Parent):
    # counter = 0
    pass

son = Child()
daughter = Child()
stepfather = Parent()

print(son)
print(daughter)
print(stepfather)

Output:
Parent_0
Parent_1
Child_0
Child_1
Parent_2


text:
Q: C#: FastColoredTextBox not updating syntax highlighting i´m new with C# and i´m required to color a text depending on what it is, for example my keywords have to be blue, numbers red, Parentheses brown, brackets sky blue, well you get the idea.
I have my FastColoredTextBox as ftbT and my method ftbT_TextChanged:
private void ftbT_TextChanged(object sender, TextChangedEventArgs e)
{
    Regex keywords = new Regex(@"\b((P|p)rincipal|(I|i)ntevalo|(N|n)ivel|(D|d)imensiones|(I|i)nicio_(P|p)ersonaje|(U|u)bicacion_(S|s)alida|(P|p)ared|(E|e)nemigo|(C|c)aminata|(C|c)asilla|(V|v)arias_(C|c)asillas|(P|p)ersonaje|(P|p)aso|(V|v)ariable|(R|r)ango_(C|c)asillas)\b");

    Range range = (sender as FastColoredTextBox).Range;
    e.ChangedRange.ClearStyle();
    e.ChangedRange.SetStyle(BlueStyle, keywords.ToString(), RegexOptions.Multiline);
}

But when i run the application it will not change any writen word to the style selected also my style is defined like this:
Style BlueStyle = new TextStyle(Brushes.Blue, null, System.Drawing.FontStyle.Italic);

Where "Brushes.Blue" is taken from using FastColoredTextBoxNS;
I tried to change the code inside the method to:
private void ftbT_TextChanged(object sender, TextChangedEventArgs e)
{
    Regex keywords = new Regex(@"\b((P|p)rincipal|(I|i)ntevalo|(N|n)ivel|(D|d)imensiones|(I|i)nicio_(P|p)ersonaje|(U|u)bicacion_(S|s)alida|(P|p)ared|(E|e)nemigo|(C|c)aminata|(C|c)asilla|(V|v)arias_(C|c)asillas|(P|p)ersonaje|(P|p)aso|(V|v)ariable|(R|r)ango_(C|c)asillas)\b");

    Range range = (sender as FastColoredTextBox).Range;
    range.ClearStyle(BlueStyle);
    range.SetStyle(BlueStyle, keywords.ToString());
}

But is also not changing the keywords to blue nor italic.
Any idea what i am missing or doing wrong ?

A: So, for some reason FastColoredTextBox the latest version didn't worked, after checking with a friend who had version 2.7.2.0 I created a new proyect and added v2.7.2.0 instead of the latest one and It Worked !


text:
Q: Unable to manually close toggle panel I have a jsfiddle here - http://jsfiddle.net/stevea/R5MPr/1/ - with a simple toggle panel. The toggle panel action works fine. You can click the questions and have the answers open and close. But the "Close All" button I have to manually close any open questions doesn't work. The
.slideToggle(500);

there doesn't close the open panel. Does anyone see the problem?
Thanks.

A: An easier way is to add a class to handle the closeAll.
HTML:

 This is question 1

This is  the answer to question 1

 This is question 2

This is  the answer to question 2

jQuery:
$('button#closeAll').click(function() {
    $('.qa div').slideUp(500);
});

jsfiddle


text:
Q: Is this a bad idea? I've been working on this problem for two days now. I'm working on an iPhone app that, at the moment, has  "dual layer" view (see picture.)  The semi-transparent orange panel covering the left third of the screen was created by simply resizing the sub-view (in IB) to take up less than half the screen so that, when that view loads, the original view is still exposed on the right.  This would allow the left view to be a "menu view" allowing a user to select what he or she would like to appear in the main view window (which is actually a UIWebView...see screen shot.)
----- Click Here For Screen Shot-----
If I'm going to keep this setup (assuming it's not a structural sin), the left-view clearly needs a way to communicate with the main view.  Can I invoke methods in the main-wiew ".m" file (WebViewController.m) like viewDidLoad and others from the "ETG" button on the orange subview?  Or is this just a really bad idea?  And if this isn't a bad idea or a sin against iPhone structure, how would you implement it? I'll thank you in advance for any helpful thoughts or suggestions you might have.  Thanks!

A: If you're following the model-view-controller pattern, which you generally should, then your view should send messages to the controller or modify the model, not another view. Although it really depends on what you're doing. In your case you are using the panel as a control, so you should implement in a fashion that makes it independent of other views.
Usually the only time you have views directly manipulate other views is in layout, and that is normally in a top-down fashion.
Again, these are general rules and there are always exceptions.

A: What you are describing doesn't seem insane, but they way you go about talking to the main view might need a little work.
It seems like what you want to do is have the overlay view have a delegate that it can send messages to.  Does that seem like it would work for you?

A: Umm, is the web view the main view?
Either way, I'd do this:
One view controller that contains two main areas. One is your UIWebView, and another is your layover. If you do this in Interface Builder, put the Layover on top of the UIWebView.
All you have to do is animate it in and out based on certain input. A bad idea is to say "hide menu" and make the UIWebView take up all the space, so you can't get it back.
Then use use one view controller for both.
The recommended method of communicating between view controllers, if that's subviewed, is to create properties in the view controller that you can pass. Eg: the web view needs to tell the main view what site it's on. So put an NSString in your main controller as a property, then pass it the string on viewWillDisappear or whatever that name is.
(Or, use viewWillAppear on the top level and have it grab that property from the 2nd view).
Essentially it's just a branching tree, and you have to pass data up one node to reach the others.
You "can" use the application's delegate itself/(the application) and from anywhere, call [UIApplication sharedApplication].property (after creating a property), and use it as a global, but that's not considered reusable code. Since you're used to basic, it might work for you.
Finally, C++ globals do work, and there are many examples on the web for using globals in an iPhone program with externs. (even less recommended).
Now, it sounds like you need to read the Views Programming Guide, even though it has severe grammar issues in areas (they may have corrected the homonyms in the 3rd paragraph of the intro by now, but other areas are totally confusing because of that), to get an understanding of how views respond to input, and what happens when input is ignored and bubbles up the tree. (that's basically what it does, lol... but layers and views have intricacies and it's good to understand them and how they function together).
No, it's not a bad idea. But without understanding layers, view animation, and design maybe it is, until you do.
NazCode

A: If I understand what you're trying to do, one approach is to use notifications. This way none of the objects involved need to have references to one another. Before I learned this approach, I had several awkward cases where I seemed to be working much too hard just to get two objects to talk to one another.
In your case, your orange layer can post notifications and the controller for the UIWebView can listen for them.
So when you tap the button in the orange layer, do something like this:
[[NSNotificationCenter defaultCenter] postNotificationName:@"etgTapped" object:self];

And in controller that looks after the webview add something like this to your viewDidLoad method:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(etgTapped:) name: @"etgTappe" object:nil];

And then create an etgTapped: (NSNotifaction*) notification method in that class.
Finally, in viewDidUnload de-register with the notification centre:
[[NSNotificationCenter defaultCenter] removeObserver:self];


text:
Q: Suggestions for Buy/Sell signals overlaid on TradingChart To visually evaluate a backtester, I would like to overlay "buy" and "sell" signals on TradingChart, while preserving the interactive functionality of TradingChart (hence no GraphicsColumn), using different colors of GridLines on a DateListPlot would have been a solution, but this doesn't have the necessary interactivity of TradingChart.

A: Wrap selected data points Labeled and wrap TrandingChart with Legended:
Legended[TradingChart[{{{2010, 10, 1}, {530.`, 530.62`, 523.`,   525.62`, 2225000}},
  {{2010, 10, 4}, {524.95`, 528.25`, 518.85`, 522.35`, 1940500}},
   Labeled[{{2010, 10, 5}, {528.38`, 540.`, 526.55`, 538.23`,  3507100}},
    Style["\[FreakedSmiley]", 30, Red], Below],
  {{2010, 10, 6}, {539.26`, 539.95`, 529.94`, 534.35`, 2762300}},
   Labeled[{{2010, 10, 7}, {536.1`, 537.2`, 529.14`, 530.01`, 2395800}},
    Style["\[HappySmiley]", 30, Green], Above],
  {{2010, 10, 8}, {532.77`, 537.6`, 527.62`, 536.35`, 2859200}}}],
 Placed[Grid[{{Style["\[FreakedSmiley]", 30, Red], Style["SELL SIGNAL", 16,  Bold]},
 {Style["\[HappySmiley]", 30, Green], Style["BUY SIGNAL", 16,  Bold]}}], {.2, .85}]]


text:
Q: How can I create a for loop which increments a number until it finds the one which's remainder is 0? I have a function which is supposed to find the smallest common multiple of the provided parameters that can be evenly divided by both of them plus the ones in between them.
The array always consists of two numbers which can be not in a numerical order.
For example. A value of [1, 3] would return 6, or [1, 5] would be 60.

*

*I understand that at first I need to find the minimum number and the maximum number in the array.

*Then I have to put all of the numbers in range of the minimum and maximum numbers including both of them into an array.

*And then I need to somehow create a for loop which increments a number until it finds the one which's remainder is 0 when it's divided by each of the numbers in the array.

The third part I understand, but don't know how to implement. Any help and tips would be much appreciated.
This is my code so far:
function smallestCommons(arr) {
  let minNum = Math.min(...arr);
  let maxNum = Math.max(...arr);
  let mySeq = [];
  for(let i = minNum; i <= maxNum; i++){
    mySeq.push(i);
  }
  // stuck here
}

Thanks.

A: One functional approach.

const range = ([min, max]) => {
  let arr = [];
  for (var i = min; i <= max; i++) arr.push(i);
  return arr;
};
const gcd = (a, b) =>  !b ? a : gcd(b, a % b);
const lcm = (a, b) => (a * b) / gcd(a, b);

const smallestCommons = (arr) => range(arr).reduce((acc, cur) => acc = lcm(acc, cur), arr[0]);

console.log(smallestCommons([1, 3])); // 6
console.log(smallestCommons([1, 6])); // 60

A: Base on your idea, I could create a function like this
function smallestCommons(arr) {
  let minNum = Math.min(...arr);
  let maxNum = Math.max(...arr);
  let mySeq = [];
  for(let i = minNum; i <= maxNum; i++){
    mySeq.push(i);
  }
  // stuck here
  let smallestCommon = maxNum;
  let found = false;
  while(!found){
    var j;
    for(j = 0; j< mySeq.length; j++){
      if(smallestCommon % mySeq[j] != 0) break;
    }
    if(j == mySeq.length){
      found = true;
    }else{
      smallestCommon ++;
    }
  }

  return smallestCommon;
}

smallestCommons([1, 3]) //return 6
smallestCommons([1, 5]) //return 60

However, I think there is still better way of approaches for this problem.

A: As i am not JS person i can give you the pseudo code.
lcm = 1
list =[1,2,3]

for i in len(list)-1:
   lcm = lcm*list[i+1]/gcd(lcm,list[i+1])

print(lcm)

provide we need to find lcm of the number from 1 to n
else we will  need to initilize lcm with first two number of the list.

A: Hey this the code that works for your scenarios.
        let array = [1,5];

        let returnValFunction = (arr) => {
            try {
                let minNum = Math.min(...arr);
                let maxNum = Math.max(...arr);
                let returnVal = false;
                let i = 1;
                while (!returnVal) {
                    let divingNum = maxNum * i;
                    let checkVal = true;
                    for (let a = maxNum; a >= minNum; a--) {
                        console.log('a', a);
                        console.log(Number.isInteger(divingNum / a));
                        !Number.isInteger(divingNum / a) ? checkVal = false : '';
                    }
                    if (checkVal) returnVal = divingNum;
                    i++;
                };
                return returnVal;
            } catch(err) {
                console.log(err);
            }
        }

        let consoleValue = returnValFunction(array);
        console.log('consoleValue', consoleValue);

A: That was an interresting problem to solve. I solved it this way, but I'm sure there's better ways to go.
I first calculated the lmc between the 2 biggest numbers.
Then, I compared this number multiplied by 1, then 2, then 3 and so on, modulo the next lowest number (max number - 2) until I find 0 as result. I kept calculating then modulo (max number - 3) until (max number - n) = arr[0];

function lcm(nb1, nb2)
{
    let i = 1;
    let j = 1;

    while (true)
    {
        for (j = 1; j <= i; ++j)
        {
            if ((nb1 * i) == (nb2 * j))
                return (nb1 * i);
        }
        ++i;
    }
}

function smallestCommons(arr)
{
    if (arr.length == 2)
    {
        biggestNumber = arr[1];
        if (biggestNumber > 2)
        {
            let biggestCommon = lcm(arr[1] - 1, arr[1]);
            let mul = 1;
            for (let num = biggestNumber - 2; num > arr[0]; --num)
                while (((biggestCommon * mul) % num) != 0)
                    ++mul;
            return (biggestCommon * mul);
        }
        else
            return (biggestNumber);
    }
}

console.log(smallestCommons([1, 5]));
console.log(smallestCommons([1, 3]));
console.log(smallestCommons([1, 42]));
console.log(smallestCommons([7, 10]));
console.log(smallestCommons([4, 5]));


text:
Q: How to infer $variables from ConcreteRequest? Relay generated files from default node export of type ConcreteRequest.
There is also a separate type export $variables:
export type IndependentPaidProjectPageQuery$variables = {
  id: string;
};

However, it seems that ConcreteRequest has all the necessary data to infer $variables:
> JSON.stringify(node.operation.argumentDefinitions)
< '[{"defaultValue":null,"kind":"LocalArgument","name":"id"}]'

Is there a way to infer $variables just from ConcreteRequest using [type:typescript]?


text:
Q: Is Default Package included in the Package Level Access? I would like to know how the default package is defined in Java.I know how public and private access is defined but I don't know whether there is any default package access that is defined in package level access in java.
The code I tried to execute is:
  class A
  {
    public static void value()
    {
    int a;
    a=5;
    }
    public static void main()
    {
    value();
    }
  }
  class B
  {
    public void greet()
    {
    System.out.println("Value of a is"+a);
    }
  }

The error I got is:
D:\Downloads\pro>javac A.java
A.java:17: error: cannot find symbol
System.out.println("Value of a is"+a);
                                   ^
  symbol:   variable a
  location: class B
1 error

Since both classes belong to the same default package shouldn't class B access class A's members(a)?
I'm asking this question because when I compile java file containing two classes since no modifier is given for classes,java compiler would give package level access as the default access modifier for the classes.Since no package is defined,java compiler would use the default package but I couldn't get whether the default package is included in package level access in java.Could anyone help me.

A: a is a variable inside the static function value and not visible outside of that function at all. Doesn't have to do with access specifiers.

A: The default package is the package without a name, all classes without a package declaration at the top of the file fall into it.
It is subject to all normal rules of packages except that you can't reference classes of it from a class inside a package.
For example I have 2 java files:
public class A{
    public static void foo(){System.out.println("fooCalled");}
}

and
package com.example;

public class B{
    public static void main(String[] arg){
        A.foo();//won't compile
    }

}

Then B (or in the qualified form com.example.B) can never call the foo of A without reflection magic.

A: Your program has nothing to do with access specifiers, as you have declared your variable int a inside a method.
Thus it becomes just a local variable. You cannot even use it outside this method in the same class.
If we talk specifically about access specifiers then we can have default access specifier in Java which has scope up to the same package only.
package com;
class A{
    int a; // this is an instance variable
    static int b; //this is a class variable
}

package com;
class B{
    //can use a variable here
    // To use a here, we need new A().a;
    // To use b here, we can do,  A.b
}

package hello;
class C{
    //can't use a variable here
}

Edit
Suppose we create a file with name MyProgram.java on Desktop. Below is the code of this file,
class First{
    int a; // a is an instance variable
    static int b;  // b is a static (class) variable

    void display(){
        int c; // c is a local variable
    }
}

class Second{
    public static void mian(){
        First obj = new First();
        obj.a = 10;  // to access instance variable we need object of the class
        obj.b = 20;  // class variable can also be accessed using the object

        // First.a = 10;  //It won't work as a is instance variable and can be accessed by object only

        // First.b = 20;  // We can also access static variables by class name directly without using any object

        // obj.c = 30;  // It won't work. As c is a local variable of method display and can be used only inside that method.

        // First.c = 30;  //It also won't work as c can only be used inside the method where it is declared.
    }
}

A: So finally I got how we could access an variable in another class without creating an object provided both classes rest in the same package.Just make the variable static.
Here's the code:
import java.io.*;
  class A
  {
  static int a=5;
    public void turn()
    {
    System.out.println("value of a is"+a);
    }
  }
  class B
  {
    public static void main(String args[])
    {
    int b;
    b=A.a;
    System.out.println("value of a is"+b);
    }
  }

This shows that classes residing in the same package can access each other's members provided it is static even though it is not public because default package access comes to play.

A: Default access modifier means we do not explicitly declare an access modifier for a class, field,
method, etc.

A variable or method declared without any access control modifier is available to any other
class    in the same package. The fields in an interface are implicitly public static final and
the methods in an interface are by default public.

A: In your class B, a is not defined.
class B {
    public void greet() {
        System.out.println("Value of a is" + a );//cannot find `a` inside `B`
    }
}

Now coming to accessibility, since your both classes are in same package B class can access public, protected and default(no access modifiers) members of other class like A. But in your case a is a local variable inside the A member method value(), so a variable cannot be accessed outside the method where it was declared.
class A {
    public static void value() {
       int a;//not accessible outside this method
       a=5;
    }
    public static void main() {//FYI: this main is not valid to execute your code, missing here: `String[] args` argument
       value();
       //`a`, is even not accessible here, forget about class `B`
    }
}

Sample code, all are in same package:
class A {
   String bar;
}

class B {
  public foo() {
    A a = new A();//required, as `bar` is instance(non-static) member of class `A`
    a.bar 'hi there';//set value
    System.out.printf("a.bar = %s\n", a.bar);
  }
}

EDIT
Sample code with nested class:
class A {
  int foo;

  class B {
     void setFoo() {
       foo = 45; //accessing member of class `A`
     }
  }
}

Working code:

class A {
  private int foo;
  private B b;

  A() {
   foo = -1;
   b = new B();
  }

  class B {
     void setFoo(int foo) {
      System.out.printf("Inside B's setFoo(), foo = %d\n", foo);
        A.this.foo = foo; //accessing member of class `A`
     }
  }

  int getFoo() {
   return foo;
  }

  public void setFoo(int foo) {
   System.out.printf("Inside A's setFoo(), foo = %d\n", foo);
   b.setFoo(foo);
  }
}

class Ideone{
 public static void main (String[] args) {
  A a = new A();
  System.out.printf("main(), foo = %d\n", a.getFoo());
  a.setFoo(34);
  System.out.printf("main(), foo = %d\n", a.getFoo());
 }
}


text:
Q: Matching individual points in two different sets of coordinates I have to match some 2d sets of points to an another 2d set of points (as ground truth) and find the outliers. In other word I have to match each single point to (maximum) one of the points in the ground truth set.
As an example consider that I want to match each star of Ursa Minor, to one of Ursa Major's stars, but in a situation that one of them may have 8 stars and the other one has 7 stars. How could I catch that unmatchable point (the 8th one)?
I found out that Ransac is a good method for matching points but (as I'm using the opencv's function) it needs the two input sets to have equal sizes! which mine don't.


text:
Q: How can I get requests.get to run multiple times to download multiple files from one website? I feel like this should be very simple to do, but I'm not very experienced with python so i'm having trouble.  I'm using requests to download files from a website.  Each of their download urls are the same save for the release number:
http://maltinerecords.cs8.biz/release/**172**/MARU**172**.zip
I'm trying to write a script using requests to get the file from each url, from 1-172.  Thanks, and apologies for my inexperience.

A: Try
import requests

for num in range(1, 173):
    response = requests.get("http://maltinerecords.cs8.biz/release/**{0}**/MARU**{0}**.zip".format(num))
    with open("MARU**{0}**.zip".format(num), 'wb') as f:
        f.write(response.content)


text:
Q: Excel-vba Columns().replace for two columns The code below changes comma to period for Column D.
I want it happen for both D & G.
Option Explicit
    Sub ReplaceDoTwComma()
            Worksheets("Sheet1").Columns("D").replace _
                What:=",", replacement:=".", LookAt:=xlPart
    End Sub

I have tried
Worksheets("Sheet1").Columns("D").replace _
Worksheets("Sheet1").Columns("G").replace _

or Columns("D", "G") or Columns ("D" & "G")  But no luck.
My good reference is Excel VBA code for replacing all "." by "," in a column
Any guidance would be highly appreciated.
Thank you!

A: do two seperate calls, remember the _ indicates a line continuation so both lines need to be duplicated:
Option Explicit
Sub ReplaceDoTwComma()
        Worksheets("Sheet1").Columns("D").replace _
            What:=",", replacement:=".", LookAt:=xlPart
        Worksheets("Sheet1").Columns("G").replace _
            What:=",", replacement:=".", LookAt:=xlPart
End Sub

Or
Option Explicit
Sub ReplaceDoTwComma()
        Worksheets("Sheet1").Range("D:D,G:G").replace _
            What:=",", replacement:=".", LookAt:=xlPart

End Sub


text:
Q: Replace with sed a tag value under a specific section when matching a line I would like to change a line when another line matchs under a section of a file using the sed command (or awk). Here is an exemple of the file :
Extract of MyFic.txt :
  <PlayList>
     ... Some tags ...
     <Album>X1</Album>
     ... oThers tags ...
     <Group>X2</Group>
     ... Some tags ...
   </PlayList>
   <PlayList>
      ... Some tags ...
      <Album>...</Album>
      ... oThers tags ...
      <Group>...</Group>
      ... Some tags ...
    </PlayList>

I would like to change the value of the tag Group by X3 when the tag Album value is X1 only into a PlayList section. The following command works fine :
sed -i '/< Album>X1/,/<\/PlayList>/ s/< Group>.*/< Group>X3<\/location>/' MyFic.txt

But this is not exactly what i really want. I would like someting like :
sed -i '/< PlayList>/,/<\/PlayList>/ {Containing  < Album>X1} s/< Group>.*/< Group>X3<\/location>/' MyFic.txt

I don't know how to code this part with the sed command : {Containing  < Album>X1}
Do you have some idea ?

A: To handle XML, use proper XML handling tools. For example, xsh:
cd //PlayList[Album='X1']/Group
set . 'X3'


text:
Q: Meta Stack Overflow questions which didn't get answers with positive scores At some moment I asked this question:
Incentives for answering questions in unpopular (small) tags
It's still near and dear to my heart and based on reasonable amount of upvotes, there are people who think along the same lines with me.
However, this question only got two answers which were both downvoted.
What should I do with questions like that? Should I try to bump them (by editing them) or should I let me go (taking into account that they won't super highly up voted).
BTW. I understand that there will be Observer effect here. As soon as I mentioned that post, there will be some influx of comments, answers. However, I want to understand broader picture here - what people do with such type of questions/suggestions.


text:
Q: highcharts tooltip wrong date I had made one highchart in that tooltip is shows date and time in format but it is showing wrong date and time.
Please go through the code below.
HTML Code

Javascript Code
var maxval="94";
$(function () {
var chart;
$(document).ready(function() {
    chart = new Highcharts.Chart({

    credits: {
        enabled: false
    },
    chart: {
        type: 'column',
        renderTo: 'container',
    },
    title: {
        text: 'Weekly Traffic'
    },
    xAxis: {
        type: 'datetime',
        labels: {
            format: '{value:%d-%b-%Y}',
            rotation:-45,
        },
    },

    yAxis: {
        labels:{enabled: false},
     title: {
              text: ''
           },
    },

          tooltip: {
                formatter: function() {
                        return ''+ this.series.name +'
'+': '+Highcharts.dateFormat('%Y-%m-%d %H:%M', this.x) +'
'+   Highcharts.numberFormat((this.y /maxval ) * 100) + '%';
                }
            },

    plotOptions: {
        line: {
         enableMouseTracking: false
        },

        series:{
         pointStart: 1444242600000,
        pointInterval: 86400000,
             shadow:false,
         dataLabels:{
            enabled:true,
            formatter:function()
                {
                var pcnt = (this.y /maxval ) * 100;
                return Highcharts.numberFormat(pcnt) + '%';
                }
            }
        }
},

    series: [{
        name: 'Firefox',
        data: [10,56,32,12,64,13,38],
    },{
        name: 'Chrome',
        data: [52,59,10,60,94,3,8],
    },{
        name: 'Edge',
        data: [22,56,20,35,14,73,38],
    },{
        name: 'Opera',
        data: [30,36,80,65,44,53,81],
    },{
        name: 'Safari',
        data: [40,16,50,77,34,33,36],

    }],

    });

});

});

The working fiddle is given
here.

A: you need to set utc false in global option of highcharts.
 Highcharts.setOptions({
global: {
    useUTC: false
}
});

see Updated fiddle here


text:
Q: Giving Claptrap a high five
How do I give Claptrap a high five for the "Up High, Down Low" achievement? I found Claptrap in Sanctuary after Roland's house and it had a "high five" dialogue option after I finished its mission, but that doesn't do anything. Is that where I do this? Some place else? What's the trick?

A: There are two opportunities to high-five Claptrap (by melee attacking his hand):

*

*After his Sanctuary mission, where there is a "high five" action (missable)

*Claptrap's birthday party (roughly 8-10 hours into the game): The mission where you give Claptrap the upgrade will make him invisible. He will be happy and say, "High-Five! That's what I'm talking about!" while raising his hand. BUT, you have to melee his hand immediately because he'll get bored: "Uh... This is weird. Hurry up and slap my hand! Gimme a five! Okay, this is boring and awkward..."

A: When you get to Sanctuary, he gives you a quest where the reward is to access his stash. Once you complete it, you'll have a temporary option to hit a button (Q in the PC version) to give him a high five. He'll raise his hand.
At that point, hit your melee button (V in the PC version) to attack his hand. This will count as a high-five.
Be warned, though: if you're playing co-op and someone else completes the high-five, Claptrap doesn't allow you to request another one. :(
Edit, since this is the accepted answer: There is at least one other opportunity that has been identified by other answers on this question as times when Claptrap will ask for a high five. Here's the full list:

*

*After "Claptrap's Secret Stash" quest

*During the "Wildlife Preservation" quest
In all cases, the tactic is the same: When he holds up his hand, use your melee attack to hit it.
On a side note, once I'd given him the high five as part of "Wildlife Preservation", I could request one at any time.
Even if you don't give Claptrap the high five in "Wildlife Preservation", as long as you complete the mission you can request the high five at any time. Aim at his hand and press V

A: For the record, having completed the game (thus missing both the opportunities outlined above), I earned the achievement by talking to him and melee-ing his hand. If it means anything, I did this while he was in his little junkyard alcove in Sanctuary, and I tried again when he left it, but could not do it again.

A: To add to GamerHawaiian's answer: another opportunity to give Claptrap a high-five comes up when you talk to him as a part of the "Wildlife Preservation" quest.


text:
Q: Create new div attribute with value I have the following jQuery code that creates new Div and append it to parent with some attributes.
 $.each(data.ConsultantDetails.ScopeOfSevrices, function (index) {
   $("#parentOptionDiv").append($('
', {
     "id": data.ConsultantDetails.ScopeOfSevrices[index].Value,
     "class": 'item',
     "data-value":''
   }))
 });

It renders HTML

How to put value in between
 My Value

Expected

MY Value

A: Use the text option:
$.each(data.ConsultantDetails.ScopeOfSevrices, function (index) {
  $("#parentOptionDiv").append($('
', {
    "id": data.ConsultantDetails.ScopeOfSevrices[index].Value,
    "class": 'item',
    "data-value":'',
    "text": "My Value"
  }))
});

This is covered by the documentation for that form of $() call:

As of jQuery 1.4, any event type can be passed in, and the following jQuery methods can be called: val, css, html, text, data, width, height, or offset.

A: Use text like this

$("#parentOptionDiv").append($('
', {
  "class": 'item',
  "data-value": '',
  "text": "My value"
}))

A: This is how to do it with plain JavaScript ( works with JQuery! )
var div = document.createElement("div"); // Create new element or use existing element
div.innerText = "The text";              // Set the text
// or ..
var text = document.createTextNode("The text"); // Create a text node
div.appendChild(text);                          // Append text node to div
// Or if you want to append another element
var anotherElement = document.createElement("div"); // Create new element or use existing element
div.appendChild(anotherElement);                    // Append the other element into the div


text:
Q: Index error: String out of range, but it shouldn't be going out of range? Alright so I am making an encoder/decoder and currently I'm testing to see if my idea will work, but I keep getting the error telling me my string index is out of range when it shouldn't be going out of range in the first place.
message = "abc"
#Should come out as 212223
translated = ' '

n = 1
while n >= 0:
    t = message[n]
    if t == 'a':
        translated = translated + '21'
    elif t == 'b':
        translated = translated + '22'
    elif t == 'c':
        translated = translated + '23'
    while n <= len(message):
        n = n + 1
print(translated)

It makes perfect sense to me so I had a hard time searching for appropriate help that solves for what I am doing, so can I have some help? A link, a solution, what I'm doing wrong and how to fix it? Thanks

A: n = 0
while n >= 0:

You have an infinite loop as you keep on incrementing n.
At some point message[n] will get out of range.
You should move the while n <= len(message): to be your main loop instead of your current one.
A better way will be to iterate directly over message with a for loop:
for t in message:
    if t == 'a':
        translated = translated + '21'
    elif t == 'b':
        translated = translated + '22'
    elif t == 'c':
        translated = translated + '23'

A: Here:
while n <= len(message):
    n = n + 1

Should need changing to:
while n < len(message):
    n = n + 1

The last index of a string will be len(message) - 1, as indexing starts at 0.
I would just set n to len(message) - 1 instantly instead however.

A: Because at last loop you are using t = message[3]..It is the cause of your error. If you  message variable contain  "abc" then you can access only t = message[0], t = message[1], t = message[2]. So try this
message = "abc"
#Should come out as 212223
translated = ' '

n = 1
while n >= 0:
    t = message[n-1]
    if t == 'a':
        translated = translated + '21'
    elif t == 'b':
        translated = translated + '22'
    elif t == 'c':
        translated = translated + '23'
    while n <= len(message):
        n = n + 1
print(translated)


text:
Q: Allow duplicate slugs for custom post type with taxonomies I have set up a custom post type (team) and a custom taxonomy (team_tax) for this post type, both with the same slug. Down to the core:
register_post_type( 'team', array(
    'labels'       => array( 'Name' => 'Pages' ),
    'hierarchical' => false,
    'rewrite'      => array( 'slug' => 'team', 'with_front' => true ),
    'has_archive'  => 'teams'
  );
);

register_taxonomy( 'team_tax', 'team', array(
    'hierarchical' => true,
    'rewrite'      => array( 'slug' => 'team', 'with_front' => true )
  );
);

The taxonomy will be the team names. The post type will be the pages for these teams.
Everything works fine by default, but I want to display these as a specific hierarchical url like so:
/team/team_tax/post

To get the team_tax permalink to behave like this I used the following plugin: WP Better Permalinks. This adds the team_tax to the url.
Now eventually I want to create a structure like so:
/team/example-team-1/info
/team/example-team-1/members
/team/example-team-1/schedule
/team/example-team-2/info
/team/example-team-2/members
/team/example-team-2/schedule
etc.

Now the problem is, Wordpress doesn't recognize the pages as a child of this taxonomy. So it will start adding -2, -3 etc. to the slugs, so the following happens instead:
/team/example-team-1/info
/team/example-team-2/info-2
/team/example-team-3/info-3

I have tried to use a filter on 'wp_unique_post_slug' to ignore the newly made slug and use the default one instead. But then the page will load the content from all these 3 pages. Also a bit more simplified for demonstration:
function team_non_unique_post_slug( $slug, $original_slug ) {
  if( $post_type === 'team' ) {
   return $original_slug;
  }
}
add_filter( 'wp_unique_post_slug', 'team_non_unique_post_slug' );

So my question is, is there a way for me to achieve this without any conflicts? Basically it should be behaving as the hierachical structure of default Wordpress pages, but with a taxonomy instead. I'm also open for better suggestions/solutions!
Edit:
function alter_query_for_duplicates( $query ) {

    if ( is_admin() ) {
      return;
    }

    if ( is_singular() ) {

      if ( $query->is_main_query() ) {

        if ( in_array ( $query->get('post_type'), array('team') ) ) {

            $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

            $split_url = explode( "/", $actual_link );

            $split_url = array_filter( $split_url );

            $url_tax = $split_url[count($split_url)-1];
            $url_page = end($split_url);

            $args = array(
                'posts_per_page' => -1,
                'post_type' => 'team',
                'tax_query' => array(
                    array(
                        'taxonomy' => 'team_tax',
                        'field' => 'slug',
                        'terms' => $url_tax,
                        'operator' => 'IN'
                    )
                ),
                // 'name' => $url_page (doesn't work because of duplicate slugs)
            );
            $posts_array = get_posts( $args );

            $current_post_key = search_for_name($url_page, $posts_array);

            $query->set( 'page_id', $posts_array[$current_post_key]->ID );

        }

      }

    }

  return $query;

}
add_filter( 'pre_get_posts', 'alter_query_for_duplicates' );

function search_for_name($name, $array) {

   foreach ($array as $key => $val) {
       if ($val->post_name === $name) {
           return $key;
       }
   }
   return null;

}

I currently added this extremely hacky way to get the content based on the current page url. It will get all posts from the specified taxonomy, and then search for the page slug in these posts and set the pre_get_posts query to only search for this page's ID.


text:
Q: Getting error as part of trying to upgrade Service Fabric Application using Start-ServiceFabricApplicationUpgrade We got a Service Fabric cluster in our development environment using 2 VMs. I was trying to upgrade the Application deployed in SF using the following command:
Start-ServiceFabricApplicationUpgrade -ApplicationName "fabric:/ApplicationName" -ApplicationTypeVersion "3.7.2625.0" -UnMonitoredAuto
I get the following error as a result:

Start-ServiceFabricApplicationUpgrade : Application type and version not found
  At line:1 char:1
  + Start-ServiceFabricApplicationUpgrade -ApplicationName "fabric:/ApplicationName"  ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [Start-ServiceFabricApplicationUpgrade], FabricElementNotFoundException
      + FullyQualifiedErrorId : UpgradeApplicationErrorId,Microsoft.ServiceFabric.Powershell.StartApplicationUpgrade

I would like to know whether there are any configurations I need to change at the ClusterConfiguration level. Any help would be appreciated.
Thanks.

A: There are 3 simple steps to upgrade an application:

*

*Copy-ServiceFabricApplicationPackage

*Register-ServiceFabricApplicationType

*Start-ServiceFabricApplicationUpgrade
By the message you posted, the error is likely because you missed the step 2.
If you have executed the step 1, 2 and 3, certify that:

*

*The application package has been registered correctly

*The application version you registered is correct, both match, the package and the Upgrade command

*The existing application and the registered one are from same type

Check this doc for more info: Service Fabric application upgrade using PowerShell


text:
Q: What is the proper way to manage Java lifecycle in swig director wrappers when the underlying C++ layer holds references? Given an interface like
%feature("director") HeldBase;
%feature("smartptr") HeldBasePtr;
typedef SmartPtr<HeldBase> HeldBasePtr;  // a minor wrapper around boost::shared_ptr
// Various typemaps that ensure Java-side HeldBase instances are always HeldBasePtr
class HeldBase {
public:
   virtual void doSomething(int) = 0;
}

class Holder {
   void hold(HeldBasePtr hb);
   void release(HeldBasePtr hb);
   void clear();
   void process(int seconds);
}

Now some code implements the HeldBase, on the java side doing something like:
class MyHeldBase: extends HeldBase {
   void doSomething(int i) { System.out.println("Hello whirled"); }
}

Holder h = new Holder();
HeldBase local = new MyHeldBase();
h.hold(new MyHeldBase());
h.hold(local);
h.process(1000000);     // presumably doing something with the held things.

The underlying C++ layer deals with the smart pointers "properly", so (for example) destroying the Holder (swig proxy and underlying C++ object) correctly decrements the ref counts on the underlying smart pointers.
Right now the 'local' held base works fine, but the one without a reference held on the java-side gives a "null upcall" error presumably after some gc causes the java instance to go away.
I noticed the generated swigTakeOwnership and swigReleaseOwnership methods, and tracked them down in the code to be toggle whether a GlobalRef or GlobalWeakRef is held by the director.  So I did some wrapper code so that calls to hold(HeldBase hb) called hb.swigReleaseOwnership() and release() called hb.swigTakeOwnership().  Looking at the code it seemed that swigReleaseOwnership would convert the underlying director ref to a GlobalRef (so that the C++ layer would hold ownership of the Java MyHeldBase).  And vice-versa for swigTakeOwnership.
Unfortunately this didn't work for unrelated reasons...  something in our typemaps have rendered the swigTakeOwnership and swigReleaseOwnership uncallable, because they (think they) hold HeldBase *  not HeldBasePtr *.
If that is the right way to solve this problem, I'll try to track down why those methods are not being generated correctly.  But I still feel like there are unresolved issues (that are hard to think about.)
For example, what about:
HeldBase local = new MyHeldBase()
Holder h1 = new Holder(); Holder h2 = new Holder();
h1.hold(local);
h2.hold(local);
h1.release(local)
local = null;

In this case, the call to swigReleaseOwnership() happens twice, but the second is a noop.  When release() call swigTakeOwnership (making the reference back into a GlobalWeakRef) the java layer is once again "owning" and h2 will get a null upcall.  Also, if calls to swigTakeOwnership ARE required, then Holder.clear() seems to mean I need to add code to hold all the passed java-extended directors (at which point I can just do that to manage their lifecycle).
It "feels" like when using smart pointers with directors, the C++ side of the director should always just use a GlobalRef and things will "just work" but OTOH it seems that is a memory leak there since then the C++ side will keep the Java proxy alive and vice-versa.


text:
Q: Optional parameters with PHP SoapClient class on wsdl mode With the SoapClient class on PHP5.x and working against a SOAP web service that has optional parameters in its methods, you won't have any problem if you use the non-wsdl mode.
But, at least by default, with the wsdl mode, if you don't fill all the parameters you will get an error like:
SOAP-ERROR: Encoding: object hasn't 'xxx' property
Is there any way to avoid that error without working with the non-wsdl mode and without filling all the parameters?

A: Maybe this is not the problem with the WSDL mode but with string encoding in the code. If your web service encode strings in UTF-8 make sure you use appropriate functions, like mb_substr(...) instead of substr(...).


text:
Q: How to send/get data using POST/GET http method in Java - REST API I am trying to send data (Add a new Book) with the help of http method POST/PUT method but I tried and couldn't figure out.
This is my Book.java class which stores Book values
package bookservice;

public class Book {
    private int id;
    private String title;
    private double price;

    public Book() {
    }

    public Book(int id, String title, double price) {
        super();
        this.id = id;
        this.title = title;
        this.price = price;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

}

And this is my Books.java with addBook() and removeBook() methods:
package bookservice;

import java.util.ArrayList;
import java.util.List;

public class Books {
    private static ArrayList<Book> books = new ArrayList<>();
    static {
        books.add(new Book(1, "The Outliers", 500));
        books.add(new Book(2, "World Is Flat", 550));
    }

    public static List<Book> getBooks() {
        return books;
    }

    // method to add books
    public void addBook(int id, String name, double price) {
        books.add(new Book(id, name, price));
    }

    // method to remove a book with a given book ID
    public Book removeBook(int bookID) {

        // search the book in entire ArrayList for the given book ID
        for (Book bookToRemove : books) {
            if (bookToRemove.getId() == bookID) {
                //remove the book
                books.remove(bookToRemove);
                // if found
                return bookToRemove;
            }
        }
        // if not found
        return null;
    }

}

And this is my BookService.java which handles RestApi
package bookservice;

import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/books")
public class BookService {
    List<Book> books;
    public BookService() {
        books = Books.getBooks();
    }
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<Book> getBooks() {
        return books;
    }
    @Path("{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Book getBook(@PathParam("id") int id) {
          for(Book b : books) {
              if ( b.getId() == id)
                   return b;
          }
          // book with the given id is not found, so throw 404 error
          throw new NotFoundException();
    }

}

And this is the index.html, (here I haven't add fields to type bookID and a button to save data, because I can do that later when the implementation is done)
<!DOCTYPE html>

<title>Book client</title>

Books Client

Book Id :

<input type="text" id="id" />
<button onclick="getDetails()">Details</button>

And this is books.js with ajax call
/**
 *
 */

function getDetails() {
    jQuery.ajax({
        url : "http://localhost:8080/BookService/rest/books/" + $("#id").val(),
        type : "GET",
        contentType : "application/json",
        dataType : 'json',
        success : function(data, textStatus, errorThrown) {
            // here is your json.
            // process it
            $("#title").text(data.title);
            $("#price").text(data.price);

        },
        error : function(jqXHR, textStatus, errorThrown) {
            $("#title").text("Sorry! Book not found!");
            $("#price").text("");
        },
        timeout : 120000,
    });
};

My Problem is:
1.) How to Update the BookService.java to add a book (using the POST http method) and to remove a book (using DELETE http method).
2. How to test the updated Service with a browser or Soap ui before proceeding to update the client?
I have implemented the functions but I am stuck with these two questions...


text:
Q: counter for instagram bot I made an instagram bot. When the program runs I want the instabot to count the posts.deployed to window seven and i made it with python
This is what I have written so far:

for i in range(1,2):
    try:
        driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
        time.sleep(2)
        hrefss=driver.find_elements_by_tag_name('a')
        hrefs = [elem.get_attribute('href') for elem in hrefss if '.com/p/' in elem.get_attribute('href')]
        time.sleep(2)
    except Exception:
        continue

    for href in hrefs:
        driver.get(href)
        try:
            driver.find_element_by_class_name('_8-yf5 ').click()


text:
Q: concat all the members of a class I am hard coding something that I am sure can be done more cleverly -- fun little problem -- using c# 6.0
How can I reduce this - it goes on another 20 lines.
  string fullLine = newLine.col1_index_no +
            newLine.col2_depot_custRef +
            newLine.col3_depot_no +
            newLine.col4_driver_id +
            newLine.col5_vehicle_id +
            newLine.col6_trans_type;

if it helps here is the class:
class lineBuilder
{
    public string col1_index_no { get; set; }
    public string col2_depot_custRef { get; set; }
    public string col3_depot_no { get; set; }
    public string col4_driver_id { get; set; }
    public string col5_vehicle_id { get; set; }
    public string col6_trans_type { get; set; }
    public string col7_sign_id { get; set; }
    public string col8_note_id { get; set; }
    public string col9_route_code { get; set; }
    public string col10_RA_no { get; set; }
    public string col11_doc_type { get; set; }
    public string col12_user_gen_flag { get; set; }
    public string col13_seq_no { get; set; }
    public string col14_pallet_id { get; set; }
    public string col15_tote_id { get; set; }
    public string col16_adj_type { get; set; }
    public string col17_rtn_sig_not_avlb { get; set; }
    public string col18_scan_dateTime { get; set; }
    public string col19_scan_in_time { get; set; }
    public string col20_AX_status { get; set; }

}

A: You can do this via reflection. This sample code will print out all of the properties in alphabetical order:
var lb = new lineBuilder
{
    col1_index_no = "item one",
    col2_depot_custRef = "item depot custRef"
    col10_RA_no = "further values will not make this explanation any clearer"
};

StringBuilder sb = new StringBuilder();
IEnumerable<PropertyInfo> properties = typeof(lineBuilder)
                                            .GetProperties()
                                            .Where(p => p.PropertyType.Equals(typeof(string)))
                                            .OrderBy(p => p.Name);

foreach(PropertyInfo propertyInfo in properties)
{
    var value = (string)propertyInfo.GetValue(lb);
    sb.AppendLine(string.Format("{0}: {1}", propertyInfo.Name, value ?? String.Empty));
}

Console.WriteLine(sb.ToString());

However, you don't want them in alphabetical order, you want them in numeric order.
You need a different OrderBy clause.
If all of your property names follow the format col{number}, you can use a regular expression to extract the number from each name and use that to perform your ordering.
Regex regex = new Regex(@"^col(\d+)");

IEnumerable<PropertyInfo> properties = typeof(lineBuilder)
                                            .GetProperties()
                                    .Where(p => p.PropertyType.Equals(typeof(string)))
                                    .OrderBy(p => int.Parse(regex.Match(p.Name).Groups[1].Value));


text:
Q: Excel VBA shell script that executes python script not working I have a VBA script as given below that executes a python script that writes values to Excel workbooks.
Dim args
Dim Ret_Val
args = ActiveWorkbook.Path & "\helloWorld.py"
Ret_Val = Shell("C:\Python27\python.exe " & args, vbNormalFocus)

The helloWorld.py is given below:
import xlrd
from xlutils.copy import copy
rb = xlrd.open_workbook("/a/b/StubProto.xlsm")
wb = copy(rb)
ws1 = wb.get_sheet(0)
ws1.write(1, 11, "Hello World")
wb.save("StubProto.xlsm")

The above code works OK on its own in a Windows environment but does not work on a VBA environment. It does not seem to return anything in a VBA environment.
Is there some thing I am doing wrong?

A: I have a VBA script that does the same thing, this is how it looks:
args = """" & Application.ActiveWorkbook.Path & "\helloWorld.py"" P"
output = ShellRun("""C:\Python27\python.exe"" " & args)

A: The issue was with a directory in the args path that had a space in between. Removing the space in the path of the python script fixed the error.


text:
Q: Efficient way to add columns of pandas dataframe with a function that returns two values using apply I have some code that fills two lists using a function, called function, that returns two values. The function requires some parameters that are located within a row of the dataframe. Then I append the lists to a new column in my dataframe.
data = [[45, 'F', 'Jill', 'USA'], [87, 'm', 'Jeff', 'Poland'], [99, 'M', 'Tim', 'Peru']]

df = pd.DataFrame(data, ['Age', 'Sex', 'Name', 'Location']

new_column1 = []
new_column2 = []

for member in tqdm(range(len(df))):
        list1, list2 = (function(df['Age'][member], df['Sex'][member], df['Name'][member], df['Location'][member]))

        new_column1.append(list1)
        new_column2.append(list2)

I am wondering if there is a faster way to do this using apply. I threw in tqdm because everyone likes to know how long they have to wait. For what it's worth, the output of the function is a float and a list.
Is there a better way to do this? I get the feeling that this is a little basic and I want something elegant and efficient. Is there a way to do this using apply? I would like to eventually use the swifter package at some point.
Update
I do not understand why this doesn't work.
df[['New_column1', 'New_column2']] = df[['Age', 'Sex', 'Name', 'Location']].swifter.applymap(function)

I am getting an error that the function is missing 3 required positional arguments: 'Sex', 'Name', and 'Location'.

A: Is this what you are looking for?
import pandas as pd
df = pd.DataFrame({'Name':['Alice','Bob'],'Age':[20,19],'Sex':['F','M'],'Location':['Berlin','San Sebastian']})

nested_list = df.values.tolist() #each pd row into list

list1, list2 = map(list, nested_list)# nested list into separate lists

print(df,'\n')
>>    Name  Age Sex       Location
>>0  Alice   20   F         Berlin
>>1    Bob   19   M  San Sebastian

print(f'{list1=}')
>>list1=['Alice', 20, 'F', 'Berlin']

print(f'{list2=}')
>>list2=['Bob', 19, 'M', 'San Sebastian']

Edit
import pandas as pd
import swifter

df = pd.DataFrame({'Name':['Alice','Bob'],'Age':[20,19],'Sex':['F','M'],'Location':['Berlin','San Sebastian']})

list1, list2 = map(list, df.swifter.apply(list,axis = 1))

print(df,'\n')

print(f'{list1=}')

print(f'{list2=}')


text:
Q: wsimport schema_reference warning when trying to generate artifacts for Sabre Retrieve Itinerary API I am trying to generate artifacts for Sabre Retrieve Itinerary.
This is the script I am using:
wsimport -keep \
         -verbose \
         https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl \
         -B-XautoNameResolution \
         -Xnocompile

However I am getting the following warning and even though Java code gets generated I am not sure if it's correct.
[WARNING] schema_reference: Failed to read schema document 'msg-header-2_0.xsd', because 'https' access is not allowed due to restriction set by the accessExternalSchema property.
  line 4 of https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl#types?schema1

This warning is a bit weird as the WSDL contains this line:
<xsd:import namespace="http://www.ebxml.org/namespaces/messageHeader" schemaLocation="msg-header-2_0.xsd"/>

So msg-header-2_0.xsd is referenced via http, not https.
What I have tried so far:

*

*I added jaxp.properties file to my JAVAHOME/lib and JAVAHOME/jre/lib with the following content:

javax.xml.accessExternalSchema = all

*I added an additional option as suggested in this post:

-J-Djavax.xml.accessExternalSchema=all

But neither of those helped. My setup is as follows:
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (Zulu 8.54.0.21-CA-macosx) (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (Zulu 8.54.0.21-CA-macosx) (build 25.292-b10, mixed mode)

Has anybody else encountered this problem or knows how to fix it?

A: The following command works for me...
wsimport -J-Djavax.xml.accessExternalDTD=all -J-Djavax.xml.accessExternalSchema=all -keep -verbose https://developer.sabre.com/sites/default/files/resources/8258/GetReservation_1.19.0.wsdl -Xnocompile


text:
Q: Can we use same CSR to create certificates for different companies? I have a quick question. I develop iOS apps for multiple clients. Each client has their own Apple accounts and I create certificates for them from my machine. My question here is can I use the same CSR file to create certificates for different companies? Thanks.

A: Yes, technically you can use the same Certificate Signing Request to create multiple certificates for multiple companies, clearly the certificate request must be uploaded from the right developer account.
The CSR contains in fact the requester public key that will be used by the CA (in this case Apple) to create the requested certificate. You can see its content by using the openssl command:

openssl req -text -noout -verify -in CertificateSigningRequest.certSigningRequest

But as a user correctly noted in a comment, all your certificates will be tied to the same private key (a public/private key pair is in fact regenerated each time you create a CSR) and this could lead to a reduced security if the machine requesting the certificate gets compromised. Some services require a unique CSR for each certificate generation but at the moment this is not enforced by Apple which allows the same CSR to be reused. This CSR separation is especially useful for the creation of the distribution certificates and the APNS production certificates.


text:
Q: MYSQL query include all "table 2" in "table 1" i have this php to export date into a csv file:
$link = mysql_connect($host, $user, $pass) or die("No se pudo conectar." . mysql_error());
mysql_select_db($db) or die ("No se pudo conectar.");

$csv_output = "Creado el, Id de Ticket, Departamento, Tema de Ayuda, Prioridad, Nombre de Staff, Apellido de Staff, Nombre del cliente, Email del cliente, Asunto, Telefono, Extension, Estado de ticket, Direccion, Marca, Tienda, Lugar de Tienda, Codigo del PC, Fecha de compra, Factura, Documento, ID, Celular, Serie del Producto, Estado del Producto, Descripcion(PyP Defectuosa), Serie(PyP Defectuosa), Proveedor(PyP Defectuosa), Factura(PyP Defectuosa), Guia(PyP Defectuosa), Fecha(PyP Defectuosa), Garantía(PyP Defectuosa), Cantidad(PyP Defectuosa), Estado(PyP Defectuosa), Comentario(PyP Defectuosa), Usuario(PyP Defectuosa), Courier(PyP Defectuosa), N°Remito(PyP Defectuosa), Fecha de envio(PyP Defectuosa)";

$csv_output .= "\n";

$query = "(SELECT t1.created, t1.ticket_id, t3.dept_name, t1.helptopic, t1.priority_id, t2.firstname, t2.lastname, t1.name, t1.email, t1.subject, t1.phone, t1.phone_ext, t1.status, t1.address, t1.pcbrand, t1.storeLocation, t1.place, t1.pcCode, t1.purchaseDate, t1.invoice, t1.tipoid, t1.numId, t1.cell_phone, t1.nserieprod, t1.estprod, t4.ticket_id, t4.`desc` , t4.serial, t4.supplier, t4.invoice, t4.guide, t4.date, t4.warranty, t4.volume, t4.state, t4.comment, t4.user, t4.nomcourier, t4.nremito, t4.fenvio
FROM ticket AS t1, staff AS t2, department AS t3, prod_cambio AS t4
WHERE t2.dept_id = t3.dept_id
AND t1.staff_id = t2.staff_id
AND t1.ticket_id = t4.ticket_id

order by t1.ticket_id)";

$result = mysql_query($query);

if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_row($result)) {
for ($j = 0; $j < 39; $j++) {
if ($j <= 25){
$csv_output .= $row[$j]. " ,";
}
$csv_output .= $row[$j]. " ,";
}
$csv_output .= "\n";
}
}
$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;

I´m selecting 2 diferent tables and trying to convert them in one.
My problem is this:
Created:            Ticket_id (Table 1):      Dept_name:       Priority_id:            Firstname:              Ticket_id (Table 2):
2011-11-23 10:04:33     2                    Soporte Lima             2                   Juan Carlos                  2
2011-11-23 10:28:55     3                    Soporte Lima             2                   Antonio Arturo               3
2011-11-23 10:42:07     4                    Soporte Lima             2                   Renzo                        4
2011-11-23 10:44:33     5                    Soporte Lima             2                   Renzo                        5
2011-11-23 10:44:33     5                    Soporte Lima             2                   Renzo                        5
2011-11-23 10:44:33     5                    Soporte Lima             2                   Renzo                        5
2011-11-23 11:00:58     6                    Soporte Lima             2                   Miguel                       6

if you notice the "table 1" is repeating every time the Ticket_id in "Table 2" match the "table 1" how can i print somethin like thi:
Created:            Ticket_id (Table 1):      Dept_name:       Priority_id:            Firstname:              Ticket_id (Table 2):
2011-11-23 10:04:33     2                    Soporte Lima             2                   Juan Carlos                  2
2011-11-23 10:28:55     3                    Soporte Lima             2                   Antonio Arturo               3
2011-11-23 10:42:07     4                    Soporte Lima             2                   Renzo                        4
2011-11-23 10:44:33     5                    Soporte Lima             2                   Renzo                        5
                                                                                5
                                                                                5
2011-11-23 11:00:58     6                    Soporte Lima             2                   Miguel                       6

blank space in "table 1" part when repeating and only print the "table 2" columns
i want to include all "table 2" in "table 1" result but with no repeating the info of the "table "1 columns instead put blank space and continue printing the "table 2" columns.
is there a way to do it?

A: have you tried SELECT DISTINCT?  judging by your example result it looks like just adding a distinct would eliminate duplicate rows.

A: Change output:
$last_ticket_id = 0;
while ($row = mysql_fetch_row($result)) {
    if ($last_ticket_id == $row[1]) { $print_data = false; } else { $print_data = true; }
    for ($j = 0; $j < 39; $j++) {
        // not understand this but i leav
        if ($j <= 25) { $csv_output .= $row[$j]. " ,"; }
        // check is leav empty or not
        if (!$print_data && in_array($j, array(0,1,2,3,4)) ) {
            $csv_output .= " ,";
        } else {
            $csv_output .= $row[$j]. " ,";
        }
    }
    $csv_output .= "\n";
    $last_ticket_id = $row[1];
}


text:
Q: How to install Cygserver I'm programming in UNIX, so I'm using Cygwin. But functions of IPC does not work on it, just in Cygserver. How can I install it? I'm looked in google and did not find any concrete information.
Thanks for your time :)

A: Cygserver is actually part of the base cygwin package that every Cygwin user has installed.
Proof:
$ cygcheck -f /usr/sbin/cygserver
cygwin-1.7.35-1

$ cygcheck -f /usr/bin/cygserver-config
cygwin-1.7.35-1

So you already have it installed, but you need to configure it:

*

*Launch "Cygwin Terminal" "as Administrator"

*$ cygserver-config
Output:
$ cygserver-config
Generating /etc/cygserver.conf file

Warning: The following function requires administrator privileges!

Do you want to install cygserver as service?
(Say "no" if it's already installed as service) (yes/no) yes

The service has been installed under LocalSystem account.
To start it, call `net start cygserver' or `cygrunsrv -S cygserver'.

Further configuration options are available by editing the configuration
file /etc/cygserver.conf.  Please read the inline information in that
file carefully. The best option for the start is to just leave it alone.

Basic Cygserver configuration finished. Have fun!

Note that in addition to the To start it instructions:

*

*It will automatically start at boot

*You can start and stop it (or disable it) under services.msc

A: Usage and installation of cygserver is fully explained in its own page of the Cygwin User Guide.

A: step1: check "cygrunsrv.exe" on your system under c:\cygwin\bin?
step2 : if not see "cygrunsrv.exe" on system under c:\cygwin\bin
select package 'sygrunsrv:NT/W2K service initiator'  and install